From 0d1a7441828940131d6424f92b6854ba8be7eacc Mon Sep 17 00:00:00 2001 From: Vali Calinescu Date: Thu, 2 Mar 2023 15:14:10 +0000 Subject: [PATCH] Check the current runtime orientation in updateCompatDisplayInsets Right now we are checking the static runtime orientation from ActivityInfo in updateCompatDisplayInsets. This can be obsolete, so we need to start checking the current one from the most recent requested configuration. Fix: 264276741 Test: atest WmTests:ActivityRecordTests Test: atest WmTests:SizeCompatTests Change-Id: I0ef411c4eb67f539352d8dbf521a6b9672b47fcc --- .../core/java/com/android/server/wm/ActivityRecord.java | 6 ++---- .../core/java/com/android/server/wm/WindowContainer.java | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 9944f127521d5..bdad30b393e7a 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -8008,9 +8008,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // The smallest screen width is the short side of screen bounds. Because the bounds // and density won't be changed, smallestScreenWidthDp is also fixed. overrideConfig.smallestScreenWidthDp = fullConfig.smallestScreenWidthDp; - // TODO(b/264276741): Check whether the runtime orietnation request is fixed rather than - // the manifest orientation which may be obsolete. - if (info.isFixedOrientation()) { + if (ActivityInfo.isFixedOrientation(getOverrideOrientation())) { // lock rotation too. When in size-compat, onConfigurationChanged will watch for and // apply runtime rotation changes. overrideConfig.windowConfiguration.setRotation( @@ -8181,7 +8179,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A /** * @return The orientation to use to understand if reachability is enabled. */ - @ActivityInfo.ScreenOrientation + @Configuration.Orientation int getOrientationForReachability() { return mLetterboxUiController.hasInheritedLetterboxBehavior() ? mLetterboxUiController.getInheritedOrientation() diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index ce032442e4af8..9e0e8c477573c 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -1436,7 +1436,7 @@ class WindowContainer extends ConfigurationContainer< * {@link Configuration#ORIENTATION_PORTRAIT}, * {@link Configuration#ORIENTATION_UNDEFINED}). */ - @ScreenOrientation + @Configuration.Orientation int getRequestedConfigurationOrientation() { return getRequestedConfigurationOrientation(false /* forDisplay */); } @@ -1454,7 +1454,7 @@ class WindowContainer extends ConfigurationContainer< * {@link Configuration#ORIENTATION_PORTRAIT}, * {@link Configuration#ORIENTATION_UNDEFINED}). */ - @ScreenOrientation + @Configuration.Orientation int getRequestedConfigurationOrientation(boolean forDisplay) { int requestedOrientation = getOverrideOrientation(); final RootDisplayArea root = getRootDisplayArea();