Merge "[tile] Repurpose PEOPLE_TILE result type to QS_TILE" into main
diff --git a/quickstep/res/layout/split_instructions_view.xml b/quickstep/res/layout/split_instructions_view.xml
index c663bf4..0bbbfd5 100644
--- a/quickstep/res/layout/split_instructions_view.xml
+++ b/quickstep/res/layout/split_instructions_view.xml
@@ -30,9 +30,15 @@
         android:id="@+id/split_instructions_text"
         android:layout_height="wrap_content"
         android:layout_width="wrap_content"
-        android:gravity="center"
         android:textColor="?androidprv:attr/textColorOnAccent"
-        android:drawableEnd="@drawable/ic_split_exit"
-        android:drawablePadding="@dimen/split_instructions_drawable_padding"
         android:text="@string/toast_split_select_app" />
+
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/split_instructions_text_cancel"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:textColor="?androidprv:attr/textColorOnAccent"
+        android:layout_marginStart="@dimen/split_instructions_start_margin_cancel"
+        android:text="@string/toast_split_select_app_cancel"
+        android:visibility="gone"/>
 </com.android.quickstep.views.SplitInstructionsView>
\ No newline at end of file
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 079f01b..4867eba 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -73,9 +73,9 @@
     <!--  The margin at the start of the task icon menu  -->
     <dimen name="task_thumbnail_icon_menu_start_margin">12dp</dimen>
     <!--  The margin at the top of the task icon menu  -->
-    <dimen name="task_thumbnail_icon_menu_top_margin">6dp</dimen>
-    <!--  The margin at the top of the task icon menu when expanded  -->
-    <dimen name="task_thumbnail_icon_menu_top_margin_expanded">4dp</dimen>
+    <dimen name="task_thumbnail_icon_menu_top_margin">12dp</dimen>
+    <!--  The gap at the top of the task icon menu when expanded  -->
+    <dimen name="task_thumbnail_icon_menu_expanded_gap">6dp</dimen>
     <!--  The margin at the start of the task icon view in the icon menu  -->
     <dimen name="task_thumbnail_icon_view_start_margin">6dp</dimen>
     <!--  The space around the task icon arrow within the icon menu  -->
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index 3dade66..077b233 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -230,6 +230,7 @@
     <string name="action_split">Split</string>
     <!-- Label for toast with instructions for split screen selection mode. [CHAR_LIMIT=50] -->
     <string name="toast_split_select_app">Tap another app to use split screen</string>
+    <string name="toast_split_select_app_cancel"><b>Cancel</b></string>
     <string name="toast_split_select_cont_desc">Exit split screen selection</string>
     <!-- Label for toast when app selected for split isn't supported. [CHAR_LIMIT=50] -->
     <string name="toast_split_app_unsupported">Choose another app to use split screen</string>
diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
index 6ee65d4..b7c6bf5 100644
--- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
+++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
@@ -252,6 +252,7 @@
         splitSelectStateController.splitInstructionsView = splitInstructionsView
         val timings = AnimUtils.getDeviceOverviewToSplitTimings(launcher.deviceProfile.isTablet)
         val anim = PendingAnimation(100 /*duration */)
+        splitInstructionsView.alpha = 0f
         anim.setViewAlpha(splitInstructionsView, 1f,
                 Interpolators.clampToProgress(Interpolators.LINEAR,
                         timings.instructionsContainerFadeInStartOffset,
diff --git a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java
index e8f06ee..8bc85cf 100644
--- a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java
+++ b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java
@@ -17,14 +17,12 @@
 package com.android.quickstep.views;
 
 import android.content.Context;
-import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.util.AttributeSet;
 import android.util.FloatProperty;
-import android.view.MotionEvent;
 import android.view.ViewGroup;
 import android.view.accessibility.AccessibilityNodeInfo;
-import android.widget.FrameLayout;
+import android.widget.LinearLayout;
 
 import androidx.annotation.Nullable;
 import androidx.appcompat.widget.AppCompatTextView;
@@ -41,9 +39,11 @@
  *
  * Appears and disappears concurrently with a FloatingTaskView.
  */
-public class SplitInstructionsView extends FrameLayout {
+public class SplitInstructionsView extends LinearLayout {
     private final StatefulActivity mLauncher;
-    private AppCompatTextView mTextView;
+    private AppCompatTextView mInstructionTextView;
+    /** Only used if {@link com.android.wm.shell.FeatureFlags#enableSplitContextual()} is true. */
+    private AppCompatTextView mCancelTextView;
 
     public static final FloatProperty<SplitInstructionsView> UNFOLD =
             new FloatProperty<SplitInstructionsView>("SplitInstructionsUnfold") {
@@ -97,22 +97,13 @@
     }
 
     private void init() {
-        mTextView = findViewById(R.id.split_instructions_text);
+        mInstructionTextView = findViewById(R.id.split_instructions_text);
+        mCancelTextView = findViewById(R.id.split_instructions_text_cancel);
 
-        if (!FeatureFlags.enableSplitContextually()) {
-            mTextView.setCompoundDrawables(null, null, null, null);
-            return;
+        if (FeatureFlags.enableSplitContextually()) {
+            mCancelTextView.setVisibility(VISIBLE);
+            mCancelTextView.setOnClickListener((v) -> exitSplitSelection());
         }
-
-        mTextView.setOnTouchListener((v, event) -> {
-            if (isTouchInsideRightCompoundDrawable(event)) {
-                if (event.getAction() == MotionEvent.ACTION_UP) {
-                    exitSplitSelection();
-                }
-                return true;
-            }
-            return false;
-        });
     }
 
     private void exitSplitSelection() {
@@ -121,20 +112,6 @@
         mLauncher.getStateManager().goToState(LauncherState.NORMAL);
     }
 
-    private boolean isTouchInsideRightCompoundDrawable(MotionEvent event) {
-        // Get the right compound drawable of the TextView.
-        Drawable rightDrawable = mTextView.getCompoundDrawablesRelative()[2];
-
-        // Check if the touch event intersects with the drawable's bounds.
-        if (rightDrawable != null) {
-            // We can get away w/o caring about the Y bounds since it's such a small view, if it's
-            // above/below the drawable just assume they meant to touch it. ¯\_(ツ)_/¯
-            return  event.getX() >= (mTextView.getWidth() - rightDrawable.getBounds().width());
-        } else {
-            return false;
-        }
-    }
-
     @Override
     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
         super.onInitializeAccessibilityNodeInfo(info);
@@ -172,6 +149,6 @@
     }
 
     public AppCompatTextView getTextView() {
-        return mTextView;
+        return mInstructionTextView;
     }
 }
diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
index 0c816b8..cf89d2e 100644
--- a/quickstep/src/com/android/quickstep/views/TaskMenuView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
@@ -311,14 +311,14 @@
                         - mActivity.getDeviceProfile().getOverviewActionsClaimedSpaceBelow();
                 float midpoint = (taskBottom + taskbarTop) / 2f;
                 additionalTranslationY = -Math.max(menuBottom - midpoint, 0);
-            } else {
-                // Animate the menu to leave a small margin at the top of the task.
-                additionalTranslationY = getResources().getDimensionPixelSize(
-                        R.dimen.task_thumbnail_icon_menu_top_margin_expanded);
             }
+            // Translate the menu to account for the expansion of the app chip menu as well.
+            float expandOffsetTranslationY = getResources().getDimensionPixelSize(
+                    R.dimen.task_thumbnail_icon_menu_expanded_gap);
             ObjectAnimator translationYAnim = ObjectAnimator.ofFloat(this, TRANSLATION_Y,
                     closing ? mMenuTranslationYBeforeOpen
-                            : mMenuTranslationYBeforeOpen + additionalTranslationY);
+                            : mMenuTranslationYBeforeOpen + additionalTranslationY
+                                    + expandOffsetTranslationY);
             translationYAnim.setInterpolator(EMPHASIZED);
 
             ObjectAnimator menuTranslationYAnim = ObjectAnimator.ofFloat(
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 6aee3de..137ffe8 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -429,6 +429,7 @@
     <dimen name="split_instructions_drawable_padding">10dp</dimen>
     <dimen name="split_instructions_bottom_margin_phone_landscape">24dp</dimen>
     <dimen name="split_instructions_bottom_margin_phone_portrait">60dp</dimen>
+    <dimen name="split_instructions_start_margin_cancel">8dp</dimen>
 
     <!-- Workspace grid visualization parameters -->
     <dimen name="grid_visualization_rounding_radius">28dp</dimen>
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 14d1683..2a64eea 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -198,7 +198,7 @@
             "Enables generating the reorder using a set of parameters");
 
     public static final BooleanFlag ENABLE_NO_LONG_PRESS_DRAG = getDebugFlag(299748096,
-            "ENABLE_NO_LONG_PRESS_DRAG", DISABLED,
+            "ENABLE_NO_LONG_PRESS_DRAG", ENABLED,
             "Don't trigger the drag if we are still under long press");
 
     // TODO(Block 12): Clean up flags
diff --git a/src/com/android/launcher3/graphics/SysUiScrim.java b/src/com/android/launcher3/graphics/SysUiScrim.java
index 66001d8..260d490 100644
--- a/src/com/android/launcher3/graphics/SysUiScrim.java
+++ b/src/com/android/launcher3/graphics/SysUiScrim.java
@@ -71,7 +71,7 @@
     private static final int ALPHA_MASK_BITMAP_WIDTH_DP = 2;
 
     private static final int BOTTOM_MASK_HEIGHT_DP = 200;
-    private static final int TOP_MASK_HEIGHT_DP = 100;
+    private static final int TOP_MASK_HEIGHT_DP = 70;
 
     private boolean mDrawTopScrim, mDrawBottomScrim;
 
@@ -104,7 +104,7 @@
         mHideSysUiScrim = Themes.getAttrBoolean(view.getContext(), R.attr.isWorkspaceDarkText);
 
         mTopMaskBitmap = mHideSysUiScrim ? null : createDitheredAlphaMask(mTopMaskHeight,
-                new int[]{0x50FFFFFF, 0x0AFFFFFF, 0x00FFFFFF},
+                new int[]{0x3DFFFFFF, 0x0AFFFFFF, 0x00FFFFFF},
                 new float[]{0f, 0.7f, 1f});
         mTopMaskPaint.setColor(0xFF222222);
         mBottomMaskBitmap = mHideSysUiScrim ? null : createDitheredAlphaMask(mBottomMaskHeight,