Merge "Have consistent All Apps UI between grid size changes." into ub-launcher3-qt-future-dev
diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml
index 5465480..826a275 100644
--- a/quickstep/AndroidManifest.xml
+++ b/quickstep/AndroidManifest.xml
@@ -88,6 +88,7 @@
         <activity android:name="com.android.quickstep.LockScreenRecentsActivity"
                   android:theme="@android:style/Theme.NoDisplay"
                   android:showOnLockScreen="true"
+                  android:taskAffinity="${packageName}.locktask"
                   android:directBootAware="true" />
 
     </application>
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 41f4a82..d270d76 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -248,6 +248,7 @@
     @Test
     @NavigationModeSwitch
     @PortraitLandscape
+    @Ignore("Temporarily disabled b/140252765")
     public void testQuickSwitchFromApp() throws Exception {
         startAppFast(getAppPackageName());
         startTestActivity(2);
diff --git a/src/com/android/launcher3/touch/SwipeDetector.java b/src/com/android/launcher3/touch/SwipeDetector.java
index d0edfd8..c38ca24 100644
--- a/src/com/android/launcher3/touch/SwipeDetector.java
+++ b/src/com/android/launcher3/touch/SwipeDetector.java
@@ -330,8 +330,7 @@
     private void initializeDragging() {
         if (mState == ScrollState.SETTLING && mIgnoreSlopWhenSettling) {
             mSubtractDisplacement = 0;
-        }
-        if (mDisplacement > 0) {
+        } else if (mDisplacement > 0) {
             mSubtractDisplacement = mTouchSlop;
         } else {
             mSubtractDisplacement = -mTouchSlop;
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 0dd3e77..db3d846 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -132,15 +132,29 @@
     }
 
     protected void quickSwitchToPreviousApp(int expectedState) {
+        boolean transposeInLandscape = false;
         switch (mLauncher.getNavigationModel()) {
-            case ZERO_BUTTON:
+            case TWO_BUTTON:
+                transposeInLandscape = true;
                 // Fall through, zero button and two button modes behave the same.
-            case TWO_BUTTON: {
-                // Swipe from the bottom left to the bottom right of the screen.
-                final int startX = 0;
-                final int startY = getSwipeStartY();
-                final int endX = mLauncher.getDevice().getDisplayWidth();
-                final int endY = startY;
+            case ZERO_BUTTON: {
+                final int startX;
+                final int startY;
+                final int endX;
+                final int endY;
+                if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
+                    // Swipe from the bottom left to the bottom right of the screen.
+                    startX = 0;
+                    startY = getSwipeStartY();
+                    endX = mLauncher.getDevice().getDisplayWidth();
+                    endY = startY;
+                } else {
+                    // Swipe from the bottom right to the top right of the screen.
+                    startX = getSwipeStartX();
+                    startY = mLauncher.getRealDisplaySize().y - 1;
+                    endX = startX;
+                    endY = 0;
+                }
                 mLauncher.swipeToState(startX, startY, endX, endY, 20, expectedState);
                 break;
             }