Unit tests for PermissionUtils

Test: atest MediaProviderTests:PermissionUtilsTest

Bug: 157716052
Merged-In: I2e0b9c991c0f6b9789933d9bebb81c2b86f6f4f6
Merged-In: I612f6e68eb933484a45571013a3585c5635dae72
Change-Id: I612f6e68eb933484a45571013a3585c5635dae72
(cherry picked from commit 9f752e967da6122b31e069d712c7c29169a3f05a)
diff --git a/tests/Android.bp b/tests/Android.bp
index cdf9280..5a354a8 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -1,3 +1,55 @@
+android_test_helper_app {
+    name: "MediaProviderTestAppWithStoragePerms",
+    manifest: "test_app/TestAppWithStoragePerms.xml",
+    srcs: [
+        "test_app/src/**/*.java",
+        "src/com/android/providers/media/util/TestUtils.java",
+    ],
+    static_libs: [
+        "cts-install-lib",
+    ],
+    sdk_version: "test_current",
+    test_suites: [
+        "device-tests",
+        "mts-mediaprovider",
+    ],
+}
+
+android_test_helper_app {
+    name: "MediaProviderTestAppWithoutPerms",
+    manifest: "test_app/TestAppWithoutPerms.xml",
+    srcs: [
+        "test_app/src/**/*.java",
+        "src/com/android/providers/media/util/TestUtils.java",
+    ],
+    static_libs: [
+        "cts-install-lib",
+    ],
+    sdk_version: "test_current",
+    test_suites: [
+        "device-tests",
+        "mts-mediaprovider",
+    ],
+}
+
+android_test_helper_app {
+    name: "LegacyMediaProviderTestApp",
+    manifest: "test_app/LegacyTestApp.xml",
+    srcs: [
+        "test_app/src/**/*.java",
+        "src/com/android/providers/media/util/TestUtils.java",
+    ],
+    static_libs: [
+        "cts-install-lib",
+    ],
+    sdk_version: "test_current",
+    target_sdk_version: "28",
+    test_suites: [
+        "device-tests",
+        "mts-mediaprovider",
+    ],
+}
+
 // This looks a bit awkward, but we need our tests to run against either
 // MediaProvider or MediaProviderGoogle, and we don't know which one is
 // on the device being tested, so we can't sign our tests with a key that
@@ -49,6 +101,7 @@
         "mockito-target",
         "modules-utils-build",
         "truth-prebuilt",
+        "cts-install-lib",
     ],
 
     certificate: "media",
@@ -61,6 +114,12 @@
             "-Xep:MissingFail:ERROR",
         ],
     },
+
+    java_resources: [
+        ":MediaProviderTestAppWithStoragePerms",
+        ":MediaProviderTestAppWithoutPerms",
+        ":LegacyMediaProviderTestApp",
+    ],
 }
 
 filegroup {