diff options
| author | 2023-03-31 16:31:47 +0000 | |
|---|---|---|
| committer | 2023-04-05 13:18:25 +0000 | |
| commit | 9da476b39ecd73e6351db6544a10ba8e4a564fcd (patch) | |
| tree | 4b0111842eecc99069e303e8dadfbc75ce02162e | |
| parent | 6ed71b9057253a94f8d8d5df8bd2e482df6b878f (diff) | |
Force Kids app to use sensorLandscape when in reverseLandscape
A few apps in Kids Space request "reverseLandscape" orientation when
Display#getRotation returns ROTATION_270 expecting it to correspond
to the seascape display orientation while it may correspond to the
landscape one when config_reverseDefaultRotation is set to true.
This CL overrides the "reverseLandscape" and "landscape" orientation
with "sensorLandscape" in the context of apps running in the Kids space
when config_reverseDefaultRotation is set to true
Fixes: 265589619
Test: Run `atest WmTests:WindowManagerServiceTests`
Run `atest WMShellUnitTests:KidsModeTaskOrganizerTest`
Run `atest WmTests:LetterboxUiControllerTest`
Change-Id: Iadfb840199df9b308df699a9ca18ac5332c2536f
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/kidsmode/KidsModeTaskOrganizer.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/kidsmode/KidsModeTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/kidsmode/KidsModeTaskOrganizer.java index 0a5cc4181caf..77fe7a869f8e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/kidsmode/KidsModeTaskOrganizer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/kidsmode/KidsModeTaskOrganizer.java @@ -23,6 +23,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; +import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; import static android.view.Display.DEFAULT_DISPLAY; import android.app.ActivityManager; @@ -290,8 +291,11 @@ public class KidsModeTaskOrganizer extends ShellTaskOrganizer { // TODO(229961548): Remove ignoreOrientationRequest exception for Kids Mode once possible. if (mReverseDefaultRotationEnabled) { setOrientationRequestPolicy(/* isIgnoreOrientationRequestDisabled */ true, - /* fromOrientations */ new int[]{SCREEN_ORIENTATION_REVERSE_LANDSCAPE}, - /* toOrientations */ new int[]{SCREEN_ORIENTATION_LANDSCAPE}); + /* fromOrientations */ + new int[]{SCREEN_ORIENTATION_LANDSCAPE, SCREEN_ORIENTATION_REVERSE_LANDSCAPE}, + /* toOrientations */ + new int[]{SCREEN_ORIENTATION_SENSOR_LANDSCAPE, + SCREEN_ORIENTATION_SENSOR_LANDSCAPE}); } else { setOrientationRequestPolicy(/* isIgnoreOrientationRequestDisabled */ true, /* fromOrientations */ null, /* toOrientations */ null); |