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.
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 143c7d5..ee53274 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -4916,6 +4916,10 @@
                                 ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS) != 0) {
                             screens.add("small,");
                         }
+                        if ((ps.pkg.applicationInfo.flags & 
+                                ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) {
+                            screens.add("resizeable,");
+                        }
                         pw.print("    supportsScreens="); pw.println(screens);
                     }
                     pw.print("    timeStamp="); pw.println(ps.getTimeStampStr());
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 2937ed0..0be8417 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -420,7 +420,7 @@
     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 @@
         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 @@
             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;