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

Commit 5e8e8ebc authored by ykhung's avatar ykhung Committed by YK Hung
Browse files

Add a static method on the ApplicationsState to enable app icon cache

This will be used by the EBS (Flipendo) process to enable the app icon cache mechanism to improve the resume latency without loading the icon from the PackageManager again

Bug: 232360114
Test: presubmit and local verification on the EBS page
Change-Id: I6694e3792f6be09620b102789b77816b0c40a4a3
parent 58af2f25
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -101,6 +101,9 @@ public class ApplicationsState {
    @VisibleForTesting
    static ApplicationsState sInstance;

    // Whether the app icon cache mechanism is enabled or not.
    private static boolean sAppIconCacheEnabled = false;

    public static ApplicationsState getInstance(Application app) {
        return getInstance(app, AppGlobals.getPackageManager());
    }
@@ -115,6 +118,11 @@ public class ApplicationsState {
        }
    }

    /** Set whether the app icon cache mechanism is enabled or not. */
    public static void setAppIconCacheEnabled(boolean enabled) {
        sAppIconCacheEnabled = enabled;
    }

    final Context mContext;
    final PackageManager mPm;
    final IPackageManager mIpm;
@@ -776,7 +784,8 @@ public class ApplicationsState {
    }

    private static boolean isAppIconCacheEnabled(Context context) {
        return SETTING_PKG.equals(context.getPackageName());
        return SETTING_PKG.equals(context.getPackageName())
                || sAppIconCacheEnabled;
    }

    void rebuildActiveSessions() {