From b3bf0276e4548819a968dfa34404ec96f28f8a13 Mon Sep 17 00:00:00 2001 From: Anushree Ganjam Date: Tue, 9 Jan 2024 16:51:08 -0800 Subject: [PATCH] Pause the prediction update until the app launch transition ends. b/319162661 issue is similar to hotseat updates on app click : b/148800229 and ag/10235572 So we will pause the prediction updates until the app launch transition is complete. See https://b.corp.google.com/issues/319162661#comment9 and https://b.corp.google.com/issues/319162661#comment10 for bug report analysis. Before fix: https://b.corp.google.com/issues/319162661#comment11 After fix: https://b.corp.google.com/issues/319162661#comment12 Bug: 319162661 Test: Manual Flag: NA Change-Id: I797ce982569c7950628368b854fb3b6766f0fc28 --- .../launcher3/appprediction/PredictionRowView.java | 13 +++++++++++++ .../launcher3/uioverrides/QuickstepLauncher.java | 12 ++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java index f0121970fd..e680ea90b6 100644 --- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -72,6 +72,8 @@ public class PredictionRowView private boolean mPredictionsEnabled = false; + private boolean mPredictionUiUpdatePaused = false; + public PredictionRowView(@NonNull Context context) { this(context, null); } @@ -193,7 +195,18 @@ public class PredictionRowView applyPredictionApps(); } + /** Pause the prediction row UI update */ + public void setPredictionUiUpdatePaused(boolean predictionUiUpdatePaused) { + mPredictionUiUpdatePaused = predictionUiUpdatePaused; + if (!mPredictionUiUpdatePaused) { + applyPredictionApps(); + } + } + private void applyPredictionApps() { + if (mPredictionUiUpdatePaused) { + return; + } if (getChildCount() != mNumPredictedAppsPerRow) { while (getChildCount() > mNumPredictedAppsPerRow) { removeViewAt(0); diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index c3bcde0e8a..5ececb5135 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -367,11 +367,19 @@ public class QuickstepLauncher extends Launcher { mHotseatPredictionController.setPauseUIUpdate(getTaskbarUIController() == null); Log.d("b/318394698", "startActivitySafely being run, getTaskbarUIController is: " + getTaskbarUIController()); + PredictionRowView predictionRowView = + getAppsView().getFloatingHeaderView().findFixedRowByType(PredictionRowView.class); + // Pause the prediction row updates until the transition (if it exists) ends. + predictionRowView.setPredictionUiUpdatePaused(true); RunnableList result = super.startActivitySafely(v, intent, item); if (result == null) { mHotseatPredictionController.setPauseUIUpdate(false); + predictionRowView.setPredictionUiUpdatePaused(false); } else { - result.add(() -> mHotseatPredictionController.setPauseUIUpdate(false)); + result.add(() -> { + mHotseatPredictionController.setPauseUIUpdate(false); + predictionRowView.setPredictionUiUpdatePaused(false); + }); } return result; } @@ -468,7 +476,7 @@ public class QuickstepLauncher extends Launcher { @Override public void bindExtraContainerItems(FixedContainerItems item) { - Log.d(TAG, "Bind extra container items"); + Log.d(TAG, "Bind extra container items. ContainerId = " + item.containerId); if (item.containerId == Favorites.CONTAINER_PREDICTION) { mAllAppsPredictions = item; PredictionRowView predictionRowView =