Loading core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -5333,6 +5333,10 @@ <!-- Whether vertical reachability repositioning is allowed for letterboxed fullscreen apps. --> <bool name="config_letterboxIsVerticalReachabilityEnabled">false</bool> <!-- Whether book mode automatic horizontal reachability positioning is allowed for letterboxed fullscreen apps --> <bool name="config_letterboxIsAutomaticReachabilityInBookModeEnabled">false</bool> <!-- Default horizontal position of the letterboxed app window when reachability is enabled and an app is fullscreen in landscape device orientation. When reachability is enabled, the position can change between left, center and right. This config defines the Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -4475,6 +4475,7 @@ <java-symbol type="dimen" name="config_letterboxTabletopModePositionMultiplier" /> <java-symbol type="bool" name="config_letterboxIsHorizontalReachabilityEnabled" /> <java-symbol type="bool" name="config_letterboxIsVerticalReachabilityEnabled" /> <java-symbol type="bool" name="config_letterboxIsAutomaticReachabilityInBookModeEnabled" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForHorizontalReachability" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForVerticalReachability" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForBookModeReachability" /> Loading services/core/java/com/android/server/wm/ActivityRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -8585,7 +8585,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A resolvedBounds.set(containingBounds); final float letterboxAspectRatioOverride = mLetterboxUiController.getFixedOrientationLetterboxAspectRatio(); mLetterboxUiController.getFixedOrientationLetterboxAspectRatio(newParentConfig); final float desiredAspectRatio = letterboxAspectRatioOverride > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO ? letterboxAspectRatioOverride : computeAspectRatio(parentBounds); Loading services/core/java/com/android/server/wm/LetterboxConfiguration.java +32 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,10 @@ final class LetterboxConfiguration { // portrait device orientation. private boolean mIsVerticalReachabilityEnabled; // Whether book mode automatic horizontal reachability positioning is allowed for letterboxed // fullscreen apps in landscape device orientation. private boolean mIsAutomaticReachabilityInBookModeEnabled; // Whether education is allowed for letterboxed fullscreen apps. private boolean mIsEducationEnabled; Loading Loading @@ -277,6 +281,8 @@ final class LetterboxConfiguration { R.bool.config_letterboxIsHorizontalReachabilityEnabled); mIsVerticalReachabilityEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsVerticalReachabilityEnabled); mIsAutomaticReachabilityInBookModeEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsAutomaticReachabilityInBookModeEnabled); mDefaultPositionForHorizontalReachability = readLetterboxHorizontalReachabilityPositionFromConfig(mContext, false); mDefaultPositionForVerticalReachability = Loading Loading @@ -681,6 +687,14 @@ final class LetterboxConfiguration { return mIsVerticalReachabilityEnabled; } /* * Whether automatic horizontal reachability repositioning in book mode is allowed for * letterboxed fullscreen apps in landscape device orientation. */ boolean getIsAutomaticReachabilityInBookModeEnabled() { return mIsAutomaticReachabilityInBookModeEnabled; } /** * Overrides whether horizontal reachability repositioning is allowed for letterboxed fullscreen * apps in landscape device orientation. Loading @@ -697,6 +711,14 @@ final class LetterboxConfiguration { mIsVerticalReachabilityEnabled = enabled; } /** * Overrides whether automatic horizontal reachability repositioning in book mode is allowed for * letterboxed fullscreen apps in landscape device orientation. */ void setIsAutomaticReachabilityInBookModeEnabled(boolean enabled) { mIsAutomaticReachabilityInBookModeEnabled = enabled; } /** * Resets whether horizontal reachability repositioning is allowed for letterboxed fullscreen * apps in landscape device orientation to Loading @@ -717,6 +739,16 @@ final class LetterboxConfiguration { R.bool.config_letterboxIsVerticalReachabilityEnabled); } /** * Resets whether automatic horizontal reachability repositioning in book mode is * allowed for letterboxed fullscreen apps in landscape device orientation to * {@link R.bool.config_letterboxIsAutomaticReachabilityInBookModeEnabled}. */ void resetEnabledAutomaticReachabilityInBookMode() { mIsAutomaticReachabilityInBookModeEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsAutomaticReachabilityInBookModeEnabled); } /* * Gets default horizontal position of the letterboxed app window when horizontal reachability * is enabled. Loading services/core/java/com/android/server/wm/LetterboxUiController.java +18 −10 Original line number Diff line number Diff line Loading @@ -801,13 +801,18 @@ final class LetterboxUiController { float getHorizontalPositionMultiplier(Configuration parentConfiguration) { // Don't check resolved configuration because it may not be updated yet during // configuration change. boolean bookMode = isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */); boolean bookModeEnabled = isFullScreenAndBookModeEnabled(); return isHorizontalReachabilityEnabled(parentConfiguration) // Using the last global dynamic position to avoid "jumps" when moving // between apps or activities. ? mLetterboxConfiguration.getHorizontalMultiplierForReachability(bookMode) : mLetterboxConfiguration.getLetterboxHorizontalPositionMultiplier(bookMode); ? mLetterboxConfiguration.getHorizontalMultiplierForReachability(bookModeEnabled) : mLetterboxConfiguration.getLetterboxHorizontalPositionMultiplier(bookModeEnabled); } private boolean isFullScreenAndBookModeEnabled() { return isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */) && mLetterboxConfiguration.getIsAutomaticReachabilityInBookModeEnabled(); } float getVerticalPositionMultiplier(Configuration parentConfiguration) { Loading @@ -822,8 +827,10 @@ final class LetterboxUiController { : mLetterboxConfiguration.getLetterboxVerticalPositionMultiplier(tabletopMode); } float getFixedOrientationLetterboxAspectRatio() { float getFixedOrientationLetterboxAspectRatio(@NonNull Configuration parentConfiguration) { // Don't resize to split screen size when half folded if letterbox position is centered return isDisplayFullScreenAndSeparatingHinge() && getHorizontalPositionMultiplier(parentConfiguration) != 0.5f ? getSplitScreenAspectRatio() : mActivityRecord.shouldCreateCompatDisplayInsets() ? getDefaultMinAspectRatioForUnresizableApps() Loading Loading @@ -889,7 +896,8 @@ final class LetterboxUiController { return; } boolean isInFullScreenBookMode = isDisplayFullScreenAndSeparatingHinge(); boolean isInFullScreenBookMode = isDisplayFullScreenAndSeparatingHinge() && mLetterboxConfiguration.getIsAutomaticReachabilityInBookModeEnabled(); int letterboxPositionForHorizontalReachability = mLetterboxConfiguration .getLetterboxPositionForHorizontalReachability(isInFullScreenBookMode); if (mLetterbox.getInnerFrame().left > x) { Loading Loading
core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -5333,6 +5333,10 @@ <!-- Whether vertical reachability repositioning is allowed for letterboxed fullscreen apps. --> <bool name="config_letterboxIsVerticalReachabilityEnabled">false</bool> <!-- Whether book mode automatic horizontal reachability positioning is allowed for letterboxed fullscreen apps --> <bool name="config_letterboxIsAutomaticReachabilityInBookModeEnabled">false</bool> <!-- Default horizontal position of the letterboxed app window when reachability is enabled and an app is fullscreen in landscape device orientation. When reachability is enabled, the position can change between left, center and right. This config defines the Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -4475,6 +4475,7 @@ <java-symbol type="dimen" name="config_letterboxTabletopModePositionMultiplier" /> <java-symbol type="bool" name="config_letterboxIsHorizontalReachabilityEnabled" /> <java-symbol type="bool" name="config_letterboxIsVerticalReachabilityEnabled" /> <java-symbol type="bool" name="config_letterboxIsAutomaticReachabilityInBookModeEnabled" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForHorizontalReachability" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForVerticalReachability" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForBookModeReachability" /> Loading
services/core/java/com/android/server/wm/ActivityRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -8585,7 +8585,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A resolvedBounds.set(containingBounds); final float letterboxAspectRatioOverride = mLetterboxUiController.getFixedOrientationLetterboxAspectRatio(); mLetterboxUiController.getFixedOrientationLetterboxAspectRatio(newParentConfig); final float desiredAspectRatio = letterboxAspectRatioOverride > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO ? letterboxAspectRatioOverride : computeAspectRatio(parentBounds); Loading
services/core/java/com/android/server/wm/LetterboxConfiguration.java +32 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,10 @@ final class LetterboxConfiguration { // portrait device orientation. private boolean mIsVerticalReachabilityEnabled; // Whether book mode automatic horizontal reachability positioning is allowed for letterboxed // fullscreen apps in landscape device orientation. private boolean mIsAutomaticReachabilityInBookModeEnabled; // Whether education is allowed for letterboxed fullscreen apps. private boolean mIsEducationEnabled; Loading Loading @@ -277,6 +281,8 @@ final class LetterboxConfiguration { R.bool.config_letterboxIsHorizontalReachabilityEnabled); mIsVerticalReachabilityEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsVerticalReachabilityEnabled); mIsAutomaticReachabilityInBookModeEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsAutomaticReachabilityInBookModeEnabled); mDefaultPositionForHorizontalReachability = readLetterboxHorizontalReachabilityPositionFromConfig(mContext, false); mDefaultPositionForVerticalReachability = Loading Loading @@ -681,6 +687,14 @@ final class LetterboxConfiguration { return mIsVerticalReachabilityEnabled; } /* * Whether automatic horizontal reachability repositioning in book mode is allowed for * letterboxed fullscreen apps in landscape device orientation. */ boolean getIsAutomaticReachabilityInBookModeEnabled() { return mIsAutomaticReachabilityInBookModeEnabled; } /** * Overrides whether horizontal reachability repositioning is allowed for letterboxed fullscreen * apps in landscape device orientation. Loading @@ -697,6 +711,14 @@ final class LetterboxConfiguration { mIsVerticalReachabilityEnabled = enabled; } /** * Overrides whether automatic horizontal reachability repositioning in book mode is allowed for * letterboxed fullscreen apps in landscape device orientation. */ void setIsAutomaticReachabilityInBookModeEnabled(boolean enabled) { mIsAutomaticReachabilityInBookModeEnabled = enabled; } /** * Resets whether horizontal reachability repositioning is allowed for letterboxed fullscreen * apps in landscape device orientation to Loading @@ -717,6 +739,16 @@ final class LetterboxConfiguration { R.bool.config_letterboxIsVerticalReachabilityEnabled); } /** * Resets whether automatic horizontal reachability repositioning in book mode is * allowed for letterboxed fullscreen apps in landscape device orientation to * {@link R.bool.config_letterboxIsAutomaticReachabilityInBookModeEnabled}. */ void resetEnabledAutomaticReachabilityInBookMode() { mIsAutomaticReachabilityInBookModeEnabled = mContext.getResources().getBoolean( R.bool.config_letterboxIsAutomaticReachabilityInBookModeEnabled); } /* * Gets default horizontal position of the letterboxed app window when horizontal reachability * is enabled. Loading
services/core/java/com/android/server/wm/LetterboxUiController.java +18 −10 Original line number Diff line number Diff line Loading @@ -801,13 +801,18 @@ final class LetterboxUiController { float getHorizontalPositionMultiplier(Configuration parentConfiguration) { // Don't check resolved configuration because it may not be updated yet during // configuration change. boolean bookMode = isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */); boolean bookModeEnabled = isFullScreenAndBookModeEnabled(); return isHorizontalReachabilityEnabled(parentConfiguration) // Using the last global dynamic position to avoid "jumps" when moving // between apps or activities. ? mLetterboxConfiguration.getHorizontalMultiplierForReachability(bookMode) : mLetterboxConfiguration.getLetterboxHorizontalPositionMultiplier(bookMode); ? mLetterboxConfiguration.getHorizontalMultiplierForReachability(bookModeEnabled) : mLetterboxConfiguration.getLetterboxHorizontalPositionMultiplier(bookModeEnabled); } private boolean isFullScreenAndBookModeEnabled() { return isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */) && mLetterboxConfiguration.getIsAutomaticReachabilityInBookModeEnabled(); } float getVerticalPositionMultiplier(Configuration parentConfiguration) { Loading @@ -822,8 +827,10 @@ final class LetterboxUiController { : mLetterboxConfiguration.getLetterboxVerticalPositionMultiplier(tabletopMode); } float getFixedOrientationLetterboxAspectRatio() { float getFixedOrientationLetterboxAspectRatio(@NonNull Configuration parentConfiguration) { // Don't resize to split screen size when half folded if letterbox position is centered return isDisplayFullScreenAndSeparatingHinge() && getHorizontalPositionMultiplier(parentConfiguration) != 0.5f ? getSplitScreenAspectRatio() : mActivityRecord.shouldCreateCompatDisplayInsets() ? getDefaultMinAspectRatioForUnresizableApps() Loading Loading @@ -889,7 +896,8 @@ final class LetterboxUiController { return; } boolean isInFullScreenBookMode = isDisplayFullScreenAndSeparatingHinge(); boolean isInFullScreenBookMode = isDisplayFullScreenAndSeparatingHinge() && mLetterboxConfiguration.getIsAutomaticReachabilityInBookModeEnabled(); int letterboxPositionForHorizontalReachability = mLetterboxConfiguration .getLetterboxPositionForHorizontalReachability(isInFullScreenBookMode); if (mLetterbox.getInnerFrame().left > x) { Loading