Merge "Reset virtual device permissions" into main
diff --git a/services/permission/java/com/android/server/permission/access/permission/DevicePermissionPolicy.kt b/services/permission/java/com/android/server/permission/access/permission/DevicePermissionPolicy.kt
index 240585c..4addab3 100644
--- a/services/permission/java/com/android/server/permission/access/permission/DevicePermissionPolicy.kt
+++ b/services/permission/java/com/android/server/permission/access/permission/DevicePermissionPolicy.kt
@@ -85,10 +85,10 @@
appId: Int,
userId: Int
) {
- resetPermissionStates(packageName, userId)
+ resetRuntimePermissions(packageName, userId)
}
- private fun MutateStateScope.resetPermissionStates(packageName: String, userId: Int) {
+ fun MutateStateScope.resetRuntimePermissions(packageName: String, userId: Int) {
// It's okay to skip resetting permissions for packages that are removed,
// because their states will be trimmed in onPackageRemoved()/onAppIdRemoved()
val packageState = newState.externalState.packageStates[packageName] ?: return
diff --git a/services/permission/java/com/android/server/permission/access/permission/PermissionService.kt b/services/permission/java/com/android/server/permission/access/permission/PermissionService.kt
index bb24d51..2a29265 100644
--- a/services/permission/java/com/android/server/permission/access/permission/PermissionService.kt
+++ b/services/permission/java/com/android/server/permission/access/permission/PermissionService.kt
@@ -1738,6 +1738,9 @@
with(policy) {
resetRuntimePermissions(androidPackage.packageName, userId)
}
+ with(devicePolicy) {
+ resetRuntimePermissions(androidPackage.packageName, userId)
+ }
}
}
@@ -1748,6 +1751,9 @@
with(policy) {
resetRuntimePermissions(packageState.packageName, userId)
}
+ with(devicePolicy) {
+ resetRuntimePermissions(packageState.packageName, userId)
+ }
}
}
}