From b40f96623267d59b9cf8ae6f565668d6e3ec435d Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Sat, 25 Apr 2020 01:58:23 +0800 Subject: [PATCH] Clear fixed rotation if display config does not change There is a timing that when remote rotation is completed, the orientation from sensor has been updated again. If the transition of rotated app hasn't complete, the display is still in previous orientation, then if it is the same as the last value from sensor, the display configuration does not change. So in this case the rotated app needs to be restored to avoid showing different orientation than the display. Fixes: 153327533 Test: ActivityRecordTests#testActivityOnCancelFixedRotationTransform Test: Add delay to execute DisplayRotation#continueRotation. Put device in landscape with a portrait home on top, launch an activity without fixed orientation, and then rotate the device to portrait immediately. The activity should launch in landscape and rotate to portrait with animation. Change-Id: Ic966923a751d94cc6ea86a83c2f600424999799c --- .../com/android/server/wm/DisplayContent.java | 25 +++++++++++++++++-- .../server/wm/ActivityRecordTests.java | 14 ++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index a1620fe410c77..c66ff330edbdf 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -1271,6 +1271,12 @@ class DisplayContent extends WindowContainer