Read permission state before scanning packages.
The readLegacyPermissionStateTEMP() call was originally introduced right before the old updateAllPermissions() call in ag/12329540 probably because we wanted to make sure packages have been properly scanned and reconciled before permission code tries to read permission state in combination with the existing package settings. But in the case of OTA removing a system app, it is possible for the permission state to change during the package reconciliation so the permission state should indeed be read earlier. It should actually be fine to read the permission state earlier as well because in Settings.RuntimePermissionPersistence.readStateForUserSyncLPr() (part of Settings.readLPw()), we are also consulting the not-yet-reconciled package settings and that has been fine for a long time. Fixes: 196177583 Test: presubmit Change-Id: I01dae1da934f927ca87b62773b6673a9b3aefb8a
This commit is contained in:
@@ -7220,6 +7220,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
t.traceEnd();
|
||||
|
||||
mPermissionManager.readLegacyPermissionsTEMP(mSettings.mPermissions);
|
||||
mPermissionManager.readLegacyPermissionStateTEMP();
|
||||
|
||||
if (!mOnlyCore && mFirstBoot) {
|
||||
requestCopyPreoptedFiles(mInjector);
|
||||
@@ -7635,7 +7636,6 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
+ ((SystemClock.uptimeMillis()-startTime)/1000f)
|
||||
+ " seconds");
|
||||
|
||||
mPermissionManager.readLegacyPermissionStateTEMP();
|
||||
// If the build fingerprint has changed since the last time we booted,
|
||||
// we need to re-grant app permission to catch any new ones that
|
||||
// appear. This is really a hack, and means that apps can in some
|
||||
|
||||
Reference in New Issue
Block a user