summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/res
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-06-01 22:34:31 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-06-01 22:34:31 -0700
commitcc20b4e31ece564800aa2322efe3ae9da163b570 (patch)
tree1acd504b8eefc1de5ba2eec83c9d41f10713ca1f /core/java/android/content/res
parent5c6e95a77359bd6f758164b7f5a5a92093c2498f (diff)
parenta5f8851019605be26dd9a628280092e27f8a5f31 (diff)
downloadframeworks_base-cc20b4e31ece564800aa2322efe3ae9da163b570.zip
frameworks_base-cc20b4e31ece564800aa2322efe3ae9da163b570.tar.gz
frameworks_base-cc20b4e31ece564800aa2322efe3ae9da163b570.tar.bz2
am a5f88510: am 2969b511: Merge "Add new supports-screen API to set maximum allowed size." into honeycomb-mr2
* commit 'a5f8851019605be26dd9a628280092e27f8a5f31': Add new supports-screen API to set maximum allowed size.
Diffstat (limited to 'core/java/android/content/res')
-rw-r--r--core/java/android/content/res/CompatibilityInfo.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java
index 0d2e567..b686e54 100644
--- a/core/java/android/content/res/CompatibilityInfo.java
+++ b/core/java/android/content/res/CompatibilityInfo.java
@@ -96,21 +96,42 @@ public class CompatibilityInfo implements Parcelable {
boolean forceCompat) {
int compatFlags = 0;
- if (appInfo.requiresSmallestWidthDp != 0 || appInfo.compatibleWidthLimitDp != 0) {
+ if (appInfo.requiresSmallestWidthDp != 0 || appInfo.compatibleWidthLimitDp != 0
+ || appInfo.largestWidthLimitDp != 0) {
// New style screen requirements spec.
int required = appInfo.requiresSmallestWidthDp != 0
? appInfo.requiresSmallestWidthDp
: appInfo.compatibleWidthLimitDp;
+ if (required == 0) {
+ required = appInfo.largestWidthLimitDp;
+ }
int compat = appInfo.compatibleWidthLimitDp != 0
- ? appInfo.compatibleWidthLimitDp
- : appInfo.requiresSmallestWidthDp;
+ ? appInfo.compatibleWidthLimitDp : required;
if (compat < required) {
compat = required;
}
-
- if (compat >= sw) {
+ int largest = appInfo.largestWidthLimitDp;
+
+ if (required > DEFAULT_NORMAL_SHORT_DIMENSION) {
+ // For now -- if they require a size larger than the only
+ // size we can do in compatibility mode, then don't ever
+ // allow the app to go in to compat mode. Trying to run
+ // it at a smaller size it can handle will make it far more
+ // broken than running at a larger size than it wants or
+ // thinks it can handle.
+ compatFlags |= NEVER_NEEDS_COMPAT;
+ } else if (largest != 0 && sw > largest) {
+ // If the screen size is larger than the largest size the
+ // app thinks it can work with, then always force it in to
+ // compatibility mode.
+ compatFlags |= NEEDS_SCREEN_COMPAT | ALWAYS_NEEDS_COMPAT;
+ } else if (compat >= sw) {
+ // The screen size is something the app says it was designed
+ // for, so never do compatibility mode.
compatFlags |= NEVER_NEEDS_COMPAT;
} else if (forceCompat) {
+ // The app may work better with or without compatibility mode.
+ // Let the user decide.
compatFlags |= NEEDS_SCREEN_COMPAT;
}