Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5356,6 +5356,9 @@ <!-- Whether using split screen aspect ratio as a default aspect ratio for unresizable apps. --> <bool name="config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled">false</bool> <!-- Whether using display aspect ratio as a default aspect ratio for all letterboxed apps. --> <bool name="config_letterboxIsDisplayAspectRatioForFixedOrientationLetterboxEnabled">false</bool> <!-- Whether the specific behaviour for translucent activities letterboxing is enabled. TODO(b/255532890) Enable when ignoreOrientationRequest is set --> <bool name="config_letterboxIsEnabledForTranslucentActivities">false</bool> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -4463,6 +4463,7 @@ <java-symbol type="bool" name="config_letterboxIsEducationEnabled" /> <java-symbol type="dimen" name="config_letterboxDefaultMinAspectRatioForUnresizableApps" /> <java-symbol type="bool" name="config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled" /> <java-symbol type="bool" name="config_letterboxIsDisplayAspectRatioForFixedOrientationLetterboxEnabled" /> <java-symbol type="bool" name="config_isCompatFakeFocusEnabled" /> <java-symbol type="bool" name="config_isWindowManagerCameraCompatTreatmentEnabled" /> <java-symbol type="bool" name="config_isCameraCompatControlForStretchedIssuesEnabled" /> Loading services/core/java/com/android/server/wm/LetterboxConfiguration.java +34 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,12 @@ final class LetterboxConfiguration { // Whether using split screen aspect ratio as a default aspect ratio for unresizable apps. private boolean mIsSplitScreenAspectRatioForUnresizableAppsEnabled; // Whether using display aspect ratio as a default aspect ratio for all letterboxed apps. // mIsSplitScreenAspectRatioForUnresizableAppsEnabled and // config_letterboxDefaultMinAspectRatioForUnresizableApps take priority over this for // unresizable apps private boolean mIsDisplayAspectRatioEnabledForFixedOrientationLetterbox; // Whether letterboxing strategy is enabled for translucent activities. If {@value false} // all the feature is disabled private boolean mTranslucentLetterboxingEnabled; Loading Loading @@ -288,6 +294,9 @@ final class LetterboxConfiguration { R.dimen.config_letterboxDefaultMinAspectRatioForUnresizableApps)); mIsSplitScreenAspectRatioForUnresizableAppsEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled); mIsDisplayAspectRatioEnabledForFixedOrientationLetterbox = mContext.getResources() .getBoolean(R.bool .config_letterboxIsDisplayAspectRatioForFixedOrientationLetterboxEnabled); mTranslucentLetterboxingEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsEnabledForTranslucentActivities); mIsCameraCompatTreatmentEnabled = mContext.getResources().getBoolean( Loading Loading @@ -942,6 +951,13 @@ final class LetterboxConfiguration { return mIsSplitScreenAspectRatioForUnresizableAppsEnabled; } /** * Whether using display aspect ratio as a default aspect ratio for all letterboxed apps. */ boolean getIsDisplayAspectRatioEnabledForFixedOrientationLetterbox() { return mIsDisplayAspectRatioEnabledForFixedOrientationLetterbox; } /** * Overrides whether using split screen aspect ratio as a default aspect ratio for unresizable * apps. Loading @@ -950,6 +966,14 @@ final class LetterboxConfiguration { mIsSplitScreenAspectRatioForUnresizableAppsEnabled = enabled; } /** * Overrides whether using display aspect ratio as a default aspect ratio for all letterboxed * apps. */ void setIsDisplayAspectRatioEnabledForFixedOrientationLetterbox(boolean enabled) { mIsDisplayAspectRatioEnabledForFixedOrientationLetterbox = enabled; } /** * Resets whether using split screen aspect ratio as a default aspect ratio for unresizable * apps {@link R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled}. Loading @@ -959,6 +983,16 @@ final class LetterboxConfiguration { R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled); } /** * Resets whether using display aspect ratio as a default aspect ratio for all letterboxed * apps {@link R.bool.config_letterboxIsDisplayAspectRatioForFixedOrientationLetterboxEnabled}. */ void resetIsDisplayAspectRatioEnabledForFixedOrientationLetterbox() { mIsDisplayAspectRatioEnabledForFixedOrientationLetterbox = mContext.getResources() .getBoolean(R.bool .config_letterboxIsDisplayAspectRatioForFixedOrientationLetterboxEnabled); } boolean isTranslucentLetterboxingEnabled() { return mTranslucentLetterboxingOverrideEnabled || (mTranslucentLetterboxingEnabled && isTranslucentLetterboxingAllowed()); Loading services/core/java/com/android/server/wm/LetterboxUiController.java +15 −2 Original line number Diff line number Diff line Loading @@ -584,7 +584,7 @@ final class LetterboxUiController { ? getSplitScreenAspectRatio() : mActivityRecord.shouldCreateCompatDisplayInsets() ? getDefaultMinAspectRatioForUnresizableApps() : mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio(); : getDefaultMinAspectRatio(); } private float getDefaultMinAspectRatioForUnresizableApps() { Loading @@ -593,7 +593,7 @@ final class LetterboxUiController { return mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps() > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO ? mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps() : mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio(); : getDefaultMinAspectRatio(); } return getSplitScreenAspectRatio(); Loading Loading @@ -621,6 +621,16 @@ final class LetterboxUiController { return computeAspectRatio(bounds); } private float getDefaultMinAspectRatio() { final DisplayContent displayContent = mActivityRecord.getDisplayContent(); if (displayContent == null || !mLetterboxConfiguration .getIsDisplayAspectRatioEnabledForFixedOrientationLetterbox()) { return mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio(); } return computeAspectRatio(new Rect(displayContent.getBounds())); } Resources getResources() { return mActivityRecord.mWmService.mContext.getResources(); } Loading Loading @@ -1014,6 +1024,9 @@ final class LetterboxUiController { + mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps()); pw.println(prefix + " isSplitScreenAspectRatioForUnresizableAppsEnabled=" + mLetterboxConfiguration.getIsSplitScreenAspectRatioForUnresizableAppsEnabled()); pw.println(prefix + " isDisplayAspectRatioEnabledForFixedOrientationLetterbox=" + mLetterboxConfiguration .getIsDisplayAspectRatioEnabledForFixedOrientationLetterbox()); } /** Loading services/core/java/com/android/server/wm/WindowManagerShellCommand.java +12 −1 Original line number Diff line number Diff line Loading @@ -955,6 +955,10 @@ public class WindowManagerShellCommand extends ShellCommand { runSetBooleanFlag(pw, mLetterboxConfiguration ::setIsSplitScreenAspectRatioForUnresizableAppsEnabled); break; case "--isDisplayAspectRatioEnabledForFixedOrientationLetterbox": runSetBooleanFlag(pw, mLetterboxConfiguration ::setIsDisplayAspectRatioEnabledForFixedOrientationLetterbox); break; case "--isTranslucentLetterboxingEnabled": runSetBooleanFlag(pw, mLetterboxConfiguration ::setTranslucentLetterboxingOverrideEnabled); Loading Loading @@ -1030,6 +1034,10 @@ public class WindowManagerShellCommand extends ShellCommand { mLetterboxConfiguration .resetIsSplitScreenAspectRatioForUnresizableAppsEnabled(); break; case "IsDisplayAspectRatioEnabledForFixedOrientationLetterbox": mLetterboxConfiguration .resetIsDisplayAspectRatioEnabledForFixedOrientationLetterbox(); break; case "isTranslucentLetterboxingEnabled": mLetterboxConfiguration.resetTranslucentLetterboxingEnabled(); break; Loading Loading @@ -1140,6 +1148,7 @@ public class WindowManagerShellCommand extends ShellCommand { mLetterboxConfiguration.resetDefaultPositionForVerticalReachability(); mLetterboxConfiguration.resetIsEducationEnabled(); mLetterboxConfiguration.resetIsSplitScreenAspectRatioForUnresizableAppsEnabled(); mLetterboxConfiguration.resetIsDisplayAspectRatioEnabledForFixedOrientationLetterbox(); mLetterboxConfiguration.resetTranslucentLetterboxingEnabled(); mLetterboxConfiguration.resetCameraCompatRefreshEnabled(); mLetterboxConfiguration.resetCameraCompatRefreshCycleThroughStopEnabled(); Loading Loading @@ -1187,7 +1196,9 @@ public class WindowManagerShellCommand extends ShellCommand { pw.println("Is using split screen aspect ratio as aspect ratio for unresizable apps: " + mLetterboxConfiguration .getIsSplitScreenAspectRatioForUnresizableAppsEnabled()); pw.println("Is using display aspect ratio as aspect ratio for all letterboxed apps: " + mLetterboxConfiguration .getIsDisplayAspectRatioEnabledForFixedOrientationLetterbox()); pw.println(" Is activity \"refresh\" in camera compatibility treatment enabled: " + mLetterboxConfiguration.isCameraCompatRefreshEnabled()); pw.println(" Refresh using \"stopped -> resumed\" cycle: " Loading Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5356,6 +5356,9 @@ <!-- Whether using split screen aspect ratio as a default aspect ratio for unresizable apps. --> <bool name="config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled">false</bool> <!-- Whether using display aspect ratio as a default aspect ratio for all letterboxed apps. --> <bool name="config_letterboxIsDisplayAspectRatioForFixedOrientationLetterboxEnabled">false</bool> <!-- Whether the specific behaviour for translucent activities letterboxing is enabled. TODO(b/255532890) Enable when ignoreOrientationRequest is set --> <bool name="config_letterboxIsEnabledForTranslucentActivities">false</bool> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -4463,6 +4463,7 @@ <java-symbol type="bool" name="config_letterboxIsEducationEnabled" /> <java-symbol type="dimen" name="config_letterboxDefaultMinAspectRatioForUnresizableApps" /> <java-symbol type="bool" name="config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled" /> <java-symbol type="bool" name="config_letterboxIsDisplayAspectRatioForFixedOrientationLetterboxEnabled" /> <java-symbol type="bool" name="config_isCompatFakeFocusEnabled" /> <java-symbol type="bool" name="config_isWindowManagerCameraCompatTreatmentEnabled" /> <java-symbol type="bool" name="config_isCameraCompatControlForStretchedIssuesEnabled" /> Loading
services/core/java/com/android/server/wm/LetterboxConfiguration.java +34 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,12 @@ final class LetterboxConfiguration { // Whether using split screen aspect ratio as a default aspect ratio for unresizable apps. private boolean mIsSplitScreenAspectRatioForUnresizableAppsEnabled; // Whether using display aspect ratio as a default aspect ratio for all letterboxed apps. // mIsSplitScreenAspectRatioForUnresizableAppsEnabled and // config_letterboxDefaultMinAspectRatioForUnresizableApps take priority over this for // unresizable apps private boolean mIsDisplayAspectRatioEnabledForFixedOrientationLetterbox; // Whether letterboxing strategy is enabled for translucent activities. If {@value false} // all the feature is disabled private boolean mTranslucentLetterboxingEnabled; Loading Loading @@ -288,6 +294,9 @@ final class LetterboxConfiguration { R.dimen.config_letterboxDefaultMinAspectRatioForUnresizableApps)); mIsSplitScreenAspectRatioForUnresizableAppsEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled); mIsDisplayAspectRatioEnabledForFixedOrientationLetterbox = mContext.getResources() .getBoolean(R.bool .config_letterboxIsDisplayAspectRatioForFixedOrientationLetterboxEnabled); mTranslucentLetterboxingEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsEnabledForTranslucentActivities); mIsCameraCompatTreatmentEnabled = mContext.getResources().getBoolean( Loading Loading @@ -942,6 +951,13 @@ final class LetterboxConfiguration { return mIsSplitScreenAspectRatioForUnresizableAppsEnabled; } /** * Whether using display aspect ratio as a default aspect ratio for all letterboxed apps. */ boolean getIsDisplayAspectRatioEnabledForFixedOrientationLetterbox() { return mIsDisplayAspectRatioEnabledForFixedOrientationLetterbox; } /** * Overrides whether using split screen aspect ratio as a default aspect ratio for unresizable * apps. Loading @@ -950,6 +966,14 @@ final class LetterboxConfiguration { mIsSplitScreenAspectRatioForUnresizableAppsEnabled = enabled; } /** * Overrides whether using display aspect ratio as a default aspect ratio for all letterboxed * apps. */ void setIsDisplayAspectRatioEnabledForFixedOrientationLetterbox(boolean enabled) { mIsDisplayAspectRatioEnabledForFixedOrientationLetterbox = enabled; } /** * Resets whether using split screen aspect ratio as a default aspect ratio for unresizable * apps {@link R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled}. Loading @@ -959,6 +983,16 @@ final class LetterboxConfiguration { R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled); } /** * Resets whether using display aspect ratio as a default aspect ratio for all letterboxed * apps {@link R.bool.config_letterboxIsDisplayAspectRatioForFixedOrientationLetterboxEnabled}. */ void resetIsDisplayAspectRatioEnabledForFixedOrientationLetterbox() { mIsDisplayAspectRatioEnabledForFixedOrientationLetterbox = mContext.getResources() .getBoolean(R.bool .config_letterboxIsDisplayAspectRatioForFixedOrientationLetterboxEnabled); } boolean isTranslucentLetterboxingEnabled() { return mTranslucentLetterboxingOverrideEnabled || (mTranslucentLetterboxingEnabled && isTranslucentLetterboxingAllowed()); Loading
services/core/java/com/android/server/wm/LetterboxUiController.java +15 −2 Original line number Diff line number Diff line Loading @@ -584,7 +584,7 @@ final class LetterboxUiController { ? getSplitScreenAspectRatio() : mActivityRecord.shouldCreateCompatDisplayInsets() ? getDefaultMinAspectRatioForUnresizableApps() : mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio(); : getDefaultMinAspectRatio(); } private float getDefaultMinAspectRatioForUnresizableApps() { Loading @@ -593,7 +593,7 @@ final class LetterboxUiController { return mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps() > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO ? mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps() : mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio(); : getDefaultMinAspectRatio(); } return getSplitScreenAspectRatio(); Loading Loading @@ -621,6 +621,16 @@ final class LetterboxUiController { return computeAspectRatio(bounds); } private float getDefaultMinAspectRatio() { final DisplayContent displayContent = mActivityRecord.getDisplayContent(); if (displayContent == null || !mLetterboxConfiguration .getIsDisplayAspectRatioEnabledForFixedOrientationLetterbox()) { return mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio(); } return computeAspectRatio(new Rect(displayContent.getBounds())); } Resources getResources() { return mActivityRecord.mWmService.mContext.getResources(); } Loading Loading @@ -1014,6 +1024,9 @@ final class LetterboxUiController { + mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps()); pw.println(prefix + " isSplitScreenAspectRatioForUnresizableAppsEnabled=" + mLetterboxConfiguration.getIsSplitScreenAspectRatioForUnresizableAppsEnabled()); pw.println(prefix + " isDisplayAspectRatioEnabledForFixedOrientationLetterbox=" + mLetterboxConfiguration .getIsDisplayAspectRatioEnabledForFixedOrientationLetterbox()); } /** Loading
services/core/java/com/android/server/wm/WindowManagerShellCommand.java +12 −1 Original line number Diff line number Diff line Loading @@ -955,6 +955,10 @@ public class WindowManagerShellCommand extends ShellCommand { runSetBooleanFlag(pw, mLetterboxConfiguration ::setIsSplitScreenAspectRatioForUnresizableAppsEnabled); break; case "--isDisplayAspectRatioEnabledForFixedOrientationLetterbox": runSetBooleanFlag(pw, mLetterboxConfiguration ::setIsDisplayAspectRatioEnabledForFixedOrientationLetterbox); break; case "--isTranslucentLetterboxingEnabled": runSetBooleanFlag(pw, mLetterboxConfiguration ::setTranslucentLetterboxingOverrideEnabled); Loading Loading @@ -1030,6 +1034,10 @@ public class WindowManagerShellCommand extends ShellCommand { mLetterboxConfiguration .resetIsSplitScreenAspectRatioForUnresizableAppsEnabled(); break; case "IsDisplayAspectRatioEnabledForFixedOrientationLetterbox": mLetterboxConfiguration .resetIsDisplayAspectRatioEnabledForFixedOrientationLetterbox(); break; case "isTranslucentLetterboxingEnabled": mLetterboxConfiguration.resetTranslucentLetterboxingEnabled(); break; Loading Loading @@ -1140,6 +1148,7 @@ public class WindowManagerShellCommand extends ShellCommand { mLetterboxConfiguration.resetDefaultPositionForVerticalReachability(); mLetterboxConfiguration.resetIsEducationEnabled(); mLetterboxConfiguration.resetIsSplitScreenAspectRatioForUnresizableAppsEnabled(); mLetterboxConfiguration.resetIsDisplayAspectRatioEnabledForFixedOrientationLetterbox(); mLetterboxConfiguration.resetTranslucentLetterboxingEnabled(); mLetterboxConfiguration.resetCameraCompatRefreshEnabled(); mLetterboxConfiguration.resetCameraCompatRefreshCycleThroughStopEnabled(); Loading Loading @@ -1187,7 +1196,9 @@ public class WindowManagerShellCommand extends ShellCommand { pw.println("Is using split screen aspect ratio as aspect ratio for unresizable apps: " + mLetterboxConfiguration .getIsSplitScreenAspectRatioForUnresizableAppsEnabled()); pw.println("Is using display aspect ratio as aspect ratio for all letterboxed apps: " + mLetterboxConfiguration .getIsDisplayAspectRatioEnabledForFixedOrientationLetterbox()); pw.println(" Is activity \"refresh\" in camera compatibility treatment enabled: " + mLetterboxConfiguration.isCameraCompatRefreshEnabled()); pw.println(" Refresh using \"stopped -> resumed\" cycle: " Loading