Skip to content

Commit ea4bfb8

Browse files
kjackalInVictusXV
authored andcommitted
[RESTRICT AUTOMERGE] Fix the inconsistency of protection level
The value may be inconsistent between BasePermission.perm.protection- Level and BasePermission.getProtectionLevel() within the same object. Update the perm to fix the inconsistency. Bug: 209607944 Test: manually using the PoC on the buganizer to ensure the symptom no longer exists. Change-Id: I19d6135f98bee9392d85e56478c42e06cfea8ba5 (cherry picked from commit b5efdf7) Merged-In:I19d6135f98bee9392d85e56478c42e06cfea8ba5
1 parent f4e5884 commit ea4bfb8

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

services/core/java/com/android/server/pm/permission/BasePermission.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ static BasePermission createOrUpdate(PackageManagerInternal packageManagerIntern
409409
}
410410
if (bp.perm != null && Objects.equals(bp.perm.getPackageName(), p.getPackageName())
411411
&& Objects.equals(bp.perm.getName(), p.getName())) {
412+
bp.perm.setFlags(bp.perm.getFlags() & ~PermissionInfo.FLAG_INSTALLED);
413+
bp.perm = p.setFlags(p.getFlags() | PermissionInfo.FLAG_INSTALLED);
412414
bp.protectionLevel = p.getProtectionLevel();
413415
}
414416
if (bp.isRuntime() && (ownerChanged || wasNonRuntime)) {

0 commit comments

Comments
 (0)