Merge changes I0c69b6a2,I286015aa

* changes:
  Refresh legacy permission state right before writing.
  Revert "Refresh legacy state before writing to runtime permission persistence."
This commit is contained in:
Hai Zhang
2020-11-10 21:27:22 +00:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 13 deletions

View File

@@ -19606,7 +19606,7 @@ public class PackageManagerService extends IPackageManager.Stub
ps.setUninstallReason(UNINSTALL_REASON_UNKNOWN, userId);
}
writeRuntimePermissionsForUserLPrTEMP(userId, false);
mSettings.writeRuntimePermissionsForUserLPr(userId, false);
}
// Regardless of writeSettings we need to ensure that this restriction
// state propagation is persisted
@@ -25752,7 +25752,7 @@ public class PackageManagerService extends IPackageManager.Stub
public void writePermissionSettings(int[] userIds, boolean async) {
synchronized (mLock) {
for (int userId : userIds) {
writeRuntimePermissionsForUserLPrTEMP(userId, !async);
mSettings.writeRuntimePermissionsForUserLPr(userId, !async);
}
}
}
@@ -26401,17 +26401,6 @@ 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) {

View File

@@ -5390,6 +5390,8 @@ public final class Settings {
mHandler.removeMessages(userId);
mWriteScheduled.delete(userId);
mPermissionDataProvider.writeLegacyPermissionStateTEMP();
int version = mVersions.get(userId, INITIAL_VERSION);
String fingerprint = mFingerprints.get(userId);

View File

@@ -61,4 +61,14 @@ public interface LegacyPermissionDataProvider {
*/
@NonNull
int[] getGidsForUid(int uid);
/**
* This method should be in PermissionManagerServiceInternal, however it is made available here
* as well to avoid serious performance regression in writePermissionSettings(), which seems to
* be a hot spot and we should delay calling this method until wre are actually writing the
* file, instead of every time an async write is requested.
*
* @see PermissionManagerServiceInternal#writeLegacyPermissionStateTEMP()
*/
void writeLegacyPermissionStateTEMP();
}