blob: c6317e46f70b045d24bb5a879d54d88152303049 [file] [log] [blame]
//########################################################################
// Build FrameworksServicesTests package
//########################################################################
java_defaults {
name: "FrameworksServicesTests-jni-defaults",
jni_libs: [
"libservicestestjni",
],
}
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "frameworks_base_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_license"],
}
android_test {
name: "FrameworksServicesTests",
defaults: [
"FrameworksServicesTests-jni-defaults",
],
// Include all test java files.
srcs: [
"src/**/*.java",
"src/**/*.kt",
"test-apps/JobTestApp/src/**/*.java",
"test-apps/SuspendTestApp/src/**/*.java",
],
static_libs: [
"frameworks-base-testutils",
"services.accessibility",
"services.appwidget",
"services.autofill",
"services.contentcapture",
"services.backup",
"services.companion",
"services.core",
"services.credentials",
"services.devicepolicy",
"services.flags",
"services.net",
"services.people",
"services.usage",
"service-permission.stubs.system_server",
"guava",
"guava-android-testlib",
"androidx.test.core",
"androidx.test.ext.truth",
"androidx.test.runner",
"androidx.test.rules",
"androidx.test.ext.junit",
"cts-wm-util",
"platform-compat-test-rules",
"mockito-target-minus-junit4",
"platform-test-annotations",
"ShortcutManagerTestUtils",
"truth",
"testables",
"androidx.test.uiautomator_uiautomator",
"platformprotosnano",
"framework-protos",
"hamcrest-library",
"servicestests-utils",
"service-jobscheduler",
// TODO: remove once Android migrates to JUnit 4.12,
// which provides assertThrows
"testng",
"truth",
"junit",
"junit-params",
"ActivityContext",
"coretests-aidl",
"securebox",
"flag-junit",
"ravenwood-junit",
"net_flags_lib",
],
libs: [
"android.hardware.power-V1-java",
"android.hardware.tv.cec-V1.0-java",
"android.hardware.vibrator-V2-java",
"android.hidl.manager-V1.0-java",
"android.test.mock",
"android.test.base",
"android.test.runner",
],
platform_apis: true,
test_suites: [
"device-tests",
"automotive-tests",
],
certificate: "platform",
// These are not normally accessible from apps so they must be explicitly included.
jni_libs: [
"libbase",
"libbinder",
"libc++",
"libcutils",
"liblog",
"liblzma",
"libnativehelper",
"libpsi",
"libui",
"libunwindstack",
"libutils",
"netd_aidl_interface-V5-cpp",
],
dxflags: ["--multi-dex"],
optimize: {
enabled: false,
},
data: [
":JobTestApp",
":SimpleServiceTestApp1",
":SimpleServiceTestApp2",
":SimpleServiceTestApp3",
":SuspendTestApp",
":MediaButtonReceiverHolderTestHelperApp",
"data/broken_shortcut.xml",
],
java_resources: [
":com.android.apex.cts.shim.v1_prebuilt",
":com.android.apex.cts.shim.v2_different_certificate_prebuilt",
":com.android.apex.cts.shim.v2_unsigned_apk_container_prebuilt",
],
resource_zips: [":FrameworksServicesTests_apks_as_resources"],
}
android_ravenwood_test {
name: "FrameworksServicesTestsRavenwood",
libs: [
"android.test.mock",
],
static_libs: [
"androidx.annotation_annotation",
"androidx.test.rules",
"mockito_ravenwood",
"services.core",
],
srcs: [
"src/com/android/server/uri/**/*.java",
],
auto_gen_config: true,
}
java_library {
name: "servicestests-core-utils",
srcs: [
"src/com/android/server/am/DeviceConfigSession.java",
"src/com/android/server/pm/PackageSettingBuilder.java",
"src/com/android/server/pm/parsing/TestPackageParser2.kt",
],
static_libs: [
"services.core",
"compatibility-device-util-axt",
],
}
java_library {
name: "servicestests-dpm-utils",
srcs: [
"src/com/android/server/devicepolicy/DevicePolicyManagerServiceTestable.java",
"src/com/android/server/devicepolicy/DevicePolicyManagerTestable.java",
"src/com/android/server/devicepolicy/DpmMockContext.java",
"src/com/android/server/devicepolicy/DpmTestBase.java",
"src/com/android/server/devicepolicy/DpmTestUtils.java",
"src/com/android/server/devicepolicy/DummyDeviceAdmins.java",
"src/com/android/server/devicepolicy/MockSystemServices.java",
"src/com/android/server/devicepolicy/MockUtils.java",
],
libs: [
"android.test.mock",
"android.test.base",
"mockito-target-minus-junit4",
],
static_libs: [
"frameworks-base-testutils",
"androidx.test.core",
"androidx.test.ext.truth",
"androidx.test.rules",
"services.core",
"services.devicepolicy",
],
}
java_library {
name: "servicestests-utils",
srcs: [
"utils/**/*.java",
"utils/**/*.kt",
"utils-mockito/**/*.kt",
],
static_libs: [
"junit",
"mockito-target-minus-junit4",
],
libs: [
"android.test.runner",
],
}
java_library {
name: "servicestests-utils-mockito-extended",
srcs: [
"utils/**/*.java",
"utils/**/*.kt",
"utils-mockito/**/*.kt",
],
static_libs: [
"junit",
"mockito-target-extended-minus-junit4",
],
libs: [
"android.test.runner",
],
}
filegroup {
name: "servicestests-SuspendTestApp-files",
srcs: [
"src/com/android/server/pm/SuspendPackagesTest.java",
],
}
// Rules to copy all the test apks to the intermediate raw resource directory
java_genrule {
name: "FrameworksServicesTests_apks_as_resources",
srcs: [
":FrameworksServicesTests_install_split_base",
":FrameworksServicesTests_install_split_feature_a",
],
out: ["FrameworkServicesTests_apks_as_resources.res.zip"],
tools: ["soong_zip"],
cmd: "mkdir -p $(genDir)/res/raw && " +
"for i in $(in); do " +
" x=$${i##*FrameworksCoreTests_}; cp $$i $(genDir)/res/raw/$${x%.apk};" +
" x=$${i##*FrameworksServicesTests_}; cp $$i $(genDir)/res/raw/$${x%.apk};" +
"done && " +
"$(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res",
}
FLAKY_AND_IGNORED = [
"androidx.test.filters.FlakyTest",
"org.junit.Ignore",
]
// Used by content protection TEST_MAPPING
test_module_config {
name: "FrameworksServicesTests_contentprotection",
base: "FrameworksServicesTests",
test_suites: ["device-tests"],
include_filters: ["com.android.server.contentprotection"],
exclude_annotations: FLAKY_AND_IGNORED,
}
test_module_config {
name: "FrameworksServicesTests_om",
base: "FrameworksServicesTests",
test_suites: ["device-tests"],
include_filters: ["com.android.server.om."],
exclude_annotations: FLAKY_AND_IGNORED,
}
// Used by contexthub TEST_MAPPING
test_module_config {
name: "FrameworksServicesTests_contexthub_presubmit",
base: "FrameworksServicesTests",
test_suites: ["device-tests"],
include_filters: ["com.android.server.location.contexthub."],
// TODO(ron): are these right, does it run anything?
include_annotations: ["android.platform.test.annotations.Presubmit"],
exclude_annotations: FLAKY_AND_IGNORED,
}
test_module_config {
name: "FrameworksServicesTests_contexthub_postsubmit",
base: "FrameworksServicesTests",
test_suites: ["device-tests"],
include_filters: ["com.android.server.location.contexthub."],
// TODO(ron): are these right, does it run anything?
include_annotations: ["android.platform.test.annotations.Postsubmit"],
exclude_annotations: FLAKY_AND_IGNORED,
}
// Used by contentcapture
test_module_config {
name: "FrameworksServicesTests_contentcapture",
base: "FrameworksServicesTests",
test_suites: ["device-tests"],
include_filters: ["com.android.server.contentcapture"],
exclude_annotations: FLAKY_AND_IGNORED,
}
test_module_config {
name: "FrameworksServicesTests_recoverysystem",
base: "FrameworksServicesTests",
test_suites: ["device-tests"],
include_filters: ["com.android.server.recoverysystem."],
exclude_annotations: ["androidx.test.filters.FlakyTest"],
}
// server pm TEST_MAPPING
test_module_config {
name: "FrameworksServicesTests_pm_presubmit",
base: "FrameworksServicesTests",
test_suites: ["device-tests"],
include_annotations: ["android.platform.test.annotations.Presubmit"],
include_filters: ["com.android.server.pm."],
exclude_annotations: FLAKY_AND_IGNORED,
}
test_module_config {
name: "FrameworksServicesTests_pm_postsubmit",
base: "FrameworksServicesTests",
test_suites: ["device-tests"],
include_annotations: ["android.platform.test.annotations.Postsubmit"],
include_filters: ["com.android.server.pm."],
exclude_annotations: FLAKY_AND_IGNORED,
}
// server os TEST_MAPPING
test_module_config {
name: "FrameworksServicesTests_os",
base: "FrameworksServicesTests",
test_suites: ["device-tests"],
include_filters: ["com.android.server.os."],
}