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

Commit f73a41c1 authored by Daniel Colascione's avatar Daniel Colascione
Browse files

RESTRICT AUTOMERGE: Cork package information cache invalidations during boot

Bug: 140788621
Bug: 150331002
Test: enable DEBUG; watch log
Change-Id: Ife4f8c4e7d10524d6000399947a4e4b9d36db750
parent 264abaff
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -8132,4 +8132,19 @@ public abstract class PackageManager {
        sPackageInfoCache.disableLocal();
    }

    /**
     * Inhibit package info cache invalidations when correct.
     *
     * @hide */
    public static void corkPackageInfoCache() {
        PropertyInvalidatedCache.corkInvalidations(PermissionManager.CACHE_KEY_PACKAGE_INFO);
    }

    /**
     * Enable package info cache invalidations.
     *
     * @hide */
    public static void uncorkPackageInfoCache() {
        PropertyInvalidatedCache.uncorkInvalidations(PermissionManager.CACHE_KEY_PACKAGE_INFO);
    }
}
+8 −1
Original line number Diff line number Diff line
@@ -2810,10 +2810,14 @@ public class PackageManagerService extends IPackageManager.Stub
    }
    public PackageManagerService(Injector injector, boolean onlyCore, boolean factoryTest) {
        PackageManager.invalidatePackageInfoCache();
        PackageManager.disableApplicationInfoCache();
        PackageManager.disablePackageInfoCache();
        // Avoid invalidation-thrashing by preventing cache invalidations from causing property
        // writes if the cache isn't enabled yet.  We re-enable writes later when we're
        // done initializing.
        PackageManager.corkPackageInfoCache();
        final TimingsTraceAndSlog t = new TimingsTraceAndSlog(TAG + "Timing",
                Trace.TRACE_TAG_PACKAGE_MANAGER);
        mPendingBroadcasts = new PendingPackageBroadcasts();
@@ -3614,6 +3618,9 @@ public class PackageManagerService extends IPackageManager.Stub
        mModuleInfoProvider = new ModuleInfoProvider(mContext, this);
        // Uncork cache invalidations and allow clients to cache package information.
        PackageManager.uncorkPackageInfoCache();
        // Now after opening every single application zip, make sure they
        // are all flushed.  Not really needed, but keeps things nice and
        // tidy.