1//######################################################################## 2// Build FrameworksServicesTests package 3//######################################################################## 4 5java_defaults { 6 name: "FrameworksServicesTests-jni-defaults", 7 jni_libs: [ 8 "libservicestestjni", 9 ], 10} 11 12package { 13 // See: http://go/android-license-faq 14 // A large-scale-change added 'default_applicable_licenses' to import 15 // all of the 'license_kinds' from "frameworks_base_license" 16 // to get the below license kinds: 17 // SPDX-license-identifier-Apache-2.0 18 default_applicable_licenses: ["frameworks_base_license"], 19} 20 21android_test { 22 name: "FrameworksServicesTests", 23 defaults: [ 24 "FrameworksServicesTests-jni-defaults", 25 ], 26 27 // Include all test java files. 28 srcs: [ 29 "src/**/*.java", 30 "src/**/*.kt", 31 32 "test-apps/SuspendTestApp/src/**/*.java", 33 ], 34 35 kotlincflags: [ 36 "-Werror", 37 ], 38 static_libs: [ 39 "cts-input-lib", 40 "frameworks-base-testutils", 41 "services.accessibility", 42 "services.appwidget", 43 "services.autofill", 44 "services.contentcapture", 45 "services.backup", 46 "services.companion", 47 "services.core", 48 "services.credentials", 49 "services.devicepolicy", 50 "services.flags", 51 "services.net", 52 "services.people", 53 "services.usage", 54 "service-permission.stubs.system_server", 55 "guava", 56 "guava-android-testlib", 57 "androidx.test.core", 58 "androidx.test.ext.truth", 59 "androidx.test.runner", 60 "androidx.test.rules", 61 "androidx.test.ext.junit", 62 "cts-wm-util", 63 "platform-compat-test-rules", 64 "mockito-target-minus-junit4", 65 "mockito-kotlin2", 66 "platform-test-annotations", 67 "ShortcutManagerTestUtils", 68 "truth", 69 "testables", 70 "androidx.test.uiautomator_uiautomator", 71 "platformprotosnano", 72 "framework-protos", 73 "hamcrest-library", 74 "servicestests-utils", 75 "service-jobscheduler", 76 // TODO: remove once Android migrates to JUnit 4.12, 77 // which provides assertThrows 78 "testng", 79 "truth", 80 "junit", 81 "junit-params", 82 "ActivityContext", 83 "coretests-aidl", 84 "securebox", 85 "flag-junit", 86 "ravenwood-junit", 87 "net_flags_lib", 88 "CtsVirtualDeviceCommonLib", 89 "com_android_server_accessibility_flags_lib", 90 ], 91 92 libs: [ 93 "android.hardware.power-V1-java", 94 "android.hardware.tv.cec-V1.0-java", 95 "android.hardware.vibrator-V2-java", 96 "android.hidl.manager-V1.0-java", 97 "android.test.mock", 98 "android.test.base", 99 "android.test.runner", 100 ], 101 102 platform_apis: true, 103 104 test_suites: [ 105 "device-tests", 106 "automotive-tests", 107 ], 108 109 certificate: "platform", 110 111 // These are not normally accessible from apps so they must be explicitly included. 112 jni_libs: [ 113 "libbase", 114 "libbinder", 115 "libc++", 116 "libcutils", 117 "liblog", 118 "liblzma", 119 "libnativehelper", 120 "libpsi", 121 "libui", 122 "libunwindstack", 123 "libutils", 124 "netd_aidl_interface-V5-cpp", 125 ], 126 127 dxflags: ["--multi-dex"], 128 129 optimize: { 130 enabled: false, 131 }, 132 133 data: [ 134 ":SimpleServiceTestApp1", 135 ":SimpleServiceTestApp2", 136 ":SimpleServiceTestApp3", 137 ":SuspendTestApp", 138 ":MediaButtonReceiverHolderTestHelperApp", 139 "data/broken_shortcut.xml", 140 ], 141 142 java_resources: [ 143 ":com.android.apex.cts.shim.v1_prebuilt", 144 ":com.android.apex.cts.shim.v2_different_certificate_prebuilt", 145 ":com.android.apex.cts.shim.v2_unsigned_apk_container_prebuilt", 146 ], 147 resource_zips: [":FrameworksServicesTests_apks_as_resources"], 148} 149 150android_ravenwood_test { 151 name: "FrameworksServicesTestsRavenwood", 152 libs: [ 153 "android.test.mock", 154 ], 155 static_libs: [ 156 "androidx.annotation_annotation", 157 "androidx.test.rules", 158 "services.core", 159 "flag-junit", 160 ], 161 srcs: [ 162 "src/com/android/server/uri/**/*.java", 163 ], 164 auto_gen_config: true, 165} 166 167java_library { 168 name: "servicestests-core-utils", 169 srcs: [ 170 "src/com/android/server/am/DeviceConfigSession.java", 171 "src/com/android/server/pm/PackageSettingBuilder.java", 172 "src/com/android/server/pm/parsing/TestPackageParser2.kt", 173 ], 174 static_libs: [ 175 "services.core", 176 "compatibility-device-util-axt", 177 ], 178} 179 180java_library { 181 name: "servicestests-dpm-utils", 182 srcs: [ 183 "src/com/android/server/devicepolicy/DevicePolicyManagerServiceTestable.java", 184 "src/com/android/server/devicepolicy/DevicePolicyManagerTestable.java", 185 "src/com/android/server/devicepolicy/DpmMockContext.java", 186 "src/com/android/server/devicepolicy/DpmTestBase.java", 187 "src/com/android/server/devicepolicy/DpmTestUtils.java", 188 "src/com/android/server/devicepolicy/DummyDeviceAdmins.java", 189 "src/com/android/server/devicepolicy/MockSystemServices.java", 190 "src/com/android/server/devicepolicy/MockUtils.java", 191 ], 192 libs: [ 193 "android.test.mock", 194 "android.test.base", 195 "mockito-target-minus-junit4", 196 ], 197 static_libs: [ 198 "frameworks-base-testutils", 199 "androidx.test.core", 200 "androidx.test.ext.truth", 201 "androidx.test.rules", 202 "services.core", 203 "services.devicepolicy", 204 ], 205} 206 207java_library { 208 name: "servicestests-utils", 209 srcs: [ 210 "utils/**/*.java", 211 "utils/**/*.kt", 212 "utils-mockito/**/*.kt", 213 ], 214 static_libs: [ 215 "junit", 216 "mockito-target-minus-junit4", 217 ], 218 libs: [ 219 "android.test.runner", 220 ], 221} 222 223java_library { 224 name: "mockito-test-utils", 225 srcs: [ 226 "utils-mockito/**/*.kt", 227 ], 228 static_libs: [ 229 "mockito-target-minus-junit4", 230 ], 231} 232 233java_library { 234 name: "servicestests-utils-mockito-extended", 235 srcs: [ 236 "utils/**/*.java", 237 "utils/**/*.kt", 238 "utils-mockito/**/*.kt", 239 ], 240 static_libs: [ 241 "junit", 242 "mockito-target-extended-minus-junit4", 243 ], 244 libs: [ 245 "android.test.runner", 246 ], 247} 248 249filegroup { 250 name: "servicestests-SuspendTestApp-files", 251 srcs: [ 252 "src/com/android/server/pm/SuspendPackagesTest.java", 253 ], 254} 255 256// Rules to copy all the test apks to the intermediate raw resource directory 257java_genrule { 258 name: "FrameworksServicesTests_apks_as_resources", 259 srcs: [ 260 ":FrameworksServicesTests_install_split_base", 261 ":FrameworksServicesTests_install_split_feature_a", 262 ], 263 out: ["FrameworkServicesTests_apks_as_resources.res.zip"], 264 tools: ["soong_zip"], 265 266 cmd: "mkdir -p $(genDir)/res/raw && " + 267 "for i in $(in); do " + 268 " x=$${i##*FrameworksCoreTests_}; cp $$i $(genDir)/res/raw/$${x%.apk};" + 269 " x=$${i##*FrameworksServicesTests_}; cp $$i $(genDir)/res/raw/$${x%.apk};" + 270 "done && " + 271 "$(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res", 272} 273 274FLAKY_AND_IGNORED = [ 275 "androidx.test.filters.FlakyTest", 276 "org.junit.Ignore", 277] 278// Used by content protection TEST_MAPPING 279test_module_config { 280 name: "FrameworksServicesTests_contentprotection", 281 base: "FrameworksServicesTests", 282 test_suites: ["device-tests"], 283 include_filters: ["com.android.server.contentprotection"], 284 exclude_annotations: FLAKY_AND_IGNORED, 285} 286 287test_module_config { 288 name: "FrameworksServicesTests_om", 289 base: "FrameworksServicesTests", 290 test_suites: ["device-tests"], 291 include_filters: ["com.android.server.om."], 292 exclude_annotations: FLAKY_AND_IGNORED, 293} 294 295// Used by contexthub TEST_MAPPING 296test_module_config { 297 name: "FrameworksServicesTests_contexthub_presubmit", 298 base: "FrameworksServicesTests", 299 test_suites: ["device-tests"], 300 include_filters: ["com.android.server.location.contexthub."], 301 // TODO(ron): are these right, does it run anything? 302 include_annotations: ["android.platform.test.annotations.Presubmit"], 303 exclude_annotations: FLAKY_AND_IGNORED, 304} 305 306test_module_config { 307 name: "FrameworksServicesTests_contexthub_postsubmit", 308 base: "FrameworksServicesTests", 309 test_suites: ["device-tests"], 310 include_filters: ["com.android.server.location.contexthub."], 311 // TODO(ron): are these right, does it run anything? 312 include_annotations: ["android.platform.test.annotations.Postsubmit"], 313 exclude_annotations: FLAKY_AND_IGNORED, 314} 315 316// Used by contentcapture 317test_module_config { 318 name: "FrameworksServicesTests_contentcapture", 319 base: "FrameworksServicesTests", 320 test_suites: ["device-tests"], 321 include_filters: ["com.android.server.contentcapture"], 322 exclude_annotations: FLAKY_AND_IGNORED, 323} 324 325test_module_config { 326 name: "FrameworksServicesTests_recoverysystem", 327 base: "FrameworksServicesTests", 328 test_suites: ["device-tests"], 329 include_filters: ["com.android.server.recoverysystem."], 330 exclude_annotations: ["androidx.test.filters.FlakyTest"], 331} 332 333// server pm TEST_MAPPING 334test_module_config { 335 name: "FrameworksServicesTests_pm_presubmit", 336 base: "FrameworksServicesTests", 337 test_suites: ["device-tests"], 338 include_annotations: ["android.platform.test.annotations.Presubmit"], 339 include_filters: ["com.android.server.pm."], 340 exclude_annotations: FLAKY_AND_IGNORED, 341} 342 343test_module_config { 344 name: "FrameworksServicesTests_pm_postsubmit", 345 base: "FrameworksServicesTests", 346 test_suites: ["device-tests"], 347 include_annotations: ["android.platform.test.annotations.Postsubmit"], 348 include_filters: ["com.android.server.pm."], 349 exclude_annotations: FLAKY_AND_IGNORED, 350} 351 352// server os TEST_MAPPING 353test_module_config { 354 name: "FrameworksServicesTests_os", 355 base: "FrameworksServicesTests", 356 test_suites: ["device-tests"], 357 include_filters: ["com.android.server.os."], 358} 359