Revoke internal permissions upon definition change.

Similar to runtime permissions. This is a follow-up to ag/15615897 but
only on T+ for safety.

Test: manual
Change-Id: Ia32f01b9aeecd00d675235e0bfe6d9eaf1eea7eb
This commit is contained in:
Hai Zhang
2021-08-18 21:46:27 +00:00
parent 013946d3ce
commit 63a3938f85

View File

@@ -431,6 +431,8 @@ public final class Permission {
}
}
}
boolean wasNonInternal = permission != null && permission.mType != TYPE_CONFIG
&& !permission.isInternal();
boolean wasNonRuntime = permission != null && permission.mType != TYPE_CONFIG
&& !permission.isRuntime();
if (permission == null) {
@@ -476,10 +478,10 @@ public final class Permission {
r.append("DUP:");
r.append(permissionInfo.name);
}
if ((permission.isInternal() && ownerChanged)
if ((permission.isInternal() && (ownerChanged || wasNonInternal))
|| (permission.isRuntime() && (ownerChanged || wasNonRuntime))) {
// If this is an internal/runtime permission and the owner has changed, or this wasn't a
// runtime permission, then permission state should be cleaned up.
// internal/runtime permission, then permission state should be cleaned up.
permission.mDefinitionChanged = true;
}
if (PackageManagerService.DEBUG_PACKAGE_SCANNING && r != null) {