summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Severson <evanseverson@google.com>2021-02-23 19:25:50 -0800
committerEvan Severson <evanseverson@google.com>2021-02-25 14:12:31 -0800
commitdc9977ebff7a115320824f738ac8de8b9e03374a (patch)
tree2ea674c4d0916de283fa6134fca3e26c87b57ccc
parented1ef5ae0d9f7b51d4aefe8c3b34d6cbf663fb21 (diff)
downloadPermission-dc9977ebff7a115320824f738ac8de8b9e03374a.tar.gz
Remove background mic and camera from upgrade logic
Test: cd PermissionController && atest -p Bug: 158311343 Change-Id: Icc2db6375d28829d707760f3df334897a88eb41b
-rw-r--r--PermissionController/src/com/android/permissioncontroller/permission/service/RuntimePermissionsUpgradeController.kt61
-rw-r--r--PermissionController/tests/hostside/upgrade/Android.bp40
-rw-r--r--PermissionController/tests/hostside/upgrade/AndroidTest.xml38
-rw-r--r--PermissionController/tests/hostside/upgrade/res/raw/roles-30.xml6
-rw-r--r--PermissionController/tests/hostside/upgrade/res/raw/runtime-permissions-30_AssistantMicDenied.xml30
-rw-r--r--PermissionController/tests/hostside/upgrade/res/raw/runtime-permissions-30_AssistantMicGranted.xml30
-rw-r--r--PermissionController/tests/hostside/upgrade/src/com/android/permissioncontroller/test/upgrade/Upgrade30ToCurrent.kt97
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/Android.bp63
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/Android.bp34
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/AndroidManifest.xml27
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/src/com/android/permissioncontroller/test/upgrade/deviceside/DeviceSide.kt328
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/src/com/android/permissioncontroller/test/upgrade/deviceside/MultipleTestRunner.kt56
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30Assistant.xml36
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraDenied.xml24
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraDeniedAndDeclaresBgCamera.xml25
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraGranted.xml24
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraGrantedAndDeclaresBgCamera.xml25
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraDenied.xml24
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraDeniedAndDeclaresBgCamera.xml25
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraGranted.xml24
-rw-r--r--PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraGrantedAndDeclaresBgCamera.xml25
21 files changed, 8 insertions, 1034 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/permission/service/RuntimePermissionsUpgradeController.kt b/PermissionController/src/com/android/permissioncontroller/permission/service/RuntimePermissionsUpgradeController.kt
index faf268ed7..c22e5dd42 100644
--- a/PermissionController/src/com/android/permissioncontroller/permission/service/RuntimePermissionsUpgradeController.kt
+++ b/PermissionController/src/com/android/permissioncontroller/permission/service/RuntimePermissionsUpgradeController.kt
@@ -18,10 +18,8 @@ package com.android.permissioncontroller.permission.service
import android.Manifest.permission
import android.Manifest.permission_group
-import android.app.role.RoleManager
import android.content.Context
import android.content.pm.PackageInfo
-import android.content.pm.PackageManager.FLAG_PERMISSION_ALLOWLIST_ROLE
import android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT
import android.content.pm.PackageManager.FLAG_PERMISSION_WHITELIST_UPGRADE
import android.content.pm.PermissionInfo
@@ -33,13 +31,11 @@ import com.android.permissioncontroller.PermissionControllerStatsLog.RUNTIME_PER
import com.android.permissioncontroller.permission.data.LightAppPermGroupLiveData
import com.android.permissioncontroller.permission.data.LightPermInfoLiveData
import com.android.permissioncontroller.permission.data.PreinstalledUserPackageInfosLiveData
-import com.android.permissioncontroller.permission.data.RoleHoldersLiveData
import com.android.permissioncontroller.permission.data.SmartUpdateMediatorLiveData
import com.android.permissioncontroller.permission.data.UserPackageInfosLiveData
import com.android.permissioncontroller.permission.data.get
import com.android.permissioncontroller.permission.model.livedatatypes.LightAppPermGroup
import com.android.permissioncontroller.permission.model.livedatatypes.LightPackageInfo
-import com.android.permissioncontroller.permission.model.livedatatypes.LightPermInfo
import com.android.permissioncontroller.permission.model.livedatatypes.LightPermission
import com.android.permissioncontroller.permission.utils.IPC
import com.android.permissioncontroller.permission.utils.KotlinUtils.grantBackgroundRuntimePermissions
@@ -131,7 +127,6 @@ internal object RuntimePermissionsUpgradeController {
val needBackgroundAppPermGroups = sdkUpgradedFromP && currentVersion <= 6
val needAccessMediaAppPermGroups = !isNewUser && currentVersion <= 7
- val needBackgroundMicAppPermGroupsForAssistant = !isNewUser && currentVersion <= 8
// All data needed by this method.
//
@@ -158,9 +153,6 @@ internal object RuntimePermissionsUpgradeController {
/** {@link #permGroupProviders} that already provided a result */
private val permGroupProvidersDone = mutableSetOf<LightAppPermGroupLiveData>()
- /** Provides the currently set assistant */
- private val assistants = RoleHoldersLiveData[RoleManager.ROLE_ASSISTANT, myUserHandle()]
-
init {
// First step: Load packages + perm infos
// TODO ntmyren: remove once b/154796729 is fixed
@@ -197,28 +189,16 @@ internal object RuntimePermissionsUpgradeController {
}
}
}
-
- if (needBackgroundMicAppPermGroupsForAssistant) {
- addSource(assistants) { assists ->
- if (assists != null) {
- removeSource(assistants)
-
- update()
- }
- }
- }
}
override fun onUpdate() {
- if (permGroupProviders == null && pkgInfoProvider.value != null &&
- (!needBackgroundMicAppPermGroupsForAssistant || assistants.value != null)) {
+ if (permGroupProviders == null && pkgInfoProvider.value != null) {
// Second step: Trigger load of app-perm-groups
permGroupProviders = mutableListOf()
// Only load app-perm-groups needed for this upgrade
- if (needBackgroundAppPermGroups || needAccessMediaAppPermGroups ||
- needBackgroundMicAppPermGroupsForAssistant) {
+ if (needBackgroundAppPermGroups || needAccessMediaAppPermGroups) {
for ((pkgName, _, requestedPerms, requestedPermFlags) in
pkgInfoProvider.value!!) {
var hasAccessMedia = false
@@ -242,13 +222,6 @@ internal object RuntimePermissionsUpgradeController {
hasGrantedExternalStorage = true
}
}
-
- if (needBackgroundMicAppPermGroupsForAssistant &&
- perm == permission.RECORD_BACKGROUND_AUDIO &&
- assistants.value!!.contains(pkgName)) {
- permGroupProviders!!.add(LightAppPermGroupLiveData[pkgName,
- permission_group.MICROPHONE, myUserHandle()])
- }
}
if (hasAccessMedia && hasGrantedExternalStorage) {
@@ -299,8 +272,7 @@ internal object RuntimePermissionsUpgradeController {
}
}
- val restrictedPermissions = mutableSetOf<LightPermInfo>()
- val restrictedPermissionsInstallerExemptIgnored = mutableSetOf<String>()
+ val restrictedPermissions = mutableSetOf<String>()
for (permInfoLiveDt in platformRuntimePermissionInfoProviders) {
val permInfo = permInfoLiveDt.value!!
@@ -309,11 +281,7 @@ internal object RuntimePermissionsUpgradeController {
continue
}
- if (permInfo.flags and PermissionInfo.FLAG_INSTALLER_EXEMPT_IGNORED != 0) {
- restrictedPermissionsInstallerExemptIgnored.add(permInfo.name)
- }
-
- restrictedPermissions.add(permInfo)
+ restrictedPermissions.add(permInfo.name)
}
value = UpgradeData(preinstalledPkgInfoProvider.value!!, restrictedPermissions,
@@ -331,15 +299,11 @@ internal object RuntimePermissionsUpgradeController {
// If a restricted permission can't be exempted by the installer then it should be filtered
// out here.
val preinstalledAppExemptions = getExemptions(
- upgradeData.restrictedPermissions.filter {
- it.flags and PermissionInfo.FLAG_INSTALLER_EXEMPT_IGNORED == 0
- }.map {
- it.name
- }.toSet(),
+ upgradeData.restrictedPermissions,
upgradeData.preinstalledPkgs)
val (newVersion, upgradeExemptions, grants) = onUpgradeLockedDataLoaded(currentVersion,
- upgradeData.pkgs, upgradeData.restrictedPermissions.map { it.name }.toSet(),
+ upgradeData.pkgs, upgradeData.restrictedPermissions,
upgradeData.bgGroups, upgradeData.storageGroups, upgradeData.bgMicGroups)
// Do not run in parallel. Measurements have shown that this is slower than sequential
@@ -494,16 +458,7 @@ internal object RuntimePermissionsUpgradeController {
}
if (currentVersion == 8) {
- val packagesToExempt = mutableListOf<LightPackageInfo>()
- for (permGroup in bgMicApps) {
- packagesToExempt.add(permGroup.packageInfo)
- if (permGroup.foreground.isGranted) {
- grants.add(Grant(true, permGroup, listOf(permission.RECORD_BACKGROUND_AUDIO)))
- }
- }
-
- exemptions.addAll(getExemptions(setOf(permission.RECORD_BACKGROUND_AUDIO),
- packagesToExempt, FLAG_PERMISSION_ALLOWLIST_ROLE))
+ // Removed
currentVersion = 9
}
@@ -520,7 +475,7 @@ internal object RuntimePermissionsUpgradeController {
/** Preinstalled packages */
val preinstalledPkgs: List<LightPackageInfo>,
/** Restricted permissions */
- val restrictedPermissions: Set<LightPermInfo>,
+ val restrictedPermissions: Set<String>,
/** Currently installed packages */
val pkgs: List<LightPackageInfo>,
/**
diff --git a/PermissionController/tests/hostside/upgrade/Android.bp b/PermissionController/tests/hostside/upgrade/Android.bp
deleted file mode 100644
index 305512715..000000000
--- a/PermissionController/tests/hostside/upgrade/Android.bp
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2020 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-java_test_host {
- name: "PermissionControllerUpgradeTests",
- srcs: ["src/**/*.kt"],
- java_resource_dirs: ["res"],
- libs: [
- "tradefed",
- "junit",
- "truth-prebuilt",
- ],
- static_libs: [
- "frameworks-base-hostutils",
- ],
- test_suites: ["general-tests"],
- java_resources: [
- ":PermissionControllerUpgradeDeviceSideTests",
- ":PermissionUpgrade30HasCameraGranted",
- ":PermissionUpgrade30HasCameraDenied",
- ":PermissionUpgrade30HasCameraGrantedAndDeclaresBgCamera",
- ":PermissionUpgrade30HasCameraDeniedAndDeclaresBgCamera",
- ":PermissionUpgradeCurrentHasCameraGranted",
- ":PermissionUpgradeCurrentHasCameraDenied",
- ":PermissionUpgradeCurrentHasCameraGrantedAndDeclaresBgCamera",
- ":PermissionUpgradeCurrentHasCameraDeniedAndDeclaresBgCamera",
- ":PermissionUpgrade30Assistant",
- ],
-}
diff --git a/PermissionController/tests/hostside/upgrade/AndroidTest.xml b/PermissionController/tests/hostside/upgrade/AndroidTest.xml
deleted file mode 100644
index f3ae6f2eb..000000000
--- a/PermissionController/tests/hostside/upgrade/AndroidTest.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<configuration description="Upgrade tests for the permissioncontroller">
-
- <option name="test-suite-tag" value="PermissionControllerUpgradeTests" />
-
- <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
-
- <test class="com.android.tradefed.testtype.HostTest">
- <option name="jar" value="PermissionControllerUpgradeTests.jar" />
- </test>
-
- <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
- <option name="test-file-name" value="PermissionControllerUpgradeDeviceSideTests.apk" />
- <option name="test-file-name" value="PermissionUpgrade30HasCameraGranted.apk" />
- <option name="test-file-name" value="PermissionUpgrade30HasCameraDenied.apk" />
- <option name="test-file-name" value="PermissionUpgrade30HasCameraGrantedAndDeclaresBgCamera.apk" />
- <option name="test-file-name" value="PermissionUpgrade30HasCameraDeniedAndDeclaresBgCamera.apk" />
- <option name="test-file-name" value="PermissionUpgradeCurrentHasCameraGranted.apk" />
- <option name="test-file-name" value="PermissionUpgradeCurrentHasCameraDenied.apk" />
- <option name="test-file-name" value="PermissionUpgradeCurrentHasCameraGrantedAndDeclaresBgCamera.apk" />
- <option name="test-file-name" value="PermissionUpgradeCurrentHasCameraDeniedAndDeclaresBgCamera.apk" />
- <option name="test-file-name" value="PermissionUpgrade30Assistant.apk" />
- </target_preparer>
-</configuration>
diff --git a/PermissionController/tests/hostside/upgrade/res/raw/roles-30.xml b/PermissionController/tests/hostside/upgrade/res/raw/roles-30.xml
deleted file mode 100644
index d5d0efe3c..000000000
--- a/PermissionController/tests/hostside/upgrade/res/raw/roles-30.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
-<roles version="-1" packagesHash="">
- <role name="android.app.role.ASSISTANT">
- <holder name="com.android.permission.test.upgrade.sdk_30.assistant" />
- </role>
-</roles> \ No newline at end of file
diff --git a/PermissionController/tests/hostside/upgrade/res/raw/runtime-permissions-30_AssistantMicDenied.xml b/PermissionController/tests/hostside/upgrade/res/raw/runtime-permissions-30_AssistantMicDenied.xml
deleted file mode 100644
index 66d3409c1..000000000
--- a/PermissionController/tests/hostside/upgrade/res/raw/runtime-permissions-30_AssistantMicDenied.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
-<runtime-permissions version="8" fingerprint="">
- <package name="com.android.permission.test.upgrade.sdk_30.camera_granted">
- <permission name="android.permission.CAMERA" granted="true" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_30.camera_denied">
- <permission name="android.permission.CAMERA" granted="false" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_30.camera_granted_declares_bg">
- <permission name="android.permission.CAMERA" granted="true" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_30.camera_denied_declares_bg">
- <permission name="android.permission.CAMERA" granted="false" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_current.camera_granted">
- <permission name="android.permission.CAMERA" granted="true" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_current.camera_denied">
- <permission name="android.permission.CAMERA" granted="false" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_current.camera_granted_declares_bg">
- <permission name="android.permission.CAMERA" granted="true" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_current.camera_denied_declares_bg">
- <permission name="android.permission.CAMERA" granted="false" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_30.assistant">
- <permission name="android.permission.RECORD_AUDIO" granted="false" flags="300" />
- </package>
-</runtime-permissions>
diff --git a/PermissionController/tests/hostside/upgrade/res/raw/runtime-permissions-30_AssistantMicGranted.xml b/PermissionController/tests/hostside/upgrade/res/raw/runtime-permissions-30_AssistantMicGranted.xml
deleted file mode 100644
index fe7367fe7..000000000
--- a/PermissionController/tests/hostside/upgrade/res/raw/runtime-permissions-30_AssistantMicGranted.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
-<runtime-permissions version="8" fingerprint="">
- <package name="com.android.permission.test.upgrade.sdk_30.camera_granted">
- <permission name="android.permission.CAMERA" granted="true" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_30.camera_denied">
- <permission name="android.permission.CAMERA" granted="false" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_30.camera_granted_declares_bg">
- <permission name="android.permission.CAMERA" granted="true" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_30.camera_denied_declares_bg">
- <permission name="android.permission.CAMERA" granted="false" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_current.camera_granted">
- <permission name="android.permission.CAMERA" granted="true" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_current.camera_denied">
- <permission name="android.permission.CAMERA" granted="false" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_current.camera_granted_declares_bg">
- <permission name="android.permission.CAMERA" granted="true" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_current.camera_denied_declares_bg">
- <permission name="android.permission.CAMERA" granted="false" flags="300" />
- </package>
- <package name="com.android.permission.test.upgrade.sdk_30.assistant">
- <permission name="android.permission.RECORD_AUDIO" granted="true" flags="300" />
- </package>
-</runtime-permissions>
diff --git a/PermissionController/tests/hostside/upgrade/src/com/android/permissioncontroller/test/upgrade/Upgrade30ToCurrent.kt b/PermissionController/tests/hostside/upgrade/src/com/android/permissioncontroller/test/upgrade/Upgrade30ToCurrent.kt
deleted file mode 100644
index 3ee214969..000000000
--- a/PermissionController/tests/hostside/upgrade/src/com/android/permissioncontroller/test/upgrade/Upgrade30ToCurrent.kt
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.permissioncontroller.test.upgrade
-
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test
-import org.junit.Test
-import org.junit.rules.TemporaryFolder
-import org.junit.runner.RunWith
-import java.io.File
-import java.nio.file.Files
-
-@RunWith(DeviceJUnit4ClassRunner::class)
-class Upgrade30ToCurrent : BaseHostJUnit4Test() {
-
- companion object {
- private const val FULL_REBOOT = false
- private const val PERMISSION_SDK30_ASSISTANT_MIC_GRANTED_PATH =
- "raw/runtime-permissions-30_AssistantMicGranted.xml"
- private const val PERMISSION_SDK30_ASSISTANT_MIC_DENIED_PATH =
- "raw/runtime-permissions-30_AssistantMicDenied.xml"
- private const val PERMISSION_SDK30_ROLES_PATH = "raw/roles-30.xml"
-
- private const val SDK30_DEVICE_PERMISSION_DB_PATH =
- "/data/misc_de/0/apexdata/com.android.permission/runtime-permissions.xml"
- private const val CURRENT_DEVICE_PERMISSION_DB_PATH =
- "/data/misc_de/0/apexdata/com.android.permission/runtime-permissions.xml"
-
- private const val SDK30_DEVICE_ROLES_DB_PATH =
- "/data/misc_de/0/apexdata/com.android.permission/roles.xml"
- private const val CURRENT_DEVICE_ROLES_DB_PATH =
- "/data/misc_de/0/apexdata/com.android.permission/roles.xml"
- }
-
- @Test
- fun testUpgrade1() {
- simulateUpgrade(PERMISSION_SDK30_ASSISTANT_MIC_GRANTED_PATH, PERMISSION_SDK30_ROLES_PATH)
-
- runDeviceSideTest("testUpgrade1")
- }
-
- @Test
- fun testUpgrade2() {
- simulateUpgrade(PERMISSION_SDK30_ASSISTANT_MIC_DENIED_PATH, PERMISSION_SDK30_ROLES_PATH)
-
- runDeviceSideTest("testUpgrade2")
- }
-
- fun simulateUpgrade(permissionsPath: String, rolesPath: String) {
- runDeviceSideTest("verifyPackagesAreInstalled")
- device.executeShellCommand("stop")
-
- // Delete the current permissions file and write the R version
- device.deleteFile(CURRENT_DEVICE_PERMISSION_DB_PATH)
- device.deleteFile(CURRENT_DEVICE_ROLES_DB_PATH)
- val tmpFolder = TemporaryFolder()
- tmpFolder.create()
-
- var tmpFile = File(tmpFolder.root, "runtime-permissions.xml")
- var input = javaClass.classLoader!!.getResourceAsStream(permissionsPath)
- Files.copy(input, tmpFile.toPath())
- device.pushFile(tmpFile, SDK30_DEVICE_PERMISSION_DB_PATH)
-
- tmpFile = File(tmpFolder.root, "roles.xml")
- input = javaClass.classLoader!!.getResourceAsStream(rolesPath)
- Files.copy(input, tmpFile.toPath())
- device.pushFile(tmpFile, SDK30_DEVICE_ROLES_DB_PATH)
-
- if (FULL_REBOOT) {
- device.reboot()
- } else {
- device.executeShellCommand("start")
- }
- device.waitForDeviceAvailable()
-
- runDeviceSideTest("verifyPackagesAreInstalled")
- }
-
- private fun runDeviceSideTest(method: String) {
- runDeviceTests("com.android.permissioncontroller.test.upgrade.deviceside",
- "com.android.permissioncontroller.test.upgrade.deviceside.DeviceSide", method)
- }
-} \ No newline at end of file
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/Android.bp b/PermissionController/tests/hostside/upgrade/test-apps/Android.bp
deleted file mode 100644
index 06e01fd77..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/Android.bp
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (C) 2020 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-android_test_helper_app {
- name: "PermissionUpgrade30HasCameraGranted",
- sdk_version: "30",
- manifest: "PermissionUpgrade30HasCameraGranted.xml"
-}
-
-android_test_helper_app {
- name: "PermissionUpgrade30HasCameraDenied",
- sdk_version: "30",
- manifest: "PermissionUpgrade30HasCameraDenied.xml"
-}
-
-android_test_helper_app {
- name: "PermissionUpgrade30HasCameraGrantedAndDeclaresBgCamera",
- sdk_version: "30",
- manifest: "PermissionUpgrade30HasCameraGrantedAndDeclaresBgCamera.xml"
-}
-
-android_test_helper_app {
- name: "PermissionUpgrade30HasCameraDeniedAndDeclaresBgCamera",
- sdk_version: "30",
- manifest: "PermissionUpgrade30HasCameraDeniedAndDeclaresBgCamera.xml"
-}
-
-android_test_helper_app {
- name: "PermissionUpgradeCurrentHasCameraGranted",
- manifest: "PermissionUpgradeCurrentHasCameraGranted.xml"
-}
-
-android_test_helper_app {
- name: "PermissionUpgradeCurrentHasCameraDenied",
- manifest: "PermissionUpgradeCurrentHasCameraDenied.xml"
-}
-
-android_test_helper_app {
- name: "PermissionUpgradeCurrentHasCameraGrantedAndDeclaresBgCamera",
- manifest: "PermissionUpgradeCurrentHasCameraGrantedAndDeclaresBgCamera.xml"
-}
-
-android_test_helper_app {
- name: "PermissionUpgradeCurrentHasCameraDeniedAndDeclaresBgCamera",
- manifest: "PermissionUpgradeCurrentHasCameraDeniedAndDeclaresBgCamera.xml"
-}
-
-android_test_helper_app {
- name: "PermissionUpgrade30Assistant",
- manifest: "PermissionUpgrade30Assistant.xml",
- sdk_version: "30",
-}
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/Android.bp b/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/Android.bp
deleted file mode 100644
index 53a68097d..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/Android.bp
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// Copyright (C) 2020 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-android_test_helper_app {
- name: "PermissionControllerUpgradeDeviceSideTests",
- sdk_version: "test_current",
- srcs: ["src/**/*.kt"],
- libs: [
- "android.test.base",
- ],
- static_libs: [
- "androidx.annotation_annotation",
- "junit",
- "junit-params",
- "androidx.test.ext.junit",
- "androidx.test.rules",
- "truth-prebuilt",
- ],
- test_suites: ["general-tests"],
- platform_apis: true,
-}
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/AndroidManifest.xml b/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/AndroidManifest.xml
deleted file mode 100644
index c44aeeecd..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/AndroidManifest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.permissioncontroller.test.upgrade.deviceside">
-
- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
-
- <instrumentation
- android:name="androidx.test.runner.AndroidJUnitRunner"
- android:targetPackage="com.android.permissioncontroller.test.upgrade.deviceside" />
-</manifest>
-
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/src/com/android/permissioncontroller/test/upgrade/deviceside/DeviceSide.kt b/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/src/com/android/permissioncontroller/test/upgrade/deviceside/DeviceSide.kt
deleted file mode 100644
index bd67e05db..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/src/com/android/permissioncontroller/test/upgrade/deviceside/DeviceSide.kt
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.permissioncontroller.test.upgrade.deviceside
-
-import android.Manifest.permission.BACKGROUND_CAMERA
-import android.Manifest.permission.CAMERA
-import android.Manifest.permission.RECORD_AUDIO
-import android.Manifest.permission.RECORD_BACKGROUND_AUDIO
-import android.app.UiAutomation
-import android.content.Context
-import android.content.pm.PackageManager
-import android.content.pm.PackageManager.FLAG_PERMISSION_APPLY_RESTRICTION
-import android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_INSTALLER_EXEMPT
-import android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_ROLE_EXEMPT
-import android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT
-import android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT
-import android.content.pm.PackageManager.GET_PERMISSIONS
-import android.content.pm.PackageManager.PERMISSION_DENIED
-import android.content.pm.PackageManager.PERMISSION_GRANTED
-import android.os.Process
-import android.os.UserHandle
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.platform.app.InstrumentationRegistry
-import com.google.common.truth.Truth.assertThat
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class DeviceSide {
- companion object {
- private const val PKG_30_CAMERA_GRANTED =
- "com.android.permission.test.upgrade.sdk_30.camera_granted"
- private const val PKG_30_CAMERA_DENIED =
- "com.android.permission.test.upgrade.sdk_30.camera_denied"
-
- private const val PKG_30_CAMERA_GRANTED_DECLARES_BG =
- "com.android.permission.test.upgrade.sdk_30.camera_granted_declares_bg"
- private const val PKG_30_CAMERA_DENIED_DECLARES_BG =
- "com.android.permission.test.upgrade.sdk_30.camera_denied_declares_bg"
-
- private const val PKG_CURRENT_CAMERA_GRANTED =
- "com.android.permission.test.upgrade.sdk_current.camera_granted"
- private const val PKG_CURRENT_CAMERA_DENIED =
- "com.android.permission.test.upgrade.sdk_current.camera_denied"
-
- private const val PKG_CURRENT_CAMERA_GRANTED_DECLARES_BG =
- "com.android.permission.test.upgrade.sdk_current.camera_granted_declares_bg"
- private const val PKG_CURRENT_CAMERA_DENIED_DECLARES_BG =
- "com.android.permission.test.upgrade.sdk_current.camera_denied_declares_bg"
-
- private const val PKG_30_ASSISTANT =
- "com.android.permission.test.upgrade.sdk_30.assistant"
-
- private const val ALL_PERMISSION_EXEMPT_FLAGS =
- FLAG_PERMISSION_RESTRICTION_INSTALLER_EXEMPT or
- FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT or
- FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT or
- FLAG_PERMISSION_RESTRICTION_ROLE_EXEMPT
- }
-
- lateinit var uiautomation: UiAutomation
- lateinit var context: Context
- lateinit var pm: PackageManager
- lateinit var user: UserHandle
-
- @Before
- fun init() {
- uiautomation = InstrumentationRegistry.getInstrumentation().uiAutomation
- context = InstrumentationRegistry.getInstrumentation().context
- pm = context.packageManager
- user = Process.myUserHandle()
- }
-
- /**
- * Assert all packages are installed
- */
- @Test
- fun verifyPackagesAreInstalled() {
- // Don't catch any NameNotFound exceptions
- pm.getPackageInfo(PKG_30_CAMERA_GRANTED, 0)
- pm.getPackageInfo(PKG_30_CAMERA_DENIED, 0)
-
- pm.getPackageInfo(PKG_30_CAMERA_GRANTED_DECLARES_BG, 0)
- pm.getPackageInfo(PKG_30_CAMERA_DENIED_DECLARES_BG, 0)
-
- pm.getPackageInfo(PKG_CURRENT_CAMERA_GRANTED, 0)
- pm.getPackageInfo(PKG_CURRENT_CAMERA_DENIED, 0)
-
- pm.getPackageInfo(PKG_CURRENT_CAMERA_GRANTED_DECLARES_BG, 0)
- pm.getPackageInfo(PKG_CURRENT_CAMERA_DENIED_DECLARES_BG, 0)
- }
-
- @Test
- fun testUpgrade1() {
- with(MultipleTestRunner()) {
- runTest("testFgCameraPermissionUnchanged_sdk30CameraGranted") {
- assertThat(pm.checkPermission(CAMERA, PKG_30_CAMERA_GRANTED))
- .isEqualTo(PERMISSION_GRANTED)
- }
- runTest("testFgCameraPermissionUnchanged_sdk30CameraDenied") {
- assertThat(pm.checkPermission(CAMERA, PKG_30_CAMERA_DENIED))
- .isEqualTo(PERMISSION_DENIED)
- }
- runTest("testFgCameraPermissionUnchanged_sdk30CameraGrantedDeclaresBg") {
- assertThat(pm.checkPermission(CAMERA, PKG_30_CAMERA_GRANTED_DECLARES_BG))
- .isEqualTo(PERMISSION_GRANTED)
- }
- runTest("testFgCameraPermissionUnchanged_sdk30CameraDeniedDeclaresBg") {
- assertThat(pm.checkPermission(CAMERA, PKG_30_CAMERA_DENIED_DECLARES_BG))
- .isEqualTo(PERMISSION_DENIED)
- }
- runTest("testFgCameraPermissionUnchanged_sdkCurrentCameraGranted") {
- assertThat(pm.checkPermission(CAMERA, PKG_CURRENT_CAMERA_GRANTED))
- .isEqualTo(PERMISSION_GRANTED)
- }
- runTest("testFgCameraPermissionUnchanged_sdkCurrentCameraDenied") {
- assertThat(pm.checkPermission(CAMERA, PKG_CURRENT_CAMERA_DENIED))
- .isEqualTo(PERMISSION_DENIED)
- }
- runTest("testFgCameraPermissionUnchanged_sdkCurrentCameraGrantedDeclaresBg") {
- assertThat(pm.checkPermission(CAMERA, PKG_CURRENT_CAMERA_GRANTED_DECLARES_BG))
- .isEqualTo(PERMISSION_GRANTED)
- }
- runTest("testFgCameraPermissionUnchanged_sdkCurrentCameraDeniedDeclaresBg") {
- assertThat(pm.checkPermission(CAMERA, PKG_CURRENT_CAMERA_DENIED_DECLARES_BG))
- .isEqualTo(PERMISSION_DENIED)
- }
-
- runTest("testPackagesRequestBgCamera_sdk30CameraGranted") {
- assertThat(pm.getPackageInfo(PKG_30_CAMERA_GRANTED, GET_PERMISSIONS)
- .requestedPermissions.contains(BACKGROUND_CAMERA)).isEqualTo(true)
- }
- runTest("testPackagesRequestBgCamera_sdk30CameraDenied") {
- assertThat(pm.getPackageInfo(PKG_30_CAMERA_DENIED, GET_PERMISSIONS)
- .requestedPermissions.contains(BACKGROUND_CAMERA)).isEqualTo(true)
- }
- runTest("testPackagesRequestBgCamera_sdk30CameraGrantedDeclaresBg") {
- assertThat(pm.getPackageInfo(PKG_30_CAMERA_GRANTED_DECLARES_BG, GET_PERMISSIONS)
- .requestedPermissions.contains(BACKGROUND_CAMERA)).isEqualTo(true)
- }
- runTest("testPackagesRequestBgCamera_sdk30CameraDeniedDeclaresBg") {
- assertThat(pm.getPackageInfo(PKG_30_CAMERA_DENIED_DECLARES_BG, GET_PERMISSIONS)
- .requestedPermissions.contains(BACKGROUND_CAMERA)).isEqualTo(true)
- }
- runTest("testPackagesRequestBgCamera_sdkCurrentCameraGranted") {
- assertThat(pm.getPackageInfo(PKG_CURRENT_CAMERA_GRANTED, GET_PERMISSIONS)
- .requestedPermissions.contains(BACKGROUND_CAMERA)).isEqualTo(false)
- }
- runTest("testPackagesRequestBgCamera_sdkCurrentCameraDenied") {
- assertThat(pm.getPackageInfo(PKG_CURRENT_CAMERA_DENIED, GET_PERMISSIONS)
- .requestedPermissions.contains(BACKGROUND_CAMERA)).isEqualTo(false)
- }
- runTest("testPackagesRequestBgCamera_sdkCurrentCameraGrantedDeclaresBg") {
- assertThat(pm.getPackageInfo(
- PKG_CURRENT_CAMERA_GRANTED_DECLARES_BG, GET_PERMISSIONS)
- .requestedPermissions.contains(BACKGROUND_CAMERA)).isEqualTo(true)
- }
- runTest("testPackagesRequestBgCamera_sdkCurrentCameraDeniedDeclaresBg") {
- assertThat(pm.getPackageInfo(PKG_CURRENT_CAMERA_DENIED_DECLARES_BG, GET_PERMISSIONS)
- .requestedPermissions.contains(BACKGROUND_CAMERA)).isEqualTo(true)
- }
-
- runTest("testBgCameraRestrictionApplied_sdk30CameraGranted") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_30_CAMERA_GRANTED, user) and
- FLAG_PERMISSION_APPLY_RESTRICTION).isNotEqualTo(0)
- }
- }
- runTest("testBgCameraRestrictionApplied_sdk30CameraDenied") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_30_CAMERA_DENIED, user) and
- FLAG_PERMISSION_APPLY_RESTRICTION).isNotEqualTo(0)
- }
- }
- runTest("testBgCameraRestrictionApplied_sdk30CameraGrantedDeclaresBg") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_30_CAMERA_GRANTED_DECLARES_BG, user) and
- FLAG_PERMISSION_APPLY_RESTRICTION).isNotEqualTo(0)
- }
- }
- runTest("testBgCameraRestrictionApplied_sdk30CameraDeniedDeclaresBg") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_30_CAMERA_DENIED_DECLARES_BG, user) and
- FLAG_PERMISSION_APPLY_RESTRICTION).isNotEqualTo(0)
- }
- }
- /* Removed 2 packages targeting CURRENT only declaring fg */
- runTest("testBgCameraRestrictionApplied_sdkCurrentCameraGrantedDeclaresBg") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_CURRENT_CAMERA_GRANTED_DECLARES_BG, user) and
- FLAG_PERMISSION_APPLY_RESTRICTION).isNotEqualTo(0)
- }
- }
- runTest("testBgCameraRestrictionApplied_sdkCurrentCameraDeniedDeclaresBg") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_CURRENT_CAMERA_DENIED_DECLARES_BG, user) and
- FLAG_PERMISSION_APPLY_RESTRICTION).isNotEqualTo(0)
- }
- }
-
- runTest("testBgCameraIsNotExempt_sdk30CameraGranted") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_30_CAMERA_GRANTED, user) and
- ALL_PERMISSION_EXEMPT_FLAGS).isEqualTo(0)
- }
- }
- runTest("testBgCameraIsNotExempt_sdk30CameraDenied") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_30_CAMERA_DENIED, user) and
- ALL_PERMISSION_EXEMPT_FLAGS).isEqualTo(0)
- }
- }
- runTest("testBgCameraIsNotExempt_sdk30CameraGrantedDeclaresBg") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_30_CAMERA_GRANTED_DECLARES_BG, user) and
- ALL_PERMISSION_EXEMPT_FLAGS).isEqualTo(0)
- }
- }
- runTest("testBgCameraIsNotExempt_sdk30CameraDeniedDeclaresBg") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_30_CAMERA_DENIED_DECLARES_BG, user) and
- ALL_PERMISSION_EXEMPT_FLAGS).isEqualTo(0)
- }
- }
- /* Removed 2 packages targeting CURRENT only declaring fg */
- runTest("testBgCameraIsNotExempt_sdkCurrentCameraGrantedDeclaresBg") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_CURRENT_CAMERA_GRANTED_DECLARES_BG, user) and
- ALL_PERMISSION_EXEMPT_FLAGS).isEqualTo(0)
- }
- }
- runTest("testBgCameraIsNotExempt_sdkCurrentCameraDeniedDeclaresBg") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(BACKGROUND_CAMERA,
- PKG_CURRENT_CAMERA_DENIED_DECLARES_BG, user) and
- ALL_PERMISSION_EXEMPT_FLAGS).isEqualTo(0)
- }
- }
-
- runTest("testGetsBgMicGranted_sdk30AssistantMicGranted") {
- assertThat(pm.checkPermission(RECORD_AUDIO, PKG_30_ASSISTANT))
- .isEqualTo(PERMISSION_GRANTED)
- assertThat(pm
- .checkPermission(RECORD_BACKGROUND_AUDIO, PKG_30_ASSISTANT))
- .isEqualTo(PERMISSION_GRANTED)
- }
- runTest("testBgMicRestrictionNotApplied_sdk30AssistantMicGranted") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(RECORD_BACKGROUND_AUDIO,
- PKG_30_ASSISTANT, user) and
- FLAG_PERMISSION_APPLY_RESTRICTION).isEqualTo(0)
- }
- }
- runTest("testBgMicIsExempt_sdk30AssistantMicGranted") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(RECORD_BACKGROUND_AUDIO,
- PKG_30_ASSISTANT, user) and
- ALL_PERMISSION_EXEMPT_FLAGS).isNotEqualTo(0)
- }
- }
-
- finish()
- }
- }
-
- @Test
- fun testUpgrade2() {
- with(MultipleTestRunner()) {
- runTest("testGetsBgMicGranted_sdk30AssistantMicDenied") {
- assertThat(pm.checkPermission(RECORD_AUDIO, PKG_30_ASSISTANT))
- .isEqualTo(PERMISSION_DENIED)
- assertThat(pm.checkPermission(RECORD_BACKGROUND_AUDIO, PKG_30_ASSISTANT))
- .isEqualTo(PERMISSION_DENIED)
- }
- runTest("testBgMicRestrictionNotApplied_sdk30AssistantMicDenied") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(RECORD_BACKGROUND_AUDIO,
- PKG_30_ASSISTANT, user) and
- FLAG_PERMISSION_APPLY_RESTRICTION).isEqualTo(0)
- }
- }
- runTest("testBgMicIsExempt_sdk30AssistantMicDenied") {
- runWithShellPermissionIdentity {
- assertThat(pm.getPermissionFlags(RECORD_BACKGROUND_AUDIO,
- PKG_30_ASSISTANT, user) and
- ALL_PERMISSION_EXEMPT_FLAGS).isNotEqualTo(0)
- }
- }
-
- finish()
- }
- }
-
- fun runWithShellPermissionIdentity(r: () -> Unit) {
- try {
- uiautomation.adoptShellPermissionIdentity()
- r()
- } finally {
- uiautomation.dropShellPermissionIdentity()
- }
- }
-}
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/src/com/android/permissioncontroller/test/upgrade/deviceside/MultipleTestRunner.kt b/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/src/com/android/permissioncontroller/test/upgrade/deviceside/MultipleTestRunner.kt
deleted file mode 100644
index fcf84d3ee..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/DeviceSide/src/com/android/permissioncontroller/test/upgrade/deviceside/MultipleTestRunner.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.permissioncontroller.test.upgrade.deviceside
-
-import java.io.PrintWriter
-import java.io.StringWriter
-
-class MultipleTestRunner {
-
- private val errors: MutableList<Pair<String, Throwable>> = ArrayList()
-
- fun runTest(tag: String = "", r: () -> Unit) {
- try {
- r.invoke()
- } catch (t: Throwable) {
- errors.add(tag to t)
- }
- }
-
- fun finish() {
- if (errors.isEmpty()) {
- return
- }
- val builder = StringBuilder("There were ${errors.size} failures.\n")
- for (i in errors.indices) {
- val stringWriter = StringWriter()
- errors[i].second.printStackTrace(PrintWriter(stringWriter))
- with(builder) {
- append(i + 1)
- append(". ")
- append(errors[i].first)
- append("\n")
- append(errors[i].second.javaClass.name)
- append("\n")
- append(stringWriter.toString())
- append("\n\n")
- }
- }
- errors.clear()
- throw AssertionError(builder.toString())
- }
-} \ No newline at end of file
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30Assistant.xml b/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30Assistant.xml
deleted file mode 100644
index 9afb6799a..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30Assistant.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2020 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.permission.test.upgrade.sdk_30.assistant">
-
- <uses-sdk android:minSdkVersion="30" android:targetSdkVersion="30" />
-
- <uses-permission android:name="android.permission.RECORD_AUDIO" />
-
-
- <application>
- <activity
- android:name=".AssistantActivity"
- android:exported="true">
- <intent-filter>
- <action android:name="android.intent.action.ASSIST" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraDenied.xml b/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraDenied.xml
deleted file mode 100644
index 4fa715a5d..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraDenied.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2020 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.permission.test.upgrade.sdk_30.camera_denied">
-
- <uses-sdk android:minSdkVersion="30" android:targetSdkVersion="30" />
-
- <uses-permission android:name="android.permission.CAMERA" />
-</manifest>
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraDeniedAndDeclaresBgCamera.xml b/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraDeniedAndDeclaresBgCamera.xml
deleted file mode 100644
index 69ec38114..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraDeniedAndDeclaresBgCamera.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2020 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.permission.test.upgrade.sdk_30.camera_denied_declares_bg">
-
- <uses-sdk android:minSdkVersion="30" android:targetSdkVersion="30" />
-
- <uses-permission android:name="android.permission.CAMERA" />
- <uses-permission android:name="android.permission.BACKGROUND_CAMERA" />
-</manifest>
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraGranted.xml b/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraGranted.xml
deleted file mode 100644
index 31baf334c..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraGranted.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2020 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.permission.test.upgrade.sdk_30.camera_granted">
-
- <uses-sdk android:minSdkVersion="30" android:targetSdkVersion="30" />
-
- <uses-permission android:name="android.permission.CAMERA" />
-</manifest>
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraGrantedAndDeclaresBgCamera.xml b/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraGrantedAndDeclaresBgCamera.xml
deleted file mode 100644
index e376e4f53..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgrade30HasCameraGrantedAndDeclaresBgCamera.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2020 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.permission.test.upgrade.sdk_30.camera_granted_declares_bg">
-
- <uses-sdk android:minSdkVersion="30" android:targetSdkVersion="30" />
-
- <uses-permission android:name="android.permission.CAMERA" />
- <uses-permission android:name="android.permission.BACKGROUND_CAMERA" />
-</manifest>
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraDenied.xml b/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraDenied.xml
deleted file mode 100644
index 38e6fdb2e..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraDenied.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2020 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.permission.test.upgrade.sdk_current.camera_denied">
-
- <uses-sdk android:minSdkVersion="30" />
-
- <uses-permission android:name="android.permission.CAMERA" />
-</manifest>
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraDeniedAndDeclaresBgCamera.xml b/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraDeniedAndDeclaresBgCamera.xml
deleted file mode 100644
index 0fc92a7e9..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraDeniedAndDeclaresBgCamera.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2020 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.permission.test.upgrade.sdk_current.camera_denied_declares_bg">
-
- <uses-sdk android:minSdkVersion="30" />
-
- <uses-permission android:name="android.permission.CAMERA" />
- <uses-permission android:name="android.permission.BACKGROUND_CAMERA" />
-</manifest>
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraGranted.xml b/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraGranted.xml
deleted file mode 100644
index 5debb333c..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraGranted.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2020 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.permission.test.upgrade.sdk_current.camera_granted">
-
- <uses-sdk android:minSdkVersion="30" />
-
- <uses-permission android:name="android.permission.CAMERA" />
-</manifest>
diff --git a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraGrantedAndDeclaresBgCamera.xml b/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraGrantedAndDeclaresBgCamera.xml
deleted file mode 100644
index 506bcc0ed..000000000
--- a/PermissionController/tests/hostside/upgrade/test-apps/PermissionUpgradeCurrentHasCameraGrantedAndDeclaresBgCamera.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2020 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.permission.test.upgrade.sdk_current.camera_granted_declares_bg">
-
- <uses-sdk android:minSdkVersion="30" />
-
- <uses-permission android:name="android.permission.CAMERA" />
- <uses-permission android:name="android.permission.BACKGROUND_CAMERA" />
-</manifest>