From eec3d0982879a1c276da45f7a087b91ec7ed2c03 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Wed, 27 May 2020 12:31:55 -0700 Subject: [PATCH] Avoid unnecessary predictor recreations. Bug: 156778758 Test: Manual Change-Id: I1bb53273c1976f700596b5ec34697ed4e1788e55 --- .../hybridhotseat/HotseatPredictionController.java | 7 +++++-- .../android/launcher3/uioverrides/QuickstepLauncher.java | 9 +-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java index 1fe364386e..e2acf9358d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java @@ -15,6 +15,7 @@ */ package com.android.launcher3.hybridhotseat; +import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_GRID; import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import android.animation.Animator; @@ -571,8 +572,10 @@ public class HotseatPredictionController implements DragController.DragListener, @Override public void onIdpChanged(int changeFlags, InvariantDeviceProfile profile) { - this.mHotSeatItemsCount = profile.numHotseatIcons; - createPredictor(); + if ((changeFlags & CHANGE_FLAG_GRID) != 0) { + this.mHotSeatItemsCount = profile.numHotseatIcons; + createPredictor(); + } } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 95087bafdd..9ae6080830 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -94,6 +94,7 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { super.onCreate(savedInstanceState); if (FeatureFlags.ENABLE_HYBRID_HOTSEAT.get()) { mHotseatPredictionController = new HotseatPredictionController(this); + mHotseatPredictionController.createPredictor(); } } @@ -176,14 +177,6 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { } } - @Override - public void finishBindingItems(int pageBoundFirst) { - super.finishBindingItems(pageBoundFirst); - if (mHotseatPredictionController != null) { - mHotseatPredictionController.createPredictor(); - } - } - @Override public void bindPredictedItems(List appInfos, IntArray ranks) { super.bindPredictedItems(appInfos, ranks);