Merge "Moving the remainder of reorder logic to ReorderAlgorithm" into main
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index 0d7ca07..27de20c 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -403,10 +403,10 @@
     }
 
     @Override
-    public void animateNavBarLongPress(boolean isTouchDown, long durationMs) {
+    public void animateNavBarLongPress(boolean isTouchDown, boolean shrink, long durationMs) {
         if (mSystemUiProxy != null) {
             try {
-                mSystemUiProxy.animateNavBarLongPress(isTouchDown, durationMs);
+                mSystemUiProxy.animateNavBarLongPress(isTouchDown, shrink, durationMs);
             } catch (RemoteException e) {
                 Log.w(TAG, "Failed call animateNavBarLongPress", e);
             }
diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
index 1effaff..dfbd32c 100644
--- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
+++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
@@ -257,10 +257,6 @@
                 Interpolators.clampToProgress(Interpolators.LINEAR,
                         timings.instructionsContainerFadeInStartOffset,
                         timings.instructionsContainerFadeInEndOffset))
-        anim.setViewAlpha(splitInstructionsView!!.textView, 1f,
-                Interpolators.clampToProgress(Interpolators.LINEAR,
-                        timings.instructionsTextFadeInStartOffset,
-                        timings.instructionsTextFadeInEndOffset))
         anim.addFloat(splitInstructionsView, SplitInstructionsView.UNFOLD, 0.1f, 1f,
                 Interpolators.clampToProgress(Interpolators.EMPHASIZED_DECELERATE,
                         timings.instructionsUnfoldStartOffset,
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 6235490..7e1034b 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -3298,9 +3298,6 @@
         anim.setViewAlpha(splitInstructionsView, 1, clampToProgress(LINEAR,
                 timings.getInstructionsContainerFadeInStartOffset(),
                 timings.getInstructionsContainerFadeInEndOffset()));
-        anim.setViewAlpha(splitInstructionsView.getTextView(), 1, clampToProgress(LINEAR,
-                timings.getInstructionsTextFadeInStartOffset(),
-                timings.getInstructionsTextFadeInEndOffset()));
         anim.addFloat(splitInstructionsView, splitInstructionsView.UNFOLD, 0.1f, 1,
                 clampToProgress(EMPHASIZED_DECELERATE,
                         timings.getInstructionsUnfoldStartOffset(),
diff --git a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java
index 8bc85cf..f6501f1 100644
--- a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java
+++ b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java
@@ -23,9 +23,9 @@
 import android.view.ViewGroup;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.LinearLayout;
+import android.widget.TextView;
 
 import androidx.annotation.Nullable;
-import androidx.appcompat.widget.AppCompatTextView;
 
 import com.android.launcher3.LauncherState;
 import com.android.launcher3.R;
@@ -41,12 +41,9 @@
  */
 public class SplitInstructionsView extends LinearLayout {
     private final StatefulActivity mLauncher;
-    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") {
+            new FloatProperty<>("SplitInstructionsUnfold") {
                 @Override
                 public void setValue(SplitInstructionsView splitInstructionsView, float v) {
                     splitInstructionsView.setScaleY(v);
@@ -97,12 +94,11 @@
     }
 
     private void init() {
-        mInstructionTextView = findViewById(R.id.split_instructions_text);
-        mCancelTextView = findViewById(R.id.split_instructions_text_cancel);
+        TextView cancelTextView = findViewById(R.id.split_instructions_text_cancel);
 
         if (FeatureFlags.enableSplitContextually()) {
-            mCancelTextView.setVisibility(VISIBLE);
-            mCancelTextView.setOnClickListener((v) -> exitSplitSelection());
+            cancelTextView.setVisibility(VISIBLE);
+            cancelTextView.setOnClickListener((v) -> exitSplitSelection());
         }
     }
 
@@ -147,8 +143,4 @@
                         getMeasuredWidth()
                 );
     }
-
-    public AppCompatTextView getTextView() {
-        return mInstructionTextView;
-    }
 }
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 15cc6e3..a2dcf96 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -124,6 +124,10 @@
             getReleaseFlag(308693847, "ANIMATE_LPNH", TEAMFOOD,
                     "Animates navbar when long pressing");
 
+    public static final BooleanFlag SHRINK_NAV_HANDLE_ON_PRESS =
+            getReleaseFlag(314158312, "SHRINK_NAV_HANDLE_ON_PRESS", DISABLED,
+                    "Shrinks navbar when long pressing if ANIMATE_LPNH is enabled");
+
     public static final IntFlag LPNH_SLOP_PERCENTAGE =
             getIntFlag(301680992, "LPNH_SLOP_PERCENTAGE", 100,
                     "Controls touch slop percentage for lpnh");
diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java
index 0438e57..1b1d347 100644
--- a/src/com/android/launcher3/testing/TestInformationHandler.java
+++ b/src/com/android/launcher3/testing/TestInformationHandler.java
@@ -104,6 +104,15 @@
                 return getUIProperty(Bundle::putBoolean, t -> isLauncherInitialized(), () -> true);
             }
 
+            case TestProtocol.REQUEST_IS_LAUNCHER_LAUNCHER_ACTIVITY_STARTED: {
+                final Bundle bundle = getLauncherUIProperty(Bundle::putBoolean, l -> l.isStarted());
+                if (bundle != null) return bundle;
+
+                // If Launcher activity wasn't created, it's not started.
+                response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, false);
+                return response;
+            }
+
             case TestProtocol.REQUEST_FREEZE_APP_LIST:
                 return getLauncherUIProperty(Bundle::putBoolean, l -> {
                     l.getAppsView().getAppsStore().enableDeferUpdates(DEFER_UPDATES_TEST);
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index 953ecda..dbfe5ad 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -95,7 +95,7 @@
     private static final long FADE_IN_DURATION = 150;
     private static final long EDUCATION_TIP_DELAY_MS = 200;
     private static final long EDUCATION_DIALOG_DELAY_MS = 500;
-    private static final float VERTICAL_START_POSITION = 0.3f;
+
     // The widget recommendation table can easily take over the entire screen on devices with small
     // resolution or landscape on phone. This ratio defines the max percentage of content area that
     // the table can display.
@@ -622,7 +622,6 @@
         if (animate) {
             if (getPopupContainer().getInsets().bottom > 0) {
                 mContent.setAlpha(0);
-                setTranslationShift(VERTICAL_START_POSITION);
             }
             setUpOpenAnimation(mActivityContext.getDeviceProfile().bottomSheetOpenDuration);
             Animator animator = mOpenCloseAnimation.getAnimationPlayer();
diff --git a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
index b940ba1..d5a645e 100644
--- a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
+++ b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
@@ -86,6 +86,8 @@
     public static final String REQUEST_ICON_HEIGHT =
             "icon-height";
     public static final String REQUEST_IS_LAUNCHER_INITIALIZED = "is-launcher-initialized";
+    public static final String REQUEST_IS_LAUNCHER_LAUNCHER_ACTIVITY_STARTED =
+            "is-launcher-activity-started";
     public static final String REQUEST_FREEZE_APP_LIST = "freeze-app-list";
     public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list";
     public static final String REQUEST_ENABLE_MANUAL_TASKBAR_STASHING = "enable-taskbar-stashing";
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 5f536c7..8ad2249 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -590,6 +590,12 @@
         getInstrumentation().getTargetContext().startActivity(intent);
         assertTrue("App didn't start: " + selector,
                 TestHelpers.wait(Until.hasObject(selector), DEFAULT_UI_TIMEOUT));
+
+        // Wait for the Launcher to stop.
+        final LauncherInstrumentation launcherInstrumentation = new LauncherInstrumentation();
+        Wait.atMost("Launcher activity didn't stop",
+                () -> !launcherInstrumentation.isLauncherActivityStarted(),
+                DEFAULT_ACTIVITY_TIMEOUT, launcherInstrumentation);
     }
 
     public static ActivityInfo resolveSystemAppInfo(String category) {
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 5b5077e..dd8ab81 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -944,6 +944,12 @@
         fail("Launcher didn't initialize");
     }
 
+    public boolean isLauncherActivityStarted() {
+        return getTestInfo(
+                TestProtocol.REQUEST_IS_LAUNCHER_LAUNCHER_ACTIVITY_STARTED).
+                getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
+    }
+
     Parcelable executeAndWaitForLauncherEvent(Runnable command,
             UiAutomation.AccessibilityEventFilter eventFilter, Supplier<String> message,
             String actionName) {