Merge "Pause the prediction update until the app launch transition ends." into main
diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
index f012197..e680ea9 100644
--- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
+++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
@@ -72,6 +72,8 @@
private boolean mPredictionsEnabled = false;
+ private boolean mPredictionUiUpdatePaused = false;
+
public PredictionRowView(@NonNull Context context) {
this(context, null);
}
@@ -193,7 +195,18 @@
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 c3bcde0..5ececb5 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -367,11 +367,19 @@
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 @@
@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 =