core: Remove default aspect ratio limit for old apps
I have never encountered a single app that this aspect ratio limit is
actually helpful for. Most legacy apps are able to cope with longer
aspect ratios fine — perhaps not optimally, but it looks better than
having a big black box at the bottom of the screen.
Instead of limiting older apps' screen space unconditionally or exposing
it in Settings, remove the limit entirely so the user doesn't have to go
through the trouble to begin with. Note that apps explicitly declaring a
shorter aspect ratio will still get their constraint satisfied.
Change-Id: Ic415288b24129a634476b5cc01a6f202588f4b89
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index e83f77c..a1f0e57 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -4715,10 +4715,8 @@
* ratio set.
*/
private void setMaxAspectRatio(Package owner) {
- // Default to (1.86) 16.7:9 aspect ratio for pre-O apps and unset for O and greater.
- // NOTE: 16.7:9 was the max aspect ratio Android devices can support pre-O per the CDD.
- float maxAspectRatio = owner.applicationInfo.targetSdkVersion < O
- ? DEFAULT_PRE_O_MAX_ASPECT_RATIO : 0;
+ // Start at an unlimited aspect ratio unless we get a more restrictive one
+ float maxAspectRatio = 0;
if (owner.applicationInfo.maxAspectRatio != 0) {
// Use the application max aspect ration as default if set.
diff --git a/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java b/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java
index dbe4fba..e10602e 100644
--- a/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java
+++ b/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java
@@ -2854,9 +2854,8 @@
* ratio set.
*/
private static void setMaxAspectRatio(ParsingPackage pkg) {
- // Default to (1.86) 16.7:9 aspect ratio for pre-O apps and unset for O and greater.
- // NOTE: 16.7:9 was the max aspect ratio Android devices can support pre-O per the CDD.
- float maxAspectRatio = pkg.getTargetSdkVersion() < O ? DEFAULT_PRE_O_MAX_ASPECT_RATIO : 0;
+ // Start at an unlimited aspect ratio unless we get a more restrictive one
+ float maxAspectRatio = 0;
float packageMaxAspectRatio = pkg.getMaxAspectRatio();
if (packageMaxAspectRatio != 0) {