From a8849f27bc9f85a5cb441ab155ae0afe7c99872a Mon Sep 17 00:00:00 2001 From: Vadim Caen Date: Fri, 5 Jun 2020 12:28:07 +0200 Subject: [PATCH] Ignore rotation update during recent animation. During the recent animation, the closing app is still considered on top and its required orientation is used for the next rotation computation. When going to launcher and rotating the device at the same time, a rotation update is triggered by the sensor and if the closing app allows a change of orientation, the display ends up rotating at the end of the animation, which make the launcher rotate even if it is not supposed to do so. Test: atest WmTests: com.android.server.wm.DisplayContentTests#testRecentsNotRotatingWithFixedRotation Fixes: 157447718 Change-Id: I3f2a46ddfe5e76ad3200ea27ad272ae36b6bcc8d --- .../com/android/server/wm/DisplayContent.java | 15 +++++++++++-- .../android/server/wm/DisplayRotation.java | 9 ++++++++ .../server/wm/DisplayContentTests.java | 22 ++++++++++++++++++- 3 files changed, 43 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 d55883968b56c..c24c1e4661335 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -32,6 +32,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; +import static android.content.res.Configuration.ORIENTATION_UNDEFINED; import static android.os.Build.VERSION_CODES.N; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.util.DisplayMetrics.DENSITY_DEFAULT; @@ -1526,12 +1527,12 @@ class DisplayContent extends WindowContainer