Merge "Don't rely on nav mode change listener for oriented state" into ub-launcher3-rvc-dev
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 4654d08..99afe39 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -1059,8 +1059,7 @@
 
     private void animateRecentsRotationInPlace(int newRotation) {
         if (mOrientationState.canLauncherRotate()) {
-            // Update the rotation but let system take care of the rotation animation
-            setLayoutRotation(newRotation, mOrientationState.getDisplayRotation());
+            // Let system take care of the rotation
             return;
         }
         AnimatorSet pa = setRecentsChangedOrientation(true);
diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
index 7949ce9..68636cb 100644
--- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
+++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
@@ -116,9 +116,6 @@
             MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE | FLAG_SYSTEM_ROTATION_ALLOWED
                     | FLAG_ROTATION_WATCHER_SUPPORTED | FLAG_ROTATION_WATCHER_ENABLED;
 
-    private SysUINavigationMode.NavigationModeChangeListener mNavModeChangeListener =
-            newMode -> setFlag(FLAG_ROTATION_WATCHER_SUPPORTED, newMode != TWO_BUTTONS);
-
     private final Context mContext;
     private final ContentResolver mContentResolver;
     private final SharedPreferences mSharedPrefs;
@@ -266,10 +263,9 @@
 
     private void initFlags() {
         SysUINavigationMode.Mode currentMode = SysUINavigationMode.getMode(mContext);
-        if (mOrientationListener.canDetectOrientation() &&
-                currentMode != TWO_BUTTONS) {
-            mFlags |= FLAG_ROTATION_WATCHER_SUPPORTED;
-        }
+        boolean rotationWatcherSupported = mOrientationListener.canDetectOrientation() &&
+                currentMode != TWO_BUTTONS;
+        setFlag(FLAG_ROTATION_WATCHER_SUPPORTED, rotationWatcherSupported);
 
         // initialize external flags
         updateAutoRotateSetting();
@@ -286,9 +282,6 @@
             mContentResolver.registerContentObserver(
                     Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION),
                     false, mSystemAutoRotateObserver);
-            SysUINavigationMode.Mode currentMode =
-                    SysUINavigationMode.INSTANCE.get(mContext)
-                            .addModeChangeListener(mNavModeChangeListener);
         }
         initFlags();
     }
@@ -300,8 +293,6 @@
         if (isMultipleOrientationSupportedByDevice()) {
             mSharedPrefs.unregisterOnSharedPreferenceChangeListener(this);
             mContentResolver.unregisterContentObserver(mSystemAutoRotateObserver);
-            SysUINavigationMode.INSTANCE.get(mContext)
-                    .removeModeChangeListener(mNavModeChangeListener);
         }
         setRotationWatcherEnabled(false);
     }
@@ -347,20 +338,6 @@
         setFlag(FLAG_ROTATION_WATCHER_ENABLED, isEnabled);
     }
 
-    public int getTouchRotationDegrees() {
-        switch (mTouchRotation) {
-            case ROTATION_90:
-                return 90;
-            case ROTATION_180:
-                return 180;
-            case ROTATION_270:
-                return 270;
-            case ROTATION_0:
-            default:
-                return 0;
-        }
-    }
-
     /**
      * Returns the scale and pivot so that the provided taskRect can fit the provided full size
      */