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

Commit a101ac69 authored by fbaron's avatar fbaron
Browse files

Ensure PauseUIUpdate always ends up getting set to false

when result was null but getTaskbarUIController() is not null, we don't setPauseUIUpdate to false. This CL ensure we always end up setting pauseUIUpdate to false so that the hotseat suggested apps show up.

Fix: 295892343
Flag: no flag
Test: verify hotseat icons don't disappear
Change-Id: Id872f3174df276cb7a4ed7f6672523d0851a11dd
parent 90e2a4d2
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.launcher3.hybridhotseat.HotseatEduController.getSettin
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOTSEAT_PREDICTION_PINNED;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOTSEAT_RANKED;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.FlagDebugUtils.appendFlag;

import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -61,9 +62,11 @@ import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.OnboardingPrefs;
import com.android.launcher3.views.Snackbar;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringJoiner;
import java.util.function.Predicate;
import java.util.stream.Collectors;

@@ -185,7 +188,7 @@ public class HotseatPredictionController implements DragController.DragListener,
    }

    private void fillGapsWithPrediction(boolean animate) {
        Log.d(TAG, "fillGapsWithPrediction");
        Log.d(TAG, "fillGapsWithPrediction flags: " + getStateString(mPauseFlags));
        if (mPauseFlags != 0) {
            return;
        }
@@ -291,6 +294,7 @@ public class HotseatPredictionController implements DragController.DragListener,
     * start and pauses predicted apps update on the hotseat
     */
    public void setPauseUIUpdate(boolean paused) {
        Log.d(TAG, "setPauseUIUpdate parameter `paused` is " + paused);
        mPauseFlags = paused
                ? (mPauseFlags | FLAG_UPDATE_PAUSED)
                : (mPauseFlags & ~FLAG_UPDATE_PAUSED);
@@ -515,4 +519,21 @@ public class HotseatPredictionController implements DragController.DragListener,
                && ((WorkspaceItemInfo) view.getTag()).container
                == LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
    }

    private static String getStateString(int flags) {
        StringJoiner str = new StringJoiner("|");
        appendFlag(str, flags, FLAG_UPDATE_PAUSED, "FLAG_UPDATE_PAUSED");
        appendFlag(str, flags, FLAG_DRAG_IN_PROGRESS, "FLAG_DRAG_IN_PROGRESS");
        appendFlag(str, flags, FLAG_FILL_IN_PROGRESS, "FLAG_FILL_IN_PROGRESS");
        appendFlag(str, flags, FLAG_REMOVING_PREDICTED_ICON,
                "FLAG_REMOVING_PREDICTED_ICON");
        return str.toString();
    }

    public void dump(String prefix, PrintWriter writer) {
        writer.println(prefix + this.getClass().getSimpleName());
        writer.println(prefix + "\tFlags: " + getStateString(mPauseFlags));
        writer.println(prefix + "\tmHotSeatItemsCount: " + mHotSeatItemsCount);
        writer.println(prefix + "\tmPredictedItems: " + mPredictedItems);
    }
}
+4 −3
Original line number Diff line number Diff line
@@ -342,9 +342,7 @@ public class QuickstepLauncher extends Launcher {
        mHotseatPredictionController.setPauseUIUpdate(getTaskbarUIController() == null);
        RunnableList result = super.startActivitySafely(v, intent, item);
        if (result == null) {
            if (getTaskbarUIController() == null) {
            mHotseatPredictionController.setPauseUIUpdate(false);
            }
        } else {
            result.add(() -> mHotseatPredictionController.setPauseUIUpdate(false));
        }
@@ -1303,5 +1301,8 @@ public class QuickstepLauncher extends Launcher {
        if (mAppTransitionManager != null) {
            mAppTransitionManager.dump(prefix + "\t" + RING_APPEAR_ANIMATION_PREFIX, writer);
        }
        if (mHotseatPredictionController != null) {
            mHotseatPredictionController.dump(prefix, writer);
        }
    }
}