Disable seamless rotation for 3 and 2 button mode

Bug: 134095068
Change-Id: I8603e49a85b5524a02c9085485a180b022e3f91e
diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
index 4891746..97cd38a 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
@@ -47,7 +47,6 @@
 import com.android.launcher3.LauncherStateManager.StateHandler;
 import com.android.launcher3.QuickstepAppTransitionManagerImpl;
 import com.android.launcher3.Utilities;
-import com.android.launcher3.dragndrop.DragLayer;
 import com.android.launcher3.proxy.ProxyActivityStarter;
 import com.android.launcher3.proxy.StartActivityParams;
 import com.android.quickstep.OverviewInteractionState;
@@ -64,10 +63,14 @@
 
 public class UiFactory extends RecentsUiFactory {
 
-    public static Runnable enableLiveTouchControllerChanges(DragLayer dl) {
-        NavigationModeChangeListener listener = m -> dl.recreateControllers();
-        SysUINavigationMode mode = SysUINavigationMode.INSTANCE.get(dl.getContext());
-        mode.addModeChangeListener(listener);
+    public static Runnable enableLiveUIChanges(Launcher launcher) {
+        NavigationModeChangeListener listener = m -> {
+            launcher.getDragLayer().recreateControllers();
+            launcher.getRotationHelper().setRotationHadDifferentUI(m != Mode.NO_BUTTON);
+        };
+        SysUINavigationMode mode = SysUINavigationMode.INSTANCE.get(launcher);
+        SysUINavigationMode.Mode m = mode.addModeChangeListener(listener);
+        launcher.getRotationHelper().setRotationHadDifferentUI(m != Mode.NO_BUTTON);
         return () -> mode.removeModeChangeListener(listener);
     }
 
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 855535b..1afbe00 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1063,7 +1063,7 @@
 
         // Setup the drag layer
         mDragLayer.setup(mDragController, mWorkspace);
-        mCancelTouchController = UiFactory.enableLiveTouchControllerChanges(mDragLayer);
+        mCancelTouchController = UiFactory.enableLiveUIChanges(this);
 
         mWorkspace.setup(mDragController);
         // Until the workspace is bound, ensure that we keep the wallpaper offset locked to the
diff --git a/src/com/android/launcher3/states/RotationHelper.java b/src/com/android/launcher3/states/RotationHelper.java
index cd96d6e..abf90e2 100644
--- a/src/com/android/launcher3/states/RotationHelper.java
+++ b/src/com/android/launcher3/states/RotationHelper.java
@@ -73,7 +73,8 @@
 
     // This is used to defer setting rotation flags until the activity is being created
     private boolean mInitialized;
-    public boolean mDestroyed;
+    private boolean mDestroyed;
+    private boolean mRotationHasDifferentUI;
 
     private int mLastActivityFlags = -1;
 
@@ -92,8 +93,12 @@
         }
     }
 
+    public void setRotationHadDifferentUI(boolean rotationHasDifferentUI) {
+        mRotationHasDifferentUI = rotationHasDifferentUI;
+    }
+
     public boolean homeScreenCanRotate() {
-        return mIgnoreAutoRotateSettings || mAutoRotateEnabled
+        return mRotationHasDifferentUI || mIgnoreAutoRotateSettings || mAutoRotateEnabled
                 || mStateHandlerRequest != REQUEST_NONE
                 || mLauncher.getDeviceProfile().isMultiWindowMode;
     }
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
index 550327d..e41916c 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
@@ -27,7 +27,6 @@
 import com.android.launcher3.Launcher;
 import com.android.launcher3.LauncherState.ScaleAndTranslation;
 import com.android.launcher3.LauncherStateManager.StateHandler;
-import com.android.launcher3.dragndrop.DragLayer;
 import com.android.launcher3.graphics.RotationMode;
 import com.android.launcher3.util.TouchController;
 
@@ -40,7 +39,7 @@
                 launcher.getDragController(), new AllAppsSwipeController(launcher)};
     }
 
-    public static Runnable enableLiveTouchControllerChanges(DragLayer dl) {
+    public static Runnable enableLiveUIChanges(Launcher l) {
         return null;
     }