Enable RotationWatcher when home rotation is on
Update the PagedOrientationHandler when launcher
is allowed to rotate to ensure the correct one
gets set.
Fixes: 157173248
Change-Id: Iffb9df479fcccfb0fe2bd462167242b592949f69
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 3273e85..78c114e 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
@@ -1047,6 +1047,11 @@
}
private void animateRecentsRotationInPlace(int newRotation) {
+ if (mOrientationState.canLauncherRotate()) {
+ // Update the rotation but let system take care of the rotation animation
+ setLayoutRotation(newRotation, mOrientationState.getDisplayRotation());
+ return;
+ }
AnimatorSet pa = setRecentsChangedOrientation(true);
pa.addListener(AnimationSuccessListener.forRunnable(() -> {
setLayoutRotation(newRotation, mOrientationState.getDisplayRotation());
diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
index 4c47d7f..7888828 100644
--- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
+++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
@@ -203,7 +203,7 @@
mDisplayRotation = displayRotation;
mTouchRotation = touchRotation;
- if (mLauncherRotation == mTouchRotation) {
+ if (mLauncherRotation == mTouchRotation || canLauncherRotate()) {
mOrientationHandler = PagedOrientationHandler.HOME_ROTATED;
if (DEBUG) {
Log.d(TAG, "current RecentsOrientedState: " + this);
@@ -235,7 +235,7 @@
private void setFlag(int mask, boolean enabled) {
boolean wasRotationEnabled = !TestProtocol.sDisableSensorRotation
- && mFlags == VALUE_ROTATION_WATCHER_ENABLED;
+ && (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED;
if (enabled) {
mFlags |= mask;
} else {
@@ -243,7 +243,7 @@
}
boolean isRotationEnabled = !TestProtocol.sDisableSensorRotation
- && mFlags == VALUE_ROTATION_WATCHER_ENABLED;
+ && (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED;
if (wasRotationEnabled != isRotationEnabled) {
UI_HELPER_EXECUTOR.execute(() -> {
if (isRotationEnabled) {