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

Commit a63d57ab authored by Todd Kennedy's avatar Todd Kennedy
Browse files

Load fallback categories earlier

At the end of the package manager constructor, we are prepare the data
directories for all installed applications. This creates ApplicationInfo
objects which needs to load categories from the fallback categories provider.
If we're populating the fallback categories during this time, there's a
subtle timing issue where we may return a 'null' category instead of an
Integer.

Change-Id: I974a39029d6c15d3986571e610eb0cd106fdc05c
Fixes: 78128442
Test: Manual. System boots and no crash
parent bdaf85eb
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -2499,6 +2499,10 @@ public class PackageManagerService extends IPackageManager.Stub
            SELinuxMMAC.readInstallPolicy();
            SELinuxMMAC.readInstallPolicy();
            Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "loadFallbacks");
            FallbackCategoryProvider.loadFallbacks();
            Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
            Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "read user settings");
            Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "read user settings");
            mFirstBoot = !mSettings.readLPw(sUserManager.getUsers(false));
            mFirstBoot = !mSettings.readLPw(sUserManager.getUsers(false));
            Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
            Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
@@ -3239,10 +3243,6 @@ public class PackageManagerService extends IPackageManager.Stub
        Runtime.getRuntime().gc();
        Runtime.getRuntime().gc();
        Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
        Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
        Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "loadFallbacks");
        FallbackCategoryProvider.loadFallbacks();
        Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
        // The initial scanning above does many calls into installd while
        // The initial scanning above does many calls into installd while
        // holding the mPackages lock, but we're mostly interested in yelling
        // holding the mPackages lock, but we're mostly interested in yelling
        // once we have a booted system.
        // once we have a booted system.