diff options
| author | Mitsuru Oshima <oshima@google.com> | 2009-06-09 21:16:08 -0700 |
|---|---|---|
| committer | Mitsuru Oshima <oshima@google.com> | 2009-06-10 15:22:17 -0700 |
| commit | e5fb328825995aa33b5b7ecf8b5bee2b17f81715 (patch) | |
| tree | 4b6ca87aaf21dd587e1d033f5ba3318c4329698f /core/java/android/content | |
| parent | ca436e24dec0fa258a8a756c3e7d07bcb096c5b3 (diff) | |
| download | frameworks_base-e5fb328825995aa33b5b7ecf8b5bee2b17f81715.zip frameworks_base-e5fb328825995aa33b5b7ecf8b5bee2b17f81715.tar.gz frameworks_base-e5fb328825995aa33b5b7ecf8b5bee2b17f81715.tar.bz2 | |
resolution support fix/improvement
* adding compatibility menu
* backup gravity
* set expanable=true if the screen size is hvga * density.
* added "supports any density" mode. I'll add sdk check later.
* disallow to catch orientation change event if the app is not expandable. This
was causing layout problem under non-expandable mode. I discussed this with Mike C
and we agreed to do this approach for now. We'll revisit if this causes problem to
a lot of applications.
Diffstat (limited to 'core/java/android/content')
| -rw-r--r-- | core/java/android/content/pm/ApplicationInfo.java | 17 | ||||
| -rw-r--r-- | core/java/android/content/res/CompatibilityInfo.java | 22 | ||||
| -rw-r--r-- | core/java/android/content/res/Resources.java | 6 |
3 files changed, 36 insertions, 9 deletions
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index f3dfc5a..f10dd53 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -145,6 +145,13 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { public static final int FLAG_ALLOW_BACKUP = 1<<10; /** + * Indicates that the application supports any densities; + * {@hide} + */ + public static final int ANY_DENSITY = -1; + private static final int[] ANY_DENSITIES_ARRAY = { ANY_DENSITY }; + + /** * Flags associated with the application. Any combination of * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE}, * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and @@ -369,4 +376,14 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { } return null; } + + /** + * Disable compatibility mode + * + * @hide + */ + public void disableCompatibilityMode() { + expandable = true; + supportsDensities = ANY_DENSITIES_ARRAY; + } } diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java index 19379fb..836de39 100644 --- a/core/java/android/content/res/CompatibilityInfo.java +++ b/core/java/android/content/res/CompatibilityInfo.java @@ -51,10 +51,17 @@ public class CompatibilityInfo { public final float mApplicationInvertedScale; /** - * * A boolean flag to indicates that the application can expand over the original size. + * The flag is set to true if + * 1) Application declares its expandable in manifest file using <expandable /> or + * 2) The screen size is same as (320 x 480) * density. */ - public final boolean mExpandable; + public boolean mExpandable; + + /** + * A expandable flag in the configuration. + */ + public final boolean mConfiguredExpandable; /** * A boolean flag to tell if the application needs scaling (when mApplicationScale != 1.0f) @@ -62,13 +69,16 @@ public class CompatibilityInfo { public final boolean mScalingRequired; public CompatibilityInfo(ApplicationInfo appInfo) { - // A temp workaround to fix rotation issue. - // mExpandable = appInfo.expandable; - mExpandable = true; + mExpandable = mConfiguredExpandable = appInfo.expandable; + float packageDensityScale = -1.0f; if (appInfo.supportsDensities != null) { int minDiff = Integer.MAX_VALUE; for (int density : appInfo.supportsDensities) { + if (density == ApplicationInfo.ANY_DENSITY) { + packageDensityScale = 1.0f; + break; + } int tmpDiff = Math.abs(DisplayMetrics.DEVICE_DENSITY - density); if (tmpDiff == 0) { packageDensityScale = 1.0f; @@ -92,7 +102,7 @@ public class CompatibilityInfo { private CompatibilityInfo() { mApplicationScale = mApplicationInvertedScale = 1.0f; - mExpandable = true; + mExpandable = mConfiguredExpandable = true; mScalingRequired = false; } diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 976b618..2f63820 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -88,7 +88,7 @@ public class Resources { PluralRules mPluralRule; private final CompatibilityInfo mCompatibilityInfo; - + private static final SparseArray<Object> EMPTY_ARRAY = new SparseArray<Object>() { @Override public void put(int k, Object o) { @@ -1255,7 +1255,7 @@ public class Resources { return array; } - + /** * Store the newly updated configuration. */ @@ -1268,7 +1268,7 @@ public class Resources { } if (metrics != null) { mMetrics.setTo(metrics); - mMetrics.updateMetrics(mCompatibilityInfo, mConfiguration); + mMetrics.updateMetrics(mCompatibilityInfo, mConfiguration.orientation); } mMetrics.scaledDensity = mMetrics.density * mConfiguration.fontScale; |
