summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2021-05-04 11:53:30 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-05-04 11:53:30 +0000
commit25a8b5f625c351ee549151c66c2527eee47371c7 (patch)
tree37450e984d30eeb23d7dec67f83b2a6c76bb1a2a
parent3476ed1d68e6372121d37a4d5d7e961bebbb0878 (diff)
parentcf951a027696295a23ba4a643de921cb4bd9f9e1 (diff)
Merge "Apply rotation animation when canceling fixed rotation" into sc-dev
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java12
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java9
2 files changed, 18 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index f568b6624f22..8f3702ac1a5e 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -6619,9 +6619,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
@Override
void onCancelFixedRotationTransform(int originalDisplayRotation) {
- if (this != mDisplayContent.getLastOrientationSource()
- || getRequestedConfigurationOrientation() != ORIENTATION_UNDEFINED) {
- // Only need to handle the activity that should be rotated with display.
+ if (this != mDisplayContent.getLastOrientationSource()) {
+ // This activity doesn't affect display rotation.
+ return;
+ }
+ final int requestedOrientation = getRequestedConfigurationOrientation();
+ if (requestedOrientation != ORIENTATION_UNDEFINED
+ && requestedOrientation != mDisplayContent.getConfiguration().orientation) {
+ // Only need to handle the activity that can be rotated with display or the activity
+ // has requested the same orientation.
return;
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
index fdeb7a6eb71a..4bbea94060c4 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
@@ -1723,6 +1723,15 @@ public class ActivityRecordTests extends WindowTestsBase {
assertFalse(display.hasTopFixedRotationLaunchingApp());
assertFalse(activity.hasFixedRotationTransform());
+
+ // Simulate that the activity requests the same orientation as display.
+ activity.setOrientation(display.getConfiguration().orientation);
+ // Skip the real freezing.
+ activity.mVisibleRequested = false;
+ clearInvocations(activity);
+ activity.onCancelFixedRotationTransform(originalRotation);
+ // The implementation of cancellation must be executed.
+ verify(activity).startFreezingScreen(originalRotation);
}
@Test