Loading core/java/android/content/pm/PackageParser.java +1 −1 Original line number Diff line number Diff line Loading @@ -4848,7 +4848,7 @@ public class PackageParser { } /** * Sets every the max aspect ratio of every child activity that doesn't already have an aspect * Sets every the min aspect ratio of every child activity that doesn't already have an aspect * ratio set. */ private void setMinAspectRatio(Package owner) { Loading core/res/res/values/config.xml +6 −1 Original line number Diff line number Diff line Loading @@ -3252,7 +3252,7 @@ skinny aspect ratio that is not expected to be widely used. --> <item name="config_pictureInPictureMinAspectRatio" format="float" type="dimen">0.41841004184</item> <!-- The minimum aspect ratio (width/height) that is supported for picture-in-picture. Any <!-- The maximum aspect ratio (width/height) that is supported for picture-in-picture. Any ratio larger than this is considered to wide and short to be usable. Currently 2.39:1. --> <item name="config_pictureInPictureMaxAspectRatio" format="float" type="dimen">2.39</item> Loading @@ -3273,6 +3273,11 @@ --> <integer name="config_dockedStackDividerSnapMode">0</integer> <!-- The maximum aspect ratio (longerSide/shorterSide) that is treated as close-to-square. If config_forceDefaultOrientation is set to true, the rotation on a close-to-square display will be fixed. --> <item name="config_closeToSquareDisplayMaxAspectRatio" format="float" type="dimen">1.333</item> <!-- List of comma separated package names for which we the system will not show crash, ANR, etc. dialogs. --> <string translatable="false" name="config_appsNotReportingCrashes"></string> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -403,6 +403,7 @@ <java-symbol type="integer" name="config_defaultPictureInPictureGravity" /> <java-symbol type="dimen" name="config_pictureInPictureMinAspectRatio" /> <java-symbol type="dimen" name="config_pictureInPictureMaxAspectRatio" /> <java-symbol type="dimen" name="config_closeToSquareDisplayMaxAspectRatio" /> <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_threshold" /> <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_factor" /> <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_penalty_threshold" /> Loading services/core/java/com/android/server/wm/ActivityRecord.java +31 −8 Original line number Diff line number Diff line Loading @@ -2677,8 +2677,9 @@ final class ActivityRecord extends ConfigurationContainer { * Get the configuration orientation by the requested screen orientation * ({@link ActivityInfo.ScreenOrientation}) of this activity. * * @return orientation in ({@link #ORIENTATION_LANDSCAPE}, {@link #ORIENTATION_PORTRAIT}, * {@link #ORIENTATION_UNDEFINED}). * @return orientation in ({@link Configuration#ORIENTATION_LANDSCAPE}, * {@link Configuration#ORIENTATION_PORTRAIT}, * {@link Configuration#ORIENTATION_UNDEFINED}). */ int getRequestedConfigurationOrientation() { final int screenOrientation = getOrientation(); Loading Loading @@ -2936,14 +2937,36 @@ final class ActivityRecord extends ConfigurationContainer { // should be given the aspect ratio. activityWidth = (int) ((activityHeight * maxAspectRatio) + 0.5f); } } else if (containingRatio < minAspectRatio && minAspectRatio != 0) { } else if (containingRatio < minAspectRatio) { boolean adjustWidth; switch (getRequestedConfigurationOrientation()) { case ORIENTATION_LANDSCAPE: // Width should be the longer side for this landscape app, so we use the width // to figure-out what the max. height should be given the aspect ratio. adjustWidth = false; break; case ORIENTATION_PORTRAIT: // Height should be the longer side for this portrait app, so we use the height // to figure-out what the max. width should be given the aspect ratio. adjustWidth = true; break; default: // This app doesn't have a preferred orientation, so we keep the length of the // longer side, and use it to figure-out the length of the shorter side. if (containingAppWidth < containingAppHeight) { // Width is the shorter side, so we use the height to figure-out what the max. width // should be given the aspect ratio. // Width is the shorter side, so we use the height to figure-out what the // max. width should be given the aspect ratio. adjustWidth = true; } else { // Height is the shorter side, so we use the width to figure-out what the // max. height should be given the aspect ratio. adjustWidth = false; } break; } if (adjustWidth) { activityWidth = (int) ((activityHeight / minAspectRatio) + 0.5f); } else { // Height is the shorter side, so we use the width to figure-out what the max. // height should be given the aspect ratio. activityHeight = (int) ((activityWidth / minAspectRatio) + 0.5f); } } Loading services/core/java/com/android/server/wm/DisplayContent.java +1 −1 Original line number Diff line number Diff line Loading @@ -1500,8 +1500,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo final int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / mBaseDisplayDensity; final int longSizeDp = longSize * DisplayMetrics.DENSITY_DEFAULT / mBaseDisplayDensity; mDisplayRotation.configure(width, height, shortSizeDp, longSizeDp); mDisplayPolicy.configure(width, height, shortSizeDp); mDisplayRotation.configure(width, height, shortSizeDp, longSizeDp); mDisplayFrames.onDisplayInfoUpdated(mDisplayInfo, calculateDisplayCutoutForRotation(mDisplayInfo.rotation)); Loading Loading
core/java/android/content/pm/PackageParser.java +1 −1 Original line number Diff line number Diff line Loading @@ -4848,7 +4848,7 @@ public class PackageParser { } /** * Sets every the max aspect ratio of every child activity that doesn't already have an aspect * Sets every the min aspect ratio of every child activity that doesn't already have an aspect * ratio set. */ private void setMinAspectRatio(Package owner) { Loading
core/res/res/values/config.xml +6 −1 Original line number Diff line number Diff line Loading @@ -3252,7 +3252,7 @@ skinny aspect ratio that is not expected to be widely used. --> <item name="config_pictureInPictureMinAspectRatio" format="float" type="dimen">0.41841004184</item> <!-- The minimum aspect ratio (width/height) that is supported for picture-in-picture. Any <!-- The maximum aspect ratio (width/height) that is supported for picture-in-picture. Any ratio larger than this is considered to wide and short to be usable. Currently 2.39:1. --> <item name="config_pictureInPictureMaxAspectRatio" format="float" type="dimen">2.39</item> Loading @@ -3273,6 +3273,11 @@ --> <integer name="config_dockedStackDividerSnapMode">0</integer> <!-- The maximum aspect ratio (longerSide/shorterSide) that is treated as close-to-square. If config_forceDefaultOrientation is set to true, the rotation on a close-to-square display will be fixed. --> <item name="config_closeToSquareDisplayMaxAspectRatio" format="float" type="dimen">1.333</item> <!-- List of comma separated package names for which we the system will not show crash, ANR, etc. dialogs. --> <string translatable="false" name="config_appsNotReportingCrashes"></string> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -403,6 +403,7 @@ <java-symbol type="integer" name="config_defaultPictureInPictureGravity" /> <java-symbol type="dimen" name="config_pictureInPictureMinAspectRatio" /> <java-symbol type="dimen" name="config_pictureInPictureMaxAspectRatio" /> <java-symbol type="dimen" name="config_closeToSquareDisplayMaxAspectRatio" /> <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_threshold" /> <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_factor" /> <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_penalty_threshold" /> Loading
services/core/java/com/android/server/wm/ActivityRecord.java +31 −8 Original line number Diff line number Diff line Loading @@ -2677,8 +2677,9 @@ final class ActivityRecord extends ConfigurationContainer { * Get the configuration orientation by the requested screen orientation * ({@link ActivityInfo.ScreenOrientation}) of this activity. * * @return orientation in ({@link #ORIENTATION_LANDSCAPE}, {@link #ORIENTATION_PORTRAIT}, * {@link #ORIENTATION_UNDEFINED}). * @return orientation in ({@link Configuration#ORIENTATION_LANDSCAPE}, * {@link Configuration#ORIENTATION_PORTRAIT}, * {@link Configuration#ORIENTATION_UNDEFINED}). */ int getRequestedConfigurationOrientation() { final int screenOrientation = getOrientation(); Loading Loading @@ -2936,14 +2937,36 @@ final class ActivityRecord extends ConfigurationContainer { // should be given the aspect ratio. activityWidth = (int) ((activityHeight * maxAspectRatio) + 0.5f); } } else if (containingRatio < minAspectRatio && minAspectRatio != 0) { } else if (containingRatio < minAspectRatio) { boolean adjustWidth; switch (getRequestedConfigurationOrientation()) { case ORIENTATION_LANDSCAPE: // Width should be the longer side for this landscape app, so we use the width // to figure-out what the max. height should be given the aspect ratio. adjustWidth = false; break; case ORIENTATION_PORTRAIT: // Height should be the longer side for this portrait app, so we use the height // to figure-out what the max. width should be given the aspect ratio. adjustWidth = true; break; default: // This app doesn't have a preferred orientation, so we keep the length of the // longer side, and use it to figure-out the length of the shorter side. if (containingAppWidth < containingAppHeight) { // Width is the shorter side, so we use the height to figure-out what the max. width // should be given the aspect ratio. // Width is the shorter side, so we use the height to figure-out what the // max. width should be given the aspect ratio. adjustWidth = true; } else { // Height is the shorter side, so we use the width to figure-out what the // max. height should be given the aspect ratio. adjustWidth = false; } break; } if (adjustWidth) { activityWidth = (int) ((activityHeight / minAspectRatio) + 0.5f); } else { // Height is the shorter side, so we use the width to figure-out what the max. // height should be given the aspect ratio. activityHeight = (int) ((activityWidth / minAspectRatio) + 0.5f); } } Loading
services/core/java/com/android/server/wm/DisplayContent.java +1 −1 Original line number Diff line number Diff line Loading @@ -1500,8 +1500,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo final int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / mBaseDisplayDensity; final int longSizeDp = longSize * DisplayMetrics.DENSITY_DEFAULT / mBaseDisplayDensity; mDisplayRotation.configure(width, height, shortSizeDp, longSizeDp); mDisplayPolicy.configure(width, height, shortSizeDp); mDisplayRotation.configure(width, height, shortSizeDp, longSizeDp); mDisplayFrames.onDisplayInfoUpdated(mDisplayInfo, calculateDisplayCutoutForRotation(mDisplayInfo.rotation)); Loading