diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/LetterboxConfiguration.java | 18 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerShellCommand.java | 30 |
2 files changed, 35 insertions, 13 deletions
diff --git a/services/core/java/com/android/server/wm/LetterboxConfiguration.java b/services/core/java/com/android/server/wm/LetterboxConfiguration.java index fd4d0405e298..fda22cab6276 100644 --- a/services/core/java/com/android/server/wm/LetterboxConfiguration.java +++ b/services/core/java/com/android/server/wm/LetterboxConfiguration.java @@ -249,6 +249,9 @@ final class LetterboxConfiguration { // Allows to enable letterboxing strategy for translucent activities ignoring flags. private boolean mTranslucentLetterboxingOverrideEnabled; + // Allows to enable user aspect ratio settings ignoring flags. + private boolean mUserAppAspectRatioSettingsOverrideEnabled; + // Whether we should use split screen aspect ratio for the activity when camera compat treatment // is enabled and activity is connected to the camera in fullscreen. private final boolean mIsCameraCompatSplitScreenAspectRatioEnabled; @@ -1223,6 +1226,19 @@ final class LetterboxConfiguration { * Whether per-app user aspect ratio override settings is enabled */ boolean isUserAppAspectRatioSettingsEnabled() { - return mDeviceConfig.getFlagValue(KEY_ENABLE_USER_ASPECT_RATIO_SETTINGS); + return mUserAppAspectRatioSettingsOverrideEnabled + || mDeviceConfig.getFlagValue(KEY_ENABLE_USER_ASPECT_RATIO_SETTINGS); + } + + void setUserAppAspectRatioSettingsOverrideEnabled(boolean enabled) { + mUserAppAspectRatioSettingsOverrideEnabled = enabled; + } + + /** + * Resets whether per-app user aspect ratio override settings is enabled + * {@code mDeviceConfig.getFlagValue(KEY_ENABLE_USER_ASPECT_RATIO_SETTINGS)}. + */ + void resetUserAppAspectRatioSettingsEnabled() { + setUserAppAspectRatioSettingsOverrideEnabled(false); } } diff --git a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java index a153708c98d5..05e858de8973 100644 --- a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java +++ b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java @@ -1006,13 +1006,16 @@ public class WindowManagerShellCommand extends ShellCommand { runSetBooleanFlag(pw, mLetterboxConfiguration ::setTranslucentLetterboxingOverrideEnabled); break; + case "--isUserAppAspectRatioSettingsEnabled": + runSetBooleanFlag(pw, mLetterboxConfiguration + ::setUserAppAspectRatioSettingsOverrideEnabled); + break; case "--isCameraCompatRefreshEnabled": - runSetBooleanFlag(pw, enabled -> mLetterboxConfiguration - .setCameraCompatRefreshEnabled(enabled)); + runSetBooleanFlag(pw, mLetterboxConfiguration::setCameraCompatRefreshEnabled); break; case "--isCameraCompatRefreshCycleThroughStopEnabled": - runSetBooleanFlag(pw, enabled -> mLetterboxConfiguration - .setCameraCompatRefreshCycleThroughStopEnabled(enabled)); + runSetBooleanFlag(pw, + mLetterboxConfiguration::setCameraCompatRefreshCycleThroughStopEnabled); break; default: getErrPrintWriter().println( @@ -1084,6 +1087,9 @@ public class WindowManagerShellCommand extends ShellCommand { case "isTranslucentLetterboxingEnabled": mLetterboxConfiguration.resetTranslucentLetterboxingEnabled(); break; + case "isUserAppAspectRatioSettingsEnabled": + mLetterboxConfiguration.resetUserAppAspectRatioSettingsEnabled(); + break; case "isCameraCompatRefreshEnabled": mLetterboxConfiguration.resetCameraCompatRefreshEnabled(); break; @@ -1194,6 +1200,7 @@ public class WindowManagerShellCommand extends ShellCommand { mLetterboxConfiguration.resetIsSplitScreenAspectRatioForUnresizableAppsEnabled(); mLetterboxConfiguration.resetIsDisplayAspectRatioEnabledForFixedOrientationLetterbox(); mLetterboxConfiguration.resetTranslucentLetterboxingEnabled(); + mLetterboxConfiguration.resetUserAppAspectRatioSettingsEnabled(); mLetterboxConfiguration.resetCameraCompatRefreshEnabled(); mLetterboxConfiguration.resetCameraCompatRefreshCycleThroughStopEnabled(); } @@ -1249,7 +1256,6 @@ public class WindowManagerShellCommand extends ShellCommand { + mLetterboxConfiguration.isCameraCompatRefreshEnabled()); pw.println(" Refresh using \"stopped -> resumed\" cycle: " + mLetterboxConfiguration.isCameraCompatRefreshCycleThroughStopEnabled()); - pw.println("Background type: " + LetterboxConfiguration.letterboxBackgroundTypeToString( mLetterboxConfiguration.getLetterboxBackgroundType())); @@ -1259,12 +1265,10 @@ public class WindowManagerShellCommand extends ShellCommand { + mLetterboxConfiguration.getLetterboxBackgroundWallpaperBlurRadius()); pw.println(" Wallpaper dark scrim alpha: " + mLetterboxConfiguration.getLetterboxBackgroundWallpaperDarkScrimAlpha()); - - if (mLetterboxConfiguration.isTranslucentLetterboxingEnabled()) { - pw.println("Letterboxing for translucent activities: enabled"); - } else { - pw.println("Letterboxing for translucent activities: disabled"); - } + pw.println("Is letterboxing for translucent activities enabled: " + + mLetterboxConfiguration.isTranslucentLetterboxingEnabled()); + pw.println("Is the user aspect ratio settings enabled: " + + mLetterboxConfiguration.isUserAppAspectRatioSettingsEnabled()); } return 0; } @@ -1462,6 +1466,8 @@ public class WindowManagerShellCommand extends ShellCommand { pw.println(" unresizable apps."); pw.println(" --isTranslucentLetterboxingEnabled [true|1|false|0]"); pw.println(" Whether letterboxing for translucent activities is enabled."); + pw.println(" --isUserAppAspectRatioSettingsEnabled [true|1|false|0]"); + pw.println(" Whether user aspect ratio settings are enabled."); pw.println(" --isCameraCompatRefreshEnabled [true|1|false|0]"); pw.println(" Whether camera compatibility refresh is enabled."); pw.println(" --isCameraCompatRefreshCycleThroughStopEnabled [true|1|false|0]"); @@ -1473,7 +1479,7 @@ public class WindowManagerShellCommand extends ShellCommand { pw.println(" |horizontalPositionMultiplier|verticalPositionMultiplier"); pw.println(" |isHorizontalReachabilityEnabled|isVerticalReachabilityEnabled"); pw.println(" |isEducationEnabled||defaultPositionMultiplierForHorizontalReachability"); - pw.println(" |isTranslucentLetterboxingEnabled"); + pw.println(" |isTranslucentLetterboxingEnabled|isUserAppAspectRatioSettingsEnabled"); pw.println(" |defaultPositionMultiplierForVerticalReachability]"); pw.println(" Resets overrides to default values for specified properties separated"); pw.println(" by space, e.g. 'reset-letterbox-style aspectRatio cornerRadius'."); |