1package {
2    // See: http://go/android-license-faq
3    default_applicable_licenses: ["Android-Apache-2.0"],
4}
5
6android_test_helper_app {
7    name: "MediaProviderTestAppForPermissionActivity",
8    manifest: "test_app/TestAppForPermissionActivity.xml",
9    srcs: [
10        "test_app/src/**/*.java",
11        "src/com/android/providers/media/util/TestUtils.java",
12    ],
13    static_libs: [
14        "cts-install-lib",
15    ],
16    sdk_version: "test_current",
17    target_sdk_version: "30",
18    min_sdk_version: "30",
19    test_suites: [
20        "general-tests",
21        "mts-mediaprovider",
22    ],
23}
24
25android_test_helper_app {
26    name: "MediaProviderTestAppForPermissionActivity33",
27    manifest: "test_app/TestAppForPermissionActivity33.xml",
28    srcs: [
29        "test_app/src/**/*.java",
30        "src/com/android/providers/media/util/TestUtils.java",
31    ],
32    static_libs: [
33        "cts-install-lib",
34    ],
35    sdk_version: "test_current",
36    target_sdk_version: "33",
37    min_sdk_version: "30",
38    test_suites: [
39        "general-tests",
40        "mts-mediaprovider",
41    ],
42}
43
44android_test_helper_app {
45    name: "MediaProviderTestAppWithStoragePerms",
46    manifest: "test_app/TestAppWithStoragePerms.xml",
47    srcs: [
48        "test_app/src/**/*.java",
49        "src/com/android/providers/media/util/TestUtils.java",
50    ],
51    static_libs: [
52        "cts-install-lib",
53    ],
54    sdk_version: "test_current",
55    target_sdk_version: "30",
56    min_sdk_version: "30",
57    test_suites: [
58        "general-tests",
59        "mts-mediaprovider",
60    ],
61}
62
63android_test_helper_app {
64    name: "MediaProviderTestAppWithMediaPerms",
65    manifest: "test_app/TestAppWithMediaPerms.xml",
66    srcs: [
67        "test_app/src/**/*.java",
68        "src/com/android/providers/media/util/TestUtils.java",
69    ],
70    static_libs: [
71        "cts-install-lib",
72    ],
73    sdk_version: "test_current",
74    target_sdk_version: "30",
75    min_sdk_version: "30",
76    test_suites: [
77        "general-tests",
78        "mts-mediaprovider",
79    ],
80}
81
82android_test_helper_app {
83    name: "MediaProviderTestAppWithUserSelectedPerms",
84    manifest: "test_app/TestAppWithUserSelectedPerms.xml",
85    srcs: [
86        "test_app/src/**/*.java",
87        "src/com/android/providers/media/util/TestUtils.java",
88    ],
89    static_libs: [
90        "cts-install-lib",
91    ],
92    sdk_version: "test_current",
93    target_sdk_version: "33",
94    min_sdk_version: "30",
95    test_suites: [
96        "general-tests",
97        "mts-mediaprovider",
98    ],
99}
100
101android_test_helper_app {
102    name: "MediaProviderTestAppWithoutPerms",
103    manifest: "test_app/TestAppWithoutPerms.xml",
104    srcs: [
105        "test_app/src/**/*.java",
106        "src/com/android/providers/media/util/TestUtils.java",
107    ],
108    static_libs: [
109        "cts-install-lib",
110    ],
111    sdk_version: "test_current",
112    target_sdk_version: "30",
113    min_sdk_version: "30",
114    test_suites: [
115        "general-tests",
116        "mts-mediaprovider",
117    ],
118}
119
120android_test_helper_app {
121    name: "LegacyMediaProviderTestApp",
122    manifest: "test_app/LegacyTestApp.xml",
123    srcs: [
124        "test_app/src/**/*.java",
125        "src/com/android/providers/media/util/TestUtils.java",
126    ],
127    static_libs: [
128        "cts-install-lib",
129    ],
130    sdk_version: "test_current",
131    target_sdk_version: "28",
132    min_sdk_version: "30",
133    test_suites: [
134        "general-tests",
135        "mts-mediaprovider",
136    ],
137}
138
139android_test_helper_app {
140    name: "LegacyMediaProviderTestAppFor35",
141    manifest: "test_app/LegacyTestAppWithTargetSdk35.xml",
142    srcs: [
143        "test_app/src/**/*.java",
144        "src/com/android/providers/media/util/TestUtils.java",
145    ],
146    static_libs: [
147        "cts-install-lib",
148    ],
149    sdk_version: "test_current",
150    target_sdk_version: "35",
151    min_sdk_version: "30",
152    test_suites: [
153        "general-tests",
154        "mts-mediaprovider",
155    ],
156}
157
158// This looks a bit awkward, but we need our tests to run against either
159// MediaProvider or MediaProviderGoogle, and we don't know which one is
160// on the device being tested, so we can't sign our tests with a key that
161// will allow instrumentation.  Thus we pull all the sources we need to
162// run tests against into the test itself.
163android_test {
164    name: "MediaProviderTests",
165    test_suites: [
166        "general-tests",
167        "mts-mediaprovider",
168    ],
169    compile_multilib: "both",
170
171    manifest: "AndroidManifest.xml",
172
173    resource_dirs: [
174        "main_res",
175        "res",
176    ],
177
178    srcs: [
179        ":framework-mediaprovider-sources",
180        ":mediaprovider-sources",
181        ":mediaprovider-testutils",
182        "src/**/*.java",
183    ],
184
185    libs: [
186        "android.test.base",
187        "android.test.mock",
188        "android.test.runner",
189        "unsupportedappusage",
190        "framework-mediaprovider.impl",
191        "keepanno-annotations",
192    ],
193
194    jni_libs: [
195        // Needed to run LevelDBManagerTest
196        "libleveldb_jni",
197    ],
198
199    static_libs: [
200        "androidx.appcompat_appcompat",
201        "modules-utils-backgroundthread",
202        "androidx.core_core",
203        "androidx.test.rules",
204        "guava",
205        "mockito-target",
206        "modules-utils-build",
207        "truth",
208        "com.google.android.material_material",
209        "cts-install-lib",
210        "androidx.test.espresso.core",
211        "androidx.test.espresso.contrib",
212        "androidx.test.core",
213        "androidx.arch.core_core-runtime",
214        "glide-prebuilt",
215        "glide-gifdecoder-prebuilt",
216        "glide-disklrucache-prebuilt",
217        "glide-annotation-and-compiler-prebuilt",
218        "glide-integration-recyclerview-prebuilt",
219        "androidx.fragment_fragment",
220        "androidx.vectordrawable_vectordrawable-animated",
221        "androidx.exifinterface_exifinterface",
222        "androidx.work_work-runtime",
223        "androidx.work_work-testing",
224        "exoplayer-mediaprovider-ui",
225        "SettingsLibProfileSelector",
226        "SettingsLibSelectorWithWidgetPreference",
227        "mediaprovider_flags_java_lib",
228    ],
229
230    certificate: "media",
231
232    aaptflags: ["--custom-package com.android.providers.media"],
233
234    errorprone: {
235        javacflags: [
236            "-Xep:CatchFail:ERROR",
237            "-Xep:MissingFail:ERROR",
238        ],
239    },
240
241    data: [
242        ":LegacyMediaProviderTestApp",
243        ":LegacyMediaProviderTestAppFor35",
244        ":MediaProviderTestAppForPermissionActivity",
245        ":MediaProviderTestAppForPermissionActivity33",
246        ":MediaProviderTestAppWithMediaPerms",
247        ":MediaProviderTestAppWithStoragePerms",
248        ":MediaProviderTestAppWithoutPerms",
249        ":MediaProviderTestAppWithUserSelectedPerms",
250    ],
251    per_testcase_directory: true,
252
253    min_sdk_version: "30",
254}
255
256filegroup {
257    name: "mediaprovider-testutils",
258    srcs: ["utils/**/*.java"],
259}
260
261filegroup {
262    name: "mediaprovider-library",
263    srcs: [
264        "src/com/android/providers/media/library/RunOnlyOnPostsubmit.java",
265    ],
266}
267