//######################################################################## // 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/SuspendTestApp/src/**/*.java", ], kotlincflags: [ "-Werror", ], static_libs: [ "cts-input-lib", "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", "mockito-kotlin2", "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-tests-utils", "net_flags_lib", "CtsVirtualDeviceCommonLib", "com_android_server_accessibility_flags_lib", "locksettings_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.stubs.system", "android.test.base.stubs.system", "android.test.runner.stubs.system", ], 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: [ ":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"], } java_defaults { name: "FrameworksServicesTestsRavenwood-defaults", libs: [ "android.test.mock.stubs.system", ], static_libs: [ "androidx.annotation_annotation", "androidx.test.rules", "flag-junit", ], auto_gen_config: true, } // Unit tests for UriGrantManager, running on ravenwood. // Note UriGrantManager does not support Ravenwood (yet). We're just running the original // unit tests as is on Ravenwood. So here, we use the original "services.core", because // "services.core.ravenwood" doesn't have the target code. // (Compare to FrameworksServicesTestsRavenwood_Compat, which does support Ravenwood.) android_ravenwood_test { name: "FrameworksServicesTestsRavenwood_Uri", defaults: ["FrameworksServicesTestsRavenwood-defaults"], team: "trendy_team_ravenwood", static_libs: [ "services.core", ], srcs: [ "src/com/android/server/uri/**/*.java", ], } // Unit tests for compat-framework. // Compat-framework does support Ravenwood, and it uses the ravenwood anottations, // so we link "services.core.ravenwood". android_ravenwood_test { name: "FrameworksServicesTestsRavenwood_Compat", defaults: ["FrameworksServicesTestsRavenwood-defaults"], team: "trendy_team_ravenwood", static_libs: [ "services.core.ravenwood", ], srcs: [ "src/com/android/server/compat/**/*.java", ], } 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.stubs.system", "android.test.base.stubs.system", "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.stubs.system", ], } java_library { name: "servicestests-utils-ravenwood", srcs: [ "utils/**/*.java", "utils/**/*.kt", "utils-mockito/**/*.kt", ], libs: [ "android.test.runner.stubs.system", "junit", "mockito-ravenwood-prebuilt", ], } java_library { name: "mockito-test-utils", srcs: [ "utils-mockito/**/*.kt", ], static_libs: [ "mockito-target-minus-junit4", ], } 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.stubs.system", ], } 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", } // Used by content protection TEST_MAPPING test_module_config { name: "FrameworksServicesTests_contentprotection", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.contentprotection"], } test_module_config { name: "FrameworksServicesTests_om", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.om."], } // Used by contexthub TEST_MAPPING test_module_config { name: "FrameworksServicesTests_contexthub_presubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.location.contexthub."], // TODO(ron): are these right, does it run anything? include_annotations: ["android.platform.test.annotations.Presubmit"], } test_module_config { name: "FrameworksServicesTests_contexthub_postsubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.location.contexthub."], // TODO(ron): are these right, does it run anything? include_annotations: ["android.platform.test.annotations.Postsubmit"], } // Used by contentcapture test_module_config { name: "FrameworksServicesTests_contentcapture", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.contentcapture"], } test_module_config { name: "FrameworksServicesTests_recoverysystem", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.recoverysystem."], } // server pm TEST_MAPPING test_module_config { name: "FrameworksServicesTests_pm_presubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_annotations: ["android.platform.test.annotations.Presubmit"], include_filters: ["com.android.server.pm."], } test_module_config { name: "FrameworksServicesTests_pm_postsubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_annotations: ["android.platform.test.annotations.Postsubmit"], include_filters: ["com.android.server.pm."], } // server os TEST_MAPPING test_module_config { name: "FrameworksServicesTests_os", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.os."], } test_module_config { name: "FrameworksServicesTests_presubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_annotations: ["android.platform.test.annotations.Presubmit"], } test_module_config { name: "FrameworksServicesTests_com_android_server_job_Presubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.job"], exclude_annotations: [ "androidx.test.filters.LargeTest", "androidx.test.filters.FlakyTest", ], } test_module_config { name: "FrameworksServicesTests_com_android_server_job", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.job"], } test_module_config { name: "FrameworksServicesTests_com_android_server_tare", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.tare"], } test_module_config { name: "FrameworksServicesTests_com_android_server_usage", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.usage"], } test_module_config { name: "FrameworksServicesTests_battery_stats", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.am.BatteryStatsServiceTest"], } test_module_config { name: "FrameworksServicesTests_accessibility", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.accessibility"], } test_module_config { name: "FrameworksServicesTests_binary_transparency", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.BinaryTransparencyServiceTest"], } test_module_config { name: "FrameworksServicesTests_pinner_service", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.PinnerServiceTest"], exclude_annotations: ["org.junit.Ignore"], } test_module_config { name: "FrameworksServicesTests_android_server_am_Presubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.am."], include_annotations: ["android.platform.test.annotations.Presubmit"], } test_module_config { name: "FrameworksServicesTests_android_server_am", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.am."], } test_module_config { name: "FrameworksServicesTests_android_server_appop", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.appop"], } test_module_config { name: "FrameworksServicesTests_android_server_audio", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.audio"], include_annotations: ["android.platform.test.annotations.Presubmit"], } test_module_config { name: "FrameworksServicesTests_android_server_compat", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.compat"], } test_module_config { name: "FrameworksServicesTests_android_server_hdmi_Presubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.hdmi"], include_annotations: ["android.platform.test.annotations.Presubmit"], } test_module_config { name: "FrameworksServicesTests_android_server_hdmi", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.hdmi"], } test_module_config { name: "FrameworksServicesTests_android_server_integrity", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.integrity."], } test_module_config { name: "FrameworksServicesTests_android_server_lights", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.lights"], } test_module_config { name: "FrameworksServicesTests_android_server_locales", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.locales."], } test_module_config { name: "FrameworksServicesTests_android_server_location_contexthub_Presubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.location.contexthub."], include_annotations: ["android.platform.test.annotations.Presubmit"], } test_module_config { name: "FrameworksServicesTests_android_server_locksettings", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.locksettings."], } test_module_config { name: "FrameworksServicesTests_android_server_logcat", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.logcat"], } test_module_config { name: "FrameworksServicesTests_android_server_net_Presubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.net."], include_annotations: ["android.platform.test.annotations.Presubmit"], } test_module_config { name: "FrameworksServicesTests_android_server_om", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.om."], } test_module_config { name: "FrameworksServicesTests_android_server_pdb", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.pdb.PersistentDataBlockServiceTest"], } test_module_config { name: "FrameworksServicesTests_android_server_pm_dex", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.pm.dex"], } test_module_config { name: "FrameworksServicesTests_android_server_policy_Presubmit", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.policy."], include_annotations: ["android.platform.test.annotations.Presubmit"], } test_module_config { name: "FrameworksServicesTests_android_server_policy", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.policy."], } test_module_config { name: "FrameworksServicesTests_android_server_power", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.power"], } test_module_config { name: "FrameworksServicesTests_android_server_power_hint", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.power.hint"], } test_module_config { name: "FrameworksServicesTests_android_server_powerstats", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.powerstats"], } test_module_config { name: "FrameworksServicesTests_android_server_rollback", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.rollback"], } test_module_config { name: "FrameworksServicesTests_android_server_uri", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.uri."], } test_module_config { name: "FrameworksServicesTests_com_android_server_location_contexthub", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.location.contexthub."], include_annotations: ["android.platform.test.annotations.Postsubmit"], } test_module_config { name: "FrameworksServicesTests_android_server_usage", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.usage"], exclude_filters: ["com.android.server.usage.StorageStatsServiceTest"], } test_module_config { name: "FrameworksServicesTests_android_server_soundtrigger_middleware", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.soundtrigger_middleware"], } test_module_config { name: "FrameworksServicesTests_android_server_input", base: "FrameworksServicesTests", test_suites: [ "device-tests", "automotive-tests", ], include_filters: ["com.android.server.input"], } test_module_config { name: "FrameworksServicesTests_server_job", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.job"], } test_module_config { name: "FrameworksServicesTests_server_tare", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.tare"], } test_module_config { name: "FrameworksServicesTests_server_usage", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.usage"], } test_module_config { name: "FrameworksServicesTests_server_om", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.om"], } test_module_config { name: "FrameworksServicesTests_server_accessibility", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.accessibility"], } test_module_config { name: "FrameworksServicesTests_server_binarytransparencyservicetest", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.BinaryTransparencyServiceTest"], } test_module_config { name: "FrameworksServicesTests_server_pinnerservicetest", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.PinnerServiceTest"], } test_module_config { name: "FrameworksServicesTests_server_am", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.am."], } test_module_config { name: "FrameworksServicesTests_server_hdmi", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.hdmi"], } test_module_config { name: "FrameworksServicesTests_server_logcat", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.logcat"], } test_module_config { name: "FrameworksServicesTests_server_net_Presubmit", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.net."], include_annotations: ["android.platform.test.annotations.Presubmit"], } test_module_config { name: "FrameworksServicesTests_server_policy_Presubmit", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.policy."], include_annotations: ["android.platform.test.annotations.Presubmit"], } test_module_config { name: "FrameworksServicesTests_server_policy", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.policy."], } test_module_config { name: "FrameworksServicesTests_server_power", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.power"], } test_module_config { name: "FrameworksServicesTests_power_hint", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.power.hint"], } test_module_config { name: "FrameworksServicesTests_location_contexthub_Postsubmit", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.location.contexthub."], include_annotations: ["android.platform.test.annotations.Postsubmit"], } test_module_config { name: "FrameworksServicesTests_server_input", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.input"], } test_module_config { name: "FrameworksServicesTests_people_data", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_filters: ["com.android.server.people.data"], } test_module_config { name: "FrameworksServicesTests_Presubmit", base: "FrameworksServicesTests", test_suites: [ "automotive-tests", "device-tests", ], include_annotations: ["android.platform.test.annotations.Presubmit"], }