Revert "Fix performance issue from refreshing runtime permission state before write."

This reverts commit 6a2480d956.

Reason for revert: Surprisingly doing strictly less things resulted in another 1.6s regression.
Fixes: 172495516
Bug: 172297495

Change-Id: Ifa42403342ceecc6d3013b052ad0a345ed0b80ea
This commit is contained in:
Hai Zhang
2020-11-06 00:55:50 +00:00
parent 6a2480d956
commit 079eb1bc67

View File

@@ -19605,6 +19605,8 @@ public class PackageManagerService extends IPackageManager.Stub
if (installed) {
ps.setUninstallReason(UNINSTALL_REASON_UNKNOWN, userId);
}
writeRuntimePermissionsForUserLPrTEMP(userId, false);
}
// Regardless of writeSettings we need to ensure that this restriction
// state propagation is persisted
@@ -25749,9 +25751,8 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public void writePermissionSettings(int[] userIds, boolean async) {
synchronized (mLock) {
mPermissionManager.writeLegacyPermissionStateTEMP();
for (int userId : userIds) {
mSettings.writeRuntimePermissionsForUserLPr(userId, !async);
writeRuntimePermissionsForUserLPrTEMP(userId, !async);
}
}
}
@@ -26400,6 +26401,17 @@ public class PackageManagerService extends IPackageManager.Stub
mSettings.writeLPr();
}
/**
* Temporary method that wraps mSettings.writeRuntimePermissionsForUserLPr() and calls
* mPermissionManager.writeLegacyPermissionStateTEMP() beforehand.
*
* TODO(zhanghai): This should be removed once we finish migration of permission storage.
*/
private void writeRuntimePermissionsForUserLPrTEMP(@UserIdInt int userId, boolean async) {
mPermissionManager.writeLegacyPermissionStateTEMP();
mSettings.writeRuntimePermissionsForUserLPr(userId, async);
}
@Override
public IBinder getHoldLockToken() {
if (!Build.IS_DEBUGGABLE) {