Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 040073ee authored by Tim Murray's avatar Tim Murray
Browse files

PackageManagerService: regenerate snapshot before writing settings

Writing settings holds the PM lock for a potentially long time while doing IO. If the snapshot has already been invalidated and is pending recreation, then any reader of a snapshot has to wait for that IO to finish. Regenerate the snapshot whenever necessary before writing settings.

Test: boot trace + reduced PM contention
Bug: 270746433
Change-Id: I3ad2dead54a0ac79baecad53b13c0394028bf612
parent bb93fbd5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7218,6 +7218,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
     * TODO(b/182523293): This should be removed once we finish migration of permission storage.
     */
    void writeSettingsLPrTEMP(boolean sync) {
        snapshotComputer(false);
        mPermissionManager.writeLegacyPermissionsTEMP(mSettings.mPermissions);
        mSettings.writeLPr(mLiveComputer, sync);
    }