From 7d964726d5bbd93b720b095c46bee2e321aa4754 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Mon, 24 May 2021 19:10:42 +0100 Subject: [PATCH] Ensure RecentsOrientedState.mRecentsRotation is up to date on swipe up - Updates RecentsOrientedState.mRecentsRotation after launcher is started, as it's not updated when RecentsView is in foreground when device rotates e.g. inside another app - No longer calls updateOrientationHandler in onConfigurationChanged, as updateOrientationHandler is already called in setInsets, which get called on rotation Bug: 181550945 Test: Swipe up to enter overview, launch app, rotate, then swipe up again Test: Swipe up to enter overview from landscape only app, while holding device in portrait Change-Id: I268093617d51333678e510c910ed15275706f984 --- .../com/android/quickstep/AbsSwipeUpHandler.java | 3 +++ .../com/android/quickstep/views/RecentsView.java | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 005e9b5a7d..2c41a5fdb1 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -393,6 +393,9 @@ public abstract class AbsSwipeUpHandler, if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) { return; } + // RecentsView never updates the display rotation until swipe-up, force update + // RecentsOrientedState before passing to TaskViewSimulator. + mRecentsView.updateRecentsRotation(); mTaskViewSimulator.setOrientationState(mRecentsView.getPagedViewOrientedState()); // If we've already ended the gesture and are going home, don't prepare recents UI, diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 376cb31a90..1e8e2b19d1 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -2618,19 +2618,20 @@ public abstract class RecentsView finishRecentsAnimation(true /* toRecents */, - this::onConfigurationChangedInternal)); + this::updateRecentsRotation)); mEnableDrawingLiveTile = false; } else { - onConfigurationChangedInternal(); + updateRecentsRotation(); } mOrientation = newConfig.orientation; } - private void onConfigurationChangedInternal() { + /** + * Updates {@link RecentsOrientedState}'s cached RecentsView rotation. + */ + public void updateRecentsRotation() { final int rotation = mActivity.getDisplay().getRotation(); - if (mOrientationState.setRecentsRotation(rotation)) { - updateOrientationHandler(); - } + mOrientationState.setRecentsRotation(rotation); } public void setLayoutRotation(int touchRotation, int displayRotation) {