diff --git a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
index af1b353..76abe8d 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
@@ -263,7 +263,9 @@
      */
     public Bitmap createIconBitmap(Drawable icon, float scale, int size) {
         Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
-
+        if (icon == null) {
+            return bitmap;
+        }
         mCanvas.setBitmap(bitmap);
         mOldBounds.set(icon.getBounds());
 
diff --git a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
index 2966cb1..d84633d 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
@@ -505,7 +505,7 @@
     }
 
     static final class IconDB extends SQLiteCacheHelper {
-        private final static int RELEASE_VERSION = 25;
+        private final static int RELEASE_VERSION = 26;
 
         public final static String TABLE_NAME = "icons";
         public final static String COLUMN_ROWID = "rowid";
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index 4930dc5..0007b37 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -612,14 +612,10 @@
                 float transX0 = floatingViewBounds[0] - offsetX;
                 float transY0 = floatingViewBounds[1] - offsetY;
 
-                // Animate window corner radius from 100% to windowCornerRadius.
-                float windowCornerRadius = RecentsModel.INSTANCE.get(mLauncher)
-                        .getWindowCornerRadius();
                 float windowRadius = 0;
                 if (RecentsModel.INSTANCE.get(mLauncher).supportsRoundedCornersOnWindows()) {
-                    float circleRadius = iconWidth / 2f;
-                    windowRadius = Utilities.mapRange(easePercent, circleRadius,
-                            windowCornerRadius);
+                    windowRadius = RecentsModel.INSTANCE.get(mLauncher)
+                            .getWindowCornerRadius();
                 }
 
                 // Animate the window crop so that it starts off as a square, and then reveals
diff --git a/quickstep/src/com/android/quickstep/MotionEventQueue.java b/quickstep/src/com/android/quickstep/MotionEventQueue.java
index b61268b..3664c97 100644
--- a/quickstep/src/com/android/quickstep/MotionEventQueue.java
+++ b/quickstep/src/com/android/quickstep/MotionEventQueue.java
@@ -30,8 +30,7 @@
 import com.android.systemui.shared.system.InputChannelCompat;
 import com.android.systemui.shared.system.InputChannelCompat.InputEventDispatcher;
 import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
-
-import java.util.function.Supplier;
+import com.android.systemui.shared.system.NavigationBarCompat.HitTarget;
 
 /**
  * Helper class for batching input events
@@ -49,29 +48,25 @@
             ACTION_VIRTUAL | (2 << ACTION_POINTER_INDEX_SHIFT);
     private static final int ACTION_QUICK_SCRUB_END =
             ACTION_VIRTUAL | (3 << ACTION_POINTER_INDEX_SHIFT);
-    private static final int ACTION_RESET =
+    private static final int ACTION_NEW_GESTURE =
             ACTION_VIRTUAL | (4 << ACTION_POINTER_INDEX_SHIFT);
     private static final int ACTION_SHOW_OVERVIEW_FROM_ALT_TAB =
             ACTION_VIRTUAL | (5 << ACTION_POINTER_INDEX_SHIFT);
     private static final int ACTION_QUICK_STEP =
             ACTION_VIRTUAL | (6 << ACTION_POINTER_INDEX_SHIFT);
-    private static final int ACTION_COMMAND =
-            ACTION_VIRTUAL | (7 << ACTION_POINTER_INDEX_SHIFT);
-    private static final int ACTION_SWITCH_CONSUMER =
-            ACTION_VIRTUAL | (8 << ACTION_POINTER_INDEX_SHIFT);
 
     private final InputEventDispatcher mDispatcher;
     private final InputEventReceiver mReceiver;
-
-    private final Object mConsumerParamsLock = new Object();
-    private Supplier[] mConsumerParams = new Supplier[2];
+    private final ConsumerFactory mConsumerFactory;
 
     private TouchConsumer mConsumer;
 
-    public MotionEventQueue(Looper looper, Choreographer choreographer) {
+    public MotionEventQueue(Looper looper, Choreographer choreographer,
+            ConsumerFactory consumerFactory) {
         Pair<InputEventDispatcher, InputEventReceiver> pair = InputChannelCompat.createPair(
                 "sysui-callbacks", looper, choreographer, this::onInputEvent);
 
+        mConsumerFactory = consumerFactory;
         mConsumer = TouchConsumer.NO_OP;
         mDispatcher = pair.first;
         mReceiver = pair.second;
@@ -93,9 +88,12 @@
                 case ACTION_QUICK_SCRUB_END:
                     mConsumer.onQuickScrubEnd();
                     break;
-                case ACTION_RESET:
-                    mConsumer.reset();
+                case ACTION_NEW_GESTURE: {
+                    boolean useSharedState = mConsumer.isActive();
+                    mConsumer.onConsumerAboutToBeSwitched();
+                    mConsumer = mConsumerFactory.newConsumer(event.getSource(), useSharedState);
                     break;
+                }
                 case ACTION_SHOW_OVERVIEW_FROM_ALT_TAB:
                     mConsumer.onShowOverviewFromAltTab();
                     mConsumer.onQuickScrubStart();
@@ -103,16 +101,6 @@
                 case ACTION_QUICK_STEP:
                     mConsumer.onQuickStep(event);
                     break;
-                case ACTION_COMMAND:
-                    mConsumer.onCommand(event.getSource());
-                    break;
-                case ACTION_SWITCH_CONSUMER:
-                    synchronized (mConsumerParamsLock) {
-                        int index = event.getSource();
-                        mConsumer = (TouchConsumer) mConsumerParams[index].get();
-                        mConsumerParams[index] = null;
-                    }
-                    break;
                 default:
                     Log.e(TAG, "Invalid virtual event: " + event.getAction());
             }
@@ -156,41 +144,26 @@
         queue(event);
     }
 
-    public void reset() {
-        queueVirtualAction(ACTION_RESET, 0);
+    public void onNewGesture(@HitTarget int downHitTarget) {
+        queueVirtualAction(ACTION_NEW_GESTURE, downHitTarget);
     }
 
-    public void onCommand(int command) {
-        queueVirtualAction(ACTION_COMMAND, command);
-    }
-
-    public void switchConsumer(Supplier<TouchConsumer> consumer) {
-        int index = -1;
-        synchronized (mConsumerParamsLock) {
-            // Find a null index
-            for (int i = 0; i < mConsumerParams.length; i++) {
-                if (mConsumerParams[i] == null) {
-                    index = i;
-                    break;
-                }
-            }
-            if (index < 0) {
-                index = mConsumerParams.length;
-                final Supplier[] newValues = new Supplier[index + 1];
-                System.arraycopy(mConsumerParams, 0, newValues, 0, index);
-                mConsumerParams = newValues;
-            }
-            mConsumerParams[index] = consumer;
+    /**
+     * To be called by the consumer when it's no longer active.
+     */
+    public void onConsumerInactive(TouchConsumer caller) {
+        if (mConsumer == caller) {
+            mConsumer = TouchConsumer.NO_OP;
         }
-        queueVirtualAction(ACTION_SWITCH_CONSUMER, index);
-    }
-
-    public TouchConsumer getConsumer() {
-        return mConsumer;
     }
 
     public void dispose() {
         mDispatcher.dispose();
         mReceiver.dispose();
     }
+
+    public interface ConsumerFactory {
+
+        TouchConsumer newConsumer(@HitTarget int downHitTarget, boolean useSharedState);
+    }
 }
diff --git a/quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java b/quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java
index 5801c10..84f16cb 100644
--- a/quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java
+++ b/quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java
@@ -25,7 +25,6 @@
 import static com.android.launcher3.util.RaceConditionTracker.ENTER;
 import static com.android.launcher3.util.RaceConditionTracker.EXIT;
 import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
-import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
 
 import android.annotation.TargetApi;
 import android.app.ActivityManager.RunningTaskInfo;
@@ -37,7 +36,6 @@
 import android.os.Build;
 import android.os.Bundle;
 import android.os.SystemClock;
-import android.util.SparseArray;
 import android.view.Display;
 import android.view.MotionEvent;
 import android.view.Surface;
@@ -45,24 +43,23 @@
 import android.view.ViewConfiguration;
 import android.view.WindowManager;
 
-import com.android.launcher3.MainThreadExecutor;
 import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.util.Preconditions;
 import com.android.launcher3.util.RaceConditionTracker;
 import com.android.launcher3.util.TraceHelper;
+import com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget;
 import com.android.quickstep.util.MotionPauseDetector;
-import com.android.quickstep.util.RemoteAnimationTargetSet;
+import com.android.quickstep.util.RecentsAnimationListenerSet;
 import com.android.systemui.shared.system.ActivityManagerWrapper;
 import com.android.systemui.shared.system.AssistDataReceiver;
 import com.android.systemui.shared.system.BackgroundExecutor;
 import com.android.systemui.shared.system.InputConsumerController;
 import com.android.systemui.shared.system.NavigationBarCompat;
 import com.android.systemui.shared.system.NavigationBarCompat.HitTarget;
-import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
-import com.android.systemui.shared.system.RecentsAnimationListener;
-import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
 import com.android.systemui.shared.system.WindowManagerWrapper;
 
 import androidx.annotation.Nullable;
+import androidx.annotation.UiThread;
 
 /**
  * Touch consumer for handling events originating from an activity other than Launcher
@@ -73,16 +70,15 @@
     public static final String DOWN_EVT = "OtherActivityTouchConsumer.DOWN";
     private static final String UP_EVT = "OtherActivityTouchConsumer.UP";
 
-    private final SparseArray<RecentsAnimationState> mAnimationStates = new SparseArray<>();
     private final RunningTaskInfo mRunningTask;
     private final RecentsModel mRecentsModel;
     private final Intent mHomeIntent;
     private final ActivityControlHelper mActivityControlHelper;
-    private final MainThreadExecutor mMainThreadExecutor;
     private final OverviewCallbacks mOverviewCallbacks;
     private final TaskOverlayFactory mTaskOverlayFactory;
     private final TouchInteractionLog mTouchInteractionLog;
     private final InputConsumerController mInputConsumer;
+    private final SwipeSharedState mSwipeSharedState;
 
     private final MotionEventQueue mEventQueue;
     private final MotionPauseDetector mMotionPauseDetector;
@@ -99,18 +95,13 @@
     private WindowTransformSwipeHandler mInteractionHandler;
     private int mDisplayRotation;
     private Rect mStableInsets = new Rect();
-    private boolean mCanGestureBeContinued;
-
-    private boolean mIsGoingToLauncher;
-    private RecentsAnimationState mRecentsAnimationState;
 
     public OtherActivityTouchConsumer(Context base, RunningTaskInfo runningTaskInfo,
             RecentsModel recentsModel, Intent homeIntent, ActivityControlHelper activityControl,
-            MainThreadExecutor mainThreadExecutor,
             @HitTarget int downHitTarget, OverviewCallbacks overviewCallbacks,
             TaskOverlayFactory taskOverlayFactory, InputConsumerController inputConsumer,
             TouchInteractionLog touchInteractionLog, MotionEventQueue eventQueue,
-            @Nullable RecentsAnimationState recentsAnimationStateToReuse) {
+            SwipeSharedState swipeSharedState) {
         super(base);
 
         mRunningTask = runningTaskInfo;
@@ -122,14 +113,13 @@
         mVelocityTracker = VelocityTracker.obtain();
 
         mActivityControlHelper = activityControl;
-        mMainThreadExecutor = mainThreadExecutor;
         mIsDeferredDownTarget = activityControl.deferStartingActivity(downHitTarget);
         mOverviewCallbacks = overviewCallbacks;
         mTaskOverlayFactory = taskOverlayFactory;
         mTouchInteractionLog = touchInteractionLog;
         mTouchInteractionLog.setTouchConsumer(this);
         mInputConsumer = inputConsumer;
-        mRecentsAnimationState = recentsAnimationStateToReuse;
+        mSwipeSharedState = swipeSharedState;
     }
 
     @Override
@@ -156,8 +146,8 @@
                 mActivePointerId = ev.getPointerId(0);
                 mDownPos.set(ev.getX(), ev.getY());
                 mLastPos.set(mDownPos);
-                // If mRecentsAnimationState != null, we are continuing the previous gesture.
-                mPassedInitialSlop = mRecentsAnimationState != null;
+                // If active listener isn't null, we are continuing the previous gesture.
+                mPassedInitialSlop = mSwipeSharedState.getActiveListener() != null;
                 mQuickStepDragSlop = NavigationBarCompat.getQuickStepDragSlopPx();
 
                 // Start the window animation on down to give more time for launcher to draw if the
@@ -262,30 +252,23 @@
     private void startTouchTrackingForWindowAnimation(long touchTimeMs) {
         mTouchInteractionLog.startRecentsAnimation();
 
-        // Create the shared handler
-        boolean reuseOldAnimState = mRecentsAnimationState != null;
-        if (reuseOldAnimState) {
-            mRecentsAnimationState.changeParent(this);
-        } else {
-            mRecentsAnimationState = new RecentsAnimationState(this);
-        }
+        RecentsAnimationListenerSet listenerSet = mSwipeSharedState.getActiveListener();
         final WindowTransformSwipeHandler handler = new WindowTransformSwipeHandler(
-                mRecentsAnimationState.id, mRunningTask, this, touchTimeMs, mActivityControlHelper,
-                reuseOldAnimState, mInputConsumer, mTouchInteractionLog);
+                mRunningTask, this, touchTimeMs, mActivityControlHelper,
+                listenerSet != null, mInputConsumer, mTouchInteractionLog);
 
         // Preload the plan
         mRecentsModel.getTasks(null);
         mInteractionHandler = handler;
-        handler.setGestureEndCallback(mEventQueue::reset);
+        handler.setGestureEndCallback(this::onInteractionGestureFinished);
         mMotionPauseDetector.setOnMotionPauseListener(handler::onMotionPauseChanged);
         handler.initWhenReady();
 
         TraceHelper.beginSection("RecentsController");
 
-        if (reuseOldAnimState) {
-            handler.onRecentsAnimationStart(mRecentsAnimationState.mController,
-                    mRecentsAnimationState.mTargets, mRecentsAnimationState.mHomeContentInsets,
-                    mRecentsAnimationState.mMinimizedHomeBounds);
+        if (listenerSet != null) {
+            listenerSet.addListener(handler);
+            mSwipeSharedState.applyActiveRecentsAnimationState(handler);
         } else {
             AssistDataReceiver assistDataReceiver = !mTaskOverlayFactory.needAssist() ? null :
                     new AssistDataReceiver() {
@@ -300,18 +283,13 @@
                         }
                     };
 
+            RecentsAnimationListenerSet newListenerSet =
+                    mSwipeSharedState.newRecentsAnimationListenerSet();
+            newListenerSet.addListener(handler);
             BackgroundExecutor.get().submit(
                     () -> ActivityManagerWrapper.getInstance().startRecentsActivity(
-                            mHomeIntent, assistDataReceiver, mRecentsAnimationState, null, null));
-        }
-
-    }
-
-    @Override
-    public void onCommand(int command) {
-        RecentsAnimationState state = mAnimationStates.get(command);
-        if (state != null) {
-            state.execute();
+                            mHomeIntent, assistDataReceiver, newListenerSet,
+                            null, null));
         }
     }
 
@@ -335,7 +313,8 @@
         } else {
             // Since we start touch tracking on DOWN, we may reach this state without actually
             // starting the gesture. In that case, just cleanup immediately.
-            reset();
+            onConsumerAboutToBeSwitched();
+            onInteractionGestureFinished();
 
             // Also clean up in case the system has handled the UP and canceled the animation before
             // we had a chance to start the recents animation. In such a case, we will not receive
@@ -347,15 +326,35 @@
     }
 
     @Override
-    public void reset() {
-        // Clean up the old interaction handler
+    public void onConsumerAboutToBeSwitched() {
+        Preconditions.assertUIThread();
         if (mInteractionHandler != null) {
-            final WindowTransformSwipeHandler handler = mInteractionHandler;
-            mInteractionHandler = null;
-            WindowTransformSwipeHandler.GestureEndTarget endTarget = handler.mGestureEndTarget;
-            mIsGoingToLauncher = endTarget != null && endTarget.isLauncher;
-            mCanGestureBeContinued = endTarget != null && endTarget.canBeContinued;
-            mMainThreadExecutor.execute(mCanGestureBeContinued ? handler::cancel : handler::reset);
+            // The consumer is being switched while we are active. Set up the shared state to be
+            // used by the next animation
+            removeListener();
+            GestureEndTarget endTarget = mInteractionHandler.mGestureEndTarget;
+            mSwipeSharedState.canGestureBeContinued = endTarget != null && endTarget.canBeContinued;
+            mSwipeSharedState.goingToLauncher = endTarget != null && endTarget.isLauncher;
+            if (mSwipeSharedState.canGestureBeContinued) {
+                mInteractionHandler.cancel();
+            } else {
+                mInteractionHandler.reset();
+            }
+        }
+    }
+
+    @UiThread
+    private void onInteractionGestureFinished() {
+        Preconditions.assertUIThread();
+        removeListener();
+        mInteractionHandler = null;
+        mEventQueue.onConsumerInactive(this);
+    }
+
+    private void removeListener() {
+        RecentsAnimationListenerSet listenerSet = mSwipeSharedState.getActiveListener();
+        if (listenerSet != null) {
+            listenerSet.removeListener(mInteractionHandler);
         }
     }
 
@@ -419,81 +418,7 @@
     }
 
     @Override
-    public boolean forceToLauncherConsumer() {
-        return mIsGoingToLauncher;
-    }
-
-    @Override
-    public @Nullable RecentsAnimationState getRecentsAnimationStateToReuse() {
-        return mCanGestureBeContinued ? mRecentsAnimationState : null;
-    }
-
-    @Override
-    public boolean deferNextEventToMainThread() {
-        // TODO: Consider also check if the eventQueue is using mainThread of not.
+    public boolean isActive() {
         return mInteractionHandler != null;
     }
-
-    public static class RecentsAnimationState implements RecentsAnimationListener {
-
-        private static final String ANIMATION_START_EVT = "RecentsAnimationState.onAnimationStart";
-        private final int id;
-
-        private OtherActivityTouchConsumer mParent;
-
-        private RecentsAnimationControllerCompat mController;
-        private RemoteAnimationTargetSet mTargets;
-        private Rect mHomeContentInsets;
-        private Rect mMinimizedHomeBounds;
-        private boolean mCancelled;
-
-        public RecentsAnimationState(OtherActivityTouchConsumer parent) {
-            mParent = parent;
-            id = mParent.mAnimationStates.size();
-            mParent.mAnimationStates.put(id, this);
-        }
-
-        @Override
-        public void onAnimationStart(
-                RecentsAnimationControllerCompat controller,
-                RemoteAnimationTargetCompat[] apps, Rect homeContentInsets,
-                Rect minimizedHomeBounds) {
-            RaceConditionTracker.onEvent(ANIMATION_START_EVT, ENTER);
-            mController = controller;
-            mTargets = new RemoteAnimationTargetSet(apps, MODE_CLOSING);
-            mHomeContentInsets = homeContentInsets;
-            mMinimizedHomeBounds = minimizedHomeBounds;
-            mParent.mEventQueue.onCommand(id);
-            RaceConditionTracker.onEvent(ANIMATION_START_EVT, EXIT);
-        }
-
-        @Override
-        public void onAnimationCanceled() {
-            mCancelled = true;
-            mParent.mEventQueue.onCommand(id);
-        }
-
-        public void execute() {
-            WindowTransformSwipeHandler handler = mParent.mInteractionHandler;
-            if (handler == null || handler.id != id) {
-                if (!mCancelled && mController != null) {
-                    TraceHelper.endSection("RecentsController", "Finishing no handler");
-                    mController.finish(false /* toHome */);
-                }
-            } else if (mCancelled) {
-                TraceHelper.endSection("RecentsController",
-                        "Cancelled: " + handler);
-                handler.onRecentsAnimationCanceled();
-            } else {
-                TraceHelper.partitionSection("RecentsController", "Received");
-                handler.onRecentsAnimationStart(mController, mTargets,
-                        mHomeContentInsets, mMinimizedHomeBounds);
-            }
-        }
-
-        public void changeParent(OtherActivityTouchConsumer newParent) {
-            mParent = newParent;
-            mParent.mAnimationStates.put(id, this);
-        }
-    }
 }
diff --git a/quickstep/src/com/android/quickstep/SwipeSharedState.java b/quickstep/src/com/android/quickstep/SwipeSharedState.java
new file mode 100644
index 0000000..15914ba
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/SwipeSharedState.java
@@ -0,0 +1,81 @@
+/*
+ * 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;
+
+import com.android.launcher3.util.Preconditions;
+import com.android.quickstep.util.RecentsAnimationListenerSet;
+import com.android.quickstep.util.SwipeAnimationTargetSet;
+import com.android.quickstep.util.SwipeAnimationTargetSet.SwipeAnimationListener;
+
+/**
+ * Utility class used to store state information shared across multiple transitions.
+ */
+public class SwipeSharedState implements SwipeAnimationListener {
+
+    private RecentsAnimationListenerSet mRecentsAnimationListener;
+    private SwipeAnimationTargetSet mLastAnimationTarget;
+    private boolean mLastAnimationCancelled = false;
+
+    public boolean canGestureBeContinued;
+    public boolean goingToLauncher;
+
+    @Override
+    public final void onRecentsAnimationStart(SwipeAnimationTargetSet targetSet) {
+        mLastAnimationTarget = targetSet;
+        mLastAnimationCancelled = false;
+    }
+
+    @Override
+    public final void onRecentsAnimationCanceled() {
+        mLastAnimationTarget = null;
+        mLastAnimationCancelled = true;
+    }
+
+    private void clearListenerState() {
+        if (mRecentsAnimationListener != null) {
+            mRecentsAnimationListener.removeListener(this);
+        }
+        mRecentsAnimationListener = null;
+        mLastAnimationTarget = null;
+        mLastAnimationCancelled = false;
+    }
+
+    public RecentsAnimationListenerSet newRecentsAnimationListenerSet() {
+        Preconditions.assertUIThread();
+        clearListenerState();
+        mRecentsAnimationListener = new RecentsAnimationListenerSet();
+        mRecentsAnimationListener.addListener(this);
+        return mRecentsAnimationListener;
+    }
+
+    public RecentsAnimationListenerSet getActiveListener() {
+        return mRecentsAnimationListener;
+    }
+
+    public void applyActiveRecentsAnimationState(SwipeAnimationListener listener) {
+        if (mLastAnimationTarget != null) {
+            listener.onRecentsAnimationStart(mLastAnimationTarget);
+        } else if (mLastAnimationCancelled) {
+            listener.onRecentsAnimationCanceled();
+        }
+    }
+
+    public void clearAllState() {
+        clearListenerState();
+        canGestureBeContinued = false;
+        goingToLauncher = false;
+    }
+}
diff --git a/quickstep/src/com/android/quickstep/TouchConsumer.java b/quickstep/src/com/android/quickstep/TouchConsumer.java
index ef37595..026f715 100644
--- a/quickstep/src/com/android/quickstep/TouchConsumer.java
+++ b/quickstep/src/com/android/quickstep/TouchConsumer.java
@@ -20,9 +20,6 @@
 import android.view.MotionEvent;
 
 import androidx.annotation.IntDef;
-import androidx.annotation.Nullable;
-
-import com.android.quickstep.OtherActivityTouchConsumer.RecentsAnimationState;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -43,8 +40,6 @@
     int INTERACTION_NORMAL = 0;
     int INTERACTION_QUICK_SCRUB = 1;
 
-    default void reset() { }
-
     default void onQuickScrubStart() { }
 
     default void onQuickScrubEnd() { }
@@ -53,22 +48,14 @@
 
     default void onQuickStep(MotionEvent ev) { }
 
-    default void onCommand(int command) { }
+    default void onShowOverviewFromAltTab() {}
 
-    default boolean deferNextEventToMainThread() {
-        return false;
-    }
-
-    default boolean forceToLauncherConsumer() {
+    default boolean isActive() {
         return false;
     }
 
     /**
-     * When continuing a gesture, return the current non-null animation state that hasn't finished.
+     * Called by the event queue when the consumer is about to be switched to a new consumer.
      */
-    default @Nullable RecentsAnimationState getRecentsAnimationStateToReuse() {
-        return null;
-    }
-
-    default void onShowOverviewFromAltTab() {}
+    default void onConsumerAboutToBeSwitched() { }
 }
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 0f52deb..951ba4f 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -31,7 +31,9 @@
 import android.app.Service;
 import android.content.Intent;
 import android.graphics.PointF;
+import android.graphics.Region;
 import android.os.Build;
+import android.os.Bundle;
 import android.os.IBinder;
 import android.os.Looper;
 import android.util.Log;
@@ -44,7 +46,6 @@
 import com.android.launcher3.MainThreadExecutor;
 import com.android.launcher3.util.TraceHelper;
 import com.android.launcher3.views.BaseDragLayer;
-import com.android.quickstep.OtherActivityTouchConsumer.RecentsAnimationState;
 import com.android.quickstep.views.RecentsView;
 import com.android.systemui.shared.recents.IOverviewProxy;
 import com.android.systemui.shared.recents.ISystemUiProxy;
@@ -61,6 +62,8 @@
 @TargetApi(Build.VERSION_CODES.O)
 public class TouchInteractionService extends Service {
 
+    public static final MainThreadExecutor MAIN_THREAD_EXECUTOR = new MainThreadExecutor();
+
     private static final SparseArray<String> sMotionEventNames;
 
     static {
@@ -76,16 +79,18 @@
 
     private final IBinder mMyBinder = new IOverviewProxy.Stub() {
 
-        @Override
+        public void onActiveNavBarRegionChanges(Region region) { }
+
+        public void onInitialize(Bundle params) { }
+
         public void onPreMotionEvent(@HitTarget int downHitTarget) {
             mTouchInteractionLog.prepareForNewGesture();
 
             TraceHelper.beginSection("SysUiBinder");
-            setupTouchConsumer(downHitTarget);
+            mEventQueue.onNewGesture(downHitTarget);
             TraceHelper.partitionSection("SysUiBinder", "Down target " + downHitTarget);
         }
 
-        @Override
         public void onMotionEvent(MotionEvent ev) {
             mEventQueue.queue(ev);
 
@@ -102,26 +107,22 @@
             }
         }
 
-        @Override
         public void onBind(ISystemUiProxy iSystemUiProxy) {
             mISystemUiProxy = iSystemUiProxy;
             mRecentsModel.setSystemUiProxy(mISystemUiProxy);
             mOverviewInteractionState.setSystemUiProxy(mISystemUiProxy);
         }
 
-        @Override
         public void onQuickScrubStart() {
             mEventQueue.onQuickScrubStart();
             mOverviewInteractionState.setSwipeGestureInitializing(false);
             TraceHelper.partitionSection("SysUiBinder", "onQuickScrubStart");
         }
 
-        @Override
         public void onQuickScrubProgress(float progress) {
             mEventQueue.onQuickScrubProgress(progress);
         }
 
-        @Override
         public void onQuickScrubEnd() {
             mEventQueue.onQuickScrubEnd();
             TraceHelper.endSection("SysUiBinder", "onQuickScrubEnd");
@@ -135,7 +136,7 @@
         @Override
         public void onOverviewShown(boolean triggeredFromAltTab) {
             if (triggeredFromAltTab) {
-                setupTouchConsumer(HIT_TARGET_NONE);
+                mEventQueue.onNewGesture(HIT_TARGET_NONE);
                 mEventQueue.onOverviewShownFromAltTab();
             } else {
                 mOverviewCommandHelper.onOverviewShown();
@@ -150,7 +151,6 @@
             }
         }
 
-        @Override
         public void onQuickStep(MotionEvent motionEvent) {
             mEventQueue.onQuickStep(motionEvent);
             mOverviewInteractionState.setSwipeGestureInitializing(false);
@@ -172,7 +172,6 @@
     private ActivityManagerWrapper mAM;
     private RecentsModel mRecentsModel;
     private MotionEventQueue mEventQueue;
-    private MainThreadExecutor mMainThreadExecutor;
     private ISystemUiProxy mISystemUiProxy;
     private OverviewCommandHelper mOverviewCommandHelper;
     private OverviewComponentObserver mOverviewComponentObserver;
@@ -181,20 +180,22 @@
     private TaskOverlayFactory mTaskOverlayFactory;
     private TouchInteractionLog mTouchInteractionLog;
     private InputConsumerController mInputConsumer;
+    private SwipeSharedState mSwipeSharedState;
 
     @Override
     public void onCreate() {
         super.onCreate();
         mAM = ActivityManagerWrapper.getInstance();
         mRecentsModel = RecentsModel.INSTANCE.get(this);
-        mMainThreadExecutor = new MainThreadExecutor();
         mOverviewComponentObserver = new OverviewComponentObserver(this);
         mOverviewCommandHelper = new OverviewCommandHelper(this, mOverviewComponentObserver);
-        mEventQueue = new MotionEventQueue(Looper.myLooper(), Choreographer.getInstance());
+        mEventQueue = new MotionEventQueue(Looper.myLooper(), Choreographer.getInstance(),
+                this::newConsumer);
         mOverviewInteractionState = OverviewInteractionState.INSTANCE.get(this);
         mOverviewCallbacks = OverviewCallbacks.get(this);
         mTaskOverlayFactory = TaskOverlayFactory.INSTANCE.get(this);
         mTouchInteractionLog = new TouchInteractionLog();
+        mSwipeSharedState = new SwipeSharedState();
         mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer();
         mInputConsumer.registerInputConsumer();
 
@@ -219,27 +220,15 @@
         return mMyBinder;
     }
 
-    private void setupTouchConsumer(@HitTarget int downHitTarget) {
-        mEventQueue.reset();
-        TouchConsumer oldConsumer = mEventQueue.getConsumer();
-        if (oldConsumer.deferNextEventToMainThread()) {
-            mEventQueue.switchConsumer(() -> getCurrentTouchConsumer(downHitTarget,
-                    oldConsumer.forceToLauncherConsumer(),
-                    oldConsumer.getRecentsAnimationStateToReuse()));
-
-        } else {
-            TouchConsumer consumer = getCurrentTouchConsumer(downHitTarget, false, null);
-            mEventQueue.switchConsumer(() -> consumer);
-        }
-    }
-
-    private TouchConsumer getCurrentTouchConsumer(@HitTarget int downHitTarget,
-            boolean forceToLauncher, RecentsAnimationState recentsAnimationStateToReuse) {
+    private TouchConsumer newConsumer(@HitTarget int downHitTarget, boolean useSharedState) {
         RunningTaskInfo runningTaskInfo = mAM.getRunningTask(0);
+        if (!useSharedState) {
+            mSwipeSharedState.clearAllState();
+        }
 
-        if (runningTaskInfo == null && !forceToLauncher) {
+        if (runningTaskInfo == null && !mSwipeSharedState.goingToLauncher) {
             return TouchConsumer.NO_OP;
-        } else if (forceToLauncher ||
+        } else if (mSwipeSharedState.goingToLauncher ||
                 mOverviewComponentObserver.getActivityControlHelper().isResumed()) {
             return OverviewTouchConsumer.newInstance(
                     mOverviewComponentObserver.getActivityControlHelper(), false,
@@ -252,10 +241,10 @@
         } else {
             return new OtherActivityTouchConsumer(this, runningTaskInfo, mRecentsModel,
                     mOverviewComponentObserver.getOverviewIntent(),
-                    mOverviewComponentObserver.getActivityControlHelper(), mMainThreadExecutor,
+                    mOverviewComponentObserver.getActivityControlHelper(),
                     downHitTarget, mOverviewCallbacks,
                     mTaskOverlayFactory, mInputConsumer, mTouchInteractionLog, mEventQueue,
-                    recentsAnimationStateToReuse);
+                    mSwipeSharedState);
         }
     }
 
diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
index d4375b5..b089381 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -34,6 +34,7 @@
 import static com.android.quickstep.QuickScrubController.QUICK_SWITCH_FROM_APP_START_DURATION;
 import static com.android.quickstep.TouchConsumer.INTERACTION_NORMAL;
 import static com.android.quickstep.TouchConsumer.INTERACTION_QUICK_SCRUB;
+import static com.android.quickstep.TouchInteractionService.MAIN_THREAD_EXECUTOR;
 import static com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget.HOME;
 import static com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget.LAST_TASK;
 import static com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget.NEW_TASK;
@@ -97,6 +98,8 @@
 import com.android.quickstep.TouchInteractionService.OverviewTouchConsumer;
 import com.android.quickstep.util.ClipAnimationHelper;
 import com.android.quickstep.util.RemoteAnimationTargetSet;
+import com.android.quickstep.util.SwipeAnimationTargetSet;
+import com.android.quickstep.util.SwipeAnimationTargetSet.SwipeAnimationListener;
 import com.android.quickstep.util.TransformedRect;
 import com.android.quickstep.views.RecentsView;
 import com.android.quickstep.views.TaskView;
@@ -113,7 +116,8 @@
 import java.util.function.BiFunction;
 
 @TargetApi(Build.VERSION_CODES.O)
-public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
+public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
+        implements SwipeAnimationListener {
     private static final String TAG = WindowTransformSwipeHandler.class.getSimpleName();
 
     // Launcher UI related states
@@ -248,14 +252,8 @@
     // To avoid UI jump when gesture is started, we offset the animation by the threshold.
     private float mShiftAtGestureStart = 0;
 
-    private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper());
+    private final Handler mMainThreadHandler = MAIN_THREAD_EXECUTOR.getHandler();
 
-    // An increasing identifier per single instance of OtherActivityTouchConsumer. Generally one
-    // instance of OtherActivityTouchConsumer will only have one swipe handle, but sometimes we can
-    // end up with multiple handlers if we get recents command in the middle of a swipe gesture.
-    // This is used to match the corresponding activity manager callbacks in
-    // OtherActivityTouchConsumer
-    public final int id;
     private final Context mContext;
     private final ActivityControlHelper<T> mActivityControlHelper;
     private final ActivityInitListener mActivityInitListener;
@@ -296,10 +294,9 @@
 
     private Bundle mAssistData;
 
-    WindowTransformSwipeHandler(int id, RunningTaskInfo runningTaskInfo, Context context,
+    WindowTransformSwipeHandler(RunningTaskInfo runningTaskInfo, Context context,
             long touchTimeMs, ActivityControlHelper<T> controller, boolean continuingLastGesture,
             InputConsumerController inputConsumer, TouchInteractionLog touchInteractionLog) {
-        this.id = id;
         mContext = context;
         mRunningTaskInfo = runningTaskInfo;
         mRunningTaskId = runningTaskInfo.id;
@@ -749,19 +746,18 @@
                         ? 0 : (progress - mShiftAtGestureStart) / (1 - mShiftAtGestureStart));
     }
 
-    @UiThread
-    public void onRecentsAnimationStart(RecentsAnimationControllerCompat controller,
-            RemoteAnimationTargetSet targets, Rect homeContentInsets, Rect minimizedHomeBounds) {
+    @Override
+    public void onRecentsAnimationStart(SwipeAnimationTargetSet targetSet) {
         DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(mContext).getDeviceProfile(mContext);
         final Rect overviewStackBounds;
-        RemoteAnimationTargetCompat runningTaskTarget = targets.findTask(mRunningTaskId);
+        RemoteAnimationTargetCompat runningTaskTarget = targetSet.findTask(mRunningTaskId);
 
-        if (minimizedHomeBounds != null && runningTaskTarget != null) {
+        if (targetSet.minimizedHomeBounds != null && runningTaskTarget != null) {
             overviewStackBounds = mActivityControlHelper
-                    .getOverviewWindowBounds(minimizedHomeBounds, runningTaskTarget);
-            dp = dp.getMultiWindowProfile(mContext,
-                    new Point(minimizedHomeBounds.width(), minimizedHomeBounds.height()));
-            dp.updateInsets(homeContentInsets);
+                    .getOverviewWindowBounds(targetSet.minimizedHomeBounds, runningTaskTarget);
+            dp = dp.getMultiWindowProfile(mContext, new Point(
+                    targetSet.minimizedHomeBounds.width(), targetSet.minimizedHomeBounds.height()));
+            dp.updateInsets(targetSet.homeContentInsets);
         } else {
             if (mActivity != null) {
                 int loc[] = new int[2];
@@ -774,7 +770,7 @@
             }
             // If we are not in multi-window mode, home insets should be same as system insets.
             dp = dp.copy(mContext);
-            dp.updateInsets(homeContentInsets);
+            dp.updateInsets(targetSet.homeContentInsets);
         }
         dp.updateIsSeascape(mContext.getSystemService(WindowManager.class));
 
@@ -784,14 +780,14 @@
         mClipAnimationHelper.prepareAnimation(false /* isOpening */);
         initTransitionEndpoints(dp);
 
-        mRecentsAnimationWrapper.setController(controller, targets);
-        mTouchInteractionLog.startRecentsAnimationCallback(targets.apps.length);
+        mRecentsAnimationWrapper.setController(targetSet.controller, targetSet);
+        mTouchInteractionLog.startRecentsAnimationCallback(targetSet.apps.length);
         setStateOnUiThread(STATE_APP_CONTROLLER_RECEIVED);
 
         mPassedOverviewThreshold = false;
     }
 
-    @UiThread
+    @Override
     public void onRecentsAnimationCanceled() {
         mRecentsAnimationWrapper.setController(null, null);
         mActivityInitListener.unregister();
diff --git a/quickstep/src/com/android/quickstep/util/RecentsAnimationListenerSet.java b/quickstep/src/com/android/quickstep/util/RecentsAnimationListenerSet.java
new file mode 100644
index 0000000..686e74d
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/util/RecentsAnimationListenerSet.java
@@ -0,0 +1,79 @@
+/*
+ * 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.util;
+
+import static com.android.quickstep.TouchInteractionService.MAIN_THREAD_EXECUTOR;
+
+import android.graphics.Rect;
+import android.util.ArraySet;
+
+import com.android.launcher3.Utilities;
+import com.android.launcher3.util.Preconditions;
+import com.android.quickstep.util.SwipeAnimationTargetSet.SwipeAnimationListener;
+import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
+import com.android.systemui.shared.system.RecentsAnimationListener;
+import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
+
+import java.util.Set;
+
+import androidx.annotation.UiThread;
+
+/**
+ * Wrapper around {@link RecentsAnimationListener} which delegates callbacks to multiple listeners
+ * on the main thread
+ */
+public class RecentsAnimationListenerSet implements RecentsAnimationListener {
+
+    private final Set<SwipeAnimationListener> mListeners = new ArraySet<>();
+
+    @UiThread
+    public void addListener(SwipeAnimationListener listener) {
+        Preconditions.assertUIThread();
+        mListeners.add(listener);
+    }
+
+    @UiThread
+    public void removeListener(SwipeAnimationListener listener) {
+        Preconditions.assertUIThread();
+        mListeners.remove(listener);
+    }
+
+    @Override
+    public final void onAnimationStart(RecentsAnimationControllerCompat controller,
+            RemoteAnimationTargetCompat[] targets, Rect homeContentInsets,
+            Rect minimizedHomeBounds) {
+        SwipeAnimationTargetSet targetSet = new SwipeAnimationTargetSet(controller, targets,
+                homeContentInsets, minimizedHomeBounds);
+        Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(), () -> {
+            for (SwipeAnimationListener listener : getListeners()) {
+                listener.onRecentsAnimationStart(targetSet);
+            }
+        });
+    }
+
+    @Override
+    public final void onAnimationCanceled() {
+        Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(), () -> {
+            for (SwipeAnimationListener listener : getListeners()) {
+                listener.onRecentsAnimationCanceled();
+            }
+        });
+    }
+
+    private SwipeAnimationListener[] getListeners() {
+        return mListeners.toArray(new SwipeAnimationListener[mListeners.size()]);
+    }
+}
diff --git a/quickstep/src/com/android/quickstep/util/SwipeAnimationTargetSet.java b/quickstep/src/com/android/quickstep/util/SwipeAnimationTargetSet.java
new file mode 100644
index 0000000..4f02acf
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/util/SwipeAnimationTargetSet.java
@@ -0,0 +1,51 @@
+/*
+ * 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.util;
+
+import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
+
+import android.graphics.Rect;
+
+import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
+import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
+
+/**
+ * Extension of {@link RemoteAnimationTargetSet} with additional information about swipe
+ * up animation
+ */
+public class SwipeAnimationTargetSet extends RemoteAnimationTargetSet {
+
+    public final RecentsAnimationControllerCompat controller;
+    public final Rect homeContentInsets;
+    public final Rect minimizedHomeBounds;
+
+    public SwipeAnimationTargetSet(RecentsAnimationControllerCompat controller,
+            RemoteAnimationTargetCompat[] targets, Rect homeContentInsets,
+            Rect minimizedHomeBounds) {
+        super(targets, MODE_CLOSING);
+        this.controller = controller;
+        this.homeContentInsets = homeContentInsets;
+        this.minimizedHomeBounds = minimizedHomeBounds;
+    }
+
+
+    public interface SwipeAnimationListener {
+
+        void onRecentsAnimationStart(SwipeAnimationTargetSet targetSet);
+
+        void onRecentsAnimationCanceled();
+    }
+}
diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
index bbcd425..cbd6b2f 100644
--- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
+++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
@@ -78,6 +78,12 @@
 
     public void initialize(Task task, InitializeCallback callback) {
         mTask = task;
+
+        if (task.key.userId != UserHandle.myUserId()) {
+            callback.call(1, task.titleDescription);
+            return;
+        }
+
         Utilities.THREAD_POOL_EXECUTOR.execute(() -> {
             long appUsageLimitTimeMs = -1;
             long appRemainingTimeMs = -1;
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index 7cab18d..e75527e 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -133,9 +133,6 @@
         return mIsOpen;
     }
 
-    protected void onWidgetsBound() {
-    }
-
     protected abstract boolean isOfType(@FloatingViewType int type);
 
     /** @return Whether the back is consumed. If false, Launcher will handle the back as well. */
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 73fba4e..245e470 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -145,7 +145,6 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 import java.util.function.Predicate;
 
 import androidx.annotation.Nullable;
@@ -1122,11 +1121,6 @@
     public void updateNotificationDots(Predicate<PackageUserKey> updatedDots) {
         mWorkspace.updateNotificationDots(updatedDots);
         mAppsView.getAppsStore().updateNotificationDots(updatedDots);
-
-        PopupContainerWithArrow popup = PopupContainerWithArrow.getOpen(Launcher.this);
-        if (popup != null) {
-            popup.updateNotificationHeader(updatedDots);
-        }
     }
 
     @Override
@@ -2247,10 +2241,6 @@
     @Override
     public void bindAllWidgets(final ArrayList<WidgetListRowEntry> allWidgets) {
         mPopupDataProvider.setAllWidgets(allWidgets);
-        AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(this);
-        if (topView != null) {
-            topView.onWidgetsBound();
-        }
     }
 
     /**
diff --git a/src/com/android/launcher3/dot/DotInfo.java b/src/com/android/launcher3/dot/DotInfo.java
index 15b2a3b0..4ff0539 100644
--- a/src/com/android/launcher3/dot/DotInfo.java
+++ b/src/com/android/launcher3/dot/DotInfo.java
@@ -18,7 +18,6 @@
 
 import com.android.launcher3.notification.NotificationInfo;
 import com.android.launcher3.notification.NotificationKeyData;
-import com.android.launcher3.util.PackageUserKey;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -30,14 +29,11 @@
 
     public static final int MAX_COUNT = 999;
 
-    /** Used to link this DotInfo to icons on the workspace and all apps */
-    private PackageUserKey mPackageUserKey;
-
     /**
      * The keys of the notifications that this dot represents. These keys can later be
      * used to retrieve {@link NotificationInfo}'s.
      */
-    private List<NotificationKeyData> mNotificationKeys;
+    private final List<NotificationKeyData> mNotificationKeys = new ArrayList<>();
 
     /**
      * The current sum of the counts in {@link #mNotificationKeys},
@@ -45,11 +41,6 @@
      */
     private int mTotalCount;
 
-    public DotInfo(PackageUserKey packageUserKey) {
-        mPackageUserKey = packageUserKey;
-        mNotificationKeys = new ArrayList<>();
-    }
-
     /**
      * Returns whether the notification was added or its count changed.
      */
diff --git a/src/com/android/launcher3/dot/FolderDotInfo.java b/src/com/android/launcher3/dot/FolderDotInfo.java
index b5eb8cd..54800a0 100644
--- a/src/com/android/launcher3/dot/FolderDotInfo.java
+++ b/src/com/android/launcher3/dot/FolderDotInfo.java
@@ -30,10 +30,6 @@
 
     private int mNumNotifications;
 
-    public FolderDotInfo() {
-        super(null);
-    }
-
     public void addDotInfo(DotInfo dotToAdd) {
         if (dotToAdd == null) {
             return;
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 9b23f3f..b0af4c6 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -61,6 +61,7 @@
 import com.android.launcher3.notification.NotificationInfo;
 import com.android.launcher3.notification.NotificationItemView;
 import com.android.launcher3.notification.NotificationKeyData;
+import com.android.launcher3.popup.PopupDataProvider.PopupDataChangeListener;
 import com.android.launcher3.shortcuts.DeepShortcutManager;
 import com.android.launcher3.shortcuts.DeepShortcutView;
 import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider;
@@ -72,7 +73,6 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.function.Predicate;
 
 /**
@@ -80,7 +80,7 @@
  */
 public class PopupContainerWithArrow extends ArrowPopup implements DragSource,
         DragController.DragListener, View.OnLongClickListener,
-        View.OnTouchListener {
+        View.OnTouchListener, PopupDataChangeListener {
 
     private final List<DeepShortcutView> mShortcuts = new ArrayList<>();
     private final PointF mInterceptTouchDown = new PointF();
@@ -115,6 +115,18 @@
     }
 
     @Override
+    protected void onAttachedToWindow() {
+        super.onAttachedToWindow();
+        mLauncher.getPopupDataProvider().setChangeListener(this);
+    }
+
+    @Override
+    protected void onDetachedFromWindow() {
+        super.onDetachedFromWindow();
+        mLauncher.getPopupDataProvider().setChangeListener(null);
+    }
+
+    @Override
     public boolean onInterceptTouchEvent(MotionEvent ev) {
         if (ev.getAction() == MotionEvent.ACTION_DOWN) {
             mInterceptTouchDown.set(ev.getX(), ev.getY());
@@ -352,7 +364,7 @@
     }
 
     @Override
-    protected void onWidgetsBound() {
+    public void onWidgetsBound() {
         ItemInfo itemInfo = (ItemInfo) mOriginalIcon.getTag();
         SystemShortcut widgetInfo = new SystemShortcut.Widgets();
         View.OnClickListener onClickListener = widgetInfo.getOnClickListener(mLauncher, itemInfo);
@@ -464,7 +476,8 @@
     /**
      * Updates the notification header if the original icon's dot updated.
      */
-    public void updateNotificationHeader(Predicate<PackageUserKey> updatedDots) {
+    @Override
+    public void onNotificationDotsUpdated(Predicate<PackageUserKey> updatedDots) {
         ItemInfo itemInfo = (ItemInfo) mOriginalIcon.getTag();
         PackageUserKey packageUser = PackageUserKey.fromItemInfo(itemInfo);
         if (updatedDots.test(packageUser)) {
@@ -481,6 +494,7 @@
         }
     }
 
+    @Override
     public void trimNotifications(Map<PackageUserKey, DotInfo> updatedDots) {
         if (mNotificationItemView == null) {
             return;
diff --git a/src/com/android/launcher3/popup/PopupDataProvider.java b/src/com/android/launcher3/popup/PopupDataProvider.java
index f4da858..2d301ac 100644
--- a/src/com/android/launcher3/popup/PopupDataProvider.java
+++ b/src/com/android/launcher3/popup/PopupDataProvider.java
@@ -22,7 +22,6 @@
 
 import com.android.launcher3.ItemInfo;
 import com.android.launcher3.Launcher;
-import com.android.launcher3.Utilities;
 import com.android.launcher3.dot.DotInfo;
 import com.android.launcher3.model.WidgetItem;
 import com.android.launcher3.notification.NotificationKeyData;
@@ -38,6 +37,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.function.Predicate;
 
 import androidx.annotation.NonNull;
 
@@ -58,10 +58,17 @@
     /** Maps packages to their Widgets */
     private ArrayList<WidgetListRowEntry> mAllWidgets = new ArrayList<>();
 
+    private PopupDataChangeListener mChangeListener = PopupDataChangeListener.INSTANCE;
+
     public PopupDataProvider(Launcher launcher) {
         mLauncher = launcher;
     }
 
+    private void updateNotificationDots(Predicate<PackageUserKey> updatedDots) {
+        mLauncher.updateNotificationDots(updatedDots);
+        mChangeListener.onNotificationDotsUpdated(updatedDots);
+    }
+
     @Override
     public void onNotificationPosted(PackageUserKey postedPackageUserKey,
             NotificationKeyData notificationKey, boolean shouldBeFilteredOut) {
@@ -69,7 +76,7 @@
         boolean dotShouldBeRefreshed;
         if (dotInfo == null) {
             if (!shouldBeFilteredOut) {
-                DotInfo newDotInfo = new DotInfo(postedPackageUserKey);
+                DotInfo newDotInfo = new DotInfo();
                 newDotInfo.addOrUpdateNotificationKey(notificationKey);
                 mPackageUserToDotInfos.put(postedPackageUserKey, newDotInfo);
                 dotShouldBeRefreshed = true;
@@ -85,7 +92,7 @@
             }
         }
         if (dotShouldBeRefreshed) {
-            mLauncher.updateNotificationDots(t -> postedPackageUserKey.equals(t));
+            updateNotificationDots(t -> postedPackageUserKey.equals(t));
         }
     }
 
@@ -97,7 +104,7 @@
             if (oldDotInfo.getNotificationKeys().size() == 0) {
                 mPackageUserToDotInfos.remove(removedPackageUserKey);
             }
-            mLauncher.updateNotificationDots(t -> removedPackageUserKey.equals(t));
+            updateNotificationDots(t -> removedPackageUserKey.equals(t));
             trimNotifications(mPackageUserToDotInfos);
         }
     }
@@ -112,7 +119,7 @@
             PackageUserKey packageUserKey = PackageUserKey.fromNotification(notification);
             DotInfo dotInfo = mPackageUserToDotInfos.get(packageUserKey);
             if (dotInfo == null) {
-                dotInfo = new DotInfo(packageUserKey);
+                dotInfo = new DotInfo();
                 mPackageUserToDotInfos.put(packageUserKey, dotInfo);
             }
             dotInfo.addOrUpdateNotificationKey(NotificationKeyData.fromNotification(notification));
@@ -133,16 +140,13 @@
         }
 
         if (!updatedDots.isEmpty()) {
-            mLauncher.updateNotificationDots(updatedDots::containsKey);
+            updateNotificationDots(updatedDots::containsKey);
         }
         trimNotifications(updatedDots);
     }
 
     private void trimNotifications(Map<PackageUserKey, DotInfo> updatedDots) {
-        PopupContainerWithArrow openContainer = PopupContainerWithArrow.getOpen(mLauncher);
-        if (openContainer != null) {
-            openContainer.trimNotifications(updatedDots);
-        }
+        mChangeListener.trimNotifications(updatedDots);
     }
 
     public void setDeepShortcutMap(HashMap<ComponentKey, Integer> deepShortcutMapCopy) {
@@ -194,6 +198,11 @@
 
     public void setAllWidgets(ArrayList<WidgetListRowEntry> allWidgets) {
         mAllWidgets = allWidgets;
+        mChangeListener.onWidgetsBound();
+    }
+
+    public void setChangeListener(PopupDataChangeListener listener) {
+        mChangeListener = listener == null ? PopupDataChangeListener.INSTANCE : listener;
     }
 
     public ArrayList<WidgetListRowEntry> getAllWidgets() {
@@ -216,4 +225,15 @@
         }
         return null;
     }
+
+    public interface PopupDataChangeListener {
+
+        PopupDataChangeListener INSTANCE = new PopupDataChangeListener() { };
+
+        default void onNotificationDotsUpdated(Predicate<PackageUserKey> updatedDots) { }
+
+        default void trimNotifications(Map<PackageUserKey, DotInfo> updatedDots) { }
+
+        default void onWidgetsBound() { }
+    }
 }
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index 508695b..df82661 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -34,6 +34,7 @@
 import com.android.launcher3.R;
 import com.android.launcher3.Utilities;
 import com.android.launcher3.dragndrop.DragOptions;
+import com.android.launcher3.popup.PopupDataProvider;
 import com.android.launcher3.touch.ItemLongClickListener;
 import com.android.launcher3.uioverrides.WallpaperColorInfo;
 import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -47,7 +48,8 @@
  * Base class for various widgets popup
  */
 abstract class BaseWidgetSheet extends AbstractSlideInView
-        implements OnClickListener, OnLongClickListener, DragSource {
+        implements OnClickListener, OnLongClickListener, DragSource,
+        PopupDataProvider.PopupDataChangeListener {
 
 
     /* Touch handling related member variables. */
@@ -61,6 +63,18 @@
     }
 
     @Override
+    protected void onAttachedToWindow() {
+        super.onAttachedToWindow();
+        mLauncher.getPopupDataProvider().setChangeListener(this);
+    }
+
+    @Override
+    protected void onDetachedFromWindow() {
+        super.onDetachedFromWindow();
+        mLauncher.getPopupDataProvider().setChangeListener(null);
+    }
+
+    @Override
     public final void onClick(View v) {
         // Let the user know that they have to long press to add a widget
         if (mWidgetInstructionToast != null) {
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index 4bd6234..05368fa 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -76,7 +76,7 @@
     }
 
     @Override
-    protected void onWidgetsBound() {
+    public void onWidgetsBound() {
         List<WidgetItem> widgets = mLauncher.getPopupDataProvider().getWidgetsForPackageUser(
                 new PackageUserKey(
                         mOriginalItemInfo.getTargetComponent().getPackageName(),
diff --git a/src/com/android/launcher3/widget/WidgetsFullSheet.java b/src/com/android/launcher3/widget/WidgetsFullSheet.java
index 1112686..ec06d1e 100644
--- a/src/com/android/launcher3/widget/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsFullSheet.java
@@ -155,7 +155,7 @@
     }
 
     @Override
-    protected void onWidgetsBound() {
+    public void onWidgetsBound() {
         mAdapter.setWidgets(mLauncher.getPopupDataProvider().getAllWidgets());
     }
 
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index e20a89e..acdcd75 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -266,6 +266,16 @@
                 event -> true,
                 "Pressing Home didn't produce any events");
         mDevice.waitForIdle();
+
+        // Temporarily press home twice as the first click sometimes gets ignored  (b/124239413)
+        executeAndWaitForEvent(
+                () -> {
+                    log("LauncherInstrumentation.pressHome before clicking");
+                    getSystemUiObject("home").click();
+                },
+                event -> true,
+                "Pressing Home didn't produce any events");
+        mDevice.waitForIdle();
         return getWorkspace();
     }
 
@@ -350,7 +360,7 @@
         return new AllAppsFromOverview(this);
     }
 
-    private void waitUntilGone(String resId) {
+    void waitUntilGone(String resId) {
         assertTrue("Unexpected launcher object visible: " + resId,
                 mDevice.wait(Until.gone(getLauncherObjectSelector(resId)),
                         WAIT_TIME_MS));
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index f055c0c..587c712 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -116,6 +116,7 @@
         final Point dest = new Point(
                 mLauncher.getDevice().getDisplayWidth(), workspace.getVisibleBounds().centerY());
         app.getObject().drag(dest, ICON_DRAG_SPEED);
+        mLauncher.waitUntilGone("drop_target_bar");
         verifyActiveContainer();
     }
 
