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

Commit 576c7ff4 authored by Fengjiang Li's avatar Fengjiang Li Committed by Android (Google) Code Review
Browse files

Merge "Don't preinflate all apps for taskbar in AllAppsStore#setApps" into main

parents 107a81fa e9255681
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -89,7 +89,8 @@ public final class TaskbarAllAppsController {
        mAppsModelFlags = flags;
        mPackageUserKeytoUidMap = map;
        if (mAppsView != null) {
            mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags, mPackageUserKeytoUidMap);
            mAppsView.getAppsStore().setApps(
                    mApps, mAppsModelFlags, mPackageUserKeytoUidMap, false);
        }
    }

@@ -190,7 +191,7 @@ public final class TaskbarAllAppsController {

        viewController.show(animate);
        mAppsView = mOverlayContext.getAppsView();
        mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags, mPackageUserKeytoUidMap);
        mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags, mPackageUserKeytoUidMap, false);
        mAppsView.getFloatingHeaderView()
                .findFixedRowByType(PredictionRowView.class)
                .setPredictedApps(mPredictedApps);
+14 −2
Original line number Diff line number Diff line
@@ -81,18 +81,30 @@ public class AllAppsStore<T extends Context & ActivityContext> {
        mContext = context;
    }

    /**
     * Calling {@link #setApps(AppInfo[], int, Map, boolean)} with shouldPreinflate set to
     * {@code true}. This method should be called in launcher (not for taskbar).
     */
    public void setApps(@Nullable AppInfo[] apps, int flags, Map<PackageUserKey, Integer> map) {
        setApps(apps, flags, map, /* shouldPreinflate= */ true);
    }

    /**
     * Sets the current set of apps and sets mapping for {@link PackageUserKey} to Uid for
     * the current set of apps.
     *
     * <p> Note that shouldPreinflate param should be set to {@code false} for taskbar, because this
     * method is too late to preinflate all apps, as user will open all apps in the same frame.
     */
    public void setApps(@Nullable AppInfo[] apps, int flags, Map<PackageUserKey, Integer> map)  {
    public void setApps(@Nullable AppInfo[] apps, int flags, Map<PackageUserKey, Integer> map,
            boolean shouldPreinflate)  {
        mApps = apps == null ? EMPTY_ARRAY : apps;
        mModelFlags = flags;
        notifyUpdate();
        mPackageUserKeytoUidMap = map;
        // Preinflate all apps RV when apps has changed, which can happen after unlocking screen,
        // rotating screen, or downloading/upgrading apps.
        if (ENABLE_ALL_APPS_RV_PREINFLATION.get()) {
        if (shouldPreinflate && ENABLE_ALL_APPS_RV_PREINFLATION.get()) {
            mAllAppsRecyclerViewPool.preInflateAllAppsViewHolders(mContext);
        }
    }