summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-05-19 21:44:52 -0700
committerDianne Hackborn <hackbod@google.com>2011-05-19 21:44:52 -0700
commit161e67ff3ba26408eea09221734ad2e29a1eed11 (patch)
tree6e98ff836fb5f134e01a7e9ef420ec35a78ad5d2
parent9e735541beed238d3b99d4bd284af1fc953c3775 (diff)
parent06a8ceacb0dc2713cb0bb2c93d2a750f2a58db68 (diff)
downloadframeworks_base-161e67ff3ba26408eea09221734ad2e29a1eed11.zip
frameworks_base-161e67ff3ba26408eea09221734ad2e29a1eed11.tar.gz
frameworks_base-161e67ff3ba26408eea09221734ad2e29a1eed11.tar.bz2
resolved conflicts for merge of 06a8ceac to master
Change-Id: Id51574c825affddfac14ad7214c5496d6a3d6e69
-rw-r--r--api/current.txt3
-rw-r--r--core/java/android/content/pm/ActivityInfo.java7
-rw-r--r--core/java/android/content/pm/PackageParser.java7
-rw-r--r--core/java/android/content/res/AssetManager.java4
-rw-r--r--core/java/android/content/res/Configuration.java124
-rwxr-xr-xcore/java/android/content/res/Resources.java1
-rw-r--r--core/java/android/view/WindowManagerPolicy.java30
-rw-r--r--core/jni/android_content_res_Configuration.cpp14
-rw-r--r--core/jni/android_util_AssetManager.cpp4
-rw-r--r--core/res/res/values-large/dimens.xml4
-rw-r--r--core/res/res/values/attrs_manifest.xml14
-rw-r--r--core/res/res/values/dimens.xml2
-rw-r--r--include/utils/ResourceTypes.h126
-rw-r--r--libs/utils/ResourceTypes.cpp13
-rw-r--r--native/android/configuration.cpp24
-rw-r--r--native/include/android/configuration.h40
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java20
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java50
-rw-r--r--tools/aapt/AaptAssets.cpp132
-rw-r--r--tools/aapt/AaptAssets.h9
-rw-r--r--tools/aapt/ResourceTable.cpp15
21 files changed, 466 insertions, 177 deletions
diff --git a/api/current.txt b/api/current.txt
index 3c8e551..7d87425 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5400,6 +5400,7 @@ package android.content.pm {
field public static final int CONFIG_ORIENTATION = 128; // 0x80
field public static final int CONFIG_SCREEN_LAYOUT = 256; // 0x100
field public static final int CONFIG_SCREEN_SIZE = 1024; // 0x400
+ field public static final int CONFIG_SMALLEST_SCREEN_SIZE = 2048; // 0x800
field public static final int CONFIG_TOUCHSCREEN = 8; // 0x8
field public static final int CONFIG_UI_MODE = 512; // 0x200
field public static final android.os.Parcelable.Creator CREATOR;
@@ -5989,6 +5990,7 @@ package android.content.res {
field public static final int SCREENLAYOUT_SIZE_XLARGE = 4; // 0x4
field public static final int SCREEN_HEIGHT_DP_UNDEFINED = 0; // 0x0
field public static final int SCREEN_WIDTH_DP_UNDEFINED = 0; // 0x0
+ field public static final int SMALLEST_SCREEN_WIDTH_DP_UNDEFINED = 0; // 0x0
field public static final int TOUCHSCREEN_FINGER = 3; // 0x3
field public static final int TOUCHSCREEN_NOTOUCH = 1; // 0x1
field public static final int TOUCHSCREEN_STYLUS = 2; // 0x2
@@ -6015,6 +6017,7 @@ package android.content.res {
field public int screenHeightDp;
field public int screenLayout;
field public int screenWidthDp;
+ field public int smallestScreenWidthDp;
field public int touchscreen;
field public int uiMode;
}
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 64c437d..4285388 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -340,6 +340,12 @@ public class ActivityInfo extends ComponentInfo
public static final int CONFIG_SCREEN_SIZE = 0x0400;
/**
* Bit in {@link #configChanges} that indicates that the activity
+ * can itself handle the smallest screen size. Set from the
+ * {@link android.R.attr#configChanges} attribute.
+ */
+ public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800;
+ /**
+ * Bit in {@link #configChanges} that indicates that the activity
* can itself handle changes to the font scaling factor. Set from the
* {@link android.R.attr#configChanges} attribute. This is
* not a core resource configutation, but a higher-level value, so its
@@ -364,6 +370,7 @@ public class ActivityInfo extends ComponentInfo
0x0800, // SCREEN LAYOUT
0x1000, // UI MODE
0x0200, // SCREEN SIZE
+ 0x2000, // SMALLEST SCREEN SIZE
};
/** @hide
* Convert Java change bits to native.
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 18120ac..9ff324b 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -396,7 +396,7 @@ public class PackageParser {
int cookie = assmgr.addAssetPath(mArchiveSourcePath);
if (cookie != 0) {
res = new Resources(assmgr, metrics, null);
- assmgr.setConfiguration(0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ assmgr.setConfiguration(0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Build.VERSION.RESOURCES_SDK_INT);
parser = assmgr.openXmlResourceParser(cookie, "AndroidManifest.xml");
assetError = false;
@@ -596,7 +596,7 @@ public class PackageParser {
AssetManager assmgr = null;
try {
assmgr = new AssetManager();
- assmgr.setConfiguration(0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ assmgr.setConfiguration(0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Build.VERSION.RESOURCES_SDK_INT);
int cookie = assmgr.addAssetPath(packageFilePath);
parser = assmgr.openXmlResourceParser(cookie, "AndroidManifest.xml");
@@ -1943,7 +1943,8 @@ public class PackageParser {
0);
if (owner.applicationInfo.targetSdkVersion
< android.os.Build.VERSION_CODES.HONEYCOMB_MR2) {
- a.info.configChanges |= ActivityInfo.CONFIG_SCREEN_SIZE;
+ a.info.configChanges |= ActivityInfo.CONFIG_SCREEN_SIZE
+ | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE;
}
a.info.softInputMode = sa.getInt(
com.android.internal.R.styleable.AndroidManifestActivity_windowSoftInputMode,
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index be67e96..931cb18 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -652,8 +652,8 @@ public final class AssetManager {
public native final void setConfiguration(int mcc, int mnc, String locale,
int orientation, int touchscreen, int density, int keyboard,
int keyboardHidden, int navigation, int screenWidth, int screenHeight,
- int screenWidthDp, int screenHeightDp, int screenLayout, int uiMode,
- int majorVersion);
+ int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp,
+ int screenLayout, int uiMode, int majorVersion);
/**
* Retrieve the resource identifier for the given resource name.
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 0de08f2..12ec258 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -259,6 +259,15 @@ public final class Configuration implements Parcelable, Comparable<Configuration
*/
public int screenHeightDp;
+ public static final int SMALLEST_SCREEN_WIDTH_DP_UNDEFINED = 0;
+
+ /**
+ * The smallest screen size an application will see in normal operation.
+ * This is the smallest value of both screenWidthDp and screenHeightDp
+ * in both portrait and landscape.
+ */
+ public int smallestScreenWidthDp;
+
/**
* @hide Internal book-keeping.
*/
@@ -298,6 +307,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
uiMode = o.uiMode;
screenWidthDp = o.screenWidthDp;
screenHeightDp = o.screenHeightDp;
+ smallestScreenWidthDp = o.smallestScreenWidthDp;
seq = o.seq;
}
@@ -315,6 +325,56 @@ public final class Configuration implements Parcelable, Comparable<Configuration
} else {
sb.append(" (no locale)");
}
+ if (smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED) {
+ sb.append(" sw"); sb.append(smallestScreenWidthDp); sb.append("dp");
+ } else {
+ sb.append("?swdp");
+ }
+ if (screenWidthDp != SCREEN_WIDTH_DP_UNDEFINED) {
+ sb.append(" w"); sb.append(screenWidthDp); sb.append("dp");
+ } else {
+ sb.append("?wdp");
+ }
+ if (screenHeightDp != SCREEN_HEIGHT_DP_UNDEFINED) {
+ sb.append(" h"); sb.append(screenHeightDp); sb.append("dp");
+ } else {
+ sb.append("?hdp");
+ }
+ switch ((screenLayout&SCREENLAYOUT_SIZE_MASK)) {
+ case SCREENLAYOUT_SIZE_UNDEFINED: sb.append(" ?lsize"); break;
+ case SCREENLAYOUT_SIZE_SMALL: sb.append(" smll"); break;
+ case SCREENLAYOUT_SIZE_NORMAL: sb.append(" nrml"); break;
+ case SCREENLAYOUT_SIZE_LARGE: sb.append(" lrg"); break;
+ case SCREENLAYOUT_SIZE_XLARGE: sb.append(" xlrg"); break;
+ default: sb.append(" layoutSize=");
+ sb.append(screenLayout&SCREENLAYOUT_SIZE_MASK); break;
+ }
+ switch ((screenLayout&SCREENLAYOUT_LONG_MASK)) {
+ case SCREENLAYOUT_LONG_UNDEFINED: sb.append(" ?long"); break;
+ case SCREENLAYOUT_LONG_NO: /* not-long is not interesting to print */ break;
+ case SCREENLAYOUT_LONG_YES: sb.append(" long"); break;
+ default: sb.append(" layoutLong=");
+ sb.append(screenLayout&SCREENLAYOUT_LONG_MASK); break;
+ }
+ switch (orientation) {
+ case ORIENTATION_UNDEFINED: sb.append(" ?orien"); break;
+ case ORIENTATION_LANDSCAPE: sb.append(" land"); break;
+ case ORIENTATION_PORTRAIT: sb.append(" port"); break;
+ default: sb.append(" orien="); sb.append(orientation); break;
+ }
+ switch ((uiMode&UI_MODE_TYPE_MASK)) {
+ case UI_MODE_TYPE_UNDEFINED: sb.append(" ?uimode"); break;
+ case UI_MODE_TYPE_NORMAL: /* normal is not interesting to print */ break;
+ case UI_MODE_TYPE_DESK: sb.append(" desk"); break;
+ case UI_MODE_TYPE_CAR: sb.append(" car"); break;
+ default: sb.append(" uimode="); sb.append(uiMode&UI_MODE_TYPE_MASK); break;
+ }
+ switch ((uiMode&UI_MODE_NIGHT_MASK)) {
+ case UI_MODE_NIGHT_UNDEFINED: sb.append(" ?night"); break;
+ case UI_MODE_NIGHT_NO: /* not-night is not interesting to print */ break;
+ case UI_MODE_NIGHT_YES: sb.append(" night"); break;
+ default: sb.append(" night="); sb.append(uiMode&UI_MODE_NIGHT_MASK); break;
+ }
switch (touchscreen) {
case TOUCHSCREEN_UNDEFINED: sb.append(" ?touch"); break;
case TOUCHSCREEN_NOTOUCH: sb.append(" -touch"); break;
@@ -356,51 +416,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
case NAVIGATIONHIDDEN_YES: sb.append("/h"); break;
default: sb.append("/"); sb.append(navigationHidden); break;
}
- switch (orientation) {
- case ORIENTATION_UNDEFINED: sb.append(" ?orien"); break;
- case ORIENTATION_LANDSCAPE: sb.append(" land"); break;
- case ORIENTATION_PORTRAIT: sb.append(" port"); break;
- default: sb.append(" orien="); sb.append(orientation); break;
- }
- switch ((screenLayout&SCREENLAYOUT_SIZE_MASK)) {
- case SCREENLAYOUT_SIZE_UNDEFINED: sb.append(" ?lsize"); break;
- case SCREENLAYOUT_SIZE_SMALL: sb.append(" smll"); break;
- case SCREENLAYOUT_SIZE_NORMAL: sb.append(" nrml"); break;
- case SCREENLAYOUT_SIZE_LARGE: sb.append(" lrg"); break;
- case SCREENLAYOUT_SIZE_XLARGE: sb.append(" xlrg"); break;
- default: sb.append(" layoutSize=");
- sb.append(screenLayout&SCREENLAYOUT_SIZE_MASK); break;
- }
- switch ((screenLayout&SCREENLAYOUT_LONG_MASK)) {
- case SCREENLAYOUT_LONG_UNDEFINED: sb.append(" ?long"); break;
- case SCREENLAYOUT_LONG_NO: /* not-long is not interesting to print */ break;
- case SCREENLAYOUT_LONG_YES: sb.append(" long"); break;
- default: sb.append(" layoutLong=");
- sb.append(screenLayout&SCREENLAYOUT_LONG_MASK); break;
- }
- switch ((uiMode&UI_MODE_TYPE_MASK)) {
- case UI_MODE_TYPE_UNDEFINED: sb.append(" ?uimode"); break;
- case UI_MODE_TYPE_NORMAL: /* normal is not interesting to print */ break;
- case UI_MODE_TYPE_DESK: sb.append(" desk"); break;
- case UI_MODE_TYPE_CAR: sb.append(" car"); break;
- default: sb.append(" uimode="); sb.append(uiMode&UI_MODE_TYPE_MASK); break;
- }
- switch ((uiMode&UI_MODE_NIGHT_MASK)) {
- case UI_MODE_NIGHT_UNDEFINED: sb.append(" ?night"); break;
- case UI_MODE_NIGHT_NO: /* not-night is not interesting to print */ break;
- case UI_MODE_NIGHT_YES: sb.append(" night"); break;
- default: sb.append(" night="); sb.append(uiMode&UI_MODE_NIGHT_MASK); break;
- }
- if (screenWidthDp != SCREEN_WIDTH_DP_UNDEFINED) {
- sb.append(" w"); sb.append(screenWidthDp); sb.append("dp");
- } else {
- sb.append("?wdp");
- }
- if (screenHeightDp != SCREEN_HEIGHT_DP_UNDEFINED) {
- sb.append(" h"); sb.append(screenHeightDp); sb.append("dp");
- } else {
- sb.append("?hdp");
- }
if (seq != 0) {
sb.append(" s.");
sb.append(seq);
@@ -428,6 +443,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
uiMode = UI_MODE_TYPE_UNDEFINED;
screenWidthDp = SCREEN_WIDTH_DP_UNDEFINED;
screenHeightDp = SCREEN_HEIGHT_DP_UNDEFINED;
+ smallestScreenWidthDp = SMALLEST_SCREEN_WIDTH_DP_UNDEFINED;
seq = 0;
}
@@ -531,6 +547,11 @@ public final class Configuration implements Parcelable, Comparable<Configuration
changed |= ActivityInfo.CONFIG_SCREEN_SIZE;
screenHeightDp = delta.screenHeightDp;
}
+ if (delta.smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED
+ && smallestScreenWidthDp != delta.smallestScreenWidthDp) {
+ changed |= ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE;
+ smallestScreenWidthDp = delta.smallestScreenWidthDp;
+ }
if (delta.seq != 0) {
seq = delta.seq;
@@ -564,7 +585,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
* {@link android.content.pm.ActivityInfo#CONFIG_SCREEN_LAYOUT
* PackageManager.ActivityInfo.CONFIG_SCREEN_LAYOUT}, or
* {@link android.content.pm.ActivityInfo#CONFIG_SCREEN_SIZE
- * PackageManager.ActivityInfo.CONFIG_SCREEN_SIZE}.
+ * PackageManager.ActivityInfo.CONFIG_SCREEN_SIZE}, or
+ * {@link android.content.pm.ActivityInfo#CONFIG_SMALLEST_SCREEN_SIZE
+ * PackageManager.ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE}.
*/
public int diff(Configuration delta) {
int changed = 0;
@@ -625,6 +648,10 @@ public final class Configuration implements Parcelable, Comparable<Configuration
&& screenHeightDp != delta.screenHeightDp) {
changed |= ActivityInfo.CONFIG_SCREEN_SIZE;
}
+ if (delta.smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED
+ && smallestScreenWidthDp != delta.smallestScreenWidthDp) {
+ changed |= ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE;
+ }
return changed;
}
@@ -708,6 +735,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
dest.writeInt(uiMode);
dest.writeInt(screenWidthDp);
dest.writeInt(screenHeightDp);
+ dest.writeInt(smallestScreenWidthDp);
dest.writeInt(seq);
}
@@ -731,6 +759,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
uiMode = source.readInt();
screenWidthDp = source.readInt();
screenHeightDp = source.readInt();
+ smallestScreenWidthDp = source.readInt();
seq = source.readInt();
}
@@ -795,6 +824,8 @@ public final class Configuration implements Parcelable, Comparable<Configuration
n = this.screenWidthDp - that.screenWidthDp;
if (n != 0) return n;
n = this.screenHeightDp - that.screenHeightDp;
+ if (n != 0) return n;
+ n = this.smallestScreenWidthDp - that.smallestScreenWidthDp;
//if (n != 0) return n;
return n;
}
@@ -830,6 +861,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
result = 31 * result + uiMode;
result = 31 * result + screenWidthDp;
result = 31 * result + screenHeightDp;
+ result = 31 * result + smallestScreenWidthDp;
return result;
}
}
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 540f704..a072e94 100755
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -1458,6 +1458,7 @@ public class Resources {
mConfiguration.touchscreen,
(int)(mMetrics.density*160), mConfiguration.keyboard,
keyboardHidden, mConfiguration.navigation, width, height,
+ mConfiguration.smallestScreenWidthDp,
mConfiguration.screenWidthDp, mConfiguration.screenHeightDp,
mConfiguration.screenLayout, mConfiguration.uiMode,
Build.VERSION.RESOURCES_SDK_INT);
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 5a418f3..4e52e40 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -466,16 +466,34 @@ public interface WindowManagerPolicy {
public int getMaxWallpaperLayer();
/**
- * Return the display width available after excluding the window
- * decor.
+ * Return the display width available after excluding any screen
+ * decorations that can never be removed. That is, system bar or
+ * button bar.
*/
- public int getNonDecorDisplayWidth(int fullWidth);
+ public int getNonDecorDisplayWidth(int rotation, int fullWidth);
/**
- * Return the display height available after excluding the screen
- * decor.
+ * Return the display height available after excluding any screen
+ * decorations that can never be removed. That is, system bar or
+ * button bar.
*/
- public int getNonDecorDisplayHeight(int fullHeight);
+ public int getNonDecorDisplayHeight(int rotation, int fullHeight);
+
+ /**
+ * Return the available screen width that we should report for the
+ * configuration. This must be no larger than
+ * {@link #getNonDecorDisplayWidth(int, int)}; it may be smaller than
+ * that to account for more transient decoration like a status bar.
+ */
+ public int getConfigDisplayWidth(int rotation, int fullWidth);
+
+ /**
+ * Return the available screen height that we should report for the
+ * configuration. This must be no larger than
+ * {@link #getNonDecorDisplayHeight(int, int)}; it may be smaller than
+ * that to account for more transient decoration like a status bar.
+ */
+ public int getConfigDisplayHeight(int rotation, int fullHeight);
/**
* Return whether the given window should forcibly hide everything
diff --git a/core/jni/android_content_res_Configuration.cpp b/core/jni/android_content_res_Configuration.cpp
index 95b18ea..27ecd9d 100644
--- a/core/jni/android_content_res_Configuration.cpp
+++ b/core/jni/android_content_res_Configuration.cpp
@@ -38,6 +38,9 @@ static struct {
jfieldID navigationHidden;
jfieldID orientation;
jfieldID uiMode;
+ jfieldID screenWidthDp;
+ jfieldID screenHeightDp;
+ jfieldID smallestScreenWidthDp;
} gConfigurationClassInfo;
void android_Configuration_getFromJava(
@@ -60,6 +63,11 @@ void android_Configuration_getFromJava(
out->orientation = env->GetIntField(clazz, gConfigurationClassInfo.orientation);
out->uiMode = env->GetIntField(clazz, gConfigurationClassInfo.uiMode);
+
+ out->screenWidthDp = env->GetIntField(clazz, gConfigurationClassInfo.screenWidthDp);
+ out->screenHeightDp = env->GetIntField(clazz, gConfigurationClassInfo.screenHeightDp);
+ out->smallestScreenWidthDp = env->GetIntField(clazz,
+ gConfigurationClassInfo.smallestScreenWidthDp);
}
/*
@@ -108,6 +116,12 @@ int register_android_content_res_Configuration(JNIEnv* env)
"orientation", "I");
GET_FIELD_ID(gConfigurationClassInfo.uiMode, clazz,
"uiMode", "I");
+ GET_FIELD_ID(gConfigurationClassInfo.screenWidthDp, gConfigurationClassInfo.clazz,
+ "screenWidthDp", "I");
+ GET_FIELD_ID(gConfigurationClassInfo.screenHeightDp, gConfigurationClassInfo.clazz,
+ "screenHeightDp", "I");
+ GET_FIELD_ID(gConfigurationClassInfo.smallestScreenWidthDp, gConfigurationClassInfo.clazz,
+ "smallestScreenWidthDp", "I");
return AndroidRuntime::registerNativeMethods(env, "android/content/res/Configuration", gMethods,
NELEM(gMethods));
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index b0e92e4..4f8f1af 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -510,6 +510,7 @@ static void android_content_AssetManager_setConfiguration(JNIEnv* env, jobject c
jint keyboard, jint keyboardHidden,
jint navigation,
jint screenWidth, jint screenHeight,
+ jint smallestScreenWidthDp,
jint screenWidthDp, jint screenHeightDp,
jint screenLayout, jint uiMode,
jint sdkVersion)
@@ -534,6 +535,7 @@ static void android_content_AssetManager_setConfiguration(JNIEnv* env, jobject c
config.navigation = (uint8_t)navigation;
config.screenWidth = (uint16_t)screenWidth;
config.screenHeight = (uint16_t)screenHeight;
+ config.smallestScreenWidthDp = (uint16_t)smallestScreenWidthDp;
config.screenWidthDp = (uint16_t)screenWidthDp;
config.screenHeightDp = (uint16_t)screenHeightDp;
config.screenLayout = (uint8_t)screenLayout;
@@ -1646,7 +1648,7 @@ static JNINativeMethod gAssetManagerMethods[] = {
(void*) android_content_AssetManager_setLocale },
{ "getLocales", "()[Ljava/lang/String;",
(void*) android_content_AssetManager_getLocales },
- { "setConfiguration", "(IILjava/lang/String;IIIIIIIIIIIII)V",
+ { "setConfiguration", "(IILjava/lang/String;IIIIIIIIIIIIII)V",
(void*) android_content_AssetManager_setConfiguration },
{ "getResourceIdentifier","(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I",
(void*) android_content_AssetManager_getResourceIdentifier },
diff --git a/core/res/res/values-large/dimens.xml b/core/res/res/values-large/dimens.xml
index da36b67..55eb145 100644
--- a/core/res/res/values-large/dimens.xml
+++ b/core/res/res/values-large/dimens.xml
@@ -24,10 +24,6 @@
<!-- Size of the giant number (unread count) in the notifications -->
<dimen name="status_bar_content_number_size">48sp</dimen>
- <!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
- <!-- Margin for permanent screen decorations at the bottom. -->
- <dimen name="screen_margin_bottom">48dip</dimen>
-
<!-- Default height of a key in the password keyboard for alpha -->
<dimen name="password_keyboard_key_height_alpha">75dip</dimen>
<!-- Default height of a key in the password keyboard for numeric -->
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 625afff..6b7c2a6 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -590,11 +590,21 @@
<!-- The global user interface mode has changed. For example,
going in or out of car mode, night mode changing, etc. -->
<flag name="uiMode" value="0x0200" />
- <!-- The physical screen size has changed. If applications don't
+ <!-- The current available screen size has changed. If applications don't
target at least {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}
then the activity will always handle this itself (the change
- will not result in a restart). -->
+ will not result in a restart). This represents a change in the
+ currently available size, so will change when the user switches
+ between landscape and portrait. -->
<flag name="screenSize" value="0x0400" />
+ <!-- The physical screen size has changed. If applications don't
+ target at least {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}
+ then the activity will always handle this itself (the change
+ will not result in a restart). This represents a change in size
+ regardless of orientation, so will only change when the actual
+ physical screen size has changed such as switching to an external
+ display. -->
+ <flag name="smallestScreenSize" value="0x0800" />
<!-- The font scaling factor has changed, that is the user has
selected a new global font size. -->
<flag name="fontScale" value="0x40000000" />
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index e405f20..3f4010b 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -38,8 +38,6 @@
<dimen name="status_bar_content_number_size">48sp</dimen>
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
<dimen name="status_bar_edge_ignore">5dp</dimen>
- <!-- Margin for permanent screen decorations at the bottom. -->
- <dimen name="screen_margin_bottom">0dip</dimen>
<!-- Size of the fastscroll hint letter -->
<dimen name="fastscroll_overlay_size">104dp</dimen>
<!-- Width of the fastscroll thumb -->
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index 173412e..9e4e132 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -966,8 +966,7 @@ struct ResTable_config
struct {
uint8_t screenLayout;
uint8_t uiMode;
- uint8_t screenConfigPad1;
- uint8_t screenConfigPad2;
+ uint16_t smallestScreenWidthDp;
};
uint32_t screenConfig;
};
@@ -1000,6 +999,7 @@ struct ResTable_config
screenHeight = dtohs(screenHeight);
sdkVersion = dtohs(sdkVersion);
minorVersion = dtohs(minorVersion);
+ smallestScreenWidthDp = dtohs(smallestScreenWidthDp);
screenWidthDp = dtohs(screenWidthDp);
screenHeightDp = dtohs(screenHeightDp);
}
@@ -1013,6 +1013,7 @@ struct ResTable_config
screenHeight = htods(screenHeight);
sdkVersion = htods(sdkVersion);
minorVersion = htods(minorVersion);
+ smallestScreenWidthDp = htods(smallestScreenWidthDp);
screenWidthDp = htods(screenWidthDp);
screenHeightDp = htods(screenHeightDp);
}
@@ -1034,6 +1035,8 @@ struct ResTable_config
if (diff != 0) return diff;
diff = (int32_t)(uiMode - o.uiMode);
if (diff != 0) return diff;
+ diff = (int32_t)(smallestScreenWidthDp - o.smallestScreenWidthDp);
+ if (diff != 0) return diff;
diff = (int32_t)(screenSizeDp - o.screenSizeDp);
return (int)diff;
}
@@ -1052,6 +1055,7 @@ struct ResTable_config
CONFIG_ORIENTATION = ACONFIGURATION_ORIENTATION,
CONFIG_DENSITY = ACONFIGURATION_DENSITY,
CONFIG_SCREEN_SIZE = ACONFIGURATION_SCREEN_SIZE,
+ CONFIG_SMALLEST_SCREEN_SIZE = ACONFIGURATION_SMALLEST_SCREEN_SIZE,
CONFIG_VERSION = ACONFIGURATION_VERSION,
CONFIG_SCREEN_LAYOUT = ACONFIGURATION_SCREEN_LAYOUT,
CONFIG_UI_MODE = ACONFIGURATION_UI_MODE
@@ -1075,6 +1079,7 @@ struct ResTable_config
if (version != o.version) diffs |= CONFIG_VERSION;
if (screenLayout != o.screenLayout) diffs |= CONFIG_SCREEN_LAYOUT;
if (uiMode != o.uiMode) diffs |= CONFIG_UI_MODE;
+ if (smallestScreenWidthDp != o.smallestScreenWidthDp) diffs |= CONFIG_SMALLEST_SCREEN_SIZE;
if (screenSizeDp != o.screenSizeDp) diffs |= CONFIG_SCREEN_SIZE;
return diffs;
}
@@ -1109,14 +1114,10 @@ struct ResTable_config
}
}
- if (screenLayout || o.screenLayout) {
- if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0) {
- if (!(screenLayout & MASK_SCREENSIZE)) return false;
- if (!(o.screenLayout & MASK_SCREENSIZE)) return true;
- }
- if (((screenLayout^o.screenLayout) & MASK_SCREENLONG) != 0) {
- if (!(screenLayout & MASK_SCREENLONG)) return false;
- if (!(o.screenLayout & MASK_SCREENLONG)) return true;
+ if (smallestScreenWidthDp || o.smallestScreenWidthDp) {
+ if (smallestScreenWidthDp != o.smallestScreenWidthDp) {
+ if (!smallestScreenWidthDp) return false;
+ if (!o.smallestScreenWidthDp) return true;
}
}
@@ -1132,6 +1133,17 @@ struct ResTable_config
}
}
+ if (screenLayout || o.screenLayout) {
+ if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0) {
+ if (!(screenLayout & MASK_SCREENSIZE)) return false;
+ if (!(o.screenLayout & MASK_SCREENSIZE)) return true;
+ }
+ if (((screenLayout^o.screenLayout) & MASK_SCREENLONG) != 0) {
+ if (!(screenLayout & MASK_SCREENLONG)) return false;
+ if (!(o.screenLayout & MASK_SCREENLONG)) return true;
+ }
+ }
+
if (orientation != o.orientation) {
if (!orientation) return false;
if (!o.orientation) return true;
@@ -1238,6 +1250,37 @@ struct ResTable_config
}
}
+ if (smallestScreenWidthDp || o.smallestScreenWidthDp) {
+ // The configuration closest to the actual size is best.
+ // We assume that larger configs have already been filtered
+ // out at this point. That means we just want the largest one.
+ return smallestScreenWidthDp >= o.smallestScreenWidthDp;
+ }
+
+ if (screenSizeDp || o.screenSizeDp) {
+ // "Better" is based on the sum of the difference between both
+ // width and height from the requested dimensions. We are
+ // assuming the invalid configs (with smaller dimens) have
+ // already been filtered. Note that if a particular dimension
+ // is unspecified, we will end up with a large value (the
+ // difference between 0 and the requested dimension), which is
+ // good since we will prefer a config that has specified a
+ // dimension value.
+ int myDelta = 0, otherDelta = 0;
+ if (requested->screenWidthDp) {
+ myDelta += requested->screenWidthDp - screenWidthDp;
+ otherDelta += requested->screenWidthDp - o.screenWidthDp;
+ }
+ if (requested->screenHeightDp) {
+ myDelta += requested->screenHeightDp - screenHeightDp;
+ otherDelta += requested->screenHeightDp - o.screenHeightDp;
+ }
+ //LOGI("Comparing this %dx%d to other %dx%d in %dx%d: myDelta=%d otherDelta=%d",
+ // screenWidthDp, screenHeightDp, o.screenWidthDp, o.screenHeightDp,
+ // requested->screenWidthDp, requested->screenHeightDp, myDelta, otherDelta);
+ return (myDelta <= otherDelta);
+ }
+
if (screenLayout || o.screenLayout) {
if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0
&& (requested->screenLayout & MASK_SCREENSIZE)) {
@@ -1270,30 +1313,6 @@ struct ResTable_config
}
}
- if (screenSizeDp || o.screenSizeDp) {
- // Better is based on the sum of the difference between both
- // width and height from the requested dimensions. We are
- // assuming the invalid configs (with smaller dimens) have
- // already been filtered. Note that if a particular dimension
- // is unspecified, we will end up with a large value (the
- // difference between 0 and the requested dimension), which is
- // good since we will prefer a config that has specified a
- // dimension value.
- int myDelta = 0, otherDelta = 0;
- if (requested->screenWidthDp) {
- myDelta += requested->screenWidthDp - screenWidthDp;
- otherDelta += requested->screenWidthDp - o.screenWidthDp;
- }
- if (requested->screenHeightDp) {
- myDelta += requested->screenHeightDp - screenHeightDp;
- otherDelta += requested->screenHeightDp - o.screenHeightDp;
- }
- //LOGI("Comparing this %dx%d to other %dx%d in %dx%d: myDelta=%d otherDelta=%d",
- // screenWidthDp, screenHeightDp, o.screenWidthDp, o.screenHeightDp,
- // requested->screenWidthDp, requested->screenHeightDp, myDelta, otherDelta);
- return (myDelta <= otherDelta);
- }
-
if ((orientation != o.orientation) && requested->orientation) {
return (orientation);
}
@@ -1388,14 +1407,24 @@ struct ResTable_config
}
if (screenSize || o.screenSize) {
- if ((screenWidth != o.screenWidth) && requested->screenWidth) {
- return (screenWidth);
+ // "Better" is based on the sum of the difference between both
+ // width and height from the requested dimensions. We are
+ // assuming the invalid configs (with smaller sizes) have
+ // already been filtered. Note that if a particular dimension
+ // is unspecified, we will end up with a large value (the
+ // difference between 0 and the requested dimension), which is
+ // good since we will prefer a config that has specified a
+ // size value.
+ int myDelta = 0, otherDelta = 0;
+ if (requested->screenWidth) {
+ myDelta += requested->screenWidth - screenWidth;
+ otherDelta += requested->screenWidth - o.screenWidth;
}
-
- if ((screenHeight != o.screenHeight) &&
- requested->screenHeight) {
- return (screenHeight);
+ if (requested->screenHeight) {
+ myDelta += requested->screenHeight - screenHeight;
+ otherDelta += requested->screenHeight - o.screenHeight;
}
+ return (myDelta <= otherDelta);
}
if (version || o.version) {
@@ -1476,15 +1505,20 @@ struct ResTable_config
&& uiModeNight != setUiModeNight) {
return false;
}
+
+ if (settings.smallestScreenWidthDp != 0 && smallestScreenWidthDp != 0
+ && smallestScreenWidthDp > settings.smallestScreenWidthDp) {
+ return false;
+ }
}
if (screenSizeDp != 0) {
if (settings.screenWidthDp != 0 && screenWidthDp != 0
- && screenWidthDp > settings.screenWidthDp) {
+ && screenWidthDp > settings.screenWidthDp) {
//LOGI("Filtering out width %d in requested %d", screenWidthDp, settings.screenWidthDp);
return false;
}
if (settings.screenHeightDp != 0 && screenHeightDp != 0
- && screenHeightDp > settings.screenHeightDp) {
+ && screenHeightDp > settings.screenHeightDp) {
//LOGI("Filtering out height %d in requested %d", screenHeightDp, settings.screenHeightDp);
return false;
}
@@ -1531,11 +1565,11 @@ struct ResTable_config
}
if (screenSize != 0) {
if (settings.screenWidth != 0 && screenWidth != 0
- && screenWidth != settings.screenWidth) {
+ && screenWidth > settings.screenWidth) {
return false;
}
if (settings.screenHeight != 0 && screenHeight != 0
- && screenHeight != settings.screenHeight) {
+ && screenHeight > settings.screenHeight) {
return false;
}
}
@@ -1568,13 +1602,13 @@ struct ResTable_config
String8 toString() const {
char buf[200];
sprintf(buf, "imsi=%d/%d lang=%c%c reg=%c%c orient=%d touch=%d dens=%d "
- "kbd=%d nav=%d input=%d ssz=%dx%d %ddp x %ddp sz=%d long=%d "
+ "kbd=%d nav=%d input=%d ssz=%dx%d sw%ddp w%ddp h%ddp sz=%d long=%d "
"ui=%d night=%d vers=%d.%d",
mcc, mnc,
language[0] ? language[0] : '-', language[1] ? language[1] : '-',
country[0] ? country[0] : '-', country[1] ? country[1] : '-',
orientation, touchscreen, density, keyboard, navigation, inputFlags,
- screenWidth, screenHeight, screenWidthDp, screenHeightDp,
+ screenWidth, screenHeight, smallestScreenWidthDp, screenWidthDp, screenHeightDp,
screenLayout&MASK_SCREENSIZE, screenLayout&MASK_SCREENLONG,
uiMode&MASK_UI_MODE_TYPE, uiMode&MASK_UI_MODE_NIGHT,
sdkVersion, minorVersion);
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index 784c9d2..4a6a3db 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -2588,7 +2588,7 @@ void ResTable::setParameters(const ResTable_config* params)
{
mLock.lock();
TABLE_GETENTRY(LOGI("Setting parameters: imsi:%d/%d lang:%c%c cnt:%c%c "
- "orien:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d %ddp x %ddp\n",
+ "orien:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d sw%ddp w%ddp h%ddp\n",
params->mcc, params->mnc,
params->language[0] ? params->language[0] : '-',
params->language[1] ? params->language[1] : '-',
@@ -2602,6 +2602,7 @@ void ResTable::setParameters(const ResTable_config* params)
params->navigation,
params->screenWidth,
params->screenHeight,
+ params->smallestScreenWidthDp,
params->screenWidthDp,
params->screenHeightDp));
mParams = *params;
@@ -3927,7 +3928,7 @@ ssize_t ResTable::getEntry(
TABLE_GETENTRY(LOGI("Match entry 0x%x in type 0x%x (sz 0x%x): imsi:%d/%d=%d/%d "
"lang:%c%c=%c%c cnt:%c%c=%c%c orien:%d=%d touch:%d=%d "
"density:%d=%d key:%d=%d inp:%d=%d nav:%d=%d w:%d=%d h:%d=%d "
- "wdp:%d=%d hdp:%d=%d\n",
+ "swdp:%d=%d wdp:%d=%d hdp:%d=%d\n",
entryIndex, typeIndex+1, dtohl(thisType->config.size),
thisConfig.mcc, thisConfig.mnc,
config ? config->mcc : 0, config ? config->mnc : 0,
@@ -3955,6 +3956,8 @@ ssize_t ResTable::getEntry(
config ? config->screenWidth : 0,
thisConfig.screenHeight,
config ? config->screenHeight : 0,
+ thisConfig.smallestScreenWidthDp,
+ config ? config->smallestScreenWidthDp : 0,
thisConfig.screenWidthDp,
config ? config->screenWidthDp : 0,
thisConfig.screenHeightDp,
@@ -4244,7 +4247,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg,
thisConfig.copyFromDtoH(type->config);
LOGI("Adding config to type %d: imsi:%d/%d lang:%c%c cnt:%c%c "
"orien:%d touch:%d density:%d key:%d inp:%d nav:%d w:%d h:%d "
- "wdp:%d hdp:%d\n",
+ "swdp:%d wdp:%d hdp:%d\n",
type->id,
thisConfig.mcc, thisConfig.mnc,
thisConfig.language[0] ? thisConfig.language[0] : '-',
@@ -4259,6 +4262,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg,
thisConfig.navigation,
thisConfig.screenWidth,
thisConfig.screenHeight,
+ thisConfig.smallestScreenWidthDp,
thisConfig.screenWidthDp,
thisConfig.screenHeightDp));
t->configs.add(type);
@@ -4753,6 +4757,9 @@ void ResTable::print(bool inclValues) const
if (type->config.screenHeight != 0) {
printf(" h=%d", dtohs(type->config.screenHeight));
}
+ if (type->config.smallestScreenWidthDp != 0) {
+ printf(" swdp=%d", dtohs(type->config.smallestScreenWidthDp));
+ }
if (type->config.screenWidthDp != 0) {
printf(" wdp=%d", dtohs(type->config.screenWidthDp));
}
diff --git a/native/android/configuration.cpp b/native/android/configuration.cpp
index d76164f..687924b 100644
--- a/native/android/configuration.cpp
+++ b/native/android/configuration.cpp
@@ -111,6 +111,18 @@ int32_t AConfiguration_getUiModeNight(AConfiguration* config) {
}
+int32_t AConfiguration_getScreenWidthDp(AConfiguration* config) {
+ return config->screenWidthDp;
+}
+
+int32_t AConfiguration_getScreenHeightDp(AConfiguration* config) {
+ return config->screenHeightDp;
+}
+
+int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config) {
+ return config->smallestScreenWidthDp;
+}
+
// ----------------------------------------------------------------------
void AConfiguration_setMcc(AConfiguration* config, int32_t mcc) {
@@ -186,6 +198,18 @@ void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight)
}
+void AConfiguration_setScreenWidthDp(AConfiguration* config, int32_t value) {
+ config->screenWidthDp = value;
+}
+
+void AConfiguration_setScreenHeightDp(AConfiguration* config, int32_t value) {
+ config->screenHeightDp = value;
+}
+
+void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value) {
+ config->smallestScreenWidthDp = value;
+}
+
// ----------------------------------------------------------------------
int32_t AConfiguration_diff(AConfiguration* config1, AConfiguration* config2) {
diff --git a/native/include/android/configuration.h b/native/include/android/configuration.h
index 99e8f97..91533c8 100644
--- a/native/include/android/configuration.h
+++ b/native/include/android/configuration.h
@@ -82,6 +82,12 @@ enum {
ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1,
ACONFIGURATION_UI_MODE_NIGHT_YES = 0x2,
+ ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0x0000,
+
+ ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0x0000,
+
+ ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000,
+
ACONFIGURATION_MCC = 0x0001,
ACONFIGURATION_MNC = 0x0002,
ACONFIGURATION_LOCALE = 0x0004,
@@ -95,6 +101,7 @@ enum {
ACONFIGURATION_VERSION = 0x0400,
ACONFIGURATION_SCREEN_LAYOUT = 0x0800,
ACONFIGURATION_UI_MODE = 0x1000,
+ ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000,
};
/**
@@ -286,6 +293,39 @@ int32_t AConfiguration_getUiModeNight(AConfiguration* config);
void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight);
/**
+ * Return the current configuration screen width in dp units, or
+ * ACONFIGURATION_SCREEN_WIDTH_DP_ANY if not set.
+ */
+int32_t AConfiguration_getScreenWidthDp(AConfiguration* config);
+
+/**
+ * Set the configuration's current screen width in dp units.
+ */
+void AConfiguration_setScreenWidthDp(AConfiguration* config, int32_t value);
+
+/**
+ * Return the current configuration screen height in dp units, or
+ * ACONFIGURATION_SCREEN_HEIGHT_DP_ANY if not set.
+ */
+int32_t AConfiguration_getScreenHeightDp(AConfiguration* config);
+
+/**
+ * Set the configuration's current screen width in dp units.
+ */
+void AConfiguration_setScreenHeightDp(AConfiguration* config, int32_t value);
+
+/**
+ * Return the configuration's smallest screen width in dp units, or
+ * ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY if not set.
+ */
+int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config);
+
+/**
+ * Set the configuration's smallest screen width in dp units.
+ */
+void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value);
+
+/**
* Perform a diff between two configurations. Returns a bit mask of
* ACONFIGURATION_* constants, each bit set meaning that configuration element
* is different between them.
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 03afc82..e5abeac 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -230,7 +230,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
boolean mSafeMode;
WindowState mStatusBar = null;
boolean mStatusBarCanHide;
- int mScreenMarginBottom;
+ int mStatusBarHeight;
final ArrayList<WindowState> mStatusBarPanels = new ArrayList<WindowState>();
WindowState mNavigationBar = null;
@@ -1071,12 +1071,20 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return STATUS_BAR_LAYER;
}
- public int getNonDecorDisplayWidth(int fullWidth) {
+ public int getNonDecorDisplayWidth(int rotation, int fullWidth) {
return fullWidth;
}
- public int getNonDecorDisplayHeight(int fullHeight) {
- return fullHeight - mScreenMarginBottom;
+ public int getNonDecorDisplayHeight(int rotation, int fullHeight) {
+ return mStatusBarCanHide ? fullHeight : (fullHeight - mStatusBarHeight);
+ }
+
+ public int getConfigDisplayWidth(int rotation, int fullWidth) {
+ return fullWidth;
+ }
+
+ public int getConfigDisplayHeight(int rotation, int fullHeight) {
+ return fullHeight - mStatusBarHeight;
}
public boolean doesForceHide(WindowState win, WindowManager.LayoutParams attrs) {
@@ -1228,8 +1236,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// The Configuration will be stable by now, so we can load this
mStatusBarCanHide = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_statusBarCanHide);
- mScreenMarginBottom = mContext.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.screen_margin_bottom);
+ mStatusBarHeight = mContext.getResources().getDimensionPixelSize(
+ com.android.internal.R.dimen.status_bar_height);
break;
case TYPE_NAVIGATION_BAR:
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 9890bec..92c490e 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -4783,8 +4783,8 @@ public class WindowManagerService extends IWindowManager.Stub
synchronized(mWindowMap) {
long ident = Binder.clearCallingIdentity();
- dw = mPolicy.getNonDecorDisplayWidth(mCurDisplayWidth);
- dh = mPolicy.getNonDecorDisplayHeight(mCurDisplayHeight);
+ dw = mPolicy.getNonDecorDisplayWidth(mRotation, mCurDisplayWidth);
+ dh = mPolicy.getNonDecorDisplayHeight(mRotation, mCurDisplayHeight);
int aboveAppLayer = mPolicy.windowTypeToLayerLw(
WindowManager.LayoutParams.TYPE_APPLICATION) * TYPE_LAYER_MULTIPLIER
@@ -5501,6 +5501,14 @@ public class WindowManagerService extends IWindowManager.Stub
return config;
}
+ private int reduceConfigWidthSize(int curSize, int rotation, float density, int dw) {
+ int size = (int)(mPolicy.getConfigDisplayWidth(rotation, dw) / density);
+ if (size < curSize) {
+ curSize = size;
+ }
+ return curSize;
+ }
+
boolean computeNewConfigurationLocked(Configuration config) {
if (mDisplay == null) {
return false;
@@ -5551,14 +5559,37 @@ public class WindowManagerService extends IWindowManager.Stub
// Override display width and height with what we are computing,
// to be sure they remain consistent.
- dm.widthPixels = dm.realWidthPixels = mPolicy.getNonDecorDisplayWidth(dw);
- dm.heightPixels = dm.realHeightPixels = mPolicy.getNonDecorDisplayHeight(dh);
+ dm.widthPixels = dm.realWidthPixels = mPolicy.getNonDecorDisplayWidth(
+ mRotation, dw);
+ dm.heightPixels = dm.realHeightPixels = mPolicy.getNonDecorDisplayHeight(
+ mRotation, dh);
mCompatibleScreenScale = CompatibilityInfo.updateCompatibleScreenFrame(
dm, mCompatibleScreenFrame, null);
- config.screenWidthDp = (int)(dm.widthPixels / dm.density);
- config.screenHeightDp = (int)(dm.heightPixels / dm.density);
+ config.screenWidthDp = (int)(mPolicy.getConfigDisplayWidth(mRotation, dw) / dm.density);
+ config.screenHeightDp = (int)(mPolicy.getConfigDisplayHeight(mRotation, dh) / dm.density);
+
+ // We need to determine the smallest width that will occur under normal
+ // operation. To this, start with the base screen size and compute the
+ // width under the different possible rotations. We need to un-rotate
+ // the current screen dimensions before doing this.
+ int unrotDw, unrotDh;
+ if (rotated) {
+ unrotDw = dh;
+ unrotDh = dw;
+ } else {
+ unrotDw = dw;
+ unrotDh = dh;
+ }
+ config.smallestScreenWidthDp = reduceConfigWidthSize(unrotDw,
+ Surface.ROTATION_0, dm.density, unrotDw);
+ config.smallestScreenWidthDp = reduceConfigWidthSize(config.smallestScreenWidthDp,
+ Surface.ROTATION_90, dm.density, unrotDh);
+ config.smallestScreenWidthDp = reduceConfigWidthSize(config.smallestScreenWidthDp,
+ Surface.ROTATION_180, dm.density, unrotDw);
+ config.smallestScreenWidthDp = reduceConfigWidthSize(config.smallestScreenWidthDp,
+ Surface.ROTATION_270, dm.density, unrotDh);
// Compute the screen layout size class.
int screenLayout;
@@ -6810,9 +6841,6 @@ public class WindowManagerService extends IWindowManager.Stub
final int dw = mCurDisplayWidth;
final int dh = mCurDisplayHeight;
- final int innerDw = mPolicy.getNonDecorDisplayWidth(dw);
- final int innerDh = mPolicy.getNonDecorDisplayHeight(dh);
-
final int N = mWindows.size();
int i;
@@ -6933,8 +6961,8 @@ public class WindowManagerService extends IWindowManager.Stub
final int dw = mCurDisplayWidth;
final int dh = mCurDisplayHeight;
- final int innerDw = mPolicy.getNonDecorDisplayWidth(dw);
- final int innerDh = mPolicy.getNonDecorDisplayHeight(dh);
+ final int innerDw = mPolicy.getNonDecorDisplayWidth(mRotation, dw);
+ final int innerDh = mPolicy.getNonDecorDisplayHeight(mRotation, dh);
int i;
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index a2271d9..75535f8 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -142,17 +142,10 @@ AaptGroupEntry::parseNamePart(const String8& part, int* axis, uint32_t* value)
return 0;
}
- // screen layout size
- if (getScreenLayoutSizeName(part.string(), &config)) {
- *axis = AXIS_SCREENLAYOUTSIZE;
- *value = (config.screenLayout&ResTable_config::MASK_SCREENSIZE);
- return 0;
- }
-
- // screen layout long
- if (getScreenLayoutLongName(part.string(), &config)) {
- *axis = AXIS_SCREENLAYOUTLONG;
- *value = (config.screenLayout&ResTable_config::MASK_SCREENLONG);
+ // smallest screen dp width
+ if (getSmallestScreenWidthDpName(part.string(), &config)) {
+ *axis = AXIS_SMALLESTSCREENWIDTHDP;
+ *value = config.smallestScreenWidthDp;
return 0;
}
@@ -170,6 +163,20 @@ AaptGroupEntry::parseNamePart(const String8& part, int* axis, uint32_t* value)
return 0;
}
+ // screen layout size
+ if (getScreenLayoutSizeName(part.string(), &config)) {
+ *axis = AXIS_SCREENLAYOUTSIZE;
+ *value = (config.screenLayout&ResTable_config::MASK_SCREENSIZE);
+ return 0;
+ }
+
+ // screen layout long
+ if (getScreenLayoutLongName(part.string(), &config)) {
+ *axis = AXIS_SCREENLAYOUTLONG;
+ *value = (config.screenLayout&ResTable_config::MASK_SCREENLONG);
+ return 0;
+ }
+
// orientation
if (getOrientationName(part.string(), &config)) {
*axis = AXIS_ORIENTATION;
@@ -257,7 +264,7 @@ AaptGroupEntry::initFromDirName(const char* dir, String8* resType)
String8 mcc, mnc, loc, layoutsize, layoutlong, orient, den;
String8 touch, key, keysHidden, nav, navHidden, size, vers;
- String8 uiModeType, uiModeNight, widthdp, heightdp;
+ String8 uiModeType, uiModeNight, smallestwidthdp, widthdp, heightdp;
const char *p = dir;
const char *q;
@@ -344,8 +351,8 @@ AaptGroupEntry::initFromDirName(const char* dir, String8* resType)
//printf("not region: %s\n", part.string());
}
- if (getScreenLayoutSizeName(part.string())) {
- layoutsize = part;
+ if (getSmallestScreenWidthDpName(part.string())) {
+ smallestwidthdp = part;
index++;
if (index == N) {
@@ -353,11 +360,11 @@ AaptGroupEntry::initFromDirName(const char* dir, String8* resType)
}
part = parts[index];
} else {
- //printf("not screen layout size: %s\n", part.string());
+ //printf("not smallest screen width dp: %s\n", part.string());
}
- if (getScreenLayoutLongName(part.string())) {
- layoutlong = part;
+ if (getScreenWidthDpName(part.string())) {
+ widthdp = part;
index++;
if (index == N) {
@@ -365,11 +372,11 @@ AaptGroupEntry::initFromDirName(const char* dir, String8* resType)
}
part = parts[index];
} else {
- //printf("not screen layout long: %s\n", part.string());
+ //printf("not screen width dp: %s\n", part.string());
}
- if (getScreenWidthDpName(part.string())) {
- widthdp = part;
+ if (getScreenHeightDpName(part.string())) {
+ heightdp = part;
index++;
if (index == N) {
@@ -377,11 +384,11 @@ AaptGroupEntry::initFromDirName(const char* dir, String8* resType)
}
part = parts[index];
} else {
- //printf("not screen width dp: %s\n", part.string());
+ //printf("not screen height dp: %s\n", part.string());
}
- if (getScreenHeightDpName(part.string())) {
- heightdp = part;
+ if (getScreenLayoutSizeName(part.string())) {
+ layoutsize = part;
index++;
if (index == N) {
@@ -389,7 +396,19 @@ AaptGroupEntry::initFromDirName(const char* dir, String8* resType)
}
part = parts[index];
} else {
- //printf("not screen height dp: %s\n", part.string());
+ //printf("not screen layout size: %s\n", part.string());
+ }
+
+ if (getScreenLayoutLongName(part.string())) {
+ layoutlong = part;
+
+ index++;
+ if (index == N) {
+ goto success;
+ }
+ part = parts[index];
+ } else {
+ //printf("not screen layout long: %s\n", part.string());
}
// orientation
@@ -541,6 +560,7 @@ success:
this->locale = loc;
this->screenLayoutSize = layoutsize;
this->screenLayoutLong = layoutlong;
+ this->smallestScreenWidthDp = smallestwidthdp;
this->screenWidthDp = widthdp;
this->screenHeightDp = heightdp;
this->orientation = orient;
@@ -570,14 +590,16 @@ AaptGroupEntry::toString() const
s += ",";
s += this->locale;
s += ",";
- s += screenLayoutSize;
- s += ",";
- s += screenLayoutLong;
+ s += smallestScreenWidthDp;
s += ",";
s += screenWidthDp;
s += ",";
s += screenHeightDp;
s += ",";
+ s += screenLayoutSize;
+ s += ",";
+ s += screenLayoutLong;
+ s += ",";
s += this->orientation;
s += ",";
s += uiModeType;
@@ -618,13 +640,9 @@ AaptGroupEntry::toDirName(const String8& resType) const
s += "-";
s += locale;
}
- if (this->screenLayoutSize != "") {
+ if (this->smallestScreenWidthDp != "") {
s += "-";
- s += screenLayoutSize;
- }
- if (this->screenLayoutLong != "") {
- s += "-";
- s += screenLayoutLong;
+ s += smallestScreenWidthDp;
}
if (this->screenWidthDp != "") {
s += "-";
@@ -634,6 +652,14 @@ AaptGroupEntry::toDirName(const String8& resType) const
s += "-";
s += screenHeightDp;
}
+ if (this->screenLayoutSize != "") {
+ s += "-";
+ s += screenLayoutSize;
+ }
+ if (this->screenLayoutLong != "") {
+ s += "-";
+ s += screenLayoutLong;
+ }
if (this->orientation != "") {
s += "-";
s += orientation;
@@ -1126,6 +1152,31 @@ bool AaptGroupEntry::getScreenSizeName(const char* name, ResTable_config* out)
return true;
}
+bool AaptGroupEntry::getSmallestScreenWidthDpName(const char* name, ResTable_config* out)
+{
+ if (strcmp(name, kWildcardName) == 0) {
+ if (out) {
+ out->smallestScreenWidthDp = out->SCREENWIDTH_ANY;
+ }
+ return true;
+ }
+
+ if (*name != 's') return false;
+ name++;
+ if (*name != 'w') return false;
+ name++;
+ const char* x = name;
+ while (*x >= '0' && *x <= '9') x++;
+ if (x == name || x[0] != 'd' || x[1] != 'p' || x[2] != 0) return false;
+ String8 xName(name, x-name);
+
+ if (out) {
+ out->smallestScreenWidthDp = (uint16_t)atoi(xName.string());
+ }
+
+ return true;
+}
+
bool AaptGroupEntry::getScreenWidthDpName(const char* name, ResTable_config* out)
{
if (strcmp(name, kWildcardName) == 0) {
@@ -1206,10 +1257,11 @@ int AaptGroupEntry::compare(const AaptGroupEntry& o) const
if (v == 0) v = mnc.compare(o.mnc);
if (v == 0) v = locale.compare(o.locale);
if (v == 0) v = vendor.compare(o.vendor);
- if (v == 0) v = screenLayoutSize.compare(o.screenLayoutSize);
- if (v == 0) v = screenLayoutLong.compare(o.screenLayoutLong);
+ if (v == 0) v = smallestScreenWidthDp.compare(o.smallestScreenWidthDp);
if (v == 0) v = screenWidthDp.compare(o.screenWidthDp);
if (v == 0) v = screenHeightDp.compare(o.screenHeightDp);
+ if (v == 0) v = screenLayoutSize.compare(o.screenLayoutSize);
+ if (v == 0) v = screenLayoutLong.compare(o.screenLayoutLong);
if (v == 0) v = orientation.compare(o.orientation);
if (v == 0) v = uiModeType.compare(o.uiModeType);
if (v == 0) v = uiModeNight.compare(o.uiModeNight);
@@ -1231,10 +1283,11 @@ ResTable_config AaptGroupEntry::toParams() const
getMccName(mcc.string(), &params);
getMncName(mnc.string(), &params);
getLocaleName(locale.string(), &params);
- getScreenLayoutSizeName(screenLayoutSize.string(), &params);
- getScreenLayoutLongName(screenLayoutLong.string(), &params);
+ getSmallestScreenWidthDpName(smallestScreenWidthDp.string(), &params);
getScreenWidthDpName(screenWidthDp.string(), &params);
getScreenHeightDpName(screenHeightDp.string(), &params);
+ getScreenLayoutSizeName(screenLayoutSize.string(), &params);
+ getScreenLayoutLongName(screenLayoutLong.string(), &params);
getOrientationName(orientation.string(), &params);
getUiModeTypeName(uiModeType.string(), &params);
getUiModeNightName(uiModeNight.string(), &params);
@@ -1249,9 +1302,10 @@ ResTable_config AaptGroupEntry::toParams() const
// Fix up version number based on specified parameters.
int minSdk = 0;
- if (params.screenWidthDp != ResTable_config::SCREENWIDTH_ANY
+ if (params.smallestScreenWidthDp != ResTable_config::SCREENWIDTH_ANY
+ || params.screenWidthDp != ResTable_config::SCREENWIDTH_ANY
|| params.screenHeightDp != ResTable_config::SCREENHEIGHT_ANY) {
- minSdk = SDK_ICS;
+ minSdk = SDK_HONEYCOMB_MR2;
} else if ((params.uiMode&ResTable_config::MASK_UI_MODE_TYPE)
!= ResTable_config::UI_MODE_TYPE_ANY
|| (params.uiMode&ResTable_config::MASK_UI_MODE_NIGHT)
diff --git a/tools/aapt/AaptAssets.h b/tools/aapt/AaptAssets.h
index e5afd1b..65743d8 100644
--- a/tools/aapt/AaptAssets.h
+++ b/tools/aapt/AaptAssets.h
@@ -42,6 +42,7 @@ enum {
AXIS_NAVHIDDEN,
AXIS_NAVIGATION,
AXIS_SCREENSIZE,
+ AXIS_SMALLESTSCREENWIDTHDP,
AXIS_SCREENWIDTHDP,
AXIS_SCREENHEIGHTDP,
AXIS_VERSION
@@ -54,7 +55,7 @@ enum {
SDK_ECLAIR_0_1 = 6,
SDK_MR1 = 7,
SDK_FROYO = 8,
- SDK_ICS = 13,
+ SDK_HONEYCOMB_MR2 = 13,
};
/**
@@ -72,10 +73,11 @@ public:
String8 mnc;
String8 locale;
String8 vendor;
- String8 screenLayoutSize;
- String8 screenLayoutLong;
+ String8 smallestScreenWidthDp;
String8 screenWidthDp;
String8 screenHeightDp;
+ String8 screenLayoutSize;
+ String8 screenLayoutLong;
String8 orientation;
String8 uiModeType;
String8 uiModeNight;
@@ -107,6 +109,7 @@ public:
static bool getNavigationName(const char* name, ResTable_config* out = NULL);
static bool getNavHiddenName(const char* name, ResTable_config* out = NULL);
static bool getScreenSizeName(const char* name, ResTable_config* out = NULL);
+ static bool getSmallestScreenWidthDpName(const char* name, ResTable_config* out = NULL);
static bool getScreenWidthDpName(const char* name, ResTable_config* out = NULL);
static bool getScreenHeightDpName(const char* name, ResTable_config* out = NULL);
static bool getVersionName(const char* name, ResTable_config* out = NULL);
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index a88476e..5c5b4fd 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -2607,6 +2607,9 @@ ResourceFilter::match(const ResTable_config& config) const
if (!match(AXIS_SCREENSIZE, config.screenSize)) {
return false;
}
+ if (!match(AXIS_SMALLESTSCREENWIDTHDP, config.smallestScreenWidthDp)) {
+ return false;
+ }
if (!match(AXIS_SCREENWIDTHDP, config.screenWidthDp)) {
return false;
}
@@ -2809,7 +2812,8 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest)
ConfigDescription config = t->getUniqueConfigs().itemAt(ci);
NOISY(printf("Writing config %d config: imsi:%d/%d lang:%c%c cnt:%c%c "
- "orien:%d ui:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d %ddp x %ddp\n",
+ "orien:%d ui:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d "
+ "sw%ddp w%ddp h%ddp\n",
ti+1,
config.mcc, config.mnc,
config.language[0] ? config.language[0] : '-',
@@ -2825,6 +2829,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest)
config.navigation,
config.screenWidth,
config.screenHeight,
+ config.smallestScreenWidthDp,
config.screenWidthDp,
config.screenHeightDp));
@@ -2849,7 +2854,8 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest)
tHeader->entriesStart = htodl(typeSize);
tHeader->config = config;
NOISY(printf("Writing type %d config: imsi:%d/%d lang:%c%c cnt:%c%c "
- "orien:%d ui:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d %ddp x %ddp\n",
+ "orien:%d ui:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d "
+ "sw%ddp w%ddp h%ddp\n",
ti+1,
tHeader->config.mcc, tHeader->config.mnc,
tHeader->config.language[0] ? tHeader->config.language[0] : '-',
@@ -2865,6 +2871,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest)
tHeader->config.navigation,
tHeader->config.screenWidth,
tHeader->config.screenHeight,
+ tHeader->config.smallestScreenWidthDp,
tHeader->config.screenWidthDp,
tHeader->config.screenHeightDp));
tHeader->config.swapHtoD();
@@ -3448,7 +3455,8 @@ sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry,
if (e == NULL) {
if (config != NULL) {
NOISY(printf("New entry at %s:%d: imsi:%d/%d lang:%c%c cnt:%c%c "
- "orien:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d %ddp x %ddp\n",
+ "orien:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d "
+ "sw%ddp w%ddp h%ddp\n",
sourcePos.file.string(), sourcePos.line,
config->mcc, config->mnc,
config->language[0] ? config->language[0] : '-',
@@ -3463,6 +3471,7 @@ sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry,
config->navigation,
config->screenWidth,
config->screenHeight,
+ config->smallestScreenWidthDp,
config->screenWidthDp,
config->screenHeightDp));
} else {