From a101ac696fef5a066f2ed8e1f126bc42eef86a43 Mon Sep 17 00:00:00 2001 From: fbaron Date: Wed, 13 Sep 2023 15:19:53 -0700 Subject: [PATCH] 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 --- .../HotseatPredictionController.java | 23 ++++++++++++++++++- .../uioverrides/QuickstepLauncher.java | 7 +++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java index 87a9ecb9f1..a63f9e8b29 100644 --- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java +++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java @@ -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); + } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 24bc58fb35..4a14ccf704 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -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); - } + 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); + } } }