1package {
2    default_team: "trendy_team_enterprise",
3    default_applicable_licenses: ["Android-Apache-2.0"],
4}
5
6java_library_static {
7    name: "TestApp_JavaProtos",
8    sdk_version: "core_current",
9    host_supported: true,
10    proto: {
11        type: "lite",
12    },
13    srcs: ["src/library/main/proto/testapp_protos.proto"],
14}
15
16android_library {
17    name: "TestApp_TestApps",
18    sdk_version: "system_current",
19    srcs: [
20        "src/testapps/main/java/**/*.java",
21        "src/testapps/main/java/**/*.kt",
22    ],
23    static_libs: [
24        "EventLib",
25        "TestApp_Annotations",
26        "ConnectedAppsSDK",
27        "ConnectedAppsSDK_Annotations",
28        "androidx.annotation_annotation",
29        "RemoteFrameworkClasses",
30        "TestApisReflection",
31    ],
32    manifest: "src/testapps/main/AndroidManifest.xml",
33    min_sdk_version: "29",
34    plugins: [
35        "ConnectedAppsSDK_Processor",
36        "TestApp_Processor",
37    ],
38    lint: {
39        baseline_filename: "lint-baseline.xml",
40    },
41}
42
43android_library {
44    name: "TestApp",
45    sdk_version: "system_current",
46    srcs: [
47        "src/library/main/java/**/*.java",
48        "src/library/main/java/**/*.kt",
49    ],
50    static_libs: [
51        "Nene",
52        "EventLib",
53        "Queryable",
54        "TestApp_Annotations",
55        "ConnectedAppsSDK",
56        "ConnectedAppsSDK_Annotations",
57        "androidx.annotation_annotation",
58        "TestApp_TestApps",
59        "TestApp_JavaProtos",
60        "QueryableCommonAndroid",
61        "auto_value_annotations",
62    ],
63    manifest: "src/library/main/AndroidManifest.xml",
64    min_sdk_version: "29",
65    resource_zips: [":TestApp_Apps"],
66    plugins: [
67        "ConnectedAppsSDK_Processor",
68        "TestApp_Processor",
69        "auto_annotation_plugin",
70    ],
71}
72
73android_test {
74    name: "TestAppTest",
75    srcs: [
76        "src/test/java/**/*.java",
77        "src/test/java/**/*.kt",
78    ],
79    test_suites: [
80        "general-tests",
81    ],
82    static_libs: [
83        "Nene",
84        "TestApp",
85        "TestApp_TestApps",
86        "Harrier",
87        "EventLib",
88        "androidx.test.ext.junit",
89        "truth",
90        "testng", // for assertThrows
91    ],
92    manifest: "src/test/AndroidManifest.xml",
93    min_sdk_version: "29",
94    plugins: ["auto_annotation_plugin"],
95}
96
97python_binary_host {
98    name: "index_testapps",
99    version: {
100        py3: {
101            embedded_launcher: true,
102        },
103    },
104    main: "tools/index/index_testapps.py",
105    srcs: [
106        "tools/index/index_testapps.py",
107        "src/library/main/proto/testapp_protos.proto",
108    ],
109    proto: {
110        canonical_path_from_root: false,
111    },
112}
113
114java_genrule {
115    name: "TestApp_Apps",
116    srcs: [
117        ":EmptyTestApp",
118        ":NotEmptyTestApp",
119        ":DeviceAdminTestApp",
120        ":TestOnlyDeviceAdminTestApp",
121        ":LockTaskApp",
122        ":DelegateTestApp",
123        ":ContentTestApp",
124        ":DevicePolicyManagementRoleHolderTestApp",
125        ":RemoteDPCTestApp",
126        ":RemoteDPCTestAppTargetingV23",
127        ":RemoteDPCTestAppTargetingV24",
128        ":RemoteDPCTestAppTargetingV28",
129        ":RemoteDPCTestAppTargetingV30",
130        ":DialerApp",
131        ":SmsApp",
132        ":AccountManagementApp",
133        ":RemoteAccountAuthenticatorApp",
134        ":MLCTestApp",
135        ":MultipleActivitiesTestApp",
136        ":HeadlessDOSingleUserTestApp",
137    ],
138    out: ["TestApp_Apps.res.zip"],
139    tools: [
140        "soong_zip",
141        "index_testapps",
142        "aapt2",
143    ],
144    cmd: "mkdir -p $(genDir)/res/raw" +
145        " && cp $(location :EmptyTestApp) $(genDir)/res/raw" +
146        " && cp $(location :NotEmptyTestApp) $(genDir)/res/raw" +
147        " && cp $(location :DeviceAdminTestApp) $(genDir)/res/raw" +
148        " && cp $(location :TestOnlyDeviceAdminTestApp) $(genDir)/res/raw" +
149        " && cp $(location :LockTaskApp) $(genDir)/res/raw" +
150        " && cp $(location :DelegateTestApp) $(genDir)/res/raw" +
151        " && cp $(location :ContentTestApp) $(genDir)/res/raw" +
152        " && cp $(location :DevicePolicyManagementRoleHolderTestApp) $(genDir)/res/raw" +
153        " && cp $(location :RemoteDPCTestApp) $(genDir)/res/raw" +
154        " && cp $(location :RemoteDPCTestAppTargetingV23) $(genDir)/res/raw" +
155        " && cp $(location :RemoteDPCTestAppTargetingV24) $(genDir)/res/raw" +
156        " && cp $(location :RemoteDPCTestAppTargetingV28) $(genDir)/res/raw" +
157        " && cp $(location :RemoteDPCTestAppTargetingV30) $(genDir)/res/raw" +
158        " && cp $(location :DialerApp) $(genDir)/res/raw" +
159        " && cp $(location :SmsApp) $(genDir)/res/raw" +
160        " && cp $(location :AccountManagementApp) $(genDir)/res/raw" +
161        " && cp $(location :RemoteAccountAuthenticatorApp) $(genDir)/res/raw" +
162        " && cp $(location :MLCTestApp) $(genDir)/res/raw" +
163        " && cp $(location :MultipleActivitiesTestApp) $(genDir)/res/raw" +
164        " && cp $(location :HeadlessDOSingleUserTestApp) $(genDir)/res/raw" +
165        " && $(location index_testapps) --directory $(genDir)/res/raw --aapt2 $(location aapt2)" +
166        " && $(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res/raw",
167}
168
169android_test_helper_app {
170    name: "EmptyTestApp",
171    static_libs: [
172        "TestApp_TestApps",
173    ],
174    defaults: ["mts-target-sdk-version-current"],
175    manifest: "manifests/EmptyTestAppManifest.xml",
176    min_sdk_version: "29",
177    sdk_version: "system_current",
178}
179
180android_test_helper_app {
181    name: "NotEmptyTestApp",
182    static_libs: [
183        "TestApp_TestApps",
184    ],
185    defaults: ["mts-target-sdk-version-current"],
186    manifest: "manifests/NotEmptyTestAppManifest.xml",
187    additional_manifests: ["CommonManifest.xml"],
188    min_sdk_version: "29",
189    sdk_version: "system_current",
190}
191
192android_test_helper_app {
193    name: "DeviceAdminTestApp",
194    static_libs: [
195        "TestApp_TestApps",
196    ],
197    defaults: ["mts-target-sdk-version-current"],
198    resource_dirs: ["src/testapps/main/res/device_admin"],
199    manifest: "manifests/DeviceAdminManifest.xml",
200    additional_manifests: ["CommonManifest.xml"],
201    min_sdk_version: "29",
202    sdk_version: "system_current",
203}
204
205android_test_helper_app {
206    name: "HeadlessDOSingleUserTestApp",
207    static_libs: [
208        "TestApp_TestApps",
209    ],
210    defaults: ["mts-target-sdk-version-current"],
211    resource_dirs: ["src/testapps/main/res/device_admin"],
212    manifest: "manifests/HeadlessDOSingleUserManifest.xml",
213    additional_manifests: ["CommonManifest.xml"],
214    min_sdk_version: "29",
215    sdk_version: "test_current",
216}
217
218android_test_helper_app {
219    name: "TestOnlyDeviceAdminTestApp",
220    static_libs: [
221        "TestApp_TestApps",
222    ],
223    defaults: ["mts-target-sdk-version-current"],
224    resource_dirs: ["src/testapps/main/res/device_admin"],
225    manifest: "manifests/TestOnlyDeviceAdminManifest.xml",
226    additional_manifests: ["CommonManifest.xml"],
227    min_sdk_version: "29",
228    sdk_version: "system_current",
229}
230
231android_test_helper_app {
232    name: "LockTaskApp",
233    static_libs: [
234        "TestApp_TestApps",
235    ],
236    defaults: ["mts-target-sdk-version-current"],
237    manifest: "manifests/LockTaskAppManifest.xml",
238    additional_manifests: ["CommonManifest.xml"],
239    min_sdk_version: "29",
240    sdk_version: "system_current",
241}
242
243android_test_helper_app {
244    name: "DelegateTestApp",
245    static_libs: [
246        "TestApp_TestApps",
247    ],
248    defaults: ["mts-target-sdk-version-current"],
249    manifest: "manifests/DelegateManifest.xml",
250    additional_manifests: ["CommonManifest.xml"],
251    min_sdk_version: "29",
252    sdk_version: "system_current",
253}
254
255android_test_helper_app {
256    name: "ContentTestApp",
257    static_libs: [
258        "TestApp_TestApps",
259    ],
260    defaults: ["mts-target-sdk-version-current"],
261    manifest: "manifests/ContentAppManifest.xml",
262    additional_manifests: ["CommonManifest.xml"],
263    min_sdk_version: "29",
264    sdk_version: "system_current",
265}
266
267android_test_helper_app {
268    name: "DevicePolicyManagementRoleHolderTestApp",
269    static_libs: [
270        "TestApp_TestApps",
271    ],
272    defaults: ["mts-target-sdk-version-current"],
273    manifest: "manifests/DevicePolicyManagementRoleHolderManifest.xml",
274    additional_manifests: ["CommonManifest.xml"],
275    resource_dirs: ["src/testapps/main/res/device_admin"],
276    min_sdk_version: "29",
277    sdk_version: "system_current",
278}
279
280android_test_helper_app {
281    name: "RemoteDPCTestApp",
282    static_libs: [
283        "TestApp_TestApps",
284    ],
285    defaults: ["mts-target-sdk-version-current"],
286    resource_dirs: ["src/testapps/main/res/device_admin"],
287    manifest: "manifests/RemoteDPCManifest.xml",
288    additional_manifests: ["CommonManifest.xml"],
289    min_sdk_version: "29",
290    sdk_version: "system_current",
291    target_sdk_version: "35",
292}
293
294android_test_helper_app {
295    name: "RemoteDPCTestAppTargetingV23",
296    static_libs: [
297        "TestApp_TestApps",
298    ],
299    resource_dirs: ["src/testapps/main/res/device_admin"],
300    manifest: "manifests/RemoteDPCManifest.xml",
301    additional_manifests: ["CommonManifest.xml"],
302    aaptflags: [
303        "--rename-manifest-package com.android.cts.RemoteDPCV23",
304    ],
305    target_sdk_version: "23",
306}
307
308android_test_helper_app {
309    name: "RemoteDPCTestAppTargetingV24",
310    static_libs: [
311        "TestApp_TestApps",
312    ],
313    resource_dirs: ["src/testapps/main/res/device_admin"],
314    manifest: "manifests/RemoteDPCManifest.xml",
315    additional_manifests: ["CommonManifest.xml"],
316    aaptflags: [
317        "--rename-manifest-package com.android.cts.RemoteDPCV24",
318    ],
319    target_sdk_version: "24",
320}
321
322android_test_helper_app {
323    name: "RemoteDPCTestAppTargetingV28",
324    static_libs: [
325        "TestApp_TestApps",
326    ],
327    resource_dirs: ["src/testapps/main/res/device_admin"],
328    manifest: "manifests/RemoteDPCManifest.xml",
329    additional_manifests: ["CommonManifest.xml"],
330    aaptflags: [
331        "--rename-manifest-package com.android.cts.RemoteDPCV28",
332    ],
333    target_sdk_version: "28",
334}
335
336android_test_helper_app {
337    name: "RemoteDPCTestAppTargetingV30",
338    static_libs: [
339        "TestApp_TestApps",
340    ],
341    resource_dirs: ["src/testapps/main/res/device_admin"],
342    manifest: "manifests/RemoteDPCManifest.xml",
343    additional_manifests: ["CommonManifest.xml"],
344    aaptflags: [
345        "--rename-manifest-package com.android.cts.RemoteDPCV30",
346    ],
347    target_sdk_version: "30",
348}
349
350android_test_helper_app {
351    name: "DialerApp",
352    static_libs: [
353        "TestApp_TestApps",
354    ],
355    defaults: ["mts-target-sdk-version-current"],
356    manifest: "manifests/DialerAppManifest.xml",
357    additional_manifests: ["CommonManifest.xml"],
358    min_sdk_version: "29",
359    sdk_version: "system_current",
360}
361
362android_test_helper_app {
363    name: "SmsApp",
364    static_libs: [
365        "TestApp_TestApps",
366    ],
367    defaults: ["mts-target-sdk-version-current"],
368    manifest: "manifests/SmsAppManifest.xml",
369    additional_manifests: ["CommonManifest.xml"],
370    min_sdk_version: "29",
371    sdk_version: "system_current",
372}
373
374android_test_helper_app {
375    name: "AccountManagementApp",
376    static_libs: [
377        "TestApp_TestApps",
378    ],
379    defaults: ["mts-target-sdk-version-current"],
380    resource_dirs: ["src/testapps/main/res/accountmanagement"],
381    manifest: "manifests/AccountManagementManifest.xml",
382    additional_manifests: ["CommonManifest.xml"],
383    min_sdk_version: "29",
384    sdk_version: "system_current",
385}
386
387android_test_helper_app {
388    name: "MLCTestApp",
389    static_libs: [
390        "TestApp_TestApps",
391    ],
392    defaults: ["mts-target-sdk-version-current"],
393    manifest: "manifests/MLCTestAppManifest.xml",
394    resource_dirs: ["src/testapps/main/res/mlctestapp"],
395    additional_manifests: ["CommonManifest.xml"],
396    min_sdk_version: "29",
397    sdk_version: "system_current",
398}
399
400android_test_helper_app {
401    name: "RemoteAccountAuthenticatorApp",
402    static_libs: [
403        "TestApp_TestApps",
404    ],
405    defaults: ["mts-target-sdk-version-current"],
406    resource_dirs: ["src/testapps/main/res/accountmanagement"],
407    manifest: "manifests/RemoteAccountAuthenticatorManifest.xml",
408    additional_manifests: ["CommonManifest.xml"],
409    min_sdk_version: "29",
410    sdk_version: "system_current",
411}
412
413android_test_helper_app {
414    name: "MultipleActivitiesTestApp",
415    static_libs: [
416        "TestApp_TestApps",
417    ],
418    defaults: ["mts-target-sdk-version-current"],
419    manifest: "manifests/MultipleActivitiesTestAppManifest.xml",
420    additional_manifests: ["CommonManifest.xml"],
421    min_sdk_version: "29",
422}
423
424java_library {
425    name: "TestApp_Annotations",
426    sdk_version: "core_current",
427    srcs: [
428        "src/processor/main/java/com/android/bedstead/testapp/processor/annotations/*.java",
429        "src/processor/main/java/com/android/bedstead/testapp/processor/annotations/*.kt",
430    ],
431    host_supported: true,
432}
433
434java_plugin {
435    name: "TestApp_Processor",
436    processor_class: "com.android.bedstead.testapp.processor.Processor",
437    static_libs: [
438        "javapoet",
439        "auto_service_annotations",
440        "TestApp_Annotations",
441        "ConnectedAppsSDK_Annotations",
442        "RemoteFrameworkClasses_Processor_Src",
443    ],
444    srcs: [
445        "src/processor/main/java/com/android/bedstead/testapp/processor/Processor.java",
446    ],
447    plugins: ["auto_service_plugin"],
448    generates_api: true,
449}
450