From 780e5452cd727860290d37cb6922e188713f6489 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Tue, 22 Sep 2020 18:05:25 +0800 Subject: [PATCH] Use normal rotation if orientation is changed by resume-scheduled app With traditional normal rotation, if an app calls Activity#setRequestedOrientation to change orientation in its onCreate or onResume, the system display info will be updated immediately. So if the app gets display rotation right after the orientation request, it can get the rotated result. While if fixed rotation transform takes effect for the case, though the rotated display adjustments will be sent to the app, it is too late that the app may have accessed the global display info which is not rotated, that may cause inconsistent UI layout if the app depends on the rotation info. Bug: 167564038 Test: DisplayContentTests#testNoFixedRotationOnResumedScheduledApp Change-Id: I3253264cb1bb8886074e88012582daa3589a1896 Merged-In: I3253264cb1bb8886074e88012582daa3589a1896 (cherry picked from commit 4d576bfa25b764b3d2dd44761f632e7962443b02) --- .../com/android/server/wm/DisplayContent.java | 9 ++++++++ .../server/wm/DisplayContentTests.java | 21 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index abfb9c99de6b9..8b645453258ba 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -1496,6 +1496,15 @@ class DisplayContent extends WindowContainer