diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-07-21 20:03:02 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-07-22 11:58:31 -0700 |
commit | 11b822d2a91ea17c34c0cb1c11e80a9a30d72864 (patch) | |
tree | 7eec5218c6831641b406f1b969841314f452adbb /core/java/android/content/res | |
parent | 59c25cbaf0dd690e503b881392510127441d9074 (diff) | |
download | frameworks_base-11b822d2a91ea17c34c0cb1c11e80a9a30d72864.zip frameworks_base-11b822d2a91ea17c34c0cb1c11e80a9a30d72864.tar.gz frameworks_base-11b822d2a91ea17c34c0cb1c11e80a9a30d72864.tar.bz2 |
Simplify density compatibility to a boolean.
Instead of a list, we now just have a single boolean indicating whether an
application is density aware, and this set set to true by default as of
Donut.
Diffstat (limited to 'core/java/android/content/res')
-rw-r--r-- | core/java/android/content/res/CompatibilityInfo.java | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java index 517551e..e2abfd1 100644 --- a/core/java/android/content/res/CompatibilityInfo.java +++ b/core/java/android/content/res/CompatibilityInfo.java @@ -131,41 +131,15 @@ public class CompatibilityInfo { mCompatibilityFlags |= EXPANDABLE | CONFIGURED_EXPANDABLE; } - float packageDensityScale = -1.0f; - int packageDensity = 0; - if (appInfo.supportsDensities != null) { - int minDiff = Integer.MAX_VALUE; - for (int density : appInfo.supportsDensities) { - if (density == ApplicationInfo.ANY_DENSITY) { - packageDensity = DisplayMetrics.DENSITY_DEVICE; - packageDensityScale = 1.0f; - break; - } - int tmpDiff = Math.abs(DisplayMetrics.DENSITY_DEVICE - density); - if (tmpDiff == 0) { - packageDensity = DisplayMetrics.DENSITY_DEVICE; - packageDensityScale = 1.0f; - break; - } - // prefer higher density (appScale>1.0), unless that's only option. - if (tmpDiff < minDiff && packageDensityScale < 1.0f) { - packageDensity = density; - packageDensityScale = DisplayMetrics.DENSITY_DEVICE / (float) density; - minDiff = tmpDiff; - } - } - } - if (packageDensityScale > 0.0f) { - applicationDensity = packageDensity; - applicationScale = packageDensityScale; + if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) != 0) { + applicationDensity = DisplayMetrics.DENSITY_DEVICE; + applicationScale = 1.0f; + applicationInvertedScale = 1.0f; } else { applicationDensity = DisplayMetrics.DENSITY_DEFAULT; - applicationScale = - DisplayMetrics.DENSITY_DEVICE / (float) DisplayMetrics.DENSITY_DEFAULT; - } - - applicationInvertedScale = 1.0f / applicationScale; - if (applicationScale != 1.0f) { + applicationScale = DisplayMetrics.DENSITY_DEVICE + / (float) DisplayMetrics.DENSITY_DEFAULT; + applicationInvertedScale = 1.0f / applicationScale; mCompatibilityFlags |= SCALING_REQUIRED; } } |