Add new supports-screens attributes for declaring the compatible screens.
Change-Id: I40d57e4354e48accc1027c9f90916ea73eb5190d
android:requiresSmallestWidthDp provides the smallest supported width.
android:compatibleWidthLimitDp provides the largest compatible width.
diff --git a/services/java/com/android/server/am/CompatModePackages.java b/services/java/com/android/server/am/CompatModePackages.java
index 1277bca..221b59b 100644
--- a/services/java/com/android/server/am/CompatModePackages.java
+++ b/services/java/com/android/server/am/CompatModePackages.java
@@ -119,13 +119,15 @@
public CompatibilityInfo compatibilityInfoForPackageLocked(ApplicationInfo ai) {
return new CompatibilityInfo(ai, mService.mConfiguration.screenLayout,
+ mService.mConfiguration.smallestScreenWidthDp,
(getPackageFlags(ai.packageName)&COMPAT_FLAG_ENABLED) != 0);
}
public int computeCompatModeLocked(ApplicationInfo ai) {
boolean enabled = (getPackageFlags(ai.packageName)&COMPAT_FLAG_ENABLED) != 0;
CompatibilityInfo info = new CompatibilityInfo(ai,
- mService.mConfiguration.screenLayout, enabled);
+ mService.mConfiguration.screenLayout,
+ mService.mConfiguration.smallestScreenWidthDp, enabled);
if (info.alwaysSupportsScreen()) {
return ActivityManager.COMPAT_MODE_NEVER;
}
@@ -315,6 +317,7 @@
final IPackageManager pm = AppGlobals.getPackageManager();
final int screenLayout = mService.mConfiguration.screenLayout;
+ final int smallestScreenWidthDp = mService.mConfiguration.smallestScreenWidthDp;
final Iterator<Map.Entry<String, Integer>> it = pkgs.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Integer> entry = it.next();
@@ -331,7 +334,8 @@
if (ai == null) {
continue;
}
- CompatibilityInfo info = new CompatibilityInfo(ai, screenLayout, false);
+ CompatibilityInfo info = new CompatibilityInfo(ai, screenLayout,
+ smallestScreenWidthDp, false);
if (info.alwaysSupportsScreen()) {
continue;
}