summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2020-10-27 22:32:33 +0800
committer Riddle Hsu <riddlehsu@google.com> 2020-10-28 09:41:30 +0000
commit8f692ef01a8ca95e87af317ff1fa6f0b75f6e616 (patch)
tree9210fc2f3886d84a507e3e498ebdf75dd2878548
parent06c050caf28a4b4c2407a9d87addbfb38a0d8812 (diff)
Finish fixed rotation of recents if it is invisible
The recents animation may be finished due to device is going to sleep, and then the recents activity will be invisible so there won't be a transition finish callback due to no visibility change when cleaning up recents animation. So if recents activity was invisible before finishing animation, just follow the current display orientation and reset the fixed rotation states. Bug: 171264143 Test: atest RecentsAnimationControllerTest# \ testClearFixedRotationLaunchingAppAfterCleanupAnimation Change-Id: Ic2028b5e1d960d1dcebbc1a56f44f93326335d57 (cherry picked from commit 9f72932f9d35cebcd128987f88b24293e5c7f1d4)
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java3
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java15
2 files changed, 17 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 946d797b8348..6e662a7232ea 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -5703,7 +5703,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
return;
}
- if (animatingRecents != null && animatingRecents == mFixedRotationLaunchingApp) {
+ if (animatingRecents != null && animatingRecents == mFixedRotationLaunchingApp
+ && animatingRecents.isVisible()) {
// The recents activity should be going to be invisible (switch to another app or
// return to original top). Only clear the top launching record without finishing
// the transform immediately because it won't affect display orientation. And before
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
index f2771175b523..730e9beecf77 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
@@ -395,6 +395,21 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
// The rotation transform should be cleared after updating orientation with display.
assertFalse(activity.hasFixedRotationTransform());
assertFalse(mDefaultDisplay.hasTopFixedRotationLaunchingApp());
+
+ // Simulate swiping up recents (home) in different rotation.
+ final ActivityRecord home = mDefaultDisplay.getDefaultTaskDisplayArea().getHomeActivity();
+ mDefaultDisplay.setFixedRotationLaunchingApp(home, (mDefaultDisplay.getRotation() + 1) % 4);
+ mController = new RecentsAnimationController(mWm, mMockRunner, mAnimationCallbacks,
+ mDefaultDisplay.getDisplayId());
+ initializeRecentsAnimationController(mController, home);
+ assertTrue(home.hasFixedRotationTransform());
+
+ // Assume recents activity becomes invisible for some reason (e.g. screen off).
+ home.setVisible(false);
+ mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
+ // Although there won't be a transition finish callback, the fixed rotation must be cleared.
+ assertFalse(home.hasFixedRotationTransform());
+ assertFalse(mDefaultDisplay.hasTopFixedRotationLaunchingApp());
}
@Test