Merge "Fix HOME/RECENTS/BACK duplicated, missing logging" into ub-launcher3-qt-dev
diff --git a/go/quickstep/src/com/android/quickstep/GoActivityControlHelper.java b/go/quickstep/src/com/android/quickstep/GoActivityControlHelper.java
index 2db8b39..274a347 100644
--- a/go/quickstep/src/com/android/quickstep/GoActivityControlHelper.java
+++ b/go/quickstep/src/com/android/quickstep/GoActivityControlHelper.java
@@ -61,4 +61,9 @@
         // Go does not support live tiles.
         return false;
     }
+
+    @Override
+    public void onLaunchTaskFailed(T activity) {
+        // Go does not support gestures from one task to another.
+    }
 }
diff --git a/quickstep/recents_ui_overrides/res/layout/proactive_hints_container.xml b/quickstep/recents_ui_overrides/res/layout/proactive_hints_container.xml
deleted file mode 100644
index be3f17a..0000000
--- a/quickstep/recents_ui_overrides/res/layout/proactive_hints_container.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<com.android.quickstep.hints.ProactiveHintsContainer
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_gravity="center_horizontal|bottom"
-    android:gravity="center_horizontal">
-</com.android.quickstep.hints.ProactiveHintsContainer>
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
index f1d6450..1c66968 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
@@ -64,10 +64,12 @@
     public ScaleAndTranslation getOverviewScaleAndTranslation(Launcher launcher) {
         // Initialize the recents view scale to what it would be when starting swipe up
         RecentsView recentsView = launcher.getOverviewPanel();
-        if (recentsView.getTaskViewCount() == 0) {
+        int taskCount = recentsView.getTaskViewCount();
+        if (taskCount == 0) {
             return super.getOverviewScaleAndTranslation(launcher);
         }
-        TaskView dummyTask = recentsView.getTaskViewAt(recentsView.getCurrentPage());
+        TaskView dummyTask = recentsView.getTaskViewAt(Math.max(taskCount - 1,
+                recentsView.getCurrentPage()));
         return recentsView.getTempClipAnimationHelper().updateForFullscreenOverview(dummyTask)
                 .getScaleAndTranslation();
     }
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
index ed511f5..cdc271f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
@@ -15,6 +15,9 @@
  */
 package com.android.launcher3.uioverrides.states;
 
+import android.os.Handler;
+import android.os.Looper;
+
 import com.android.launcher3.Launcher;
 import com.android.launcher3.userevent.nano.LauncherLogProto;
 import com.android.quickstep.views.RecentsView;
@@ -27,6 +30,8 @@
  */
 public class QuickSwitchState extends BackgroundAppState {
 
+    private static final String TAG = "QuickSwitchState";
+
     public QuickSwitchState(int id) {
         super(id, LauncherLogProto.ContainerType.APP);
     }
@@ -48,7 +53,12 @@
     public void onStateTransitionEnd(Launcher launcher) {
         TaskView tasktolaunch = launcher.<RecentsView>getOverviewPanel().getTaskViewAt(0);
         if (tasktolaunch != null) {
-            tasktolaunch.launchTask(false);
+            tasktolaunch.launchTask(false, success -> {
+                if (!success) {
+                    launcher.getStateManager().goToState(OVERVIEW);
+                    tasktolaunch.notifyTaskLaunchFailed(TAG);
+                }
+            }, new Handler(Looper.getMainLooper()));
         } else {
             launcher.getStateManager().goToState(NORMAL);
         }
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
index 2c42fd6..4ae6d87 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
@@ -224,4 +224,10 @@
     public boolean isInLiveTileMode() {
         return false;
     }
+
+    @Override
+    public void onLaunchTaskFailed(RecentsActivity activity) {
+        // TODO: probably go back to overview instead.
+        activity.<RecentsView>getOverviewPanel().startHome();
+    }
 }
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
index 7809e45..0d06c19 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -30,9 +30,6 @@
 import static com.android.launcher3.anim.Interpolators.LINEAR;
 import static com.android.quickstep.WindowTransformSwipeHandler.RECENTS_ATTACH_DURATION;
 
-import static androidx.dynamicanimation.animation.SpringForce.DAMPING_RATIO_LOW_BOUNCY;
-import static androidx.dynamicanimation.animation.SpringForce.STIFFNESS_LOW;
-
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
 import android.animation.AnimatorSet;
@@ -64,7 +61,6 @@
 import com.android.launcher3.anim.AnimatorPlaybackController;
 import com.android.launcher3.anim.AnimatorSetBuilder;
 import com.android.launcher3.anim.SpringObjectAnimator;
-import com.android.launcher3.compat.AccessibilityManagerCompat;
 import com.android.launcher3.testing.TestProtocol;
 import com.android.launcher3.userevent.nano.LauncherLogProto;
 import com.android.launcher3.views.FloatingIconView;
@@ -219,8 +215,6 @@
         // Optimization, hide the all apps view to prevent layout while initializing
         activity.getAppsView().getContentView().setVisibility(View.GONE);
 
-        AccessibilityManagerCompat.sendStateEventToTest(activity, fromState.ordinal);
-
         return new AnimationFactory() {
             private Animator mShelfAnim;
             private ShelfAnimState mShelfState;
@@ -321,8 +315,8 @@
                     if (mAttachToWindowTranslationXAnim == null) {
                         mAttachToWindowTranslationXAnim = new SpringAnimation(recentsView,
                                 SpringAnimation.TRANSLATION_X).setSpring(new SpringForce()
-                                .setDampingRatio(DAMPING_RATIO_LOW_BOUNCY)
-                                .setStiffness(STIFFNESS_LOW));
+                                .setDampingRatio(0.8f)
+                                .setStiffness(250));
                     }
                     if (!recentsView.isShown() && animate) {
                         recentsView.setTranslationX(fromTranslationX);
@@ -512,4 +506,9 @@
         return launcher != null && launcher.getStateManager().getState() == OVERVIEW &&
                 launcher.isStarted();
     }
+
+    @Override
+    public void onLaunchTaskFailed(Launcher launcher) {
+        launcher.getStateManager().goToState(OVERVIEW);
+    }
 }
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java
index 5a039cd..6689ce3 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java
@@ -15,8 +15,11 @@
  */
 package com.android.quickstep;
 
+import static com.android.quickstep.TouchInteractionService.MAIN_THREAD_EXECUTOR;
+
 import android.util.Log;
 
+import com.android.launcher3.Utilities;
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.util.Preconditions;
 import com.android.quickstep.util.RecentsAnimationListenerSet;
@@ -29,7 +32,7 @@
  */
 public class SwipeSharedState implements SwipeAnimationListener {
 
-    private final OverviewComponentObserver mOverviewComponentObserver;
+    private OverviewComponentObserver mOverviewComponentObserver;
 
     private RecentsAnimationListenerSet mRecentsAnimationListener;
     private SwipeAnimationTargetSet mLastAnimationTarget;
@@ -42,8 +45,8 @@
     public boolean recentsAnimationFinishInterrupted;
     public int nextRunningTaskId = -1;
 
-    public SwipeSharedState(OverviewComponentObserver overviewComponentObserver) {
-        mOverviewComponentObserver = overviewComponentObserver;
+    public void setOverviewComponentObserver(OverviewComponentObserver observer) {
+        mOverviewComponentObserver = observer;
     }
 
     @Override
@@ -72,6 +75,12 @@
     private void clearListenerState() {
         if (mRecentsAnimationListener != null) {
             mRecentsAnimationListener.removeListener(this);
+            mRecentsAnimationListener.cancelListener();
+            if (mLastAnimationRunning && mLastAnimationTarget != null) {
+                Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(),
+                        mLastAnimationTarget::cancelAnimation);
+                mLastAnimationTarget = null;
+            }
         }
         mRecentsAnimationListener = null;
         clearAnimationTarget();
@@ -98,9 +107,10 @@
         }
 
         clearListenerState();
-        mRecentsAnimationListener = new RecentsAnimationListenerSet(mOverviewComponentObserver
-                .getActivityControlHelper().shouldMinimizeSplitScreen(),
-                this::onSwipeAnimationFinished);
+        boolean shouldMinimiseSplitScreen = mOverviewComponentObserver == null ? false
+                : mOverviewComponentObserver.getActivityControlHelper().shouldMinimizeSplitScreen();
+        mRecentsAnimationListener = new RecentsAnimationListenerSet(
+                shouldMinimiseSplitScreen, this::onSwipeAnimationFinished);
         mRecentsAnimationListener.addListener(this);
         return mRecentsAnimationListener;
     }
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
index 5104fb8..b90f6c2 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
@@ -24,6 +24,7 @@
 import com.android.launcher3.R;
 import com.android.launcher3.util.MainThreadInitializedObject;
 import com.android.launcher3.util.ResourceBasedOverride;
+import com.android.quickstep.views.TaskThumbnailView;
 import com.android.quickstep.views.TaskView;
 import com.android.systemui.shared.recents.model.Task;
 import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -62,7 +63,7 @@
         return shortcuts;
     }
 
-    public TaskOverlay createOverlay(View thumbnailView) {
+    public TaskOverlay createOverlay(TaskThumbnailView thumbnailView) {
         return new TaskOverlay();
     }
 
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 4a40c64..769d207 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -17,7 +17,12 @@
 
 import static android.view.MotionEvent.ACTION_DOWN;
 
+import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
+import static com.android.launcher3.config.FeatureFlags.APPLY_CONFIG_AT_RUNTIME;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_HINTS_IN_OVERVIEW;
 import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
+import static com.android.launcher3.config.FeatureFlags.FAKE_LANDSCAPE_UI;
+import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
 import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_INPUT_MONITOR;
 import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE;
@@ -32,7 +37,6 @@
 import android.annotation.TargetApi;
 import android.app.ActivityManager;
 import android.app.ActivityManager.RunningTaskInfo;
-import android.app.KeyguardManager;
 import android.app.Service;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
@@ -81,6 +85,7 @@
 import com.android.quickstep.inputconsumers.OtherActivityInputConsumer;
 import com.android.quickstep.inputconsumers.OverviewInputConsumer;
 import com.android.quickstep.inputconsumers.OverviewWithoutFocusInputConsumer;
+import com.android.quickstep.inputconsumers.ResetGestureInputConsumer;
 import com.android.quickstep.inputconsumers.ScreenPinnedInputConsumer;
 import com.android.systemui.shared.recents.IOverviewProxy;
 import com.android.systemui.shared.recents.ISystemUiProxy;
@@ -224,7 +229,10 @@
         return sConnected;
     }
 
-    private KeyguardManager mKM;
+    private final SwipeSharedState mSwipeSharedState = new SwipeSharedState();
+    private final InputConsumer mResetGestureInputConsumer =
+            new ResetGestureInputConsumer(mSwipeSharedState);
+
     private ActivityManagerWrapper mAM;
     private RecentsModel mRecentsModel;
     private ISystemUiProxy mISystemUiProxy;
@@ -234,7 +242,6 @@
     private OverviewCallbacks mOverviewCallbacks;
     private TaskOverlayFactory mTaskOverlayFactory;
     private InputConsumerController mInputConsumer;
-    private SwipeSharedState mSwipeSharedState;
     private boolean mAssistantAvailable;
     private float mLastAssistantVisibility = 0;
     private @SystemUiStateFlags int mSystemUiStateFlags;
@@ -271,8 +278,8 @@
 
         // Initialize anything here that is needed in direct boot mode.
         // Everything else should be initialized in initWhenUserUnlocked() below.
-        mKM = getSystemService(KeyguardManager.class);
         mMainChoreographer = Choreographer.getInstance();
+        mAM = ActivityManagerWrapper.getInstance();
 
         if (UserManagerCompat.getInstance(this).isUserUnlocked(Process.myUserHandle())) {
             initWhenUserUnlocked();
@@ -399,7 +406,6 @@
     }
 
     private void initWhenUserUnlocked() {
-        mAM = ActivityManagerWrapper.getInstance();
         mRecentsModel = RecentsModel.INSTANCE.get(this);
         mOverviewComponentObserver = new OverviewComponentObserver(this);
 
@@ -407,10 +413,10 @@
         mOverviewInteractionState = OverviewInteractionState.INSTANCE.get(this);
         mOverviewCallbacks = OverviewCallbacks.get(this);
         mTaskOverlayFactory = TaskOverlayFactory.INSTANCE.get(this);
-        mSwipeSharedState = new SwipeSharedState(mOverviewComponentObserver);
         mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer();
         mIsUserUnlocked = true;
 
+        mSwipeSharedState.setOverviewComponentObserver(mOverviewComponentObserver);
         mInputConsumer.registerInputConsumer();
         onSystemUiProxySet();
         onSystemUiFlagsChanged();
@@ -508,12 +514,14 @@
                 // launched while device is locked even after exiting direct boot mode (e.g. camera).
                 return createDeviceLockedInputConsumer(mAM.getRunningTask(0));
             } else {
-                return InputConsumer.NO_OP;
+                return mResetGestureInputConsumer;
             }
         }
 
-        InputConsumer base = isInValidSystemUiState
-                ? newBaseConsumer(useSharedState, event) : InputConsumer.NO_OP;
+        // When using sharedState, bypass systemState check as this is a followup gesture and the
+        // first gesture started in a valid system state.
+        InputConsumer base = isInValidSystemUiState || useSharedState
+                ? newBaseConsumer(useSharedState, event) : mResetGestureInputConsumer;
         if (mMode == Mode.NO_BUTTON) {
             final ActivityControlHelper activityControl =
                     mOverviewComponentObserver.getActivityControlHelper();
@@ -536,6 +544,10 @@
                         (mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0, base,
                         mInputMonitorCompat, mSwipeTouchRegion);
             }
+        } else {
+            if ((mSystemUiStateFlags & SYSUI_STATE_SCREEN_PINNING) != 0) {
+                base = mResetGestureInputConsumer;
+            }
         }
         return base;
     }
@@ -545,11 +557,8 @@
         if (!useSharedState) {
             mSwipeSharedState.clearAllState();
         }
-        if ((mSystemUiStateFlags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0
-                || mKM.isDeviceLocked()) {
-            // This handles apps launched in direct boot mode (e.g. dialer) as well as apps launched
-            // while device is locked after exiting direct boot mode (e.g. camera), or if the
-            // app is showing over the lockscreen (even if not locked)
+        if ((mSystemUiStateFlags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0) {
+            // This handles apps showing over the lockscreen (e.g. camera)
             return createDeviceLockedInputConsumer(runningTaskInfo);
         }
 
@@ -558,7 +567,7 @@
 
         if (runningTaskInfo == null && !mSwipeSharedState.goingToLauncher
                 && !mSwipeSharedState.recentsAnimationFinishInterrupted) {
-            return InputConsumer.NO_OP;
+            return mResetGestureInputConsumer;
         } else if (mSwipeSharedState.recentsAnimationFinishInterrupted) {
             // If the finish animation was interrupted, then continue using the other activity input
             // consumer but with the next task as the running task
@@ -571,7 +580,7 @@
             return createOverviewInputConsumer(event);
         } else if (mGestureBlockingActivity != null && runningTaskInfo != null
                 && mGestureBlockingActivity.equals(runningTaskInfo.topActivity)) {
-            return InputConsumer.NO_OP;
+            return mResetGestureInputConsumer;
         } else {
             return createOtherActivityInputConsumer(event, runningTaskInfo);
         }
@@ -602,7 +611,7 @@
             return new DeviceLockedInputConsumer(this, mSwipeSharedState, mInputMonitorCompat,
                     mSwipeTouchRegion, taskInfo.taskId);
         } else {
-            return InputConsumer.NO_OP;
+            return mResetGestureInputConsumer;
         }
     }
 
@@ -611,10 +620,10 @@
                 mOverviewComponentObserver.getActivityControlHelper();
         BaseDraggingActivity activity = activityControl.getCreatedActivity();
         if (activity == null) {
-            return InputConsumer.NO_OP;
+            return mResetGestureInputConsumer;
         }
 
-        if (activity.getRootView().hasWindowFocus()) {
+        if (activity.getRootView().hasWindowFocus() || mSwipeSharedState.goingToLauncher) {
             return new OverviewInputConsumer(activity, mInputMonitorCompat,
                     false /* startingInActivityBounds */);
         } else {
@@ -628,7 +637,8 @@
      */
     private void onConsumerInactive(InputConsumer caller) {
         if (mConsumer == caller) {
-            mConsumer = InputConsumer.NO_OP;
+            mConsumer = mResetGestureInputConsumer;
+            mUncheckedConsumer = mConsumer;
         }
     }
 
@@ -653,7 +663,6 @@
             pw.println("  systemUiFlags=" + mSystemUiStateFlags);
             pw.println("  systemUiFlagsDesc="
                     + QuickStepContract.getSystemUiStateString(mSystemUiStateFlags));
-            pw.println("  isDeviceLocked=" + mKM.isDeviceLocked());
             pw.println("  assistantAvailable=" + mAssistantAvailable);
             pw.println("  assistantDisabled="
                     + QuickStepContract.isAssistantGestureDisabled(mSystemUiStateFlags));
@@ -664,6 +673,13 @@
                 mSwipeSharedState.dump("    ", pw);
             }
             pw.println("  mConsumer=" + mConsumer.getName());
+            pw.println("FeatureFlags:");
+            pw.println("  APPLY_CONFIG_AT_RUNTIME=" + APPLY_CONFIG_AT_RUNTIME.get());
+            pw.println("  QUICKSTEP_SPRINGS=" + QUICKSTEP_SPRINGS.get());
+            pw.println("  ADAPTIVE_ICON_WINDOW_ANIM=" + ADAPTIVE_ICON_WINDOW_ANIM.get());
+            pw.println("  ENABLE_QUICKSTEP_LIVE_TILE=" + ENABLE_QUICKSTEP_LIVE_TILE.get());
+            pw.println("  ENABLE_HINTS_IN_OVERVIEW=" + ENABLE_HINTS_IN_OVERVIEW.get());
+            pw.println("  FAKE_LANDSCAPE_UI=" + FAKE_LANDSCAPE_UI.get());
             TOUCH_INTERACTION_LOG.dump("", pw);
 
         }
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index 7d17f85..e9aa6d0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -746,6 +746,9 @@
                         ? 0 : (progress - mShiftAtGestureStart) / (1 - mShiftAtGestureStart));
     }
 
+    /**
+     * @param windowProgress 0 == app, 1 == overview
+     */
     private void updateSysUiFlags(float windowProgress) {
         if (mRecentsView != null) {
             TaskView centermostTask = mRecentsView.getTaskViewAt(mRecentsView
@@ -868,9 +871,7 @@
     @UiThread
     private InputConsumer createNewInputProxyHandler() {
         endRunningWindowAnim();
-        if (mLauncherTransitionController != null) {
-            mLauncherTransitionController.getAnimationPlayer().end();
-        }
+        endLauncherTransitionController();
         if (!ENABLE_QUICKSTEP_LIVE_TILE.get()) {
             // Hide the task view, if not already hidden
             setTargetAlphaProvider(WindowTransformSwipeHandler::getHiddenTargetAlpha);
@@ -1249,7 +1250,17 @@
                 if (!mCanceled) {
                     TaskView nextTask = mRecentsView.getTaskView(taskId);
                     if (nextTask != null) {
-                        nextTask.launchTask(false /* animate */, true /* freezeTaskList */);
+                        nextTask.launchTask(false /* animate */, true /* freezeTaskList */,
+                                success -> {
+                            if (!success) {
+                                // We couldn't launch the task, so take user to overview so they can
+                                // decide what to do instead of staying in this broken state.
+                                endLauncherTransitionController();
+                                mActivityControlHelper.onLaunchTaskFailed(mActivity);
+                                nextTask.notifyTaskLaunchFailed(TAG);
+                                updateSysUiFlags(1 /* windowProgress == overview */);
+                            }
+                        }, mMainThreadHandler);
                         doLogGesture(NEW_TASK);
                     }
                     reset();
@@ -1312,6 +1323,7 @@
     }
 
     private void endLauncherTransitionController() {
+        setShelfState(ShelfAnimState.CANCEL, LINEAR, 0);
         if (mLauncherTransitionController != null) {
             mLauncherTransitionController.getAnimationPlayer().end();
             mLauncherTransitionController = null;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java
index 489eb27..a1e5d47 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java
@@ -32,6 +32,19 @@
     int TYPE_ACCESSIBILITY = 1 << 5;
     int TYPE_SCREEN_PINNED = 1 << 6;
     int TYPE_OVERVIEW_WITHOUT_FOCUS = 1 << 7;
+    int TYPE_RESET_GESTURE = 1 << 8;
+
+    String[] NAMES = new String[] {
+           "TYPE_NO_OP",                    // 0
+            "TYPE_OVERVIEW",                // 1
+            "TYPE_OTHER_ACTIVITY",          // 2
+            "TYPE_ASSISTANT",               // 3
+            "TYPE_DEVICE_LOCKED",           // 4
+            "TYPE_ACCESSIBILITY",           // 5
+            "TYPE_SCREEN_PINNED",           // 6
+            "TYPE_OVERVIEW_WITHOUT_FOCUS",  // 7
+            "TYPE_RESET_GESTURE",           // 8
+    };
 
     InputConsumer NO_OP = () -> TYPE_NO_OP;
 
@@ -66,23 +79,15 @@
     }
 
     default String getName() {
-        switch (getType()) {
-            case TYPE_OVERVIEW:
-                return "OVERVIEW";
-            case TYPE_OTHER_ACTIVITY:
-                return "OTHER_ACTIVITY";
-            case TYPE_ASSISTANT:
-                return "ASSISTANT";
-            case TYPE_DEVICE_LOCKED:
-                return "DEVICE_LOCKED";
-            case TYPE_ACCESSIBILITY:
-                return "ACCESSIBILITY";
-            case TYPE_SCREEN_PINNED:
-                return "SCREEN_PINNED";
-            case TYPE_OVERVIEW_WITHOUT_FOCUS:
-                return "TYPE_OVERVIEW_WITHOUT_FOCUS";
-            default:
-                return "NO_OP";
+        String name = "";
+        for (int i = 0; i < NAMES.length; i++) {
+            if ((getType() & (1 << i)) != 0) {
+                if (name.length() > 0) {
+                    name += ":";
+                }
+                name += NAMES[i];
+            }
         }
+        return name;
     }
 }
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
index 69b25db..6bc543f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
@@ -22,10 +22,9 @@
 import static android.view.MotionEvent.ACTION_POINTER_UP;
 import static android.view.MotionEvent.ACTION_UP;
 import static android.view.MotionEvent.INVALID_POINTER_ID;
+
 import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
 import static com.android.launcher3.Utilities.squaredHypot;
-import static com.android.launcher3.uioverrides.RecentsUiFactory.ROTATION_LANDSCAPE;
-import static com.android.launcher3.uioverrides.RecentsUiFactory.ROTATION_SEASCAPE;
 import static com.android.launcher3.util.RaceConditionTracker.ENTER;
 import static com.android.launcher3.util.RaceConditionTracker.EXIT;
 import static com.android.quickstep.TouchInteractionService.TOUCH_INTERACTION_LOG;
@@ -45,10 +44,7 @@
 import android.view.VelocityTracker;
 import android.view.ViewConfiguration;
 
-import androidx.annotation.UiThread;
-
 import com.android.launcher3.R;
-import com.android.launcher3.graphics.RotationMode;
 import com.android.launcher3.util.Preconditions;
 import com.android.launcher3.util.RaceConditionTracker;
 import com.android.launcher3.util.TraceHelper;
@@ -68,10 +64,11 @@
 import com.android.systemui.shared.system.BackgroundExecutor;
 import com.android.systemui.shared.system.InputConsumerController;
 import com.android.systemui.shared.system.InputMonitorCompat;
-import com.android.systemui.shared.system.QuickStepContract;
 
 import java.util.function.Consumer;
 
+import androidx.annotation.UiThread;
+
 /**
  * Input consumer for handling events originating from an activity other than Launcher
  */
@@ -81,6 +78,9 @@
     public static final String DOWN_EVT = "OtherActivityInputConsumer.DOWN";
     private static final String UP_EVT = "OtherActivityInputConsumer.UP";
 
+    // TODO: Move to quickstep contract
+    private static final float QUICKSTEP_TOUCH_SLOP_RATIO = 3;
+
     private final CachedEventDispatcher mRecentsViewDispatcher = new CachedEventDispatcher();
     private final RunningTaskInfo mRunningTask;
     private final RecentsModel mRecentsModel;
@@ -107,14 +107,16 @@
     private final PointF mLastPos = new PointF();
     private int mActivePointerId = INVALID_POINTER_ID;
 
-    private final float mDragSlop;
+    // Distance after which we start dragging the window.
+    private final float mTouchSlop;
+
     private final float mSquaredTouchSlop;
     private final boolean mDisableHorizontalSwipe;
 
     // Slop used to check when we start moving window.
-    private boolean mPassedDragSlop;
+    private boolean mPaddedWindowMoveSlop;
     // Slop used to determine when we say that the gesture has started.
-    private boolean mPassedTouchSlop;
+    private boolean mPassedPilferInputSlop;
 
     // Might be displacement in X or Y, depending on the direction we are swiping from the nav bar.
     private float mStartDisplacement;
@@ -156,12 +158,13 @@
         mSwipeSharedState = swipeSharedState;
 
         mNavBarPosition = new NavBarPosition(base);
-        mDragSlop = QuickStepContract.getQuickStepDragSlopPx();
-        float slop = QuickStepContract.getQuickStepTouchSlopPx();
+        mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop();
+
+        float slop = QUICKSTEP_TOUCH_SLOP_RATIO * mTouchSlop;
         mSquaredTouchSlop = slop * slop;
 
-        mPassedTouchSlop = mPassedDragSlop = continuingPreviousGesture;
-        mDisableHorizontalSwipe = !mPassedTouchSlop && disableHorizontalSwipe;
+        mPassedPilferInputSlop = mPaddedWindowMoveSlop = continuingPreviousGesture;
+        mDisableHorizontalSwipe = !mPassedPilferInputSlop && disableHorizontalSwipe;
     }
 
     @Override
@@ -183,7 +186,7 @@
         }
 
         // Proxy events to recents view
-        if (mPassedDragSlop && mInteractionHandler != null
+        if (mPaddedWindowMoveSlop && mInteractionHandler != null
                 && !mRecentsViewDispatcher.hasConsumer()) {
             mRecentsViewDispatcher.setConsumer(mInteractionHandler.getRecentsViewDispatcher(
                     mNavBarPosition.getRotationMode()));
@@ -217,7 +220,7 @@
                 break;
             }
             case ACTION_POINTER_DOWN: {
-                if (!mPassedTouchSlop) {
+                if (!mPassedPilferInputSlop) {
                     // Cancel interaction in case of multi-touch interaction
                     int ptrIdx = ev.getActionIndex();
                     if (!mSwipeTouchRegion.contains(ev.getX(ptrIdx), ev.getY(ptrIdx))) {
@@ -248,18 +251,18 @@
                 float displacement = getDisplacement(ev);
                 float displacementX = mLastPos.x - mDownPos.x;
 
-                if (!mPassedDragSlop) {
+                if (!mPaddedWindowMoveSlop) {
                     if (!mIsDeferredDownTarget) {
                         // Normal gesture, ensure we pass the drag slop before we start tracking
                         // the gesture
-                        if (Math.abs(displacement) > mDragSlop) {
-                            mPassedDragSlop = true;
-                            mStartDisplacement = displacement;
+                        if (Math.abs(displacement) > mTouchSlop) {
+                            mPaddedWindowMoveSlop = true;
+                            mStartDisplacement = Math.min(displacement, -mTouchSlop);
                         }
                     }
                 }
 
-                if (!mPassedTouchSlop) {
+                if (!mPassedPilferInputSlop) {
                     float displacementY = mLastPos.y - mDownPos.y;
                     if (squaredHypot(displacementX, displacementY) >= mSquaredTouchSlop) {
                         if (mDisableHorizontalSwipe
@@ -269,23 +272,24 @@
                             break;
                         }
 
-                        mPassedTouchSlop = true;
+                        mPassedPilferInputSlop = true;
 
                         if (mIsDeferredDownTarget) {
                             // Deferred gesture, start the animation and gesture tracking once
                             // we pass the actual touch slop
                             startTouchTrackingForWindowAnimation(ev.getEventTime());
                         }
-                        if (!mPassedDragSlop) {
-                            mPassedDragSlop = true;
-                            mStartDisplacement = displacement;
+                        if (!mPaddedWindowMoveSlop) {
+                            mPaddedWindowMoveSlop = true;
+                            mStartDisplacement = Math.min(displacement, -mTouchSlop);
+
                         }
                         notifyGestureStarted();
                     }
                 }
 
                 if (mInteractionHandler != null) {
-                    if (mPassedDragSlop) {
+                    if (mPaddedWindowMoveSlop) {
                         // Move
                         mInteractionHandler.updateDisplacement(displacement - mStartDisplacement);
                     }
@@ -362,7 +366,7 @@
         RaceConditionTracker.onEvent(UP_EVT, ENTER);
         TraceHelper.endSection("TouchInt");
 
-        if (mPassedDragSlop && mInteractionHandler != null) {
+        if (mPaddedWindowMoveSlop && mInteractionHandler != null) {
             if (ev.getActionMasked() == ACTION_CANCEL) {
                 mInteractionHandler.onGestureCancelled();
             } else {
@@ -448,6 +452,6 @@
 
     @Override
     public boolean allowInterceptByParent() {
-        return !mPassedTouchSlop;
+        return !mPassedPilferInputSlop;
     }
 }
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
index 4851e67..56db209 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
@@ -27,7 +27,6 @@
 import com.android.launcher3.BaseDraggingActivity;
 import com.android.launcher3.Utilities;
 import com.android.launcher3.views.BaseDragLayer;
-import com.android.quickstep.ActivityControlHelper;
 import com.android.quickstep.OverviewCallbacks;
 import com.android.systemui.shared.system.ActivityManagerWrapper;
 import com.android.systemui.shared.system.InputMonitorCompat;
@@ -114,13 +113,4 @@
             mActivity.dispatchKeyEvent(ev);
         }
     }
-
-    public static InputConsumer newInstanceWithinActivityBounds(
-            ActivityControlHelper activityHelper) {
-        BaseDraggingActivity activity = activityHelper.getCreatedActivity();
-        if (activity == null) {
-            return InputConsumer.NO_OP;
-        }
-        return new OverviewInputConsumer(activity, null, true);
-    }
 }
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java
new file mode 100644
index 0000000..56cba21
--- /dev/null
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.quickstep.inputconsumers;
+
+import android.view.MotionEvent;
+
+import com.android.quickstep.SwipeSharedState;
+
+/**
+ * A NO_OP input consumer which also resets any pending gesture
+ */
+public class ResetGestureInputConsumer implements InputConsumer {
+
+    private final SwipeSharedState mSwipeSharedState;
+
+    public ResetGestureInputConsumer(SwipeSharedState swipeSharedState) {
+        mSwipeSharedState = swipeSharedState;
+    }
+
+    @Override
+    public int getType() {
+        return TYPE_RESET_GESTURE;
+    }
+
+    @Override
+    public void onMotionEvent(MotionEvent ev) {
+        if (ev.getAction() == MotionEvent.ACTION_DOWN
+                && mSwipeSharedState.getActiveListener() != null) {
+            mSwipeSharedState.clearAllState();
+        }
+    }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
index aca23e4..de671e0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
@@ -192,6 +192,7 @@
             float cornerRadius = 0f;
             float scale = Math.max(params.currentRect.width(), mTargetRect.width()) / crop.width();
             if (app.mode == targetSet.targetMode) {
+                alpha = mTaskAlphaCallback.apply(app, params.targetAlpha);
                 if (app.activityType != RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME) {
                     mTmpMatrix.setRectToRect(mSourceRect, params.currentRect, ScaleToFit.FILL);
                     mTmpMatrix.postTranslate(app.position.x, app.position.y);
@@ -208,8 +209,11 @@
                         }
                         mCurrentCornerRadius = cornerRadius;
                     }
+                } else if (targetSet.hasRecents) {
+                    // If home has a different target then recents, reverse anim the
+                    // home target.
+                    alpha = 1 - (progress * params.targetAlpha);
                 }
-                alpha = mTaskAlphaCallback.apply(app, params.targetAlpha);
             } else if (ENABLE_QUICKSTEP_LIVE_TILE.get() && launcherOnTop) {
                 crop = null;
                 layer = Integer.MAX_VALUE;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java
index 94e704a..83601e6 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java
@@ -49,6 +49,8 @@
     private final Consumer<SwipeAnimationTargetSet> mOnFinishListener;
     private RecentsAnimationControllerCompat mController;
 
+    private boolean mCancelled;
+
     public RecentsAnimationListenerSet(boolean shouldMinimizeSplitScreen,
             Consumer<SwipeAnimationTargetSet> onFinishListener) {
         mShouldMinimizeSplitScreen = shouldMinimizeSplitScreen;
@@ -75,11 +77,16 @@
         SwipeAnimationTargetSet targetSet = new SwipeAnimationTargetSet(controller, targets,
                 homeContentInsets, minimizedHomeBounds, mShouldMinimizeSplitScreen,
                 mOnFinishListener);
-        Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(), () -> {
-            for (SwipeAnimationListener listener : getListeners()) {
-                listener.onRecentsAnimationStart(targetSet);
-            }
-        });
+
+        if (mCancelled) {
+            targetSet.cancelAnimation();
+        } else {
+            Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(), () -> {
+                for (SwipeAnimationListener listener : getListeners()) {
+                    listener.onRecentsAnimationStart(targetSet);
+                }
+            });
+        }
     }
 
     @Override
@@ -99,4 +106,9 @@
     private SwipeAnimationListener[] getListeners() {
         return mListeners.toArray(new SwipeAnimationListener[mListeners.size()]);
     }
+
+    public void cancelListener() {
+        mCancelled = true;
+        onAnimationCanceled(false);
+    }
 }
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java
index f5a9e8a..df9efa2 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java
@@ -36,7 +36,6 @@
     private final boolean mShouldMinimizeSplitScreen;
     private final Consumer<SwipeAnimationTargetSet> mOnFinishListener;
 
-
     public final RecentsAnimationControllerCompat controller;
     public final Rect homeContentInsets;
     public final Rect minimizedHomeBounds;
@@ -103,6 +102,10 @@
         return controller != null ? controller.screenshotTask(taskId) : null;
     }
 
+    public void cancelAnimation() {
+        finishController(false /* toRecents */, null, false /* sendUserLeaveHint */);
+    }
+
     public interface SwipeAnimationListener {
 
         void onRecentsAnimationStart(SwipeAnimationTargetSet targetSet);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java
index 5aab944..7fac813 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java
@@ -18,9 +18,11 @@
 
 import static android.provider.Settings.ACTION_APP_USAGE_SETTINGS;
 
+import static com.android.launcher3.Utilities.prefixTextWithIcon;
+
+import android.annotation.TargetApi;
 import android.app.ActivityOptions;
 import android.content.ActivityNotFoundException;
-import android.content.Context;
 import android.content.Intent;
 import android.content.pm.LauncherApps;
 import android.content.pm.LauncherApps.AppUsageLimit;
@@ -28,16 +30,16 @@
 import android.icu.text.MeasureFormat.FormatWidth;
 import android.icu.util.Measure;
 import android.icu.util.MeasureUnit;
+import android.os.Build;
 import android.os.UserHandle;
-import android.util.AttributeSet;
 import android.util.Log;
 import android.view.View;
-import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import androidx.annotation.StringRes;
 
 import com.android.launcher3.BaseActivity;
+import com.android.launcher3.BaseDraggingActivity;
 import com.android.launcher3.R;
 import com.android.launcher3.Utilities;
 import com.android.launcher3.userevent.nano.LauncherLogProto;
@@ -46,45 +48,72 @@
 import java.time.Duration;
 import java.util.Locale;
 
-public final class DigitalWellBeingToast extends LinearLayout {
+@TargetApi(Build.VERSION_CODES.Q)
+public final class DigitalWellBeingToast {
     static final Intent OPEN_APP_USAGE_SETTINGS_TEMPLATE = new Intent(ACTION_APP_USAGE_SETTINGS);
     static final int MINUTE_MS = 60000;
-    private final LauncherApps mLauncherApps;
-
-    public interface InitializeCallback {
-        void call(String contentDescription);
-    }
 
     private static final String TAG = DigitalWellBeingToast.class.getSimpleName();
 
+    private final BaseDraggingActivity mActivity;
+    private final TaskView mTaskView;
+    private final LauncherApps mLauncherApps;
+
     private Task mTask;
-    private TextView mText;
+    private boolean mHasLimit;
+    private long mAppRemainingTimeMs;
 
-    public DigitalWellBeingToast(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        setLayoutDirection(Utilities.isRtl(getResources()) ?
-                View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
-        setOnClickListener((view) -> openAppUsageSettings());
-        mLauncherApps = context.getSystemService(LauncherApps.class);
+    public DigitalWellBeingToast(BaseDraggingActivity activity, TaskView taskView) {
+        mActivity = activity;
+        mTaskView = taskView;
+        mLauncherApps = activity.getSystemService(LauncherApps.class);
     }
 
-    public TextView getTextView() {
-        return mText;
+    private void setTaskFooter(View view) {
+        View oldFooter = mTaskView.setFooter(TaskView.INDEX_DIGITAL_WELLBEING_TOAST, view);
+        if (oldFooter != null) {
+            oldFooter.setOnClickListener(null);
+            mActivity.getViewCache().recycleView(R.layout.digital_wellbeing_toast, oldFooter);
+        }
     }
 
-    @Override
-    protected void onFinishInflate() {
-        super.onFinishInflate();
-
-        mText = findViewById(R.id.digital_well_being_remaining_time);
+    private void setNoLimit() {
+        mHasLimit = false;
+        mTaskView.setContentDescription(mTask.titleDescription);
+        setTaskFooter(null);
+        mAppRemainingTimeMs = 0;
     }
 
-    public void initialize(Task task, InitializeCallback callback) {
+    private void setLimit(long appUsageLimitTimeMs, long appRemainingTimeMs) {
+        mAppRemainingTimeMs = appRemainingTimeMs;
+        mHasLimit = true;
+        TextView toast = mActivity.getViewCache().getView(R.layout.digital_wellbeing_toast,
+                mActivity, mTaskView);
+        toast.setText(prefixTextWithIcon(mActivity, R.drawable.ic_hourglass_top, getText()));
+        toast.setOnClickListener(this::openAppUsageSettings);
+        setTaskFooter(toast);
+
+        mTaskView.setContentDescription(
+                getContentDescriptionForTask(mTask, appUsageLimitTimeMs, appRemainingTimeMs));
+        RecentsView rv = mTaskView.getRecentsView();
+        if (rv != null) {
+            rv.onDigitalWellbeingToastShown();
+        }
+    }
+
+    public String getText() {
+        return getText(mAppRemainingTimeMs);
+    }
+
+    public boolean hasLimit() {
+        return mHasLimit;
+    }
+
+    public void initialize(Task task) {
         mTask = task;
 
         if (task.key.userId != UserHandle.myUserId()) {
-            setVisibility(GONE);
-            callback.call(task.titleDescription);
+            setNoLimit();
             return;
         }
 
@@ -98,16 +127,12 @@
             final long appRemainingTimeMs =
                     usageLimit != null ? usageLimit.getUsageRemaining() : -1;
 
-            post(() -> {
+            mTaskView.post(() -> {
                 if (appUsageLimitTimeMs < 0 || appRemainingTimeMs < 0) {
-                    setVisibility(GONE);
+                    setNoLimit();
                 } else {
-                    setVisibility(VISIBLE);
-                    mText.setText(getText(appRemainingTimeMs));
+                    setLimit(appUsageLimitTimeMs, appRemainingTimeMs);
                 }
-
-                callback.call(getContentDescriptionForTask(
-                        task, appUsageLimitTimeMs, appRemainingTimeMs));
             });
         });
     }
@@ -146,7 +171,7 @@
 
         // Use a specific string for usage less than one minute but non-zero.
         if (duration.compareTo(Duration.ZERO) > 0) {
-            return getResources().getString(durationLessThanOneMinuteStringId);
+            return mActivity.getString(durationLessThanOneMinuteStringId);
         }
 
         // Otherwise, return 0-minute string.
@@ -176,24 +201,24 @@
     }
 
     private String getText(long remainingTime) {
-        return getResources().getString(
+        return mActivity.getString(
                 R.string.time_left_for_app,
                 getRoundedUpToMinuteReadableDuration(remainingTime));
     }
 
-    public void openAppUsageSettings() {
+    public void openAppUsageSettings(View view) {
         final Intent intent = new Intent(OPEN_APP_USAGE_SETTINGS_TEMPLATE)
                 .putExtra(Intent.EXTRA_PACKAGE_NAME,
                         mTask.getTopComponent().getPackageName()).addFlags(
                         Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
         try {
-            final BaseActivity activity = BaseActivity.fromContext(getContext());
+            final BaseActivity activity = BaseActivity.fromContext(view.getContext());
             final ActivityOptions options = ActivityOptions.makeScaleUpAnimation(
-                    this, 0, 0,
-                    getWidth(), getHeight());
+                    view, 0, 0,
+                    view.getWidth(), view.getHeight());
             activity.startActivity(intent, options.toBundle());
             activity.getUserEventDispatcher().logActionOnControl(LauncherLogProto.Action.Touch.TAP,
-                    LauncherLogProto.ControlType.APP_USAGE_SETTINGS, this);
+                    LauncherLogProto.ControlType.APP_USAGE_SETTINGS, view);
         } catch (ActivityNotFoundException e) {
             Log.e(TAG, "Failed to open app usage settings for task "
                     + mTask.getTopComponent().getPackageName(), e);
@@ -203,7 +228,7 @@
     private String getContentDescriptionForTask(
             Task task, long appUsageLimitTimeMs, long appRemainingTimeMs) {
         return appUsageLimitTimeMs >= 0 && appRemainingTimeMs >= 0 ?
-                getResources().getString(
+                mActivity.getString(
                         R.string.task_contents_description_with_remaining_time,
                         task.titleDescription,
                         getText(appRemainingTimeMs)) :
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 90e123e..9058e7e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -351,6 +351,9 @@
                 .getDimensionPixelSize(R.dimen.recents_empty_message_text_padding);
         setWillNotDraw(false);
         updateEmptyMessage();
+
+        // Initialize quickstep specific cache params here, as this is constructed only once
+        mActivity.getViewCache().setCacheSize(R.layout.digital_wellbeing_toast, 5);
     }
 
     public OverScroller getScroller() {
@@ -892,7 +895,7 @@
         mRunningTaskTileHidden = isHidden;
         TaskView runningTask = getRunningTaskView();
         if (runningTask != null) {
-            runningTask.setAlpha(isHidden ? 0 : mContentAlpha);
+            runningTask.setStableAlpha(isHidden ? 0 : mContentAlpha);
         }
     }
 
@@ -1294,7 +1297,7 @@
         for (int i = getTaskViewCount() - 1; i >= 0; i--) {
             TaskView child = getTaskViewAt(i);
             if (!mRunningTaskTileHidden || child.getTask().key.id != mRunningTaskId) {
-                getChildAt(i).setAlpha(alpha);
+                child.setStableAlpha(alpha);
             }
         }
         mClearAllButton.setContentAlpha(mContentAlpha);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
index 8b8240d..6f10b42 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -252,7 +252,7 @@
         }
     }
 
-    protected TaskView getTaskView() {
+    public TaskView getTaskView() {
         return (TaskView) getParent();
     }
 
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index bf3e91f..e7e4189 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -27,6 +27,8 @@
 import android.animation.AnimatorListenerAdapter;
 import android.animation.ObjectAnimator;
 import android.animation.TimeInterpolator;
+import android.animation.ValueAnimator;
+import android.animation.ValueAnimator.AnimatorUpdateListener;
 import android.app.ActivityOptions;
 import android.content.Context;
 import android.content.res.Resources;
@@ -39,6 +41,7 @@
 import android.util.AttributeSet;
 import android.util.FloatProperty;
 import android.util.Log;
+import android.view.Gravity;
 import android.view.View;
 import android.view.ViewOutlineProvider;
 import android.view.accessibility.AccessibilityNodeInfo;
@@ -145,14 +148,12 @@
             };
 
     private final TaskOutlineProvider mOutlineProvider;
-    private final FooterOutlineProvider mFooterOutlineProvider;
 
     private Task mTask;
     private TaskThumbnailView mSnapshotView;
     private TaskMenuView mMenuView;
     private IconView mIconView;
-    private View mTaskFooterContainer;
-    private DigitalWellBeingToast mDigitalWellBeingToast;
+    private final DigitalWellBeingToast mDigitalWellBeingToast;
     private float mCurveScale;
     private float mFullscreenProgress;
     private final FullscreenDrawParams mCurrentFullscreenParams;
@@ -163,6 +164,7 @@
     private ObjectAnimator mIconAndDimAnimator;
     private float mIconScaleAnimStartProgress = 0;
     private float mFocusTransitionProgress = 1;
+    private float mStableAlpha = 1;
 
     private boolean mShowScreenshot;
 
@@ -170,6 +172,14 @@
     private TaskThumbnailCache.ThumbnailLoadRequest mThumbnailLoadRequest;
     private TaskIconCache.IconLoadRequest mIconLoadRequest;
 
+    // Order in which the footers appear. Lower order appear below higher order.
+    public static final int INDEX_DIGITAL_WELLBEING_TOAST = 0;
+    public static final int INDEX_PROACTIVE_SUGGEST = 1;
+    private final FooterWrapper[] mFooters = new FooterWrapper[2];
+    private float mFooterVerticalOffset = 0;
+    private float mFooterAlpha = 1;
+    private int mStackHeight;
+
     public TaskView(Context context) {
         this(context, null);
     }
@@ -207,8 +217,9 @@
         mCornerRadius = TaskCornerRadius.get(context);
         mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context.getResources());
         mCurrentFullscreenParams = new FullscreenDrawParams(mCornerRadius);
+        mDigitalWellBeingToast = new DigitalWellBeingToast(mActivity, this);
+
         mOutlineProvider = new TaskOutlineProvider(getResources(), mCurrentFullscreenParams);
-        mFooterOutlineProvider = new FooterOutlineProvider(mCurrentFullscreenParams);
         setOutlineProvider(mOutlineProvider);
     }
 
@@ -217,10 +228,6 @@
         super.onFinishInflate();
         mSnapshotView = findViewById(R.id.snapshot);
         mIconView = findViewById(R.id.icon);
-        mDigitalWellBeingToast = findViewById(R.id.digital_well_being_toast);
-        mTaskFooterContainer = findViewById(R.id.task_footer_container);
-        mTaskFooterContainer.setOutlineProvider(mFooterOutlineProvider);
-        mTaskFooterContainer.setClipToOutline(true);
     }
 
     public TaskMenuView getMenuView() {
@@ -353,17 +360,10 @@
             mIconLoadRequest = iconCache.updateIconInBackground(mTask,
                     (task) -> {
                         setIcon(task.icon);
-                        if (isRunningTask()) {
+                        if (ENABLE_QUICKSTEP_LIVE_TILE.get() && isRunningTask()) {
                             getRecentsView().updateLiveTileIcon(task.icon);
                         }
-                        mDigitalWellBeingToast.initialize(
-                                mTask,
-                                contentDescription -> {
-                                    setContentDescription(contentDescription);
-                                    if (mDigitalWellBeingToast.getVisibility() == VISIBLE) {
-                                        getRecentsView().onDigitalWellbeingToastShown();
-                                    }
-                                });
+                        mDigitalWellBeingToast.initialize(mTask);
                     });
         } else {
             mSnapshotView.setThumbnail(null, null);
@@ -422,14 +422,12 @@
         mIconView.setScaleX(scale);
         mIconView.setScaleY(scale);
 
-        int footerVerticalOffset = (int) (mTaskFooterContainer.getHeight() * (1.0f - scale));
-        mTaskFooterContainer.setTranslationY(
-                mCurrentFullscreenParams.mCurrentDrawnInsets.bottom +
-                mCurrentFullscreenParams.mCurrentDrawnInsets.top +
-                footerVerticalOffset);
-        mFooterOutlineProvider.setFullscreenDrawParams(
-                mCurrentFullscreenParams, footerVerticalOffset);
-        mTaskFooterContainer.invalidateOutline();
+        mFooterVerticalOffset = 1.0f - scale;
+        for (FooterWrapper footer : mFooters) {
+            if (footer != null) {
+                footer.updateFooterOffset();
+            }
+        }
     }
 
     public void setIconScaleAnimStartProgress(float startProgress) {
@@ -468,7 +466,7 @@
         setTranslationX(0f);
         setTranslationY(0f);
         setTranslationZ(0);
-        setAlpha(1f);
+        setAlpha(mStableAlpha);
         setIconScaleAndDim(1);
     }
 
@@ -477,6 +475,11 @@
         setFullscreenProgress(0);
     }
 
+    public void setStableAlpha(float parentAlpha) {
+        mStableAlpha = parentAlpha;
+        setAlpha(mStableAlpha);
+    }
+
     @Override
     public void onRecycle() {
         resetViewTransforms();
@@ -498,6 +501,13 @@
         mSnapshotView.setDimAlpha(curveInterpolation * MAX_PAGE_SCRIM_ALPHA);
         setCurveScale(getCurveScaleForCurveInterpolation(curveInterpolation));
 
+        mFooterAlpha = Utilities.boundToRange(1.0f - 2 * scrollState.linearInterpolation, 0f, 1f);
+        for (FooterWrapper footer : mFooters) {
+            if (footer != null) {
+                footer.mView.setAlpha(mFooterAlpha);
+            }
+        }
+
         if (mMenuView != null) {
             mMenuView.setPosition(getX() - getRecentsView().getScrollX(), getY());
             mMenuView.setScaleX(getScaleX());
@@ -505,6 +515,56 @@
         }
     }
 
+
+    /**
+     * Sets the footer at the specific index and returns the previously set footer.
+     */
+    public View setFooter(int index, View view) {
+        View oldFooter = null;
+
+        // If the footer are is already collapsed, do not animate entry
+        boolean shouldAnimateEntry = mFooterVerticalOffset <= 0;
+
+        if (mFooters[index] != null) {
+            oldFooter = mFooters[index].mView;
+            mFooters[index].release();
+            removeView(oldFooter);
+
+            // If we are replacing an existing footer, do not animate entry
+            shouldAnimateEntry = false;
+        }
+        if (view != null) {
+            int indexToAdd = getChildCount();
+            for (int i = index - 1; i >= 0; i--) {
+                if (mFooters[i] != null) {
+                    indexToAdd = indexOfChild(mFooters[i].mView);
+                    break;
+                }
+            }
+
+            addView(view, indexToAdd);
+            ((LayoutParams) view.getLayoutParams()).gravity =
+                    Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
+            view.setAlpha(mFooterAlpha);
+            mFooters[index] = new FooterWrapper(view);
+            if (shouldAnimateEntry) {
+                mFooters[index].animateEntry();
+            }
+        } else {
+            mFooters[index] = null;
+        }
+
+        mStackHeight = 0;
+        for (FooterWrapper footer : mFooters) {
+            if (footer != null) {
+                footer.setVerticalShift(mStackHeight);
+                mStackHeight += footer.mExpectedHeight;
+            }
+        }
+
+        return oldFooter;
+    }
+
     @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
         super.onLayout(changed, left, top, right, bottom);
@@ -514,6 +574,18 @@
             SYSTEM_GESTURE_EXCLUSION_RECT.get(0).set(0, 0, getWidth(), getHeight());
             setSystemGestureExclusionRects(SYSTEM_GESTURE_EXCLUSION_RECT);
         }
+
+        mStackHeight = 0;
+        for (FooterWrapper footer : mFooters) {
+            if (footer != null) {
+                mStackHeight += footer.mView.getHeight();
+            }
+        }
+        for (FooterWrapper footer : mFooters) {
+            if (footer != null) {
+                footer.updateFooterOffset();
+            }
+        }
     }
 
     public static float getCurveScaleForInterpolation(float linearInterpolation) {
@@ -572,26 +644,74 @@
         }
     }
 
-    private static final class FooterOutlineProvider extends ViewOutlineProvider {
+    private class FooterWrapper extends ViewOutlineProvider {
 
-        private FullscreenDrawParams mFullscreenDrawParams;
-        private int mVerticalOffset;
-        private final Rect mOutlineRect = new Rect();
+        final View mView;
+        final ViewOutlineProvider mOldOutlineProvider;
+        final ViewOutlineProvider mDelegate;
 
-        FooterOutlineProvider(FullscreenDrawParams params) {
-            mFullscreenDrawParams = params;
+        final int mExpectedHeight;
+        final int mOldPaddingBottom;
+
+        int mAnimationOffset = 0;
+        int mEntryAnimationOffset = 0;
+
+        public FooterWrapper(View view) {
+            mView = view;
+            mOldOutlineProvider = view.getOutlineProvider();
+            mDelegate = mOldOutlineProvider == null
+                    ? ViewOutlineProvider.BACKGROUND : mOldOutlineProvider;
+
+            int h = view.getLayoutParams().height;
+            if (h > 0) {
+                mExpectedHeight = h;
+            } else {
+                int m = MeasureSpec.makeMeasureSpec(MeasureSpec.EXACTLY - 1, MeasureSpec.AT_MOST);
+                view.measure(m, m);
+                mExpectedHeight = view.getMeasuredHeight();
+            }
+            mOldPaddingBottom = view.getPaddingBottom();
+
+            if (mOldOutlineProvider != null) {
+                view.setOutlineProvider(this);
+                view.setClipToOutline(true);
+            }
         }
 
-        void setFullscreenDrawParams(FullscreenDrawParams params, int verticalOffset) {
-            mFullscreenDrawParams = params;
-            mVerticalOffset = verticalOffset;
+        public void setVerticalShift(int shift) {
+            mView.setPadding(mView.getPaddingLeft(), mView.getPaddingTop(),
+                    mView.getPaddingRight(), mOldPaddingBottom + shift);
         }
 
         @Override
         public void getOutline(View view, Outline outline) {
-            mOutlineRect.set(0, 0, view.getWidth(), view.getHeight());
-            mOutlineRect.offset(0, -mVerticalOffset);
-            outline.setRoundRect(mOutlineRect, mFullscreenDrawParams.mCurrentDrawnCornerRadius);
+            mDelegate.getOutline(view, outline);
+            outline.offset(0, -mAnimationOffset - mEntryAnimationOffset);
+        }
+
+        void updateFooterOffset() {
+            mAnimationOffset = Math.round(mStackHeight * mFooterVerticalOffset);
+            mView.setTranslationY(mAnimationOffset + mEntryAnimationOffset
+                    + mCurrentFullscreenParams.mCurrentDrawnInsets.bottom
+                    + mCurrentFullscreenParams.mCurrentDrawnInsets.top);
+            mView.invalidateOutline();
+        }
+
+        void release() {
+            mView.setOutlineProvider(mOldOutlineProvider);
+            setVerticalShift(0);
+        }
+
+        void animateEntry() {
+            ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
+            animator.addUpdateListener(anim -> {
+               float factor = 1 - anim.getAnimatedFraction();
+               int totalShift = mExpectedHeight + mView.getPaddingBottom() - mOldPaddingBottom;
+                mEntryAnimationOffset = Math.round(factor * totalShift);
+                updateFooterOffset();
+            });
+            animator.setDuration(100);
+            animator.start();
         }
     }
 
@@ -615,7 +735,7 @@
             }
         }
 
-        if (mDigitalWellBeingToast.getVisibility() == VISIBLE) {
+        if (mDigitalWellBeingToast.hasLimit()) {
             info.addAction(
                     new AccessibilityNodeInfo.AccessibilityAction(
                             R.string.accessibility_app_usage_settings,
@@ -639,7 +759,7 @@
         }
 
         if (action == R.string.accessibility_app_usage_settings) {
-            mDigitalWellBeingToast.openAppUsageSettings();
+            mDigitalWellBeingToast.openAppUsageSettings(this);
             return true;
         }
 
@@ -716,6 +836,9 @@
     }
 
     public boolean isRunningTask() {
+        if (getRecentsView() == null) {
+            return false;
+        }
         return this == getRecentsView().getRunningTaskView();
     }
 
diff --git a/quickstep/res/layout/digital_wellbeing_toast.xml b/quickstep/res/layout/digital_wellbeing_toast.xml
new file mode 100644
index 0000000..83594e4
--- /dev/null
+++ b/quickstep/res/layout/digital_wellbeing_toast.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<TextView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="48dp"
+    android:background="@drawable/bg_wellbeing_toast"
+    android:fontFamily="sans-serif"
+    android:forceHasOverlappingRendering="false"
+    android:gravity="center"
+    android:importantForAccessibility="noHideDescendants"
+    android:textColor="@android:color/white"
+    android:textSize="14sp"/>
\ No newline at end of file
diff --git a/quickstep/res/layout/task.xml b/quickstep/res/layout/task.xml
index 1869188..60cfa0c 100644
--- a/quickstep/res/layout/task.xml
+++ b/quickstep/res/layout/task.xml
@@ -25,7 +25,7 @@
         android:id="@+id/snapshot"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:layout_marginTop="@dimen/task_thumbnail_top_margin" />
+        android:layout_marginTop="@dimen/task_thumbnail_top_margin"/>
 
     <com.android.quickstep.views.IconView
         android:id="@+id/icon"
@@ -33,45 +33,5 @@
         android:layout_height="@dimen/task_thumbnail_icon_size"
         android:layout_gravity="top|center_horizontal"
         android:focusable="false"
-        android:importantForAccessibility="no" />
-
-    <LinearLayout
-        android:id="@+id/task_footer_container"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:layout_gravity="bottom|center_horizontal">
-        <FrameLayout
-            android:id="@+id/proactive_suggest_container"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:gravity="center"
-            android:visibility="gone"
-            />
-        <com.android.quickstep.views.DigitalWellBeingToast
-            android:id="@+id/digital_well_being_toast"
-            android:layout_width="match_parent"
-            android:layout_height="48dp"
-            android:importantForAccessibility="noHideDescendants"
-            android:background="@drawable/bg_wellbeing_toast"
-            android:gravity="center"
-            android:visibility="gone">
-            <ImageView
-                android:id="@+id/digital_well_being_hourglass"
-                android:layout_width="24dp"
-                android:layout_height="24dp"
-                android:layout_marginEnd="8dp"
-                android:src="@drawable/ic_hourglass_top"
-            />
-            <TextView
-                android:id="@+id/digital_well_being_remaining_time"
-                android:layout_width="wrap_content"
-                android:layout_height="24dp"
-                android:fontFamily="sans-serif"
-                android:textSize="14sp"
-                android:textColor="@android:color/white"
-                android:gravity="center_vertical"
-            />
-        </com.android.quickstep.views.DigitalWellBeingToast>
-    </LinearLayout>
+        android:importantForAccessibility="no"/>
 </com.android.quickstep.views.TaskView>
\ No newline at end of file
diff --git a/quickstep/res/values-as/strings.xml b/quickstep/res/values-as/strings.xml
index a33973b..c188493 100644
--- a/quickstep/res/values-as/strings.xml
+++ b/quickstep/res/values-as/strings.xml
@@ -31,4 +31,7 @@
     <string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
     <string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"&lt; ১ মিনিট"</string>
     <string name="time_left_for_app" msgid="3111996412933644358">"আজি <xliff:g id="TIME">%1$s</xliff:g> বাকী আছ"</string>
+    <string name="title_app_suggestions" msgid="4185902664111965088">"এপৰ পৰামৰ্শসমূহ"</string>
+    <string name="all_apps_label" msgid="8542784161730910663">"সকলো এপ্"</string>
+    <string name="all_apps_prediction_tip" msgid="2672336544844936186">"আপোনাৰ অনুমানিক এপ্"</string>
 </resources>
diff --git a/quickstep/res/values-or/strings.xml b/quickstep/res/values-or/strings.xml
index bd88671..2ebec4e 100644
--- a/quickstep/res/values-or/strings.xml
+++ b/quickstep/res/values-or/strings.xml
@@ -27,8 +27,11 @@
     <string name="accessibility_close_task" msgid="5354563209433803643">"ବନ୍ଦ କରନ୍ତୁ"</string>
     <string name="accessibility_app_usage_settings" msgid="6312864233673544149">"ଆପ୍‍ ବ୍ୟବହାର ସେଟିଂସ୍‍"</string>
     <string name="recents_clear_all" msgid="5328176793634888831">"ସବୁ ଖାଲି କରନ୍ତୁ"</string>
-    <string name="accessibility_recent_apps" msgid="4058661986695117371">"ସାମ୍ପ୍ରତିକ ଆପ୍‌"</string>
+    <string name="accessibility_recent_apps" msgid="4058661986695117371">"ବର୍ତ୍ତମାନର ଆପ୍‌"</string>
     <string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g> <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
     <string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"&lt; 1 ମିନିଟ୍"</string>
     <string name="time_left_for_app" msgid="3111996412933644358">"ଆଜି <xliff:g id="TIME">%1$s</xliff:g> ବାକି ଅଛି"</string>
+    <string name="title_app_suggestions" msgid="4185902664111965088">"ଆପ୍ ପରାମର୍ଶଗୁଡ଼ିକ"</string>
+    <string name="all_apps_label" msgid="8542784161730910663">"ସମସ୍ତ ଆପ୍ସ"</string>
+    <string name="all_apps_prediction_tip" msgid="2672336544844936186">"ଆପଣ ପୂର୍ବାନୁମାନ କରିଥିବା ଆପ୍ସ"</string>
 </resources>
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index 46161cb..8643160 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -59,6 +59,7 @@
 import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
 import com.android.launcher3.allapps.AllAppsTransitionController;
 import com.android.launcher3.anim.Interpolators;
+import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.dragndrop.DragLayer;
 import com.android.launcher3.shortcuts.DeepShortcutView;
 import com.android.launcher3.util.MultiValueAlpha;
@@ -182,6 +183,12 @@
         mDeviceProfile = dp;
     }
 
+    @Override
+    public boolean supportsAdaptiveIconAnimation() {
+        return hasControlRemoteAppTransitionPermission()
+                && FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM.get();
+    }
+
     /**
      * @return ActivityOptions with remote animations that controls how the window of the opening
      *         targets are displayed.
diff --git a/quickstep/src/com/android/launcher3/proxy/StartActivityParams.java b/quickstep/src/com/android/launcher3/proxy/StartActivityParams.java
index 1e8bd93..bee8bb8 100644
--- a/quickstep/src/com/android/launcher3/proxy/StartActivityParams.java
+++ b/quickstep/src/com/android/launcher3/proxy/StartActivityParams.java
@@ -31,7 +31,7 @@
 
     private static final String TAG = "StartActivityParams";
 
-    private final PendingIntent mCallback;
+    private final PendingIntent mPICallback;
     public final int requestCode;
 
     public Intent intent;
@@ -44,13 +44,17 @@
     public Bundle options;
 
     public StartActivityParams(Activity activity, int requestCode) {
-        mCallback = activity.createPendingResult(requestCode, new Intent(),
-                PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT);
+        this(activity.createPendingResult(requestCode, new Intent(),
+                PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT), requestCode);
+    }
+
+    public StartActivityParams(PendingIntent pendingIntent, int requestCode) {
+        this.mPICallback = pendingIntent;
         this.requestCode = requestCode;
     }
 
     private StartActivityParams(Parcel parcel) {
-        mCallback = parcel.readTypedObject(PendingIntent.CREATOR);
+        mPICallback = parcel.readTypedObject(PendingIntent.CREATOR);
         requestCode = parcel.readInt();
         intent = parcel.readTypedObject(Intent.CREATOR);
 
@@ -70,7 +74,7 @@
 
     @Override
     public void writeToParcel(Parcel parcel, int flags) {
-        parcel.writeTypedObject(mCallback, flags);
+        parcel.writeTypedObject(mPICallback, flags);
         parcel.writeInt(requestCode);
         parcel.writeTypedObject(intent, flags);
 
@@ -84,7 +88,9 @@
 
     public void deliverResult(Context context, int resultCode, Intent data) {
         try {
-            mCallback.send(context, resultCode, data);
+            if (mPICallback != null) {
+                mPICallback.send(context, resultCode, data);
+            }
         } catch (CanceledException e) {
             Log.e(TAG, "Unable to send back result", e);
         }
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
index dcc1ace..8675c3e 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
@@ -93,6 +93,8 @@
 
     boolean isInLiveTileMode();
 
+    void onLaunchTaskFailed(T activity);
+
     interface ActivityInitListener {
 
         void register();
diff --git a/quickstep/src/com/android/quickstep/util/RemoteAnimationTargetSet.java b/quickstep/src/com/android/quickstep/util/RemoteAnimationTargetSet.java
index 0df4e94..1229293 100644
--- a/quickstep/src/com/android/quickstep/util/RemoteAnimationTargetSet.java
+++ b/quickstep/src/com/android/quickstep/util/RemoteAnimationTargetSet.java
@@ -33,20 +33,26 @@
     public final RemoteAnimationTargetCompat[] unfilteredApps;
     public final RemoteAnimationTargetCompat[] apps;
     public final int targetMode;
+    public final boolean hasRecents;
 
     public RemoteAnimationTargetSet(RemoteAnimationTargetCompat[] apps, int targetMode) {
         ArrayList<RemoteAnimationTargetCompat> filteredApps = new ArrayList<>();
+        boolean hasRecents = false;
         if (apps != null) {
             for (RemoteAnimationTargetCompat target : apps) {
                 if (target.mode == targetMode) {
                     filteredApps.add(target);
                 }
+
+                hasRecents |= target.activityType ==
+                        RemoteAnimationTargetCompat.ACTIVITY_TYPE_RECENTS;
             }
         }
 
         this.unfilteredApps = apps;
         this.apps = filteredApps.toArray(new RemoteAnimationTargetCompat[filteredApps.size()]);
         this.targetMode = targetMode;
+        this.hasRecents = hasRecents;
     }
 
     public RemoteAnimationTargetCompat findTask(int taskId) {
diff --git a/quickstep/tests/src/com/android/quickstep/DigitalWellBeingToastTest.java b/quickstep/tests/src/com/android/quickstep/DigitalWellBeingToastTest.java
index 70f9c90..0c5a6f5 100644
--- a/quickstep/tests/src/com/android/quickstep/DigitalWellBeingToastTest.java
+++ b/quickstep/tests/src/com/android/quickstep/DigitalWellBeingToastTest.java
@@ -51,15 +51,15 @@
             mLauncher.pressHome();
             final DigitalWellBeingToast toast = getToast();
 
-            assertTrue("Toast is not visible", toast.isShown());
-            assertEquals("Toast text: ", "5 minutes left today", toast.getTextView().getText());
+            assertTrue("Toast is not visible", toast.hasLimit());
+            assertEquals("Toast text: ", "5 minutes left today", toast.getText());
 
             // Unset time limit for app.
             runWithShellPermission(
                     () -> usageStatsManager.unregisterAppUsageLimitObserver(observerId));
 
             mLauncher.pressHome();
-            assertFalse("Toast is visible", getToast().isShown());
+            assertFalse("Toast is visible", getToast().hasLimit());
         } finally {
             runWithShellPermission(
                     () -> usageStatsManager.unregisterAppUsageLimitObserver(observerId));
diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
index 20fdff2..0135911 100644
--- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
+++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
@@ -22,6 +22,7 @@
 import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS;
 import static com.android.launcher3.tapl.TestHelpers.getHomeIntentInPackage;
 import static com.android.launcher3.tapl.TestHelpers.getLauncherInMyProcess;
+import static com.android.launcher3.ui.AbstractLauncherUiTest.resolveSystemApp;
 import static com.android.launcher3.util.rule.ShellCommandRule.disableHeadsUpNotification;
 import static com.android.launcher3.util.rule.ShellCommandRule.getLauncherCommand;
 import static com.android.quickstep.NavigationModeSwitchRule.Mode.THREE_BUTTON;
@@ -108,7 +109,7 @@
     @NavigationModeSwitch(mode = THREE_BUTTON)
     @Test
     public void goToOverviewFromApp() {
-        startAppFast("com.android.settings");
+        startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
 
         mLauncher.getBackground().switchToOverview();
     }
diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
index c3e46ea..90763b8 100644
--- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
+++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
@@ -33,6 +33,7 @@
 
 import com.android.launcher3.tapl.LauncherInstrumentation;
 import com.android.launcher3.tapl.TestHelpers;
+import com.android.systemui.shared.system.QuickStepContract;
 
 import org.junit.Assert;
 import org.junit.rules.TestRule;
@@ -43,6 +44,8 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Test rule that allows executing a test with Quickstep on and then Quickstep off.
@@ -78,11 +81,14 @@
                 @Override
                 public void evaluate() throws Throwable {
                     final Context context = getInstrumentation().getContext();
-                    final String prevOverlayPkg = LauncherInstrumentation.isGesturalMode(context)
-                            ? NAV_BAR_MODE_GESTURAL_OVERLAY
-                            : LauncherInstrumentation.isSwipeUpMode(context)
-                                    ? NAV_BAR_MODE_2BUTTON_OVERLAY
-                                    : NAV_BAR_MODE_3BUTTON_OVERLAY;
+                    final int currentInteractionMode =
+                            LauncherInstrumentation.getCurrentInteractionMode(context);
+                    final String prevOverlayPkg =
+                            QuickStepContract.isGesturalMode(currentInteractionMode)
+                                    ? NAV_BAR_MODE_GESTURAL_OVERLAY
+                                    : QuickStepContract.isSwipeUpMode(currentInteractionMode)
+                                            ? NAV_BAR_MODE_2BUTTON_OVERLAY
+                                            : NAV_BAR_MODE_3BUTTON_OVERLAY;
                     final LauncherInstrumentation.NavigationModel originalMode =
                             mLauncher.getNavigationModel();
                     try {
@@ -131,6 +137,27 @@
                     setOverlayPackageEnabled(NAV_BAR_MODE_GESTURAL_OVERLAY,
                             overlayPackage == NAV_BAR_MODE_GESTURAL_OVERLAY);
 
+                    if (currentSysUiNavigationMode() != expectedMode) {
+                        final CountDownLatch latch = new CountDownLatch(1);
+                        final Context targetContext = getInstrumentation().getTargetContext();
+                        final SysUINavigationMode.NavigationModeChangeListener listener =
+                                newMode -> {
+                                    if (LauncherInstrumentation.getNavigationModel(newMode.resValue)
+                                            == expectedMode) {
+                                        latch.countDown();
+                                    }
+                                };
+                        final SysUINavigationMode sysUINavigationMode =
+                                SysUINavigationMode.INSTANCE.get(targetContext);
+                        targetContext.getMainExecutor().execute(() ->
+                                sysUINavigationMode.addModeChangeListener(listener));
+                        latch.await(10, TimeUnit.SECONDS);
+                        targetContext.getMainExecutor().execute(() ->
+                                sysUINavigationMode.removeModeChangeListener(listener));
+                        Assert.assertTrue("Navigation mode didn't change to " + expectedMode,
+                                currentSysUiNavigationMode() == expectedMode);
+                    }
+
                     for (int i = 0; i != 100; ++i) {
                         if (mLauncher.getNavigationModel() == expectedMode) {
                             Thread.sleep(5000);
@@ -153,4 +180,12 @@
             return base;
         }
     }
+
+    private static LauncherInstrumentation.NavigationModel currentSysUiNavigationMode() {
+        return LauncherInstrumentation.getNavigationModel(
+                SysUINavigationMode.getMode(
+                        getInstrumentation().
+                                getTargetContext()).
+                        resValue);
+    }
 }
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index fd31875..9804af1 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -33,7 +33,7 @@
     <string name="long_accessible_way_to_add" msgid="4289502106628154155">"点按两次并按住微件即可选择微件,您也可以使用自定义操作。"</string>
     <string name="widget_dims_format" msgid="2370757736025621599">"%1$d × %2$d"</string>
     <string name="widget_accessible_dims_format" msgid="3640149169885301790">"宽 %1$d,高 %2$d"</string>
-    <string name="add_item_request_drag_hint" msgid="5899764264480397019">"触摸并按住即可手动放置"</string>
+    <string name="add_item_request_drag_hint" msgid="5899764264480397019">"轻触并按住即可手动放置"</string>
     <string name="place_automatically" msgid="8064208734425456485">"自动添加"</string>
     <string name="all_apps_search_bar_hint" msgid="1390553134053255246">"搜索应用"</string>
     <string name="all_apps_loading_message" msgid="5813968043155271636">"正在加载应用…"</string>
diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java
index 424ffde..6455056 100644
--- a/src/com/android/launcher3/BaseActivity.java
+++ b/src/com/android/launcher3/BaseActivity.java
@@ -175,6 +175,10 @@
         mActivityFlags &= ~ACTIVITY_STATE_STARTED & ~ACTIVITY_STATE_USER_ACTIVE;
         mForceInvisible = 0;
         super.onStop();
+
+        // Reset the overridden sysui flags used for the task-swipe launch animation, this is a
+        // catch all for if we do not get resumed (and therefore not paused below)
+        getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0);
     }
 
     @Override
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 2f801e0..7085c60 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -32,6 +32,7 @@
 import android.graphics.drawable.Drawable;
 import android.text.TextUtils.TruncateAt;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.util.Property;
 import android.util.TypedValue;
 import android.view.KeyEvent;
@@ -52,6 +53,7 @@
 import com.android.launcher3.icons.IconCache.IconLoadRequest;
 import com.android.launcher3.icons.IconCache.ItemInfoUpdateReceiver;
 import com.android.launcher3.model.PackageItemInfo;
+import com.android.launcher3.testing.TestProtocol;
 import com.android.launcher3.views.ActivityContext;
 
 import java.text.NumberFormat;
@@ -304,6 +306,9 @@
 
     @Override
     public boolean onTouchEvent(MotionEvent event) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_START_TAG, "BubbleTextView.onTouchEvent " + event);
+        }
         // Call the superclass onTouchEvent first, because sometimes it changes the state to
         // isPressed() on an ACTION_UP
         boolean result = super.onTouchEvent(event);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 0b80751..80ea78f 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -80,6 +80,7 @@
 import com.android.launcher3.DropTarget.DragObject;
 import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
 import com.android.launcher3.allapps.AllAppsContainerView;
+import com.android.launcher3.allapps.AllAppsStore;
 import com.android.launcher3.allapps.AllAppsTransitionController;
 import com.android.launcher3.allapps.DiscoveryBounce;
 import com.android.launcher3.anim.PropertyListBuilder;
@@ -460,13 +461,18 @@
     private void onIdpChanged(InvariantDeviceProfile idp) {
         mUserEventDispatcher = null;
 
+        DeviceProfile oldWallpaperProfile = getWallpaperDeviceProfile();
         initDeviceProfile(idp);
         dispatchDeviceProfileChanged();
         reapplyUi();
         mDragLayer.recreateControllers();
 
-        // TODO: We can probably avoid rebind when only screen size changed.
-        rebindModel();
+        // Calling onSaveInstanceState ensures that static cache used by listWidgets is
+        // initialized properly.
+        onSaveInstanceState(new Bundle());
+        if (oldWallpaperProfile != getWallpaperDeviceProfile()) {
+            rebindModel();
+        }
     }
 
     public void onAssistantVisibilityChanged(float visibility) {
@@ -888,7 +894,6 @@
             mLauncherCallbacks.onStart();
         }
         mAppWidgetHost.setListenIfResumed(true);
-        NotificationListener.setNotificationsChangedListener(mPopupDataProvider);
         RaceConditionTracker.onEvent(ON_START_EVT, EXIT);
     }
 
@@ -908,6 +913,9 @@
             // Refresh shortcuts if the permission changed.
             mModel.refreshShortcutsIfRequired();
 
+            // Set the notification listener and fetch updated notifications when we resume
+            NotificationListener.setNotificationsChangedListener(mPopupDataProvider);
+
             DiscoveryBounce.showForHomeIfNeeded(this);
 
             if (mPendingActivityRequestCode != -1 && isInState(NORMAL)) {
@@ -2235,8 +2243,9 @@
         }
         mPendingExecutor = executor;
         if (!isInState(ALL_APPS)) {
-            mAppsView.getAppsStore().setDeferUpdates(true);
-            mPendingExecutor.execute(() -> mAppsView.getAppsStore().setDeferUpdates(false));
+            mAppsView.getAppsStore().enableDeferUpdates(AllAppsStore.DEFER_UPDATES_NEXT_DRAW);
+            mPendingExecutor.execute(() -> mAppsView.getAppsStore().disableDeferUpdates(
+                    AllAppsStore.DEFER_UPDATES_NEXT_DRAW));
         }
 
         executor.attachTo(this);
diff --git a/src/com/android/launcher3/LauncherAppTransitionManager.java b/src/com/android/launcher3/LauncherAppTransitionManager.java
index fb50dfb..4bddc6a 100644
--- a/src/com/android/launcher3/LauncherAppTransitionManager.java
+++ b/src/com/android/launcher3/LauncherAppTransitionManager.java
@@ -51,4 +51,8 @@
         }
         return ActivityOptions.makeClipRevealAnimation(v, left, top, width, height);
     }
+
+    public boolean supportsAdaptiveIconAnimation() {
+        return false;
+    }
 }
diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java
index 49b380b..f964b8d 100644
--- a/src/com/android/launcher3/LauncherRootView.java
+++ b/src/com/android/launcher3/LauncherRootView.java
@@ -8,18 +8,22 @@
 import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.Color;
+import android.graphics.Insets;
 import android.graphics.Paint;
 import android.graphics.Rect;
 import android.os.Build;
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.ViewDebug;
+import android.view.WindowInsets;
 
 import java.util.Collections;
 import java.util.List;
 
 public class LauncherRootView extends InsettableFrameLayout {
 
+    private final Rect mTempRect = new Rect();
+
     private final Launcher mLauncher;
 
     private final Paint mOpaquePaint;
@@ -56,9 +60,7 @@
         super.onFinishInflate();
     }
 
-    @TargetApi(23)
-    @Override
-    protected boolean fitSystemWindows(Rect insets) {
+    private void handleSystemWindowInsets(Rect insets) {
         mConsumedInsets.setEmpty();
         boolean drawInsetBar = false;
         if (mLauncher.isInMultiWindowMode()
@@ -66,13 +68,13 @@
             mConsumedInsets.left = insets.left;
             mConsumedInsets.right = insets.right;
             mConsumedInsets.bottom = insets.bottom;
-            insets = new Rect(0, insets.top, 0, 0);
+            insets.set(0, insets.top, 0, 0);
             drawInsetBar = true;
         } else  if ((insets.right > 0 || insets.left > 0) &&
                 getContext().getSystemService(ActivityManager.class).isLowRamDevice()) {
             mConsumedInsets.left = insets.left;
             mConsumedInsets.right = insets.right;
-            insets = new Rect(0, insets.top, 0, insets.bottom);
+            insets.set(0, insets.top, 0, insets.bottom);
             drawInsetBar = true;
         }
 
@@ -99,8 +101,19 @@
         if (resetState) {
             mLauncher.getStateManager().reapplyState(true /* cancelCurrentAnimation */);
         }
+    }
 
-        return false; // Let children get the full insets
+    @Override
+    public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+        mTempRect.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(),
+                insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom());
+        handleSystemWindowInsets(mTempRect);
+        if (Utilities.ATLEAST_Q) {
+            return insets.inset(mConsumedInsets.left, mConsumedInsets.top,
+                    mConsumedInsets.right, mConsumedInsets.bottom);
+        } else {
+            return insets.replaceSystemWindowInsets(mTempRect);
+        }
     }
 
     @Override
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index fe6b522..8b03691 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -49,6 +49,7 @@
 import com.android.launcher3.anim.AnimatorSetBuilder;
 import com.android.launcher3.anim.PropertySetter;
 import com.android.launcher3.anim.PropertySetter.AnimatedPropertySetter;
+import com.android.launcher3.compat.AccessibilityManagerCompat;
 import com.android.launcher3.testing.TestProtocol;
 import com.android.launcher3.uioverrides.UiFactory;
 
@@ -496,6 +497,8 @@
         for (int i = mListeners.size() - 1; i >= 0; i--) {
             mListeners.get(i).onStateTransitionComplete(state);
         }
+
+        AccessibilityManagerCompat.sendStateEventToTest(mLauncher, state.ordinal);
     }
 
     public void onWindowFocusChanged() {
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index cc9bda7..7bdbb95 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -69,6 +69,7 @@
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
 import com.android.launcher3.graphics.RotationMode;
+import com.android.launcher3.graphics.TintedDrawableSpan;
 import com.android.launcher3.icons.LauncherIcons;
 import com.android.launcher3.shortcuts.DeepShortcutManager;
 import com.android.launcher3.shortcuts.ShortcutKey;
@@ -562,6 +563,20 @@
         return spanned;
     }
 
+    /**
+     * Prefixes a text with the provided icon
+     */
+    public static CharSequence prefixTextWithIcon(Context context, int iconRes, CharSequence msg) {
+        // Update the hint to contain the icon.
+        // Prefix the original hint with two spaces. The first space gets replaced by the icon
+        // using span. The second space is used for a singe space character between the hint
+        // and the icon.
+        SpannableString spanned = new SpannableString("  " + msg);
+        spanned.setSpan(new TintedDrawableSpan(context, iconRes),
+                0, 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
+        return spanned;
+    }
+
     public static SharedPreferences getPrefs(Context context) {
         return context.getSharedPreferences(
                 LauncherFiles.SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE);
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 0d43e21..ea9b077 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -26,6 +26,7 @@
 import android.text.Selection;
 import android.text.SpannableStringBuilder;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
@@ -625,14 +626,18 @@
 
     @Override
     public boolean dispatchTouchEvent(MotionEvent ev) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_START_TAG, "AllAppsContainerView.dispatchTouchEvent " + ev);
+        }
         final boolean result = super.dispatchTouchEvent(ev);
         switch (ev.getActionMasked()) {
             case MotionEvent.ACTION_DOWN:
-                if (result) mAllAppsStore.setDeferUpdates(true);
+                if (result) mAllAppsStore.enableDeferUpdates(
+                        AllAppsStore.DEFER_UPDATES_USER_INTERACTION);
                 break;
             case MotionEvent.ACTION_UP:
             case MotionEvent.ACTION_CANCEL:
-                mAllAppsStore.setDeferUpdates(false);
+                mAllAppsStore.disableDeferUpdates(AllAppsStore.DEFER_UPDATES_USER_INTERACTION);
                 break;
         }
         return result;
diff --git a/src/com/android/launcher3/allapps/AllAppsStore.java b/src/com/android/launcher3/allapps/AllAppsStore.java
index 8e7fec8..160042e 100644
--- a/src/com/android/launcher3/allapps/AllAppsStore.java
+++ b/src/com/android/launcher3/allapps/AllAppsStore.java
@@ -29,7 +29,6 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Set;
 import java.util.function.Consumer;
 import java.util.function.Predicate;
 
@@ -38,12 +37,19 @@
  */
 public class AllAppsStore {
 
+    // Defer updates flag used to defer all apps updates to the next draw.
+    public static final int DEFER_UPDATES_NEXT_DRAW = 1 << 0;
+    // Defer updates flag used to defer all apps updates while the user interacts with all apps.
+    public static final int DEFER_UPDATES_USER_INTERACTION = 1 << 1;
+    // Defer updates flag used to defer all apps updates by a test's request.
+    public static final int DEFER_UPDATES_TEST = 1 << 2;
+
     private PackageUserKey mTempKey = new PackageUserKey(null, null);
     private final HashMap<ComponentKey, AppInfo> mComponentToAppMap = new HashMap<>();
     private final List<OnUpdateListener> mUpdateListeners = new ArrayList<>();
     private final ArrayList<ViewGroup> mIconContainers = new ArrayList<>();
 
-    private boolean mDeferUpdates = false;
+    private int mDeferUpdatesFlags = 0;
     private boolean mUpdatePending = false;
 
     public Collection<AppInfo> getApps() {
@@ -62,17 +68,22 @@
         return mComponentToAppMap.get(key);
     }
 
-    public void setDeferUpdates(boolean deferUpdates) {
-        if (mDeferUpdates != deferUpdates) {
-            mDeferUpdates = deferUpdates;
+    public void enableDeferUpdates(int flag) {
+        mDeferUpdatesFlags |= flag;
+    }
 
-            if (!mDeferUpdates && mUpdatePending) {
-                notifyUpdate();
-                mUpdatePending = false;
-            }
+    public void disableDeferUpdates(int flag) {
+        mDeferUpdatesFlags &= ~flag;
+        if (mDeferUpdatesFlags == 0 && mUpdatePending) {
+            notifyUpdate();
+            mUpdatePending = false;
         }
     }
 
+    public int getDeferUpdatesFlags() {
+        return mDeferUpdatesFlags;
+    }
+
     /**
      * Adds or updates existing apps in the list
      */
@@ -95,7 +106,7 @@
 
 
     private void notifyUpdate() {
-        if (mDeferUpdates) {
+        if (mDeferUpdatesFlags != 0) {
             mUpdatePending = true;
             return;
         }
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index 1ff484b..31fcc8c 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -20,6 +20,7 @@
 import static android.view.View.MeasureSpec.makeMeasureSpec;
 
 import static com.android.launcher3.LauncherState.ALL_APPS_HEADER;
+import static com.android.launcher3.Utilities.prefixTextWithIcon;
 import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR;
 
 import android.content.Context;
@@ -40,6 +41,7 @@
 import com.android.launcher3.Insettable;
 import com.android.launcher3.Launcher;
 import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
 import com.android.launcher3.allapps.AllAppsContainerView;
 import com.android.launcher3.allapps.AllAppsStore;
 import com.android.launcher3.allapps.AlphabeticalAppsList;
@@ -89,14 +91,7 @@
         mFixedTranslationY = getTranslationY();
         mMarginTopAdjusting = mFixedTranslationY - getPaddingTop();
 
-        // Update the hint to contain the icon.
-        // Prefix the original hint with two spaces. The first space gets replaced by the icon
-        // using span. The second space is used for a singe space character between the hint
-        // and the icon.
-        SpannableString spanned = new SpannableString("  " + getHint());
-        spanned.setSpan(new TintedDrawableSpan(getContext(), R.drawable.ic_allapps_search),
-                0, 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
-        setHint(spanned);
+        setHint(prefixTextWithIcon(getContext(), R.drawable.ic_allapps_search, getHint()));
     }
 
     @Override
diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java
index 7e20d11..54d0db1 100644
--- a/src/com/android/launcher3/config/BaseFlags.java
+++ b/src/com/android/launcher3/config/BaseFlags.java
@@ -105,7 +105,7 @@
             "ENABLE_QUICKSTEP_LIVE_TILE", false, "Enable live tile in Quickstep overview");
 
     public static final TogglableFlag ENABLE_HINTS_IN_OVERVIEW = new TogglableFlag(
-            "ENABLE_HINTS_IN_OVERVIEW", false,
+            "ENABLE_HINTS_IN_OVERVIEW", true,
             "Show chip hints and gleams on the overview screen");
 
     public static final TogglableFlag FAKE_LANDSCAPE_UI = new TogglableFlag(
diff --git a/src/com/android/launcher3/graphics/TintedDrawableSpan.java b/src/com/android/launcher3/graphics/TintedDrawableSpan.java
index d719575..0bfc435 100644
--- a/src/com/android/launcher3/graphics/TintedDrawableSpan.java
+++ b/src/com/android/launcher3/graphics/TintedDrawableSpan.java
@@ -32,7 +32,7 @@
 
     public TintedDrawableSpan(Context context, int resourceId) {
         super(ALIGN_BOTTOM);
-        mDrawable = context.getDrawable(resourceId);
+        mDrawable = context.getDrawable(resourceId).mutate();
         mOldTint = 0;
         mDrawable.setTint(0);
     }
diff --git a/src/com/android/launcher3/icons/LauncherIcons.java b/src/com/android/launcher3/icons/LauncherIcons.java
index 3b74307..7632408 100644
--- a/src/com/android/launcher3/icons/LauncherIcons.java
+++ b/src/com/android/launcher3/icons/LauncherIcons.java
@@ -189,6 +189,7 @@
     private String getBadgePackage(ShortcutInfo si) {
         String whitelistedPkg = mContext.getString(R.string.shortcutinfo_badgepkg_whitelist);
         if (whitelistedPkg.equals(si.getPackage())
+                && si.getExtras() != null
                 && si.getExtras().containsKey(EXTRA_BADGEPKG)) {
             return si.getExtras().getString(EXTRA_BADGEPKG);
         }
diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java
index b8476aa..d2e1961 100644
--- a/src/com/android/launcher3/testing/TestInformationHandler.java
+++ b/src/com/android/launcher3/testing/TestInformationHandler.java
@@ -23,9 +23,13 @@
 import com.android.launcher3.Launcher;
 import com.android.launcher3.LauncherAppState;
 import com.android.launcher3.LauncherState;
+import com.android.launcher3.MainThreadExecutor;
 import com.android.launcher3.R;
+import com.android.launcher3.allapps.AllAppsStore;
 import com.android.launcher3.util.ResourceBasedOverride;
 
+import java.util.concurrent.ExecutionException;
+
 public class TestInformationHandler implements ResourceBasedOverride {
 
     public static TestInformationHandler newInstance(Context context) {
@@ -77,6 +81,32 @@
             case TestProtocol.REQUEST_DISABLE_DEBUG_TRACING:
                 TestProtocol.sDebugTracing = false;
                 break;
+
+            case TestProtocol.REQUEST_FREEZE_APP_LIST:
+                new MainThreadExecutor().execute(() ->
+                        mLauncher.getAppsView().getAppsStore().enableDeferUpdates(
+                                AllAppsStore.DEFER_UPDATES_TEST));
+                break;
+
+            case TestProtocol.REQUEST_UNFREEZE_APP_LIST:
+                new MainThreadExecutor().execute(() ->
+                        mLauncher.getAppsView().getAppsStore().disableDeferUpdates(
+                                AllAppsStore.DEFER_UPDATES_TEST));
+                break;
+
+            case TestProtocol.REQUEST_APP_LIST_FREEZE_FLAGS: {
+                try {
+                    final int deferUpdatesFlags = new MainThreadExecutor().submit(() ->
+                            mLauncher.getAppsView().getAppsStore().getDeferUpdatesFlags()).get();
+                    response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD,
+                            deferUpdatesFlags);
+                } catch (ExecutionException e) {
+                    throw new RuntimeException(e);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+                break;
+            }
         }
         return response;
     }
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 02e6bbd..6ffc2d9 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -57,6 +57,7 @@
     }
 
     public static final String TEST_INFO_RESPONSE_FIELD = "response";
+
     public static final String REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT =
             "home-to-overview-swipe-height";
     public static final String REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT =
@@ -65,6 +66,10 @@
             "all-apps-to-overview-swipe-height";
     public static final String REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT =
             "home-to-all-apps-swipe-height";
+    public static final String REQUEST_FREEZE_APP_LIST = "freeze-app-list";
+    public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list";
+    public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
+
     public static boolean sDebugTracing = false;
     public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
     public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing";
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index 4e5f7a5..6f53140 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -43,7 +43,6 @@
 import com.android.launcher3.anim.AnimationSuccessListener;
 import com.android.launcher3.anim.AnimatorPlaybackController;
 import com.android.launcher3.anim.AnimatorSetBuilder;
-import com.android.launcher3.compat.AccessibilityManagerCompat;
 import com.android.launcher3.testing.TestProtocol;
 import com.android.launcher3.userevent.nano.LauncherLogProto;
 import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
@@ -541,7 +540,6 @@
                 android.util.Log.e(
                         TestProtocol.NO_ALLAPPS_EVENT_TAG, "onSwipeInteractionCompleted 2");
             }
-            AccessibilityManagerCompat.sendStateEventToTest(mLauncher, targetState.ordinal);
         }
     }
 
diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java
index f858dc4..85f763d 100644
--- a/src/com/android/launcher3/touch/ItemClickHandler.java
+++ b/src/com/android/launcher3/touch/ItemClickHandler.java
@@ -49,6 +49,7 @@
 import com.android.launcher3.folder.FolderIcon;
 import com.android.launcher3.testing.TestProtocol;
 import com.android.launcher3.util.PackageManagerHelper;
+import com.android.launcher3.views.FloatingIconView;
 import com.android.launcher3.widget.PendingAppWidgetHostView;
 import com.android.launcher3.widget.WidgetAddFlowHandler;
 
@@ -259,6 +260,10 @@
                 intent.setPackage(null);
             }
         }
+        if (v != null && launcher.getAppTransitionManager().supportsAdaptiveIconAnimation()) {
+            // Preload the icon to reduce latency b/w swapping the floating view with the original.
+            FloatingIconView.fetchIcon(launcher, v, item, true /* isOpening */);
+        }
         launcher.startActivitySafely(v, intent, item, sourceContainer);
     }
 }
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index 939b0f2..ac152db 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -29,6 +29,7 @@
 import android.graphics.RectF;
 import android.os.Build;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.util.Property;
 import android.view.MotionEvent;
 import android.view.View;
@@ -240,6 +241,9 @@
 
     @Override
     public boolean dispatchTouchEvent(MotionEvent ev) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_START_TAG, "BaseDragLayer.dispatchTouchEvent " + ev);
+        }
         switch (ev.getAction()) {
             case ACTION_DOWN: {
                 float x = ev.getX();
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 339681c..b6c4fed 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -17,6 +17,7 @@
 
 import static com.android.launcher3.LauncherAnimUtils.DRAWABLE_ALPHA;
 import static com.android.launcher3.Utilities.getBadge;
+import static com.android.launcher3.Utilities.getFullDrawable;
 import static com.android.launcher3.Utilities.mapToRange;
 import static com.android.launcher3.anim.Interpolators.LINEAR;
 import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
@@ -42,6 +43,7 @@
 import android.os.CancellationSignal;
 import android.os.Handler;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewOutlineProvider;
@@ -65,6 +67,7 @@
 import com.android.launcher3.shortcuts.DeepShortcutView;
 
 import androidx.annotation.Nullable;
+import androidx.annotation.UiThread;
 import androidx.annotation.WorkerThread;
 import androidx.dynamicanimation.animation.FloatPropertyCompat;
 import androidx.dynamicanimation.animation.SpringAnimation;
@@ -77,6 +80,11 @@
 public class FloatingIconView extends View implements
         Animator.AnimatorListener, ClipPathView, OnGlobalLayoutListener {
 
+    private static final String TAG = FloatingIconView.class.getSimpleName();
+
+    // Manages loading the icon on a worker thread
+    private static @Nullable IconLoadResult sIconLoadResult;
+
     public static final float SHAPE_PROGRESS_DURATION = 0.10f;
     private static final int FADE_DURATION_MS = 200;
     private static final Rect sTmpRect = new Rect();
@@ -126,6 +134,8 @@
     private boolean mIsAdaptiveIcon = false;
     private boolean mIsOpening;
 
+    private IconLoadResult mIconLoadResult;
+
     private @Nullable Drawable mBadge;
     private @Nullable Drawable mForeground;
     private @Nullable Drawable mBackground;
@@ -299,8 +309,8 @@
      * @param v The view to copy
      * @param positionOut Rect that will hold the size and position of v.
      */
-    private void matchPositionOf(View v, RectF positionOut) {
-        float rotation = getLocationBoundsForView(v, positionOut);
+    private void matchPositionOf(Launcher launcher, View v, boolean isOpening, RectF positionOut) {
+        float rotation = getLocationBoundsForView(launcher, v, isOpening, positionOut);
         final LayoutParams lp = new LayoutParams(
                 Math.round(positionOut.width()),
                 Math.round(positionOut.height()));
@@ -328,8 +338,9 @@
      * - For DeepShortcutView, we return the bounds of the icon view.
      * - For BubbleTextView, we return the icon bounds.
      */
-    private float getLocationBoundsForView(View v, RectF outRect) {
-        boolean ignoreTransform = !mIsOpening;
+    private static float getLocationBoundsForView(Launcher launcher, View v, boolean isOpening,
+            RectF outRect) {
+        boolean ignoreTransform = !isOpening;
         if (v instanceof DeepShortcutView) {
             v = ((DeepShortcutView) v).getBubbleText();
             ignoreTransform = false;
@@ -353,7 +364,7 @@
         float[] points = new float[] {iconBounds.left, iconBounds.top, iconBounds.right,
                 iconBounds.bottom};
         float[] rotation = new float[] {0};
-        Utilities.getDescendantCoordRelativeToAncestor(v, mLauncher.getDragLayer(), points,
+        Utilities.getDescendantCoordRelativeToAncestor(v, launcher.getDragLayer(), points,
                 false, ignoreTransform, rotation);
         outRect.set(
                 Math.min(points[0], points[2]),
@@ -363,148 +374,217 @@
         return rotation[0];
     }
 
+    /**
+     * Loads the icon and saves the results to {@link #sIconLoadResult}.
+     * Runs onIconLoaded callback (if any), which signifies that the FloatingIconView is
+     * ready to display the icon. Otherwise, the FloatingIconView will grab the results when its
+     * initialized.
+     *
+     * @param originalView The View that the FloatingIconView will replace.
+     * @param info ItemInfo of the originalView
+     * @param pos The position of the view.
+     */
     @WorkerThread
     @SuppressWarnings("WrongThread")
-    private void getIcon(View v, ItemInfo info, boolean isOpening,
-            Runnable onIconLoadedRunnable, CancellationSignal loadIconSignal) {
-        final LayoutParams lp = (LayoutParams) getLayoutParams();
+    private static void getIconResult(Launcher l, View originalView, ItemInfo info, RectF pos,
+            IconLoadResult iconLoadResult) {
         Drawable drawable = null;
+        Drawable badge = null;
         boolean supportsAdaptiveIcons = ADAPTIVE_ICON_WINDOW_ANIM.get()
                 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
-        Drawable btvIcon = v instanceof BubbleTextView ? ((BubbleTextView) v).getIcon() : null;
+        Drawable btvIcon = originalView instanceof BubbleTextView
+                ? ((BubbleTextView) originalView).getIcon() : null;
         if (info instanceof SystemShortcut) {
-            if (v instanceof ImageView) {
-                drawable = ((ImageView) v).getDrawable();
-            } else if (v instanceof DeepShortcutView) {
-                drawable = ((DeepShortcutView) v).getIconView().getBackground();
+            if (originalView instanceof ImageView) {
+                drawable = ((ImageView) originalView).getDrawable();
+            } else if (originalView instanceof DeepShortcutView) {
+                drawable = ((DeepShortcutView) originalView).getIconView().getBackground();
             } else {
-                drawable = v.getBackground();
+                drawable = originalView.getBackground();
             }
         } else {
-            boolean isFolderIcon = v instanceof FolderIcon;
-            int width = isFolderIcon ? v.getWidth() : lp.width;
-            int height = isFolderIcon ? v.getHeight() : lp.height;
+            boolean isFolderIcon = originalView instanceof FolderIcon;
+            int width = isFolderIcon ? originalView.getWidth() : (int) pos.width();
+            int height = isFolderIcon ? originalView.getHeight() : (int) pos.height();
             if (supportsAdaptiveIcons) {
-                drawable = Utilities.getFullDrawable(mLauncher, info, width, height, false,
-                        sTmpObjArray);
+                drawable = getFullDrawable(l, info, width, height, false, sTmpObjArray);
                 if (drawable instanceof AdaptiveIconDrawable) {
-                    mBadge = getBadge(mLauncher, info, sTmpObjArray[0]);
+                    badge = getBadge(l, info, sTmpObjArray[0]);
                 } else {
                     // The drawable we get back is not an adaptive icon, so we need to use the
                     // BubbleTextView icon that is already legacy treated.
                     drawable = btvIcon;
                 }
             } else {
-                if (v instanceof BubbleTextView) {
+                if (originalView instanceof BubbleTextView) {
                     // Similar to DragView, we simply use the BubbleTextView icon here.
                     drawable = btvIcon;
                 } else {
-                    drawable = Utilities.getFullDrawable(mLauncher, info, width, height, false,
-                            sTmpObjArray);
+                    drawable = getFullDrawable(l, info, width, height, false, sTmpObjArray);
                 }
             }
         }
 
-        Drawable finalDrawable = drawable == null ? null
-                : drawable.getConstantState().newDrawable();
-        boolean isAdaptiveIcon = supportsAdaptiveIcons
-                && finalDrawable instanceof AdaptiveIconDrawable;
-        int iconOffset = getOffsetForIconBounds(finalDrawable);
+        drawable = drawable == null ? null : drawable.getConstantState().newDrawable();
+        int iconOffset = getOffsetForIconBounds(l, drawable, pos);
+        synchronized (iconLoadResult) {
+            iconLoadResult.drawable = drawable;
+            iconLoadResult.badge = badge;
+            iconLoadResult.iconOffset = iconOffset;
+            if (iconLoadResult.onIconLoaded != null) {
+                l.getMainExecutor().execute(iconLoadResult.onIconLoaded);
+                iconLoadResult.onIconLoaded = null;
+            }
+            iconLoadResult.isIconLoaded = true;
+        }
+    }
 
-        mLauncher.getMainExecutor().execute(() -> {
-            if (isAdaptiveIcon) {
-                mIsAdaptiveIcon = true;
-                boolean isFolderIcon = finalDrawable instanceof FolderAdaptiveIcon;
+    /**
+     * Sets the drawables of the {@param originalView} onto this view.
+     *
+     * @param originalView The View that the FloatingIconView will replace.
+     * @param drawable The drawable of the original view.
+     * @param badge The badge of the original view.
+     * @param iconOffset The amount of offset needed to match this view with the original view.
+     */
+    @UiThread
+    private void setIcon(View originalView, @Nullable Drawable drawable, @Nullable Drawable badge,
+            int iconOffset) {
+        mBadge = badge;
 
-                AdaptiveIconDrawable adaptiveIcon = (AdaptiveIconDrawable) finalDrawable;
-                Drawable background = adaptiveIcon.getBackground();
-                if (background == null) {
-                    background = new ColorDrawable(Color.TRANSPARENT);
+        mIsAdaptiveIcon = drawable instanceof AdaptiveIconDrawable;
+        if (mIsAdaptiveIcon) {
+            boolean isFolderIcon = drawable instanceof FolderAdaptiveIcon;
+
+            AdaptiveIconDrawable adaptiveIcon = (AdaptiveIconDrawable) drawable;
+            Drawable background = adaptiveIcon.getBackground();
+            if (background == null) {
+                background = new ColorDrawable(Color.TRANSPARENT);
+            }
+            mBackground = background;
+            Drawable foreground = adaptiveIcon.getForeground();
+            if (foreground == null) {
+                foreground = new ColorDrawable(Color.TRANSPARENT);
+            }
+            mForeground = foreground;
+
+            final LayoutParams lp = (LayoutParams) getLayoutParams();
+            final int originalHeight = lp.height;
+            final int originalWidth = lp.width;
+
+            int blurMargin = mBlurSizeOutline / 2;
+            mFinalDrawableBounds.set(0, 0, originalWidth, originalHeight);
+
+            if (!isFolderIcon) {
+                mFinalDrawableBounds.inset(iconOffset - blurMargin, iconOffset - blurMargin);
+            }
+            mForeground.setBounds(mFinalDrawableBounds);
+            mBackground.setBounds(mFinalDrawableBounds);
+
+            mStartRevealRect.set(0, 0, originalWidth, originalHeight);
+
+            if (mBadge != null) {
+                mBadge.setBounds(mStartRevealRect);
+                if (!mIsOpening && !isFolderIcon) {
+                    DRAWABLE_ALPHA.set(mBadge, 0);
                 }
-                mBackground = background;
-                Drawable foreground = adaptiveIcon.getForeground();
-                if (foreground == null) {
-                    foreground = new ColorDrawable(Color.TRANSPARENT);
+            }
+
+            if (isFolderIcon) {
+                ((FolderIcon) originalView).getPreviewBounds(sTmpRect);
+                float bgStroke = ((FolderIcon) originalView).getBackgroundStrokeWidth();
+                if (mForeground instanceof ShiftedBitmapDrawable) {
+                    ShiftedBitmapDrawable sbd = (ShiftedBitmapDrawable) mForeground;
+                    sbd.setShiftX(sbd.getShiftX() - sTmpRect.left - bgStroke);
+                    sbd.setShiftY(sbd.getShiftY() - sTmpRect.top - bgStroke);
                 }
-                mForeground = foreground;
-
-                final int originalHeight = lp.height;
-                final int originalWidth = lp.width;
-
-                int blurMargin = mBlurSizeOutline / 2;
-                mFinalDrawableBounds.set(0, 0, originalWidth, originalHeight);
-                if (!isFolderIcon) {
-                    mFinalDrawableBounds.inset(iconOffset - blurMargin, iconOffset - blurMargin);
+                if (mBadge instanceof ShiftedBitmapDrawable) {
+                    ShiftedBitmapDrawable sbd = (ShiftedBitmapDrawable) mBadge;
+                    sbd.setShiftX(sbd.getShiftX() - sTmpRect.left - bgStroke);
+                    sbd.setShiftY(sbd.getShiftY() - sTmpRect.top - bgStroke);
                 }
-                mForeground.setBounds(mFinalDrawableBounds);
-                mBackground.setBounds(mFinalDrawableBounds);
-
-                mStartRevealRect.set(0, 0, originalWidth, originalHeight);
-
-                if (mBadge != null) {
-                    mBadge.setBounds(mStartRevealRect);
-                    if (!isOpening && !isFolderIcon) {
-                        DRAWABLE_ALPHA.set(mBadge, 0);
-                    }
-                }
-
-                if (isFolderIcon) {
-                    ((FolderIcon) v).getPreviewBounds(sTmpRect);
-                    float bgStroke = ((FolderIcon) v).getBackgroundStrokeWidth();
-                    if (mForeground instanceof ShiftedBitmapDrawable) {
-                        ShiftedBitmapDrawable sbd = (ShiftedBitmapDrawable) mForeground;
-                        sbd.setShiftX(sbd.getShiftX() - sTmpRect.left - bgStroke);
-                        sbd.setShiftY(sbd.getShiftY() - sTmpRect.top - bgStroke);
-                    }
-                    if (mBadge instanceof ShiftedBitmapDrawable) {
-                        ShiftedBitmapDrawable sbd = (ShiftedBitmapDrawable) mBadge;
-                        sbd.setShiftX(sbd.getShiftX() - sTmpRect.left - bgStroke);
-                        sbd.setShiftY(sbd.getShiftY() - sTmpRect.top - bgStroke);
-                    }
-                } else {
-                    Utilities.scaleRectAboutCenter(mStartRevealRect,
-                            IconShape.getNormalizationScale());
-                }
-
-                float aspectRatio = mLauncher.getDeviceProfile().aspectRatio;
-                if (mIsVerticalBarLayout) {
-                    lp.width = (int) Math.max(lp.width, lp.height * aspectRatio);
-                } else {
-                    lp.height = (int) Math.max(lp.height, lp.width * aspectRatio);
-                }
-                layout(lp.leftMargin, lp.topMargin, lp.leftMargin + lp.width, lp.topMargin
-                        + lp.height);
-
-                float scale = Math.max((float) lp.height / originalHeight,
-                        (float) lp.width / originalWidth);
-                float bgDrawableStartScale;
-                if (isOpening) {
-                    bgDrawableStartScale = 1f;
-                    mOutline.set(0, 0, originalWidth, originalHeight);
-                } else {
-                    bgDrawableStartScale = scale;
-                    mOutline.set(0, 0, lp.width, lp.height);
-                }
-                setBackgroundDrawableBounds(bgDrawableStartScale);
-                mEndRevealRect.set(0, 0, lp.width, lp.height);
-                setOutlineProvider(new ViewOutlineProvider() {
-                    @Override
-                    public void getOutline(View view, Outline outline) {
-                        outline.setRoundRect(mOutline, mTaskCornerRadius);
-                    }
-                });
-                setClipToOutline(true);
             } else {
-                setBackground(finalDrawable);
-                setClipToOutline(false);
+                Utilities.scaleRectAboutCenter(mStartRevealRect,
+                        IconShape.getNormalizationScale());
             }
 
-            if (!loadIconSignal.isCanceled()) {
-                onIconLoadedRunnable.run();
+            float aspectRatio = mLauncher.getDeviceProfile().aspectRatio;
+            if (mIsVerticalBarLayout) {
+                lp.width = (int) Math.max(lp.width, lp.height * aspectRatio);
+            } else {
+                lp.height = (int) Math.max(lp.height, lp.width * aspectRatio);
             }
-            invalidate();
-            invalidateOutline();
-        });
+            layout(lp.leftMargin, lp.topMargin, lp.leftMargin + lp.width, lp.topMargin
+                    + lp.height);
+
+            float scale = Math.max((float) lp.height / originalHeight,
+                    (float) lp.width / originalWidth);
+            float bgDrawableStartScale;
+            if (mIsOpening) {
+                bgDrawableStartScale = 1f;
+                mOutline.set(0, 0, originalWidth, originalHeight);
+            } else {
+                bgDrawableStartScale = scale;
+                mOutline.set(0, 0, lp.width, lp.height);
+            }
+            setBackgroundDrawableBounds(bgDrawableStartScale);
+            mEndRevealRect.set(0, 0, lp.width, lp.height);
+            setOutlineProvider(new ViewOutlineProvider() {
+                @Override
+                public void getOutline(View view, Outline outline) {
+                    outline.setRoundRect(mOutline, mTaskCornerRadius);
+                }
+            });
+            setClipToOutline(true);
+        } else {
+            setBackground(drawable);
+            setClipToOutline(false);
+        }
+
+        invalidate();
+        invalidateOutline();
+    }
+
+    /**
+     * Checks if the icon result is loaded. If true, we set the icon immediately. Else, we add a
+     * callback to set the icon once the icon result is loaded.
+     */
+    private void checkIconResult(View originalView, boolean isOpening) {
+        CancellationSignal cancellationSignal = new CancellationSignal();
+        if (!isOpening) {
+            // Hide immediately since the floating view starts at a different location.
+            originalView.setVisibility(INVISIBLE);
+            cancellationSignal.setOnCancelListener(() -> originalView.setVisibility(VISIBLE));
+        }
+
+        if (mIconLoadResult == null) {
+            Log.w(TAG, "No icon load result found in checkIconResult");
+            return;
+        }
+
+        synchronized (mIconLoadResult) {
+            if (mIconLoadResult.isIconLoaded) {
+                setIcon(originalView, mIconLoadResult.drawable, mIconLoadResult.badge,
+                        mIconLoadResult.iconOffset);
+                if (isOpening) {
+                    originalView.setVisibility(INVISIBLE);
+                }
+            } else {
+                mIconLoadResult.onIconLoaded = () -> {
+                    if (cancellationSignal.isCanceled()) {
+                        return;
+                    }
+                    if (mIconLoadResult.isIconLoaded) {
+                        setIcon(originalView, mIconLoadResult.drawable, mIconLoadResult.badge,
+                                mIconLoadResult.iconOffset);
+                    }
+                    // Delay swapping views until the icon is loaded to prevent a flash.
+                    setVisibility(VISIBLE);
+                    originalView.setVisibility(INVISIBLE);
+                };
+            }
+        }
+        mLoadIconSignal = cancellationSignal;
     }
 
     private void setBackgroundDrawableBounds(float scale) {
@@ -521,17 +601,19 @@
 
     @WorkerThread
     @SuppressWarnings("WrongThread")
-    private int getOffsetForIconBounds(Drawable drawable) {
+    private static int getOffsetForIconBounds(Launcher l, Drawable drawable, RectF position) {
         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O ||
                 !(drawable instanceof AdaptiveIconDrawable)) {
             return 0;
         }
+        int blurSizeOutline =
+                l.getResources().getDimensionPixelSize(R.dimen.blur_size_medium_outline);
 
-        final LayoutParams lp = (LayoutParams) getLayoutParams();
-        Rect bounds = new Rect(0, 0, lp.width + mBlurSizeOutline, lp.height + mBlurSizeOutline);
-        bounds.inset(mBlurSizeOutline / 2, mBlurSizeOutline / 2);
+        Rect bounds = new Rect(0, 0, (int) position.width() + blurSizeOutline,
+                (int) position.height() + blurSizeOutline);
+        bounds.inset(blurSizeOutline / 2, blurSizeOutline / 2);
 
-        try (LauncherIcons li = LauncherIcons.obtain(mLauncher)) {
+        try (LauncherIcons li = LauncherIcons.obtain(l)) {
             Utilities.scaleRectAboutCenter(bounds, li.getNormalizer().getScale(drawable, null,
                     null, null));
         }
@@ -587,7 +669,11 @@
     }
 
     @Override
-    public void onAnimationStart(Animator animator) {}
+    public void onAnimationStart(Animator animator) {
+        if (mIconLoadResult != null && mIconLoadResult.isIconLoaded) {
+            setVisibility(View.VISIBLE);
+        }
+    }
 
     @Override
     public void onAnimationCancel(Animator animator) {}
@@ -598,7 +684,8 @@
     @Override
     public void onGlobalLayout() {
         if (mOriginalIcon.isAttachedToWindow() && mPositionOut != null) {
-            float rotation = getLocationBoundsForView(mOriginalIcon, sTmpRectF);
+            float rotation = getLocationBoundsForView(mLauncher, mOriginalIcon, mIsOpening,
+                    sTmpRectF);
             if (rotation != mRotation || !sTmpRectF.equals(mPositionOut)) {
                 updatePosition(rotation, sTmpRectF, (LayoutParams) getLayoutParams());
                 if (mOnTargetChangeRunnable != null) {
@@ -613,6 +700,22 @@
     }
 
     /**
+     * Loads the icon drawable on a worker thread to reduce latency between swapping views.
+     */
+    @UiThread
+    public static IconLoadResult fetchIcon(Launcher l, View v, ItemInfo info, boolean isOpening) {
+        IconLoadResult result = new IconLoadResult();
+        new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> {
+            RectF position = new RectF();
+            getLocationBoundsForView(l, v, isOpening, position);
+            getIconResult(l, v, info, position, result);
+        });
+
+        sIconLoadResult = result;
+        return result;
+    }
+
+    /**
      * Creates a floating icon view for {@param originalView}.
      * @param originalView The view to copy
      * @param hideOriginal If true, it will hide {@param originalView} while this view is visible.
@@ -624,38 +727,30 @@
             boolean hideOriginal, RectF positionOut, boolean isOpening) {
         final DragLayer dragLayer = launcher.getDragLayer();
         ViewGroup parent = (ViewGroup) dragLayer.getParent();
-
         FloatingIconView view = launcher.getViewCache().getView(R.layout.floating_icon_view,
                 launcher, parent);
         view.recycle();
 
+        // Get the drawable on the background thread
+        boolean shouldLoadIcon = originalView.getTag() instanceof ItemInfo && hideOriginal;
+        view.mIconLoadResult = sIconLoadResult;
+        if (shouldLoadIcon && view.mIconLoadResult == null) {
+            view.mIconLoadResult = fetchIcon(launcher, originalView,
+                    (ItemInfo) originalView.getTag(), isOpening);
+        }
+        sIconLoadResult = null;
+
         view.mIsVerticalBarLayout = launcher.getDeviceProfile().isVerticalBarLayout();
         view.mIsOpening = isOpening;
-
         view.mOriginalIcon = originalView;
         view.mPositionOut = positionOut;
-        // Match the position of the original view.
-        view.matchPositionOf(originalView, positionOut);
 
-        // Get the drawable on the background thread
+        // Match the position of the original view.
+        view.matchPositionOf(launcher, originalView, isOpening, positionOut);
+
         // Must be called after matchPositionOf so that we know what size to load.
-        if (originalView.getTag() instanceof ItemInfo && hideOriginal) {
-            view.mLoadIconSignal = new CancellationSignal();
-            Runnable onIconLoaded = () -> {
-                // Delay swapping views until the icon is loaded to prevent a flash.
-                view.setVisibility(VISIBLE);
-                originalView.setVisibility(INVISIBLE);
-            };
-            if (!isOpening) {
-                // Hide immediately since the floating view starts at a different location.
-                originalView.setVisibility(INVISIBLE);
-                view.mLoadIconSignal.setOnCancelListener(() -> originalView.setVisibility(VISIBLE));
-            }
-            CancellationSignal loadIconSignal = view.mLoadIconSignal;
-            new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> {
-                view.getIcon(originalView, (ItemInfo) originalView.getTag(), isOpening,
-                        onIconLoaded, loadIconSignal);
-            });
+        if (shouldLoadIcon) {
+            view.checkIconResult(originalView, isOpening);
         }
 
         // We need to add it to the overlay, but keep it invisible until animation starts..
@@ -779,5 +874,14 @@
         mFgSpringY.cancel();
         mBadge = null;
         sTmpObjArray[0] = null;
+        mIconLoadResult = null;
+    }
+
+    private static class IconLoadResult {
+        Drawable drawable;
+        Drawable badge;
+        int iconOffset;
+        Runnable onIconLoaded;
+        boolean isIconLoaded;
     }
 }
diff --git a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java
index 35e44bb..dce839f 100644
--- a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java
@@ -44,6 +44,7 @@
 import com.android.launcher3.StylusEventHelper;
 import com.android.launcher3.Utilities;
 import com.android.launcher3.dragndrop.DragLayer;
+import com.android.launcher3.util.Themes;
 import com.android.launcher3.views.BaseDragLayer.TouchCompleteListener;
 
 /**
@@ -97,6 +98,9 @@
         if (Utilities.ATLEAST_OREO) {
             setExecutor(Utilities.THREAD_POOL_EXECUTOR);
         }
+        if (Utilities.ATLEAST_Q && Themes.getAttrBoolean(mLauncher, R.attr.isWorkspaceDarkText)) {
+            setOnLightBackground(true);
+        }
     }
 
     @Override
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 64fe2d7..abc93cd 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -395,7 +395,7 @@
                         DEFAULT_UI_TIMEOUT));
     }
 
-    protected static String resolveSystemApp(String category) {
+    public static String resolveSystemApp(String category) {
         return getInstrumentation().getContext().getPackageManager().resolveActivity(
                 new Intent(Intent.ACTION_MAIN).addCategory(category),
                 PackageManager.MATCH_SYSTEM_ONLY).
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index 4f8b87c..d171004 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -108,47 +108,63 @@
     @Test
     @Ignore
     public void testPressHomeOnAllAppsContextMenu() throws Exception {
-        mLauncher.getWorkspace().switchToAllApps().getAppIcon("TestActivity7").openMenu();
+        final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
+        allApps.freeze();
+        try {
+            allApps.getAppIcon("TestActivity7").openMenu();
+        } finally {
+            allApps.unfreeze();
+        }
         mLauncher.pressHome();
     }
 
     public static void runAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
-        assertNotNull("allApps parameter is null", allApps);
+        allApps.freeze();
+        try {
+            assertNotNull("allApps parameter is null", allApps);
 
-        assertTrue(
-                "Launcher internal state is not All Apps", test.isInState(LauncherState.ALL_APPS));
+            assertTrue(
+                    "Launcher internal state is not All Apps",
+                    test.isInState(LauncherState.ALL_APPS));
 
-        // Test flinging forward and backward.
-        test.executeOnLauncher(launcher -> assertEquals(
-                "All Apps started in already scrolled state", 0, test.getAllAppsScroll(launcher)));
+            // Test flinging forward and backward.
+            test.executeOnLauncher(launcher -> assertEquals(
+                    "All Apps started in already scrolled state", 0,
+                    test.getAllAppsScroll(launcher)));
 
-        allApps.flingForward();
-        assertTrue("Launcher internal state is not All Apps",
-                test.isInState(LauncherState.ALL_APPS));
-        final Integer flingForwardY = test.getFromLauncher(
-                launcher -> test.getAllAppsScroll(launcher));
-        test.executeOnLauncher(
-                launcher -> assertTrue("flingForward() didn't scroll App Apps", flingForwardY > 0));
+            allApps.flingForward();
+            assertTrue("Launcher internal state is not All Apps",
+                    test.isInState(LauncherState.ALL_APPS));
+            final Integer flingForwardY = test.getFromLauncher(
+                    launcher -> test.getAllAppsScroll(launcher));
+            test.executeOnLauncher(
+                    launcher -> assertTrue("flingForward() didn't scroll App Apps",
+                            flingForwardY > 0));
 
-        allApps.flingBackward();
-        assertTrue(
-                "Launcher internal state is not All Apps", test.isInState(LauncherState.ALL_APPS));
-        final Integer flingBackwardY = test.getFromLauncher(
-                launcher -> test.getAllAppsScroll(launcher));
-        test.executeOnLauncher(launcher -> assertTrue("flingBackward() didn't scroll App Apps",
-                flingBackwardY < flingForwardY));
+            allApps.flingBackward();
+            assertTrue(
+                    "Launcher internal state is not All Apps",
+                    test.isInState(LauncherState.ALL_APPS));
+            final Integer flingBackwardY = test.getFromLauncher(
+                    launcher -> test.getAllAppsScroll(launcher));
+            test.executeOnLauncher(launcher -> assertTrue("flingBackward() didn't scroll App Apps",
+                    flingBackwardY < flingForwardY));
 
-        // Test scrolling down to YouTube.
-        assertNotNull("All apps: can't fine YouTube", allApps.getAppIcon("YouTube"));
-        // Test scrolling up to Camera.
-        assertNotNull("All apps: can't fine Camera", allApps.getAppIcon("Camera"));
-        // Test failing to find a non-existing app.
-        final AllApps allAppsFinal = allApps;
-        expectFail("All apps: could find a non-existing app",
-                () -> allAppsFinal.getAppIcon("NO APP"));
+            // Test scrolling down to YouTube.
+            assertNotNull("All apps: can't fine YouTube", allApps.getAppIcon("YouTube"));
+            // Test scrolling up to Camera.
+            assertNotNull("All apps: can't fine Camera", allApps.getAppIcon("Camera"));
+            // Test failing to find a non-existing app.
+            final AllApps allAppsFinal = allApps;
+            expectFail("All apps: could find a non-existing app",
+                    () -> allAppsFinal.getAppIcon("NO APP"));
 
-        assertTrue(
-                "Launcher internal state is not All Apps", test.isInState(LauncherState.ALL_APPS));
+            assertTrue(
+                    "Launcher internal state is not All Apps",
+                    test.isInState(LauncherState.ALL_APPS));
+        } finally {
+            allApps.unfreeze();
+        }
     }
 
     @Test
@@ -199,12 +215,17 @@
     }
 
     public static void runIconLaunchFromAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
-        final AppIcon app = allApps.getAppIcon("TestActivity7");
-        assertNotNull("AppIcon.launch returned null", app.launch(getAppPackageName()));
-        test.executeOnLauncher(launcher -> assertTrue(
-                "Launcher activity is the top activity; expecting another activity to be the top "
-                        + "one",
-                test.isInBackground(launcher)));
+        allApps.freeze();
+        try {
+            final AppIcon app = allApps.getAppIcon("TestActivity7");
+            assertNotNull("AppIcon.launch returned null", app.launch(getAppPackageName()));
+            test.executeOnLauncher(launcher -> assertTrue(
+                    "Launcher activity is the top activity; expecting another activity to be the top "
+                            + "one",
+                    test.isInBackground(launcher)));
+        } finally {
+            allApps.unfreeze();
+        }
     }
 
     @Test
@@ -260,20 +281,23 @@
     public void testLaunchMenuItem() throws Exception {
         if (!TestHelpers.isInLauncherProcess()) return;
 
-        final AppIconMenu menu = mLauncher.
+        final AllApps allApps = mLauncher.
                 getWorkspace().
-                switchToAllApps().
-                getAppIcon(APP_NAME).
-                openMenu();
+                switchToAllApps();
+        allApps.freeze();
+        try {
+            final AppIconMenu menu = allApps.
+                    getAppIcon(APP_NAME).
+                    openMenu();
 
-        executeOnLauncher(
-                launcher -> assertTrue("Launcher internal state didn't switch to Showing Menu",
-                        isOptionsPopupVisible(launcher)));
+            executeOnLauncher(
+                    launcher -> assertTrue("Launcher internal state didn't switch to Showing Menu",
+                            isOptionsPopupVisible(launcher)));
 
-        final AppIconMenuItem menuItem = menu.getMenuItem(1);
-        final String itemName = menuItem.getText();
-
-        menuItem.launch(getAppPackageName());
+            menu.getMenuItem(1).launch(getAppPackageName());
+        } finally {
+            allApps.unfreeze();
+        }
     }
 
     @Test
@@ -282,12 +306,18 @@
         // 1. Open all apps and wait for load complete.
         // 2. Drag icon to homescreen.
         // 3. Verify that the icon works on homescreen.
-        mLauncher.getWorkspace().
-                switchToAllApps().
-                getAppIcon(APP_NAME).
-                dragToWorkspace().
-                getWorkspaceAppIcon(APP_NAME).
-                launch(getAppPackageName());
+        final AllApps allApps = mLauncher.getWorkspace().
+                switchToAllApps();
+        allApps.freeze();
+        try {
+            allApps.
+                    getAppIcon(APP_NAME).
+                    dragToWorkspace().
+                    getWorkspaceAppIcon(APP_NAME).
+                    launch(getAppPackageName());
+        } finally {
+            allApps.unfreeze();
+        }
         executeOnLauncher(launcher -> assertTrue(
                 "Launcher activity is the top activity; expecting another activity to be the top "
                         + "one",
@@ -302,21 +332,27 @@
         // 1. Open all apps and wait for load complete.
         // 2. Find the app and long press it to show shortcuts.
         // 3. Press icon center until shortcuts appear
-        final AppIconMenuItem menuItem = mLauncher.
+        final AllApps allApps = mLauncher.
                 getWorkspace().
-                switchToAllApps().
-                getAppIcon(APP_NAME).
-                openMenu().
-                getMenuItem(0);
-        final String shortcutName = menuItem.getText();
+                switchToAllApps();
+        allApps.freeze();
+        try {
+            final AppIconMenuItem menuItem = allApps.
+                    getAppIcon(APP_NAME).
+                    openMenu().
+                    getMenuItem(0);
+            final String shortcutName = menuItem.getText();
 
-        // 4. Drag the first shortcut to the home screen.
-        // 5. Verify that the shortcut works on home screen
-        //    (the app opens and has the same text as the shortcut).
-        menuItem.
-                dragToWorkspace().
-                getWorkspaceAppIcon(shortcutName).
-                launch(getAppPackageName());
+            // 4. Drag the first shortcut to the home screen.
+            // 5. Verify that the shortcut works on home screen
+            //    (the app opens and has the same text as the shortcut).
+            menuItem.
+                    dragToWorkspace().
+                    getWorkspaceAppIcon(shortcutName).
+                    launch(getAppPackageName());
+        } finally {
+            allApps.unfreeze();
+        }
     }
 
     public static String getAppPackageName() {
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index d03035a..9ff354a 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -16,8 +16,6 @@
 
 package com.android.launcher3.tapl;
 
-import static com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel.ZERO_BUTTON;
-
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.widget.TextView;
@@ -36,7 +34,6 @@
  */
 public class AllApps extends LauncherInstrumentation.VisibleContainer {
     private static final int MAX_SCROLL_ATTEMPTS = 40;
-    private static final int MIN_INTERACT_SIZE = 100;
 
     private final int mHeight;
 
@@ -48,6 +45,7 @@
                 "apps_list_view");
         // Wait for the recycler to populate.
         mLauncher.waitForObjectInContainer(appListRecycler, By.clazz(TextView.class));
+        verifyNotFrozen("All apps freeze flags upon opening all apps");
     }
 
     @Override
@@ -64,13 +62,6 @@
         }
         final Rect iconBounds = icon.getVisibleBounds();
         LauncherInstrumentation.log("hasClickableIcon: icon bounds: " + iconBounds);
-        if (mLauncher.getNavigationModel() != ZERO_BUTTON) {
-            final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame");
-            if (iconBounds.bottom >= navBar.getVisibleBounds().top) {
-                LauncherInstrumentation.log("hasClickableIcon: icon intersects with nav bar");
-                return false;
-            }
-        }
         if (iconCenterInSearchBox(allAppsContainer, icon)) {
             LauncherInstrumentation.log("hasClickableIcon: icon center is under search box");
             return false;
@@ -95,7 +86,7 @@
     @NonNull
     public AppIcon getAppIcon(String appName) {
         try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
-                "want to get app icon " + appName + " on all apps")) {
+                "getting app icon " + appName + " on all apps")) {
             final UiObject2 allAppsContainer = verifyActiveContainer();
             final UiObject2 appListRecycler = mLauncher.waitForObjectInContainer(allAppsContainer,
                     "apps_list_view");
@@ -109,21 +100,28 @@
             if (!hasClickableIcon(allAppsContainer, appListRecycler, appIconSelector)) {
                 scrollBackToBeginning();
                 int attempts = 0;
+                int scroll = getScroll(allAppsContainer);
                 try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("scrolled")) {
-                    while (!hasClickableIcon(allAppsContainer, appListRecycler, appIconSelector) &&
-                            allAppsContainer.scroll(Direction.DOWN, 0.8f)) {
+                    while (!hasClickableIcon(allAppsContainer, appListRecycler, appIconSelector)) {
+                        mLauncher.scroll(allAppsContainer, Direction.DOWN, 0.8f, null, 50);
+                        final int newScroll = getScroll(allAppsContainer);
+                        if (newScroll == scroll) break;
+
                         mLauncher.assertTrue(
                                 "Exceeded max scroll attempts: " + MAX_SCROLL_ATTEMPTS,
                                 ++attempts <= MAX_SCROLL_ATTEMPTS);
                         verifyActiveContainer();
+                        scroll = newScroll;
                     }
                 }
                 verifyActiveContainer();
             }
 
+            mLauncher.assertTrue("Unable to scroll to a clickable icon: " + appName,
+                    hasClickableIcon(allAppsContainer, appListRecycler, appIconSelector));
+
             final UiObject2 appIcon = mLauncher.getObjectInContainer(appListRecycler,
                     appIconSelector);
-            ensureIconVisible(appIcon, allAppsContainer, appListRecycler);
             return new AppIcon(mLauncher, appIcon);
         }
     }
@@ -161,24 +159,6 @@
                 getInt(TestProtocol.SCROLL_Y_FIELD, -1);
     }
 
-    private void ensureIconVisible(
-            UiObject2 appIcon, UiObject2 allAppsContainer, UiObject2 appListRecycler) {
-        final int appHeight = appIcon.getVisibleBounds().height();
-        if (appHeight < MIN_INTERACT_SIZE) {
-            // Try to figure out how much percentage of the container needs to be scrolled in order
-            // to reveal the app icon to have the MIN_INTERACT_SIZE
-            final float pct = Math.max(((float) (MIN_INTERACT_SIZE - appHeight)) / mHeight, 0.2f);
-            mLauncher.scroll(appListRecycler, Direction.DOWN, pct, null, 10);
-            try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
-                    "scrolled an icon in all apps to make it visible - and then")) {
-                mLauncher.waitForIdle();
-                verifyActiveContainer();
-            }
-        }
-        mLauncher.assertTrue("Couldn't scroll app icon to not intersect with the search box",
-                !iconCenterInSearchBox(allAppsContainer, appIcon));
-    }
-
     private UiObject2 getSearchBox(UiObject2 allAppsContainer) {
         return mLauncher.waitForObjectInContainer(allAppsContainer, "search_container_all_apps");
     }
@@ -210,4 +190,25 @@
             verifyActiveContainer();
         }
     }
+
+    /**
+     * Freezes updating app list upon app install/uninstall/update.
+     */
+    public void freeze() {
+        mLauncher.getTestInfo(TestProtocol.REQUEST_FREEZE_APP_LIST);
+    }
+
+    /**
+     * Resumes updating app list upon app install/uninstall/update.
+     */
+    public void unfreeze() {
+        mLauncher.getTestInfo(TestProtocol.REQUEST_UNFREEZE_APP_LIST);
+        verifyNotFrozen("All apps freeze flags upon unfreezing");
+    }
+
+    private void verifyNotFrozen(String message) {
+        mLauncher.assertEquals(message, 0, mLauncher.getTestInfo(
+                TestProtocol.REQUEST_APP_LIST_FREEZE_FLAGS).
+                getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD));
+    }
 }
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index e45fca8..2db9d08 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -208,14 +208,10 @@
             // app context are not constructed with resources that take overlays into account
             final Context ctx = baseContext.createPackageContext("android", 0);
             for (int i = 0; i < 100; ++i) {
-                log("Interaction mode = " + getCurrentInteractionMode(ctx));
-                if (isGesturalMode(ctx)) {
-                    return NavigationModel.ZERO_BUTTON;
-                } else if (isSwipeUpMode(ctx)) {
-                    return NavigationModel.TWO_BUTTON;
-                } else if (isLegacyMode(ctx)) {
-                    return NavigationModel.THREE_BUTTON;
-                }
+                final int currentInteractionMode = getCurrentInteractionMode(ctx);
+                final NavigationModel model = getNavigationModel(currentInteractionMode);
+                log("Interaction mode = " + currentInteractionMode + " (" + model + ")");
+                if (model != null) return model;
                 Thread.sleep(100);
             }
             fail("Can't detect navigation mode");
@@ -225,6 +221,17 @@
         return NavigationModel.THREE_BUTTON;
     }
 
+    public static NavigationModel getNavigationModel(int currentInteractionMode) {
+        if (QuickStepContract.isGesturalMode(currentInteractionMode)) {
+            return NavigationModel.ZERO_BUTTON;
+        } else if (QuickStepContract.isSwipeUpMode(currentInteractionMode)) {
+            return NavigationModel.TWO_BUTTON;
+        } else if (QuickStepContract.isLegacyMode(currentInteractionMode)) {
+            return NavigationModel.THREE_BUTTON;
+        }
+        return null;
+    }
+
     public static boolean isAvd() {
         return Build.MODEL.contains("Cuttlefish");
     }
@@ -292,6 +299,12 @@
         }
     }
 
+    void assertEquals(String message, long expected, long actual) {
+        if (expected != actual) {
+            fail(message + " expected: " + expected + " but was: " + actual);
+        }
+    }
+
     void assertNotEquals(String message, int unexpected, int actual) {
         if (unexpected == actual) {
             failEquals(message, actual);
@@ -742,19 +755,7 @@
         return currentTime;
     }
 
-    public static boolean isGesturalMode(Context context) {
-        return QuickStepContract.isGesturalMode(getCurrentInteractionMode(context));
-    }
-
-    public static boolean isSwipeUpMode(Context context) {
-        return QuickStepContract.isSwipeUpMode(getCurrentInteractionMode(context));
-    }
-
-    public static boolean isLegacyMode(Context context) {
-        return QuickStepContract.isLegacyMode(getCurrentInteractionMode(context));
-    }
-
-    private static int getCurrentInteractionMode(Context context) {
+    public static int getCurrentInteractionMode(Context context) {
         return getSystemIntegerRes(context, "config_navBarInteractionMode");
     }