Merge "Add flag guarding around setText in TaskView." into main
diff --git a/quickstep/res/layout/taskbar.xml b/quickstep/res/layout/taskbar.xml
index 94388b4..72d7485 100644
--- a/quickstep/res/layout/taskbar.xml
+++ b/quickstep/res/layout/taskbar.xml
@@ -45,9 +45,6 @@
             android:id="@+id/start_contextual_buttons"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:paddingStart="@dimen/taskbar_contextual_button_padding"
-            android:paddingEnd="@dimen/taskbar_contextual_button_padding"
-            android:paddingTop="@dimen/taskbar_contextual_padding_top"
             android:gravity="center_vertical"
             android:layout_gravity="start"/>
 
@@ -63,7 +60,6 @@
             android:id="@+id/end_contextual_buttons"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:paddingTop="@dimen/taskbar_contextual_padding_top"
             android:gravity="center_vertical"
             android:layout_gravity="end"/>
     </FrameLayout>
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index cca0fd4..d2be94a 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -1824,7 +1824,7 @@
                 StartingWindowListener startingWindowListener, RunnableList onEndCallback) {
             View viewToUse = findLaunchableViewWithBackground(v);
             if (viewToUse == null) {
-                viewToUse = v;
+                return null;
             }
 
             // The CUJ is logged by the click handler, so we don't log it inside the animation
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt
index 7529508..b516d6f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt
@@ -69,4 +69,18 @@
         params.gravity = Gravity.CENTER
         return params;
     }
+
+    open fun repositionContextualContainer(contextualContainer: ViewGroup, barAxisMargin: Int,
+                                           gravity: Int) {
+        val contextualContainerParams = FrameLayout.LayoutParams(
+                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
+        contextualContainerParams.apply {
+            marginStart = barAxisMargin
+            marginEnd = barAxisMargin
+            topMargin = 0
+            bottomMargin = 0
+        }
+        contextualContainerParams.gravity = gravity or Gravity.CENTER_VERTICAL
+        contextualContainer.layoutParams = contextualContainerParams
+    }
 }
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt
index cb37cc7..3f51958 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt
@@ -25,6 +25,7 @@
 import android.widget.ImageView
 import android.widget.LinearLayout
 import com.android.launcher3.DeviceProfile
+import com.android.launcher3.R
 import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.*
 import com.android.systemui.shared.rotation.RotationButton
 
@@ -100,15 +101,10 @@
         endContextualContainer.removeAllViews()
         startContextualContainer.removeAllViews()
 
-        val endContextualContainerParams = FrameLayout.LayoutParams(
-                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
-        endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL
-        endContextualContainer.layoutParams = endContextualContainerParams
-
-        val startContextualContainerParams = FrameLayout.LayoutParams(
-                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
-        startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL
-        startContextualContainer.layoutParams = startContextualContainerParams
+        val contextualMargin = resources.getDimensionPixelSize(
+                R.dimen.taskbar_contextual_button_padding)
+        repositionContextualContainer(endContextualContainer, 0, Gravity.END)
+        repositionContextualContainer(startContextualContainer, contextualMargin, Gravity.START)
 
         if (imeSwitcher != null) {
             startContextualContainer.addView(imeSwitcher)
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt
index 9903efa..382e298 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt
@@ -104,10 +104,9 @@
         endContextualContainer.removeAllViews()
         startContextualContainer.removeAllViews()
 
-        val startContextualContainerParams = FrameLayout.LayoutParams(
-                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
-        startContextualContainerParams.gravity = Gravity.TOP or Gravity.CENTER_HORIZONTAL
-        startContextualContainer.layoutParams = startContextualContainerParams
+        val contextualMargin = resources.getDimensionPixelSize(
+                R.dimen.taskbar_contextual_button_padding)
+        repositionContextualContainer(startContextualContainer, contextualMargin, Gravity.TOP)
 
         if (imeSwitcher != null) {
             startContextualContainer.addView(imeSwitcher)
@@ -121,4 +120,18 @@
             rotationButton.currentView.layoutParams = getParamsToCenterView()
         }
     }
+
+    override fun repositionContextualContainer(contextualContainer: ViewGroup, barAxisMargin: Int,
+                                               gravity: Int) {
+        val contextualContainerParams = FrameLayout.LayoutParams(
+                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+        contextualContainerParams.apply {
+            marginStart = 0
+            marginEnd = 0
+            topMargin = barAxisMargin
+            bottomMargin = barAxisMargin
+        }
+        contextualContainerParams.gravity = gravity or Gravity.CENTER_HORIZONTAL
+        contextualContainer.layoutParams = contextualContainerParams
+    }
 }
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt
index 8745fc7..e1ffa4d 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt
@@ -102,10 +102,9 @@
         endContextualContainer.removeAllViews()
         startContextualContainer.removeAllViews()
 
-        val endContextualContainerParams = FrameLayout.LayoutParams(
-                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
-        endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL
-        endContextualContainer.layoutParams = endContextualContainerParams
+        val contextualMargin = resources.getDimensionPixelSize(
+                R.dimen.taskbar_contextual_button_padding)
+        repositionContextualContainer(endContextualContainer, contextualMargin, Gravity.END)
 
         if (imeSwitcher != null) {
             endContextualContainer.addView(imeSwitcher)
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt
index cfe1276..0368b1d 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt
@@ -19,9 +19,9 @@
 import android.content.res.Resources
 import android.view.Gravity
 import android.view.ViewGroup
-import android.widget.FrameLayout
 import android.widget.ImageView
 import android.widget.LinearLayout
+import com.android.launcher3.R
 import com.android.systemui.shared.rotation.RotationButton
 
 class PhoneSeascapeNavLayoutter(
@@ -54,10 +54,9 @@
         endContextualContainer.removeAllViews()
         startContextualContainer.removeAllViews()
 
-        val endContextualContainerParams = FrameLayout.LayoutParams(
-                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
-        endContextualContainerParams.gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL
-        endContextualContainer.layoutParams = endContextualContainerParams
+        val contextualMargin = resources.getDimensionPixelSize(
+                R.dimen.taskbar_contextual_button_padding)
+        repositionContextualContainer(endContextualContainer, contextualMargin, Gravity.BOTTOM)
 
         if (imeSwitcher != null) {
             endContextualContainer.addView(imeSwitcher)
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt
index 015fac4..abdd32c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt
@@ -23,6 +23,7 @@
 import android.widget.ImageView
 import android.widget.LinearLayout
 import com.android.launcher3.DeviceProfile
+import com.android.launcher3.R
 import com.android.systemui.shared.rotation.RotationButton
 
 class SetupNavLayoutter(
@@ -58,15 +59,10 @@
         endContextualContainer.removeAllViews()
         startContextualContainer.removeAllViews()
 
-        val endContextualContainerParams = FrameLayout.LayoutParams(
-                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
-        endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL
-        endContextualContainer.layoutParams = endContextualContainerParams
-
-        val startContextualContainerParams = FrameLayout.LayoutParams(
-                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
-        startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL
-        startContextualContainer.layoutParams = startContextualContainerParams
+        val contextualMargin = resources.getDimensionPixelSize(
+                R.dimen.taskbar_contextual_button_padding)
+        repositionContextualContainer(endContextualContainer, 0, Gravity.END)
+        repositionContextualContainer(startContextualContainer, contextualMargin, Gravity.START)
 
         if (imeSwitcher != null) {
             startContextualContainer.addView(imeSwitcher)
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt
index ccd5c72..f5a4c64 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt
@@ -92,15 +92,10 @@
         startContextualContainer.removeAllViews()
 
         if (!dp.isGestureMode) {
-            val endContextualContainerParams = FrameLayout.LayoutParams(
-                    ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
-            endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL
-            endContextualContainer.layoutParams = endContextualContainerParams
-
-            val startContextualContainerParams = FrameLayout.LayoutParams(
-                    ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
-            startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL
-            startContextualContainer.layoutParams = startContextualContainerParams
+            val contextualMargin = resources.getDimensionPixelSize(
+                    R.dimen.taskbar_contextual_button_padding)
+            repositionContextualContainer(endContextualContainer, 0, Gravity.END)
+            repositionContextualContainer(startContextualContainer, contextualMargin, Gravity.START)
 
             if (imeSwitcher != null) {
                 startContextualContainer.addView(imeSwitcher)
diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java
index 3c7fbf0..38e896e 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -37,7 +37,6 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Trace;
-import android.util.Log;
 import android.view.Display;
 import android.view.RemoteAnimationAdapter;
 import android.view.RemoteAnimationTarget;
@@ -68,7 +67,6 @@
 import com.android.launcher3.statemanager.StatefulActivity;
 import com.android.launcher3.taskbar.FallbackTaskbarUIController;
 import com.android.launcher3.taskbar.TaskbarManager;
-import com.android.launcher3.testing.shared.TestProtocol;
 import com.android.launcher3.util.ActivityOptionsWrapper;
 import com.android.launcher3.util.ActivityTracker;
 import com.android.launcher3.util.RunnableList;
@@ -418,7 +416,6 @@
     }
 
     public void startHome() {
-        Log.d(TestProtocol.INCORRECT_HOME_STATE, "start home from recents activity");
         RecentsView recentsView = getOverviewPanel();
         recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true,
                 this::startHomeInternal));
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index 4b47209..0bc44e1 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -21,6 +21,7 @@
 import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
 import static com.android.launcher3.util.NavigationMode.NO_BUTTON;
 import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
+import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINISHED;
 import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_INITIALIZED;
 import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_STARTED;
 import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.START_RECENTS_ANIMATION;
@@ -38,9 +39,7 @@
 
 import com.android.launcher3.Utilities;
 import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.testing.shared.TestProtocol;
 import com.android.launcher3.util.DisplayController;
-import com.android.quickstep.TopTaskTracker.CachedTaskInfo;
 import com.android.quickstep.util.ActiveGestureLog;
 import com.android.quickstep.views.RecentsView;
 import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -154,6 +153,24 @@
                     mLastAppearedTaskTargets[i] = task;
                 }
                 mLastGestureState.updateLastAppearedTaskTargets(mLastAppearedTaskTargets);
+
+                if (ENABLE_SHELL_TRANSITIONS && mTargets.hasRecents
+                        // The filtered (MODE_CLOSING) targets only contain 1 home activity.
+                        && mTargets.apps.length == 1
+                        && mTargets.apps[0].windowConfiguration.getActivityType()
+                        == ACTIVITY_TYPE_HOME) {
+                    // This is launching RecentsActivity on top of a 3p launcher. There are no
+                    // other apps need to keep visible so finish the animating state after the
+                    // enter animation of overview is done. Then 3p launcher can be stopped.
+                    mLastGestureState.runOnceAtState(STATE_END_TARGET_ANIMATION_FINISHED, () -> {
+                        // Only finish if the end target is RECENTS. Otherwise, if the target is
+                        // NEW_TASK, startActivityFromRecents will be skipped.
+                        if (mLastGestureState.getEndTarget() == RECENTS) {
+                            finishRunningRecentsAnimation(false /* toHome */,
+                                    true /* forceFinish */, null /* forceFinishCb */);
+                        }
+                    });
+                }
             }
 
             @Override
@@ -181,9 +198,6 @@
                         RecentsView recentsView =
                                 activityInterface.getCreatedActivity().getOverviewPanel();
                         if (recentsView != null) {
-                            Log.d(TestProtocol.INCORRECT_HOME_STATE,
-                                    "finish recents animation on "
-                                            + compat.taskInfo.description);
                             recentsView.finishRecentsAnimation(true, null);
                         }
                         return;
@@ -256,15 +270,8 @@
 
         if (ENABLE_SHELL_TRANSITIONS) {
             final ActivityOptions options = ActivityOptions.makeBasic();
-            // Allowing to pause Home if Home is top activity and Recents is not Home. So when user
-            // start home when recents animation is playing, the home activity can be resumed again
-            // to let the transition controller collect Home activity.
-            CachedTaskInfo cti = gestureState.getRunningTask();
-            boolean homeIsOnTop = cti != null && cti.isHomeTask();
-            if (activityInterface.allowAllAppsFromOverview()) {
-                homeIsOnTop = true;
-            }
-            if (!homeIsOnTop) {
+            // Use regular (non-transient) launch for all apps page to control IME.
+            if (!activityInterface.allowAllAppsFromOverview()) {
                 options.setTransientLaunch();
             }
             options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_RECENTS_ANIMATION, eventTime);
diff --git a/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java
index f9f1579..1af4bad 100644
--- a/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java
+++ b/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java
@@ -20,8 +20,6 @@
 import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
 
 import android.content.Context;
-import android.view.GestureDetector;
-import android.view.GestureDetector.SimpleOnGestureListener;
 import android.view.MotionEvent;
 import android.view.ViewConfiguration;
 
@@ -37,51 +35,36 @@
  */
 public class NavHandleLongPressInputConsumer extends DelegateInputConsumer {
 
-    private final GestureDetector mLongPressDetector;
     private final NavHandleLongPressHandler mNavHandleLongPressHandler;
     private final float mNavHandleWidth;
     private final float mScreenWidth;
+    private final ViewConfiguration mViewConfiguration;
 
-    // Below are only used if CUSTOM_LPNH_THRESHOLDS is enabled.
-    private final float mCustomTouchSlopSquared;
-    private final int mCustomLongPressTimeout;
-    private final Runnable mTriggerCustomLongPress = this::triggerCustomLongPress;
-    private MotionEvent mCurrentCustomDownEvent;
+    private final Runnable mTriggerLongPress = this::triggerLongPress;
+    private final float mTouchSlopSquared;
+    private final int mLongPressTimeout;
+
+    private MotionEvent mCurrentDownEvent;
 
     public NavHandleLongPressInputConsumer(Context context, InputConsumer delegate,
             InputMonitorCompat inputMonitor) {
         super(delegate, inputMonitor);
+        mViewConfiguration = ViewConfiguration.get(context);
         mNavHandleWidth = context.getResources().getDimensionPixelSize(
                 R.dimen.navigation_home_handle_width);
         mScreenWidth = DisplayController.INSTANCE.get(context).getInfo().currentSize.x;
-        float customSlopMultiplier =
-                LauncherPrefs.get(context).get(LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE) / 100f;
-        float customTouchSlop =
-                ViewConfiguration.get(context).getScaledEdgeSlop() * customSlopMultiplier;
-        mCustomTouchSlopSquared = customTouchSlop * customTouchSlop;
-        mCustomLongPressTimeout = LauncherPrefs.get(context).get(LONG_PRESS_NAV_HANDLE_TIMEOUT_MS);
-
+        float touchSlop;
+        if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) {
+            float customSlopMultiplier =
+                    LauncherPrefs.get(context).get(LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE) / 100f;
+            touchSlop = mViewConfiguration.getScaledEdgeSlop() * customSlopMultiplier;
+            mLongPressTimeout = LauncherPrefs.get(context).get(LONG_PRESS_NAV_HANDLE_TIMEOUT_MS);
+        } else {
+            touchSlop = mViewConfiguration.getScaledTouchSlop();
+            mLongPressTimeout = ViewConfiguration.getLongPressTimeout();
+        }
+        mTouchSlopSquared = touchSlop * touchSlop;
         mNavHandleLongPressHandler = NavHandleLongPressHandler.newInstance(context);
-
-        mLongPressDetector = new GestureDetector(context, new SimpleOnGestureListener() {
-            @Override
-            public void onLongPress(MotionEvent motionEvent) {
-                if (isInNavBarHorizontalArea(motionEvent.getRawX())) {
-                    Runnable longPressRunnable = mNavHandleLongPressHandler.getLongPressRunnable();
-                    if (longPressRunnable != null) {
-                        OtherActivityInputConsumer oaic = getInputConsumerOfClass(
-                                OtherActivityInputConsumer.class);
-                        if (oaic != null) {
-                            oaic.setForceFinishRecentsTransitionCallback(longPressRunnable);
-                            setActive(motionEvent);
-                        } else {
-                            setActive(motionEvent);
-                            MAIN_EXECUTOR.post(longPressRunnable);
-                        }
-                    }
-                }
-            }
-        });
     }
 
     @Override
@@ -91,30 +74,41 @@
 
     @Override
     public void onMotionEvent(MotionEvent ev) {
-        if (!FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) {
-            mLongPressDetector.onTouchEvent(ev);
-        } else {
-            switch (ev.getAction()) {
-                case MotionEvent.ACTION_DOWN -> {
-                    if (mCurrentCustomDownEvent != null) {
-                        mCurrentCustomDownEvent.recycle();
-                    }
-                    mCurrentCustomDownEvent = MotionEvent.obtain(ev);
-                    if (isInNavBarHorizontalArea(ev.getRawX())) {
-                        MAIN_EXECUTOR.getHandler().postDelayed(mTriggerCustomLongPress,
-                                mCustomLongPressTimeout);
-                    }
+        switch (ev.getAction()) {
+            case MotionEvent.ACTION_DOWN -> {
+                if (mCurrentDownEvent != null) {
+                    mCurrentDownEvent.recycle();
                 }
-                case MotionEvent.ACTION_MOVE -> {
-                    double touchDeltaSquared =
-                            Math.pow(ev.getX() - mCurrentCustomDownEvent.getX(), 2)
-                            + Math.pow(ev.getY() - mCurrentCustomDownEvent.getY(), 2);
-                    if (touchDeltaSquared > mCustomTouchSlopSquared) {
-                        cancelCustomLongPress();
-                    }
+                mCurrentDownEvent = MotionEvent.obtain(ev);
+                if (isInNavBarHorizontalArea(ev.getRawX())) {
+                    MAIN_EXECUTOR.getHandler().postDelayed(mTriggerLongPress,
+                            mLongPressTimeout);
                 }
-                case MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> cancelCustomLongPress();
             }
+            case MotionEvent.ACTION_MOVE -> {
+                float touchSlopSquared = mTouchSlopSquared;
+                float dx = ev.getX() - mCurrentDownEvent.getX();
+                float dy = ev.getY() - mCurrentDownEvent.getY();
+                double distanceSquared = (dx * dx) + (dy * dy);
+                // If the gesture is ambiguous then require more movement before classifying this
+                // as a NON long press gesture.
+                if (ev.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE) {
+                    float ambiguousGestureMultiplier =
+                            mViewConfiguration.getScaledAmbiguousGestureMultiplier();
+                    touchSlopSquared *= ambiguousGestureMultiplier * ambiguousGestureMultiplier;
+                }
+                if (distanceSquared > touchSlopSquared) {
+                    cancelLongPress();
+                }
+            }
+            case MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> cancelLongPress();
+        }
+
+        // If the gesture is deep press then trigger long press asap
+        if (MAIN_EXECUTOR.getHandler().hasCallbacks(mTriggerLongPress)
+                && ev.getClassification() == MotionEvent.CLASSIFICATION_DEEP_PRESS) {
+            MAIN_EXECUTOR.getHandler().removeCallbacks(mTriggerLongPress);
+            MAIN_EXECUTOR.getHandler().post(mTriggerLongPress);
         }
 
         if (mState != STATE_ACTIVE) {
@@ -122,17 +116,23 @@
         }
     }
 
-    private void triggerCustomLongPress() {
+    private void triggerLongPress() {
         Runnable longPressRunnable = mNavHandleLongPressHandler.getLongPressRunnable();
         if (longPressRunnable != null) {
-            setActive(mCurrentCustomDownEvent);
-
-            MAIN_EXECUTOR.post(longPressRunnable);
+            OtherActivityInputConsumer oaic = getInputConsumerOfClass(
+                    OtherActivityInputConsumer.class);
+            if (oaic != null) {
+                oaic.setForceFinishRecentsTransitionCallback(longPressRunnable);
+                setActive(mCurrentDownEvent);
+            } else {
+                setActive(mCurrentDownEvent);
+                MAIN_EXECUTOR.post(longPressRunnable);
+            }
         }
     }
 
-    private void cancelCustomLongPress() {
-        MAIN_EXECUTOR.getHandler().removeCallbacks(mTriggerCustomLongPress);
+    private void cancelLongPress() {
+        MAIN_EXECUTOR.getHandler().removeCallbacks(mTriggerLongPress);
     }
 
     private boolean isInNavBarHorizontalArea(float x) {
diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
index b1daac4..71673f3 100644
--- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
+++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
@@ -224,6 +224,7 @@
         private LauncherAtom.Slice mSlice;
         private Optional<Integer> mCardinality = Optional.empty();
         private int mInputType = SysUiStatsLog.LAUNCHER_UICHANGED__INPUT_TYPE__UNKNOWN;
+        private Optional<Integer> mFeatures = Optional.empty();
 
         StatsCompatLogger(Context context, ActivityContext activityContext) {
             mContext = context;
@@ -323,6 +324,12 @@
         }
 
         @Override
+        public StatsLogger withFeatures(int feature) {
+            this.mFeatures = Optional.of(feature);
+            return this;
+        }
+
+        @Override
         public void log(EventEnum event) {
             if (!Utilities.ATLEAST_R) {
                 return;
@@ -451,6 +458,7 @@
                 return;
             }
             int cardinality = mCardinality.orElseGet(() -> getCardinality(atomInfo));
+            int features = mFeatures.orElseGet(() -> getFeatures(atomInfo));
             SysUiStatsLog.write(
                     SysUiStatsLog.LAUNCHER_EVENT,
                     SysUiStatsLog.LAUNCHER_UICHANGED__ACTION__DEFAULT_ACTION /* deprecated */,
@@ -477,7 +485,7 @@
                     atomInfo.getFolderIcon().getToLabelState().getNumber() /* toState */,
                     atomInfo.getFolderIcon().getLabelInfo() /* edittext */,
                     cardinality /* cardinality */,
-                    getFeatures(atomInfo) /* features */,
+                    features /* features */,
                     getSearchAttributes(atomInfo) /* searchAttributes */,
                     getAttributes(atomInfo) /* attributes */,
                     inputType /* input_type */
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index ef908c5..0a195c3 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -5270,8 +5270,6 @@
         cleanupRemoteTargets();
 
         if (mRecentsAnimationController == null) {
-            Log.d(TestProtocol.INCORRECT_HOME_STATE, "finish recents animation but recents "
-                    + "animation controller was null. returning.");
             if (onFinishComplete != null) {
                 onFinishComplete.run();
             }
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 152d834..3ba62cb 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -1020,6 +1020,17 @@
                     mActivity.getStateManager(), recentsView,
                     recentsView.getDepthController());
             anim.addListener(new AnimatorListenerAdapter() {
+                @Override
+                public void onAnimationStart(Animator animation) {
+                    if (!recentsView.showAsGrid()) {
+                        return;
+                    }
+                    recentsView.runActionOnRemoteHandles(
+                            (Consumer<RemoteTargetHandle>) remoteTargetHandle ->
+                                    remoteTargetHandle
+                                            .getTaskViewSimulator()
+                                            .setDrawsBelowRecents(false));
+                }
 
                 @Override
                 public void onAnimationEnd(Animator animator) {
diff --git a/quickstep/tests/src/com/android/quickstep/RecentsModelTest.java b/quickstep/tests/src/com/android/quickstep/RecentsModelTest.java
index c552d83..648fa93 100644
--- a/quickstep/tests/src/com/android/quickstep/RecentsModelTest.java
+++ b/quickstep/tests/src/com/android/quickstep/RecentsModelTest.java
@@ -101,11 +101,6 @@
         when(mContext.getResources()).thenReturn(mResource);
     }
 
-    @After
-    public void tearDown() throws Exception {
-        mSetFlagsRule.disableFlags(Flags.FLAG_ENABLE_GRID_ONLY_OVERVIEW);
-    }
-
     @Test
     @UiThreadTest
     public void preloadOnHighResolutionEnabled() {
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 689da48..61f1f74 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -17,7 +17,6 @@
 package com.android.quickstep;
 
 import static com.android.launcher3.config.FeatureFlags.ENABLE_CURSOR_HOVER_STATES;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ICON_MENU;
 import static com.android.quickstep.TaskbarModeSwitchRule.Mode.PERSISTENT;
 import static com.android.quickstep.TaskbarModeSwitchRule.Mode.TRANSIENT;
 
@@ -44,7 +43,6 @@
 import com.android.launcher3.tapl.Overview;
 import com.android.launcher3.tapl.OverviewActions;
 import com.android.launcher3.tapl.OverviewTask;
-import com.android.launcher3.tapl.OverviewTaskMenu;
 import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
 import com.android.launcher3.ui.TaplTestsLauncher3;
 import com.android.launcher3.util.TestUtil;
@@ -195,38 +193,6 @@
         actionsView.clickAndDismissScreenshot();
     }
 
-
-    @PlatinumTest(focusArea = "launcher")
-    @Test
-    public void testOverviewActionsMenu() throws Exception {
-        startTestAppsWithCheck();
-
-        OverviewTaskMenu menu = mLauncher.goHome().switchToOverview().getCurrentTask().tapMenu();
-
-        assertNotNull("Tapping App info menu item returned null", menu.tapAppInfoMenuItem());
-        executeOnLauncher(launcher -> assertTrue(
-                "Launcher activity is the top activity; expecting another activity to be the top",
-                isInLaunchedApp(launcher)));
-    }
-
-
-    @Test
-    @ScreenRecord // b/303329286
-    public void testOverviewActionsMenu_iconAppChipMenu() throws Exception {
-        try (AutoCloseable c = TestUtil.overrideFlag(ENABLE_OVERVIEW_ICON_MENU, true)) {
-            startTestAppsWithCheck();
-
-            OverviewTaskMenu menu =
-                    mLauncher.goHome().switchToOverview().getCurrentTask().tapMenu();
-
-            assertNotNull("Tapping App info menu item returned null", menu.tapAppInfoMenuItem());
-            executeOnLauncher(launcher -> assertTrue(
-                    "Launcher activity is the top activity; expecting another activity to be the "
-                            + "top",
-                    isInLaunchedApp(launcher)));
-        }
-    }
-
     private int getCurrentOverviewPage(Launcher launcher) {
         return launcher.<RecentsView>getOverviewPanel().getCurrentPage();
     }
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java b/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java
index 1e99f17..acbb58f 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java
@@ -16,7 +16,6 @@
 package com.android.quickstep;
 
 
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ICON_MENU;
 import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
 import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
 
@@ -30,10 +29,8 @@
 import androidx.test.filters.LargeTest;
 import androidx.test.platform.app.InstrumentationRegistry;
 
-import com.android.launcher3.tapl.OverviewTaskMenu;
 import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
 import com.android.launcher3.ui.TaplTestsLauncher3;
-import com.android.launcher3.util.TestUtil;
 import com.android.launcher3.util.rule.TestStabilityRule;
 import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
 import com.android.wm.shell.Flags;
@@ -142,42 +139,6 @@
                         .hasMenuItem("Save app pair"));
     }
 
-    @Test
-    public void testTapBothIconMenus() {
-        createAndLaunchASplitPair();
-
-        OverviewTaskMenu taskMenu =
-                mLauncher.goHome().switchToOverview().getCurrentTask().tapMenu();
-        assertTrue("App info item not appearing in expanded task menu.",
-                taskMenu.hasMenuItem("App info"));
-        taskMenu.touchOutsideTaskMenuToDismiss();
-
-        OverviewTaskMenu splitMenu =
-                mLauncher.getOverview().getCurrentTask().tapSplitTaskMenu();
-        assertTrue("App info item not appearing in expanded split task's menu.",
-                splitMenu.hasMenuItem("App info"));
-        splitMenu.touchOutsideTaskMenuToDismiss();
-    }
-
-    @Test
-    public void testTapBothIconMenus_iconAppChipMenu() throws Exception {
-        try (AutoCloseable c = TestUtil.overrideFlag(ENABLE_OVERVIEW_ICON_MENU, true)) {
-            createAndLaunchASplitPair();
-
-            OverviewTaskMenu taskMenu =
-                    mLauncher.goHome().switchToOverview().getCurrentTask().tapMenu();
-            assertTrue("App info item not appearing in expanded task menu.",
-                    taskMenu.hasMenuItem("App info"));
-            taskMenu.touchOutsideTaskMenuToDismiss();
-
-            OverviewTaskMenu splitMenu =
-                    mLauncher.getOverview().getCurrentTask().tapSplitTaskMenu();
-            assertTrue("App info item not appearing in expanded split task's menu.",
-                    splitMenu.hasMenuItem("App info"));
-            splitMenu.touchOutsideTaskMenuToDismiss();
-        }
-    }
-
     private void createAndLaunchASplitPair() {
         startTestActivity(2);
         startTestActivity(3);
diff --git a/res/drawable/encrypted_24px.xml b/res/drawable/encrypted_24px.xml
new file mode 100644
index 0000000..cf4d2df
--- /dev/null
+++ b/res/drawable/encrypted_24px.xml
@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="960"
+    android:viewportHeight="960"
+    android:tint="?attr/colorControlNormal">
+    <path
+        android:fillColor="@android:color/white"
+        android:pathData="M420,600L540,600L517,471Q537,461 548.5,442Q560,423 560,400Q560,367 536.5,343.5Q513,320 480,320Q447,320 423.5,343.5Q400,367 400,400Q400,423 411.5,442Q423,461 443,471L420,600ZM480,880Q341,845 250.5,720.5Q160,596 160,444L160,200L480,80L800,200L800,444Q800,596 709.5,720.5Q619,845 480,880ZM480,796Q584,763 652,664Q720,565 720,444L720,255L480,165L240,255L240,444Q240,565 308,664Q376,763 480,796ZM480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480Z"/>
+</vector>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 57163ff..4e865d0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -453,4 +453,7 @@
     <string name="search_pref_screen_title_tablet">Search your tablet</string>
     <!-- Failed action error message: e.g. Failed: Pause -->
     <string name="remote_action_failed">Failed: <xliff:g id="what" example="Pause">%1$s</xliff:g></string>
+
+    <!-- Private space label -->
+    <string name="private_space_label">Private space</string>
 </resources>
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 04e8da1..75f4bb2 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -486,7 +486,9 @@
                 iconBitmapSize, fillResIconDpi, numDatabaseAllAppsColumns, dbFile};
     }
 
-    private void onConfigChanged(Context context) {
+    /** Updates IDP using the provided context. Notifies listeners of change. */
+    @VisibleForTesting
+    public void onConfigChanged(Context context) {
         Object[] oldState = toModelState();
 
         // Re-init grid
diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
index dabe84d..61ca95b 100644
--- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
@@ -80,6 +80,7 @@
 import com.android.launcher3.keyboard.FocusedItemDecorator;
 import com.android.launcher3.model.StringCache;
 import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.recyclerview.AllAppsRecyclerViewPool;
 import com.android.launcher3.util.ItemInfoMatcher;
 import com.android.launcher3.util.Themes;
 import com.android.launcher3.views.ActivityContext;
@@ -93,7 +94,6 @@
 import java.util.Arrays;
 import java.util.List;
 import java.util.function.Predicate;
-import java.util.stream.Stream;
 
 /**
  * All apps container view with search support for use in a dragging activity.
@@ -623,16 +623,18 @@
     private static void setUpCustomRecyclerViewPool(
             @NonNull AllAppsRecyclerView mainRecyclerView,
             @Nullable AllAppsRecyclerView workRecyclerView,
-            @NonNull RecyclerView.RecycledViewPool recycledViewPool) {
+            @NonNull AllAppsRecyclerViewPool recycledViewPool) {
         if (!ENABLE_ALL_APPS_RV_PREINFLATION.get()) {
             return;
         }
+        final boolean hasWorkProfile = workRecyclerView != null;
+        recycledViewPool.setHasWorkProfile(hasWorkProfile);
         mainRecyclerView.setRecycledViewPool(recycledViewPool);
         if (workRecyclerView != null) {
             workRecyclerView.setRecycledViewPool(recycledViewPool);
         }
         if (ALL_APPS_GONE_VISIBILITY.get()) {
-            mainRecyclerView.updatePoolSize();
+            mainRecyclerView.updatePoolSize(hasWorkProfile);
         }
     }
 
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index cffddfc..b0f13ef 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -95,6 +95,10 @@
     }
 
     protected void updatePoolSize() {
+        updatePoolSize(false);
+    }
+
+    void updatePoolSize(boolean hasWorkProfile) {
         DeviceProfile grid = ActivityContext.lookupContext(getContext()).getDeviceProfile();
         RecyclerView.RecycledViewPool pool = getRecycledViewPool();
         pool.setMaxRecycledViews(AllAppsGridAdapter.VIEW_TYPE_EMPTY_SEARCH, 1);
@@ -111,6 +115,9 @@
             maxPoolSizeForAppIcons +=
                     PREINFLATE_ICONS_ROW_COUNT * grid.numShownAllAppsColumns + EXTRA_ICONS_COUNT;
         }
+        if (hasWorkProfile) {
+            maxPoolSizeForAppIcons *= 2;
+        }
         pool.setMaxRecycledViews(
                 AllAppsGridAdapter.VIEW_TYPE_ICON, maxPoolSizeForAppIcons);
     }
diff --git a/src/com/android/launcher3/allapps/AllAppsStore.java b/src/com/android/launcher3/allapps/AllAppsStore.java
index 7867f44..9f6e0fc 100644
--- a/src/com/android/launcher3/allapps/AllAppsStore.java
+++ b/src/com/android/launcher3/allapps/AllAppsStore.java
@@ -27,7 +27,6 @@
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
-import androidx.recyclerview.widget.RecyclerView.RecycledViewPool;
 
 import com.android.launcher3.BubbleTextView;
 import com.android.launcher3.model.data.AppInfo;
@@ -110,7 +109,7 @@
         }
     }
 
-    RecycledViewPool getRecyclerViewPool() {
+    AllAppsRecyclerViewPool getRecyclerViewPool() {
         return mAllAppsRecyclerViewPool;
     }
 
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index 4307566..632ca24 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -835,6 +835,13 @@
         }
 
         /**
+         * Set the features of the log message.
+         */
+        default StatsLogger withFeatures(int feature) {
+            return this;
+        }
+
+        /**
          * Builds the final message and logs it as {@link EventEnum}.
          */
         default void log(EventEnum event) {
diff --git a/src/com/android/launcher3/recyclerview/AllAppsRecyclerViewPool.kt b/src/com/android/launcher3/recyclerview/AllAppsRecyclerViewPool.kt
index 1d71805..45174a7 100644
--- a/src/com/android/launcher3/recyclerview/AllAppsRecyclerViewPool.kt
+++ b/src/com/android/launcher3/recyclerview/AllAppsRecyclerViewPool.kt
@@ -40,6 +40,8 @@
 
     private var future: Future<Void>? = null
 
+    var hasWorkProfile = false
+
     /**
      * Preinflate app icons. If all apps RV cannot be scrolled down, we don't need to preinflate.
      */
@@ -95,6 +97,9 @@
             val grid = ActivityContext.lookupContext<T>(context).deviceProfile
             targetPreinflateCount += grid.maxAllAppsRowCount * grid.numShownAllAppsColumns
         }
+        if (hasWorkProfile) {
+            targetPreinflateCount *= 2
+        }
         val existingPreinflateCount = getRecycledViewCount(BaseAllAppsAdapter.VIEW_TYPE_ICON)
         return targetPreinflateCount - existingPreinflateCount
     }
diff --git a/tests/Android.bp b/tests/Android.bp
index 4988dbd..29a45aa 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -45,6 +45,7 @@
       "src/com/android/launcher3/allapps/TaplOpenCloseAllApps.java",
       "src/com/android/launcher3/allapps/TaplTestsAllAppsIconsWorking.java",
       "src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java",
+      "src/com/android/launcher3/appiconmenu/TaplOverviewIconTest.java",
       "src/com/android/launcher3/dragging/TaplDragTest.java",
       "src/com/android/launcher3/dragging/TaplUninstallRemove.java",
       "src/com/android/launcher3/ui/AbstractLauncherUiTest.java",
diff --git a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
index 51f457d..3e80e6b 100644
--- a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
+++ b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
@@ -158,7 +158,6 @@
     public static final String PERMANENT_DIAG_TAG = "TaplTarget";
     public static final String TWO_TASKBAR_LONG_CLICKS = "b/262282528";
     public static final String ICON_MISSING = "b/282963545";
-    public static final String INCORRECT_HOME_STATE = "b/293191790";
 
     public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
     public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display";
diff --git a/tests/src/com/android/launcher3/appiconmenu/TaplOverviewIconAppChipMenuTest.java b/tests/src/com/android/launcher3/appiconmenu/TaplOverviewIconAppChipMenuTest.java
new file mode 100644
index 0000000..4070c03
--- /dev/null
+++ b/tests/src/com/android/launcher3/appiconmenu/TaplOverviewIconAppChipMenuTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2023 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.launcher3.appiconmenu;
+
+import com.android.launcher3.Flags;
+import com.android.launcher3.InvariantDeviceProfile;
+
+import org.junit.Before;
+
+/**
+ * Tests the Icon App Chip Menu in overview.
+ *
+ * <p>Same tests as TaplOverviewIconTest with the Flag FLAG_ENABLE_OVERVIEW_ICON_MENU enabled.
+ * This class can be removed once FLAG_ENABLE_OVERVIEW_ICON_MENU is enabled by default.
+ */
+public class TaplOverviewIconAppChipMenuTest extends TaplOverviewIconTest {
+
+    @Before
+    public void setUp() throws Exception {
+        mSetFlagsRule.enableFlags(Flags.FLAG_ENABLE_OVERVIEW_ICON_MENU); // Call before super.setUp
+        super.setUp();
+        executeOnLauncher(launcher -> InvariantDeviceProfile.INSTANCE.get(launcher).onConfigChanged(
+                launcher));
+    }
+}
diff --git a/tests/src/com/android/launcher3/appiconmenu/TaplOverviewIconTest.java b/tests/src/com/android/launcher3/appiconmenu/TaplOverviewIconTest.java
new file mode 100644
index 0000000..7340264
--- /dev/null
+++ b/tests/src/com/android/launcher3/appiconmenu/TaplOverviewIconTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2023 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.launcher3.appiconmenu;
+
+import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import android.content.Intent;
+import android.platform.test.annotations.PlatinumTest;
+
+import com.android.launcher3.tapl.OverviewTaskMenu;
+import com.android.launcher3.ui.AbstractLauncherUiTest;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This test run in both Out of process (Oop) and in-process (Ipc).
+ * Tests the app Icon in overview.
+ */
+public class TaplOverviewIconTest extends AbstractLauncherUiTest {
+
+    private static final String CALCULATOR_APP_PACKAGE =
+            resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR);
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        initialize(this);
+    }
+
+    @PlatinumTest(focusArea = "launcher")
+    @Test
+    public void testOverviewActionsMenu() {
+        startTestAppsWithCheck();
+
+        OverviewTaskMenu menu = mLauncher.goHome().switchToOverview().getCurrentTask().tapMenu();
+
+        assertNotNull("Tapping App info menu item returned null", menu.tapAppInfoMenuItem());
+        executeOnLauncher(launcher -> assertTrue(
+                "Launcher activity is the top activity; expecting another activity to be the top",
+                isInLaunchedApp(launcher)));
+    }
+
+    private void startTestAppsWithCheck() {
+        startTestApps();
+        executeOnLauncher(launcher -> assertTrue(
+                "Launcher activity is the top activity; expecting another activity to be the top "
+                        + "one",
+                isInLaunchedApp(launcher)));
+    }
+
+    private void startTestApps() {
+        startAppFast(getAppPackageName());
+        startAppFast(CALCULATOR_APP_PACKAGE);
+        startTestActivity(2);
+    }
+
+    @Test
+    public void testSplitTaskTapBothIconMenus() {
+        createAndLaunchASplitPair();
+
+        OverviewTaskMenu taskMenu =
+                mLauncher.goHome().switchToOverview().getCurrentTask().tapMenu();
+        assertTrue("App info item not appearing in expanded task menu.",
+                taskMenu.hasMenuItem("App info"));
+        taskMenu.touchOutsideTaskMenuToDismiss();
+
+        OverviewTaskMenu splitMenu =
+                mLauncher.getOverview().getCurrentTask().tapSplitTaskMenu();
+        assertTrue("App info item not appearing in expanded split task's menu.",
+                splitMenu.hasMenuItem("App info"));
+        splitMenu.touchOutsideTaskMenuToDismiss();
+    }
+
+    private void createAndLaunchASplitPair() {
+        startTestActivity(2);
+        startTestActivity(3);
+
+        if (mLauncher.isTablet()) {
+            mLauncher.goHome().switchToOverview().getOverviewActions()
+                    .clickSplit()
+                    .getTestActivityTask(2)
+                    .open();
+        } else {
+            mLauncher.goHome().switchToOverview().getCurrentTask()
+                    .tapMenu()
+                    .tapSplitMenuItem()
+                    .getCurrentTask()
+                    .open();
+        }
+    }
+}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 34ebe11..56a74a9 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -39,6 +39,7 @@
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.platform.test.flag.junit.SetFlagsRule;
 import android.system.OsConstants;
 import android.util.Log;
 
@@ -202,6 +203,15 @@
     @Rule
     public ScreenRecordRule mScreenRecordRule = new ScreenRecordRule();
 
+    @Rule
+    public SetFlagsRule mSetFlagsRule = getFlagsRule();
+
+    private SetFlagsRule getFlagsRule() {
+        SetFlagsRule flagsRule = new SetFlagsRule();
+        flagsRule.initAllFlagsToReleaseConfigDefault();
+        return flagsRule;
+    }
+
     protected void clearPackageData(String pkg) throws IOException, InterruptedException {
         final CountDownLatch count = new CountDownLatch(2);
         final SimpleBroadcastReceiver broadcastReceiver =
diff --git a/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java b/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java
index 6c2950c..b019414 100644
--- a/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java
+++ b/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java
@@ -97,9 +97,7 @@
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
-        mSetFlagsRule.disableFlags(Flags.FLAG_ENABLE_TWOLINE_ALLAPPS);
-        mSetFlagsRule.disableFlags(Flags.FLAG_ENABLE_CURSOR_HOVER_STATES);
-        mSetFlagsRule.disableFlags(Flags.FLAG_ENABLE_OVERVIEW_ICON_MENU);
+        mSetFlagsRule.initAllFlagsToReleaseConfigDefault();
         Utilities.enableRunningInTestHarnessForTests();
         mContext = new ActivityContextWrapper(getApplicationContext());
         mBubbleTextView = new BubbleTextView(mContext);
diff --git a/tests/src/com/android/launcher3/util/viewcapture_analysis/PositionJumpDetector.java b/tests/src/com/android/launcher3/util/viewcapture_analysis/PositionJumpDetector.java
index a1ddcb0..5f2c68c 100644
--- a/tests/src/com/android/launcher3/util/viewcapture_analysis/PositionJumpDetector.java
+++ b/tests/src/com/android/launcher3/util/viewcapture_analysis/PositionJumpDetector.java
@@ -46,7 +46,7 @@
             DRAG_LAYER + "WidgetsTwoPaneSheet|SpringRelativeLayout:id/container",
             DRAG_LAYER + "WidgetsFullSheet|SpringRelativeLayout:id/container",
             DRAG_LAYER + "LauncherDragView",
-            RECENTS_DRAG_LAYER + "FallbackRecentsView:id/overview_panel|TaskView",
+            RECENTS_DRAG_LAYER + "FallbackRecentsView:id/overview_panel",
             CONTENT + "LauncherRootView:id/launcher|FloatingIconView",
             DRAG_LAYER + "FloatingTaskView",
             DRAG_LAYER + "LauncherRecentsView:id/overview_panel"