diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-07-21 17:46:02 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-07-21 18:28:42 -0700 |
commit | c4db95c077f826585d20be2f3db4043c53d30cf5 (patch) | |
tree | 9176baa673f97b27150f862485fd492cb3ec7e88 /services/java/com/android/server/WindowManagerService.java | |
parent | fe6f45c81463d2d28e11ac6083f2653e1286c5ef (diff) |
First pass at reworking screen density/size APIs.
This changes the names of the directories in aapt, to what you see
in the list of DpiTest resources. Also adds a new "long" configuration
for wide screens, which the platform sets appropriate, and introduces
a new kind of resizeability for not large but significantly larger
than normal screens which may have compatibility issues.
Diffstat (limited to 'services/java/com/android/server/WindowManagerService.java')
-rw-r--r-- | services/java/com/android/server/WindowManagerService.java | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 2937ed00b45a..0be841790d87 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -420,7 +420,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo final Rect mTempRect = new Rect(); final Configuration mTempConfiguration = new Configuration(); - int screenLayout = Configuration.SCREENLAYOUT_UNDEFINED; + int mScreenLayout = Configuration.SCREENLAYOUT_SIZE_UNDEFINED; // The frame use to limit the size of the app running in compatibility mode. Rect mCompatibleScreenFrame = new Rect(); @@ -3759,7 +3759,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo mDisplay.getMetrics(dm); CompatibilityInfo.updateCompatibleScreenFrame(dm, orientation, mCompatibleScreenFrame); - if (screenLayout == Configuration.SCREENLAYOUT_UNDEFINED) { + if (mScreenLayout == Configuration.SCREENLAYOUT_SIZE_UNDEFINED) { // Note we only do this once because at this point we don't // expect the screen to change in this way at runtime, and want // to avoid all of this computation for every config change. @@ -3779,16 +3779,35 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo if (longSize < 470) { // This is shorter than an HVGA normal density screen (which // is 480 pixels on its long side). - screenLayout = Configuration.SCREENLAYOUT_SMALL; - } else if (longSize > 490 && shortSize > 330) { - // This is larger than an HVGA normal density screen (which - // is 480x320 pixels). - screenLayout = Configuration.SCREENLAYOUT_LARGE; + mScreenLayout = Configuration.SCREENLAYOUT_SIZE_SMALL + | Configuration.SCREENLAYOUT_LONG_NO; } else { - screenLayout = Configuration.SCREENLAYOUT_NORMAL; + // Is this a large screen? + if (longSize > 640 && shortSize >= 480) { + // VGA or larger screens at medium density are the point + // at which we consider it to be a large screen. + mScreenLayout = Configuration.SCREENLAYOUT_SIZE_LARGE; + } else { + mScreenLayout = Configuration.SCREENLAYOUT_SIZE_NORMAL; + + // If this screen is wider than normal HVGA, or taller + // than FWVGA, then for old apps we want to run in size + // compatibility mode. + if (shortSize > 321 || longSize > 570) { + mScreenLayout |= Configuration.SCREENLAYOUT_COMPAT_NEEDED; + } + } + + // Is this a long screen? + if (((longSize*3)/5) >= (shortSize-1)) { + // Anything wider than WVGA (5:3) is considering to be long. + mScreenLayout |= Configuration.SCREENLAYOUT_LONG_YES; + } else { + mScreenLayout |= Configuration.SCREENLAYOUT_LONG_NO; + } } } - config.screenLayout = screenLayout; + config.screenLayout = mScreenLayout; config.keyboardHidden = Configuration.KEYBOARDHIDDEN_NO; config.hardKeyboardHidden = Configuration.HARDKEYBOARDHIDDEN_NO; |