Prevent some key system applications from losing storage permissions

The storage permissions of some system applications have been authorized by default and cannot be modified by users with SYSTEM_FIXED or POLICY_FIXED flags. Once revoked due to an self-upgrade package, the user cannot re-grant.

Bug: 292732635
Test: manual
Change-Id: Ifb2480fa05c281dcdf9129b453f168ed68ebfc5d
This commit is contained in:
张倞诚
2023-07-24 13:38:26 +00:00
parent e7627bd732
commit e7b8f467c0

View File

@@ -2116,6 +2116,12 @@ public class PermissionManagerServiceImpl implements PermissionManagerServiceInt
if (!isStorageOrMedia) {
continue;
}
boolean isSystemOrPolicyFixed = (getPermissionFlags(newPackage.getPackageName(),
permInfo.name, userId) & (FLAG_PERMISSION_SYSTEM_FIXED
| FLAG_PERMISSION_POLICY_FIXED)) != 0;
if (isSystemOrPolicyFixed) {
continue;
}
EventLog.writeEvent(0x534e4554, "171430330", newPackage.getUid(),
"Revoking permission " + permInfo.name + " from package "