Merge "Revoke internal permissions upon definition change."

This commit is contained in:
TreeHugger Robot
2021-12-03 05:52:51 +00:00
committed by Android (Google) Code Review

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) {