Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5182,6 +5182,9 @@ An exception will be thrown if the given aspect ratio < 4:3. --> <item name="config_letterboxDefaultMinAspectRatioForUnresizableApps" format="float" type="dimen">1.5</item> <!-- Whether using split screen aspect ratio as a default aspect ratio for unresizable apps. --> <bool name="config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled">false</bool> <!-- Whether a camera compat controller is enabled to allow the user to apply or revert treatment for stretched issues in camera viewfinder. --> <bool name="config_isCameraCompatControlForStretchedIssuesEnabled">false</bool> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -4396,6 +4396,7 @@ <java-symbol type="integer" name="config_letterboxDefaultPositionForVerticalReachability" /> <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_isCameraCompatControlForStretchedIssuesEnabled" /> <java-symbol type="bool" name="config_hideDisplayCutoutWithDisplayArea" /> Loading services/core/java/com/android/server/wm/ActivityRecord.java +2 −2 Original line number Diff line number Diff line Loading @@ -8082,7 +8082,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A resolvedBounds.set(containingBounds); final float letterboxAspectRatioOverride = mLetterboxUiController.getFixedOrientationLetterboxAspectRatio(newParentConfig); mWmService.mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio(); final float desiredAspectRatio = letterboxAspectRatioOverride > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO ? letterboxAspectRatioOverride : computeAspectRatio(parentBounds); Loading Loading @@ -8645,7 +8645,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // if an app sets orientation to portrait dynamically because of aspect ratio // restriction applied here. && getRequestedConfigurationOrientation() != ORIENTATION_UNDEFINED ? mWmService.mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps() ? mLetterboxUiController.getDefaultMinAspectRatioForUnresizableApps() : infoAspectRatio; } Loading services/core/java/com/android/server/wm/LetterboxConfiguration.java +29 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,9 @@ final class LetterboxConfiguration { // Whether education is allowed for letterboxed fullscreen apps. private boolean mIsEducationEnabled; // Whether using split screen aspect ratio as a default aspect ratio for unresizable apps. private boolean mIsSplitScreenAspectRatioForUnresizableAppsEnabled; LetterboxConfiguration(Context systemUiContext) { mContext = systemUiContext; mFixedOrientationLetterboxAspectRatio = mContext.getResources().getFloat( Loading Loading @@ -216,6 +219,8 @@ final class LetterboxConfiguration { R.bool.config_letterboxIsEducationEnabled); setDefaultMinAspectRatioForUnresizableApps(mContext.getResources().getFloat( R.dimen.config_letterboxDefaultMinAspectRatioForUnresizableApps)); mIsSplitScreenAspectRatioForUnresizableAppsEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled); } /** Loading Loading @@ -797,4 +802,28 @@ final class LetterboxConfiguration { R.bool.config_letterboxIsEducationEnabled); } /** * Whether using split screen aspect ratio as a default aspect ratio for unresizable apps. */ boolean getIsSplitScreenAspectRatioForUnresizableAppsEnabled() { return mIsSplitScreenAspectRatioForUnresizableAppsEnabled; } /** * Overrides whether using split screen aspect ratio as a default aspect ratio for unresizable * apps. */ void setIsSplitScreenAspectRatioForUnresizableAppsEnabled(boolean enabled) { mIsSplitScreenAspectRatioForUnresizableAppsEnabled = enabled; } /** * Resets whether using split screen aspect ratio as a default aspect ratio for unresizable * apps {@link R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled}. */ void resetIsSplitScreenAspectRatioForUnresizableAppsEnabled() { mIsSplitScreenAspectRatioForUnresizableAppsEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled); } } services/core/java/com/android/server/wm/LetterboxUiController.java +15 −12 Original line number Diff line number Diff line Loading @@ -211,12 +211,10 @@ final class LetterboxUiController { : mLetterboxConfiguration.getLetterboxVerticalPositionMultiplier(); } float getFixedOrientationLetterboxAspectRatio(Configuration parentConfiguration) { // Don't check resolved windowing mode because it may not be updated yet during // configuration change. if (!isHorizontalReachabilityEnabled(parentConfiguration) && !isVerticalReachabilityEnabled(parentConfiguration)) { return mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio(); float getDefaultMinAspectRatioForUnresizableApps() { if (!mLetterboxConfiguration.getIsSplitScreenAspectRatioForUnresizableAppsEnabled() || mActivityRecord.getDisplayContent() == null) { return mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps(); } int dividerWindowWidth = Loading @@ -226,10 +224,14 @@ final class LetterboxUiController { int dividerSize = dividerWindowWidth - dividerInsets * 2; // Getting the same aspect ratio that apps get in split screen. Rect bounds = new Rect(parentConfiguration.windowConfiguration.getAppBounds()); bounds.inset(dividerSize, /* dy */ 0); Rect bounds = new Rect(mActivityRecord.getDisplayContent().getBounds()); if (bounds.width() >= bounds.height()) { bounds.inset(/* dx */ dividerSize, /* dy */ 0); bounds.right = bounds.centerX(); } else { bounds.inset(/* dx */ 0, /* dy */ dividerSize); bounds.bottom = bounds.centerY(); } return computeAspectRatio(bounds); } Loading Loading @@ -538,10 +540,11 @@ final class LetterboxUiController { pw.println(prefix + " letterboxVerticalPositionMultiplier=" + getVerticalPositionMultiplier(mActivityRecord.getParent().getConfiguration())); pw.println(prefix + " fixedOrientationLetterboxAspectRatio=" + getFixedOrientationLetterboxAspectRatio( mActivityRecord.getParent().getConfiguration())); + mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio()); pw.println(prefix + " defaultMinAspectRatioForUnresizableApps=" + mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps()); pw.println(prefix + " isSplitScreenAspectRatioForUnresizableAppsEnabled=" + mLetterboxConfiguration.getIsSplitScreenAspectRatioForUnresizableAppsEnabled()); } /** Loading Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5182,6 +5182,9 @@ An exception will be thrown if the given aspect ratio < 4:3. --> <item name="config_letterboxDefaultMinAspectRatioForUnresizableApps" format="float" type="dimen">1.5</item> <!-- Whether using split screen aspect ratio as a default aspect ratio for unresizable apps. --> <bool name="config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled">false</bool> <!-- Whether a camera compat controller is enabled to allow the user to apply or revert treatment for stretched issues in camera viewfinder. --> <bool name="config_isCameraCompatControlForStretchedIssuesEnabled">false</bool> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -4396,6 +4396,7 @@ <java-symbol type="integer" name="config_letterboxDefaultPositionForVerticalReachability" /> <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_isCameraCompatControlForStretchedIssuesEnabled" /> <java-symbol type="bool" name="config_hideDisplayCutoutWithDisplayArea" /> Loading
services/core/java/com/android/server/wm/ActivityRecord.java +2 −2 Original line number Diff line number Diff line Loading @@ -8082,7 +8082,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A resolvedBounds.set(containingBounds); final float letterboxAspectRatioOverride = mLetterboxUiController.getFixedOrientationLetterboxAspectRatio(newParentConfig); mWmService.mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio(); final float desiredAspectRatio = letterboxAspectRatioOverride > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO ? letterboxAspectRatioOverride : computeAspectRatio(parentBounds); Loading Loading @@ -8645,7 +8645,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // if an app sets orientation to portrait dynamically because of aspect ratio // restriction applied here. && getRequestedConfigurationOrientation() != ORIENTATION_UNDEFINED ? mWmService.mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps() ? mLetterboxUiController.getDefaultMinAspectRatioForUnresizableApps() : infoAspectRatio; } Loading
services/core/java/com/android/server/wm/LetterboxConfiguration.java +29 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,9 @@ final class LetterboxConfiguration { // Whether education is allowed for letterboxed fullscreen apps. private boolean mIsEducationEnabled; // Whether using split screen aspect ratio as a default aspect ratio for unresizable apps. private boolean mIsSplitScreenAspectRatioForUnresizableAppsEnabled; LetterboxConfiguration(Context systemUiContext) { mContext = systemUiContext; mFixedOrientationLetterboxAspectRatio = mContext.getResources().getFloat( Loading Loading @@ -216,6 +219,8 @@ final class LetterboxConfiguration { R.bool.config_letterboxIsEducationEnabled); setDefaultMinAspectRatioForUnresizableApps(mContext.getResources().getFloat( R.dimen.config_letterboxDefaultMinAspectRatioForUnresizableApps)); mIsSplitScreenAspectRatioForUnresizableAppsEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled); } /** Loading Loading @@ -797,4 +802,28 @@ final class LetterboxConfiguration { R.bool.config_letterboxIsEducationEnabled); } /** * Whether using split screen aspect ratio as a default aspect ratio for unresizable apps. */ boolean getIsSplitScreenAspectRatioForUnresizableAppsEnabled() { return mIsSplitScreenAspectRatioForUnresizableAppsEnabled; } /** * Overrides whether using split screen aspect ratio as a default aspect ratio for unresizable * apps. */ void setIsSplitScreenAspectRatioForUnresizableAppsEnabled(boolean enabled) { mIsSplitScreenAspectRatioForUnresizableAppsEnabled = enabled; } /** * Resets whether using split screen aspect ratio as a default aspect ratio for unresizable * apps {@link R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled}. */ void resetIsSplitScreenAspectRatioForUnresizableAppsEnabled() { mIsSplitScreenAspectRatioForUnresizableAppsEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsSplitScreenAspectRatioForUnresizableAppsEnabled); } }
services/core/java/com/android/server/wm/LetterboxUiController.java +15 −12 Original line number Diff line number Diff line Loading @@ -211,12 +211,10 @@ final class LetterboxUiController { : mLetterboxConfiguration.getLetterboxVerticalPositionMultiplier(); } float getFixedOrientationLetterboxAspectRatio(Configuration parentConfiguration) { // Don't check resolved windowing mode because it may not be updated yet during // configuration change. if (!isHorizontalReachabilityEnabled(parentConfiguration) && !isVerticalReachabilityEnabled(parentConfiguration)) { return mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio(); float getDefaultMinAspectRatioForUnresizableApps() { if (!mLetterboxConfiguration.getIsSplitScreenAspectRatioForUnresizableAppsEnabled() || mActivityRecord.getDisplayContent() == null) { return mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps(); } int dividerWindowWidth = Loading @@ -226,10 +224,14 @@ final class LetterboxUiController { int dividerSize = dividerWindowWidth - dividerInsets * 2; // Getting the same aspect ratio that apps get in split screen. Rect bounds = new Rect(parentConfiguration.windowConfiguration.getAppBounds()); bounds.inset(dividerSize, /* dy */ 0); Rect bounds = new Rect(mActivityRecord.getDisplayContent().getBounds()); if (bounds.width() >= bounds.height()) { bounds.inset(/* dx */ dividerSize, /* dy */ 0); bounds.right = bounds.centerX(); } else { bounds.inset(/* dx */ 0, /* dy */ dividerSize); bounds.bottom = bounds.centerY(); } return computeAspectRatio(bounds); } Loading Loading @@ -538,10 +540,11 @@ final class LetterboxUiController { pw.println(prefix + " letterboxVerticalPositionMultiplier=" + getVerticalPositionMultiplier(mActivityRecord.getParent().getConfiguration())); pw.println(prefix + " fixedOrientationLetterboxAspectRatio=" + getFixedOrientationLetterboxAspectRatio( mActivityRecord.getParent().getConfiguration())); + mLetterboxConfiguration.getFixedOrientationLetterboxAspectRatio()); pw.println(prefix + " defaultMinAspectRatioForUnresizableApps=" + mLetterboxConfiguration.getDefaultMinAspectRatioForUnresizableApps()); pw.println(prefix + " isSplitScreenAspectRatioForUnresizableAppsEnabled=" + mLetterboxConfiguration.getIsSplitScreenAspectRatioForUnresizableAppsEnabled()); } /** Loading