Implement issue #3116702: New manifest tags for supported screen sizes

Merged from GB.

Change-Id: I94730b54bcacd083f77708e84c35f4932a7b9d2e
This commit is contained in:
Dianne Hackborn
2010-10-21 15:32:06 -07:00
parent e6634981f1
commit a0b46c9c44
7 changed files with 221 additions and 92 deletions

View File

@@ -1773,7 +1773,7 @@
type="int"
transient="false"
volatile="false"
value="16843511"
value="16843513"
static="true"
final="true"
deprecated="not deprecated"
@@ -1784,7 +1784,7 @@
type="int"
transient="false"
volatile="false"
value="16843480"
value="16843482"
static="true"
final="true"
deprecated="not deprecated"
@@ -1795,7 +1795,7 @@
type="int"
transient="false"
volatile="false"
value="16843520"
value="16843522"
static="true"
final="true"
deprecated="not deprecated"
@@ -1806,7 +1806,7 @@
type="int"
transient="false"
volatile="false"
value="16843519"
value="16843521"
static="true"
final="true"
deprecated="not deprecated"
@@ -1817,7 +1817,7 @@
type="int"
transient="false"
volatile="false"
value="16843521"
value="16843523"
static="true"
final="true"
deprecated="not deprecated"
@@ -1828,7 +1828,7 @@
type="int"
transient="false"
volatile="false"
value="16843490"
value="16843492"
static="true"
final="true"
deprecated="not deprecated"
@@ -1839,7 +1839,7 @@
type="int"
transient="false"
volatile="false"
value="16843489"
value="16843491"
static="true"
final="true"
deprecated="not deprecated"
@@ -1850,7 +1850,7 @@
type="int"
transient="false"
volatile="false"
value="16843527"
value="16843529"
static="true"
final="true"
deprecated="not deprecated"
@@ -1861,7 +1861,7 @@
type="int"
transient="false"
volatile="false"
value="16843493"
value="16843495"
static="true"
final="true"
deprecated="not deprecated"
@@ -1872,7 +1872,7 @@
type="int"
transient="false"
volatile="false"
value="16843523"
value="16843525"
static="true"
final="true"
deprecated="not deprecated"
@@ -1883,7 +1883,7 @@
type="int"
transient="false"
volatile="false"
value="16843494"
value="16843496"
static="true"
final="true"
deprecated="not deprecated"
@@ -1894,7 +1894,7 @@
type="int"
transient="false"
volatile="false"
value="16843547"
value="16843549"
static="true"
final="true"
deprecated="not deprecated"
@@ -1905,7 +1905,7 @@
type="int"
transient="false"
volatile="false"
value="16843546"
value="16843548"
static="true"
final="true"
deprecated="not deprecated"
@@ -1916,7 +1916,7 @@
type="int"
transient="false"
volatile="false"
value="16843548"
value="16843550"
static="true"
final="true"
deprecated="not deprecated"
@@ -1927,7 +1927,7 @@
type="int"
transient="false"
volatile="false"
value="16843522"
value="16843524"
static="true"
final="true"
deprecated="not deprecated"
@@ -1938,7 +1938,7 @@
type="int"
transient="false"
volatile="false"
value="16843528"
value="16843530"
static="true"
final="true"
deprecated="not deprecated"
@@ -1949,7 +1949,7 @@
type="int"
transient="false"
volatile="false"
value="16843529"
value="16843531"
static="true"
final="true"
deprecated="not deprecated"
@@ -2004,7 +2004,7 @@
type="int"
transient="false"
volatile="false"
value="16843466"
value="16843468"
static="true"
final="true"
deprecated="not deprecated"
@@ -2037,7 +2037,7 @@
type="int"
transient="false"
volatile="false"
value="16843545"
value="16843547"
static="true"
final="true"
deprecated="not deprecated"
@@ -2059,7 +2059,7 @@
type="int"
transient="false"
volatile="false"
value="16843541"
value="16843543"
static="true"
final="true"
deprecated="not deprecated"
@@ -2070,7 +2070,7 @@
type="int"
transient="false"
volatile="false"
value="16843478"
value="16843480"
static="true"
final="true"
deprecated="not deprecated"
@@ -2169,7 +2169,7 @@
type="int"
transient="false"
volatile="false"
value="16843487"
value="16843489"
static="true"
final="true"
deprecated="not deprecated"
@@ -2180,7 +2180,7 @@
type="int"
transient="false"
volatile="false"
value="16843518"
value="16843520"
static="true"
final="true"
deprecated="not deprecated"
@@ -2279,7 +2279,7 @@
type="int"
transient="false"
volatile="false"
value="16843472"
value="16843474"
static="true"
final="true"
deprecated="not deprecated"
@@ -2521,7 +2521,7 @@
type="int"
transient="false"
volatile="false"
value="16843536"
value="16843538"
static="true"
final="true"
deprecated="not deprecated"
@@ -2532,7 +2532,7 @@
type="int"
transient="false"
volatile="false"
value="16843535"
value="16843537"
static="true"
final="true"
deprecated="not deprecated"
@@ -2565,7 +2565,7 @@
type="int"
transient="false"
volatile="false"
value="16843544"
value="16843546"
static="true"
final="true"
deprecated="not deprecated"
@@ -2983,7 +2983,7 @@
type="int"
transient="false"
volatile="false"
value="16843475"
value="16843477"
static="true"
final="true"
deprecated="not deprecated"
@@ -3137,7 +3137,7 @@
type="int"
transient="false"
volatile="false"
value="16843484"
value="16843486"
static="true"
final="true"
deprecated="not deprecated"
@@ -3346,7 +3346,7 @@
type="int"
transient="false"
volatile="false"
value="16843540"
value="16843542"
static="true"
final="true"
deprecated="not deprecated"
@@ -3423,7 +3423,7 @@
type="int"
transient="false"
volatile="false"
value="16843482"
value="16843484"
static="true"
final="true"
deprecated="not deprecated"
@@ -3467,7 +3467,7 @@
type="int"
transient="false"
volatile="false"
value="16843543"
value="16843545"
static="true"
final="true"
deprecated="not deprecated"
@@ -3643,7 +3643,7 @@
type="int"
transient="false"
volatile="false"
value="16843488"
value="16843490"
static="true"
final="true"
deprecated="not deprecated"
@@ -4215,7 +4215,7 @@
type="int"
transient="false"
volatile="false"
value="16843501"
value="16843503"
static="true"
final="true"
deprecated="not deprecated"
@@ -4226,7 +4226,7 @@
type="int"
transient="false"
volatile="false"
value="16843505"
value="16843507"
static="true"
final="true"
deprecated="not deprecated"
@@ -4237,7 +4237,7 @@
type="int"
transient="false"
volatile="false"
value="16843506"
value="16843508"
static="true"
final="true"
deprecated="not deprecated"
@@ -4248,7 +4248,7 @@
type="int"
transient="false"
volatile="false"
value="16843507"
value="16843509"
static="true"
final="true"
deprecated="not deprecated"
@@ -4259,7 +4259,7 @@
type="int"
transient="false"
volatile="false"
value="16843508"
value="16843510"
static="true"
final="true"
deprecated="not deprecated"
@@ -4270,7 +4270,7 @@
type="int"
transient="false"
volatile="false"
value="16843503"
value="16843505"
static="true"
final="true"
deprecated="not deprecated"
@@ -4281,7 +4281,7 @@
type="int"
transient="false"
volatile="false"
value="16843504"
value="16843506"
static="true"
final="true"
deprecated="not deprecated"
@@ -4292,7 +4292,7 @@
type="int"
transient="false"
volatile="false"
value="16843509"
value="16843511"
static="true"
final="true"
deprecated="not deprecated"
@@ -4303,7 +4303,7 @@
type="int"
transient="false"
volatile="false"
value="16843510"
value="16843512"
static="true"
final="true"
deprecated="not deprecated"
@@ -4325,7 +4325,7 @@
type="int"
transient="false"
volatile="false"
value="16843470"
value="16843472"
static="true"
final="true"
deprecated="not deprecated"
@@ -4358,7 +4358,7 @@
type="int"
transient="false"
volatile="false"
value="16843473"
value="16843475"
static="true"
final="true"
deprecated="not deprecated"
@@ -4655,7 +4655,7 @@
type="int"
transient="false"
volatile="false"
value="16843485"
value="16843487"
static="true"
final="true"
deprecated="not deprecated"
@@ -4787,7 +4787,7 @@
type="int"
transient="false"
volatile="false"
value="16843526"
value="16843528"
static="true"
final="true"
deprecated="not deprecated"
@@ -4908,7 +4908,7 @@
type="int"
transient="false"
volatile="false"
value="16843514"
value="16843516"
static="true"
final="true"
deprecated="not deprecated"
@@ -4919,7 +4919,7 @@
type="int"
transient="false"
volatile="false"
value="16843512"
value="16843514"
static="true"
final="true"
deprecated="not deprecated"
@@ -4930,7 +4930,7 @@
type="int"
transient="false"
volatile="false"
value="16843513"
value="16843515"
static="true"
final="true"
deprecated="not deprecated"
@@ -5953,7 +5953,7 @@
type="int"
transient="false"
volatile="false"
value="16843516"
value="16843518"
static="true"
final="true"
deprecated="not deprecated"
@@ -5997,7 +5997,7 @@
type="int"
transient="false"
volatile="false"
value="16843537"
value="16843539"
static="true"
final="true"
deprecated="not deprecated"
@@ -6008,7 +6008,7 @@
type="int"
transient="false"
volatile="false"
value="16843531"
value="16843533"
static="true"
final="true"
deprecated="not deprecated"
@@ -6096,7 +6096,7 @@
type="int"
transient="false"
volatile="false"
value="16843539"
value="16843541"
static="true"
final="true"
deprecated="not deprecated"
@@ -6261,7 +6261,7 @@
type="int"
transient="false"
volatile="false"
value="16843486"
value="16843488"
static="true"
final="true"
deprecated="not deprecated"
@@ -6404,7 +6404,7 @@
type="int"
transient="false"
volatile="false"
value="16843481"
value="16843483"
static="true"
final="true"
deprecated="not deprecated"
@@ -6580,7 +6580,7 @@
type="int"
transient="false"
volatile="false"
value="16843500"
value="16843502"
static="true"
final="true"
deprecated="not deprecated"
@@ -6910,7 +6910,7 @@
type="int"
transient="false"
volatile="false"
value="16843532"
value="16843534"
static="true"
final="true"
deprecated="not deprecated"
@@ -7009,7 +7009,7 @@
type="int"
transient="false"
volatile="false"
value="16843492"
value="16843494"
static="true"
final="true"
deprecated="not deprecated"
@@ -7174,7 +7174,7 @@
type="int"
transient="false"
volatile="false"
value="16843499"
value="16843501"
static="true"
final="true"
deprecated="not deprecated"
@@ -7621,6 +7621,17 @@
visibility="public"
>
</field>
<field name="screenDensity"
type="int"
transient="false"
volatile="false"
value="16843467"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="screenOrientation"
type="int"
transient="false"
@@ -7632,6 +7643,17 @@
visibility="public"
>
</field>
<field name="screenSize"
type="int"
transient="false"
volatile="false"
value="16843466"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="scrollHorizontally"
type="int"
transient="false"
@@ -7955,7 +7977,7 @@
type="int"
transient="false"
volatile="false"
value="16843467"
value="16843469"
static="true"
final="true"
deprecated="not deprecated"
@@ -8076,7 +8098,7 @@
type="int"
transient="false"
volatile="false"
value="16843491"
value="16843493"
static="true"
final="true"
deprecated="not deprecated"
@@ -8164,7 +8186,7 @@
type="int"
transient="false"
volatile="false"
value="16843468"
value="16843470"
static="true"
final="true"
deprecated="not deprecated"
@@ -8219,7 +8241,7 @@
type="int"
transient="false"
volatile="false"
value="16843517"
value="16843519"
static="true"
final="true"
deprecated="not deprecated"
@@ -8241,7 +8263,7 @@
type="int"
transient="false"
volatile="false"
value="16843515"
value="16843517"
static="true"
final="true"
deprecated="not deprecated"
@@ -8340,7 +8362,7 @@
type="int"
transient="false"
volatile="false"
value="16843530"
value="16843532"
static="true"
final="true"
deprecated="not deprecated"
@@ -8560,7 +8582,7 @@
type="int"
transient="false"
volatile="false"
value="16843483"
value="16843485"
static="true"
final="true"
deprecated="not deprecated"
@@ -8571,7 +8593,7 @@
type="int"
transient="false"
volatile="false"
value="16843525"
value="16843527"
static="true"
final="true"
deprecated="not deprecated"
@@ -8956,7 +8978,7 @@
type="int"
transient="false"
volatile="false"
value="16843533"
value="16843535"
static="true"
final="true"
deprecated="not deprecated"
@@ -9033,7 +9055,7 @@
type="int"
transient="false"
volatile="false"
value="16843534"
value="16843536"
static="true"
final="true"
deprecated="not deprecated"
@@ -9077,7 +9099,7 @@
type="int"
transient="false"
volatile="false"
value="16843538"
value="16843540"
static="true"
final="true"
deprecated="not deprecated"
@@ -9275,7 +9297,7 @@
type="int"
transient="false"
volatile="false"
value="16843542"
value="16843544"
static="true"
final="true"
deprecated="not deprecated"
@@ -9506,7 +9528,7 @@
type="int"
transient="false"
volatile="false"
value="16843524"
value="16843526"
static="true"
final="true"
deprecated="not deprecated"
@@ -9517,7 +9539,7 @@
type="int"
transient="false"
volatile="false"
value="16843471"
value="16843473"
static="true"
final="true"
deprecated="not deprecated"
@@ -9550,7 +9572,7 @@
type="int"
transient="false"
volatile="false"
value="16843474"
value="16843476"
static="true"
final="true"
deprecated="not deprecated"
@@ -9737,7 +9759,7 @@
type="int"
transient="false"
volatile="false"
value="16843469"
value="16843471"
static="true"
final="true"
deprecated="not deprecated"
@@ -9781,7 +9803,7 @@
type="int"
transient="false"
volatile="false"
value="16843496"
value="16843498"
static="true"
final="true"
deprecated="not deprecated"
@@ -9792,7 +9814,7 @@
type="int"
transient="false"
volatile="false"
value="16843497"
value="16843499"
static="true"
final="true"
deprecated="not deprecated"
@@ -9803,7 +9825,7 @@
type="int"
transient="false"
volatile="false"
value="16843498"
value="16843500"
static="true"
final="true"
deprecated="not deprecated"
@@ -10122,7 +10144,7 @@
type="int"
transient="false"
volatile="false"
value="16843479"
value="16843481"
static="true"
final="true"
deprecated="not deprecated"
@@ -10133,7 +10155,7 @@
type="int"
transient="false"
volatile="false"
value="16843502"
value="16843504"
static="true"
final="true"
deprecated="not deprecated"
@@ -10144,7 +10166,7 @@
type="int"
transient="false"
volatile="false"
value="16843495"
value="16843497"
static="true"
final="true"
deprecated="not deprecated"
@@ -10364,7 +10386,7 @@
type="int"
transient="false"
volatile="false"
value="16843477"
value="16843479"
static="true"
final="true"
deprecated="not deprecated"
@@ -10375,7 +10397,7 @@
type="int"
transient="false"
volatile="false"
value="16843476"
value="16843478"
static="true"
final="true"
deprecated="not deprecated"
@@ -186751,6 +186773,17 @@
visibility="public"
>
</field>
<field name="DENSITY_XHIGH"
type="int"
transient="false"
volatile="false"
value="320"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="density"
type="float"
transient="false"

View File

@@ -1076,6 +1076,16 @@ public class PackageParser {
XmlUtils.skipCurrentTag(parser);
} else if (tagName.equals("uses-gl-texture")) {
// Just skip this tag
XmlUtils.skipCurrentTag(parser);
continue;
} else if (tagName.equals("compatible-screens")) {
// Just skip this tag
XmlUtils.skipCurrentTag(parser);
continue;
} else if (tagName.equals("eat-comment")) {
// Just skip this tag
XmlUtils.skipCurrentTag(parser);

View File

@@ -44,6 +44,11 @@ public class DisplayMetrics {
*/
public static final int DENSITY_HIGH = 240;
/**
* Standard quantized DPI for extra-high-density screens.
*/
public static final int DENSITY_XHIGH = 320;
/**
* The reference density used throughout the system.
*/

View File

@@ -1441,6 +1441,38 @@
<attr name="functionalTest" />
</declare-styleable>
<!-- Attributes that can be supplied in an AndroidManifest.xml
<code>screen</code> tag, a child of <code>compatible-screens</code>,
which is itseld a child of the root
{@link #AndroidManifest manifest} tag. -->
<declare-styleable name="AndroidManifestCompatibleScreensScreen">
<!-- Specifies a compatible screen size, as per the device
configuration screen size bins. -->
<attr name="screenSize">
<!-- A small screen configuration, at least 240x320db. -->
<enum name="small" value="200" />
<!-- A normal screen configuration, at least 320x480db. -->
<enum name="normal" value="300" />
<!-- A large screen configuration, at least 400x530db. -->
<enum name="large" value="400" />
<!-- An extra large screen configuration, at least 600x800db. -->
<enum name="xlarge" value="500" />
</attr>
<!-- Specifies a compatible screen density, as per the device
configuration screen density bins. -->
<attr name="screenDensity" format="integer">
<!-- A low density screen, approximately 120dpi. -->
<enum name="ldpi" value="120" />
<!-- A medium density screen, approximately 160dpi. -->
<enum name="mdpi" value="160" />
<!-- A high density screen, approximately 240dpi. -->
<enum name="hdpi" value="240" />
<!-- An extra high density screen, approximately 320dpi. -->
<enum name="xhdpi" value="320" />
</attr>
</declare-styleable>
<!-- Declaration of an {@link android.content.Intent} object in XML. May
also include zero or more {@link #IntentCategory <category> and
{@link #Extra <extra>} tags. -->

View File

@@ -1257,6 +1257,8 @@
<public type="attr" name="textSelectHandle" id="0x010102c7" />
<public type="attr" name="textSelectHandleWindowStyle" id="0x010102c8" />
<public type="attr" name="popupAnimationStyle" id="0x010102c9" />
<public type="attr" name="screenSize" id="0x010102ca" />
<public type="attr" name="screenDensity" id="0x010102cb" />
<!-- presence drawables for videochat or audiochat capable contacts -->
<public type="drawable" name="presence_video_away" id="0x010800ac" />

View File

@@ -18,6 +18,12 @@
package="com.google.android.test.dpi">
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="3" />
<supports-screens android:smallScreens="true" />
<compatible-screens>
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<screen android:screenSize="large" android:screenDensity="hdpi" />
<screen android:screenSize="xlarge" android:screenDensity="mdpi" />
</compatible-screens>
<application android:label="DpiTest">
<activity android:name="DpiTestActivity">
<intent-filter>

View File

@@ -334,13 +334,15 @@ enum {
REQ_FIVE_WAY_NAV_ATTR = 0x01010232,
TARGET_SDK_VERSION_ATTR = 0x01010270,
TEST_ONLY_ATTR = 0x01010272,
DENSITY_ATTR = 0x0101026c,
ANY_DENSITY_ATTR = 0x0101026c,
GL_ES_VERSION_ATTR = 0x01010281,
SMALL_SCREEN_ATTR = 0x01010284,
NORMAL_SCREEN_ATTR = 0x01010285,
LARGE_SCREEN_ATTR = 0x01010286,
XLARGE_SCREEN_ATTR = 0x010102bf,
REQUIRED_ATTR = 0x0101028e,
SCREEN_SIZE_ATTR = 0x010102ca,
SCREEN_DENSITY_ATTR = 0x010102cb,
};
const char *getComponentName(String8 &pkgName, String8 &componentName) {
@@ -357,6 +359,42 @@ const char *getComponentName(String8 &pkgName, String8 &componentName) {
return retStr.string();
}
static void printCompatibleScreens(ResXMLTree& tree) {
size_t len;
ResXMLTree::event_code_t code;
int depth = 0;
bool first = true;
printf("compatible-screens:");
while ((code=tree.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
if (code == ResXMLTree::END_TAG) {
depth--;
if (depth < 0) {
break;
}
continue;
}
if (code != ResXMLTree::START_TAG) {
continue;
}
depth++;
String8 tag(tree.getElementName(&len));
if (tag == "screen") {
int32_t screenSize = getIntegerAttribute(tree,
SCREEN_SIZE_ATTR, NULL, -1);
int32_t screenDensity = getIntegerAttribute(tree,
SCREEN_DENSITY_ATTR, NULL, -1);
if (screenSize > 0 && screenDensity > 0) {
if (!first) {
printf(",");
}
first = false;
printf("'%d/%d'", screenSize, screenDensity);
}
}
}
printf("\n");
}
/*
* Handle the "dump" command, to extract select data from an archive.
*/
@@ -575,6 +613,7 @@ int doDump(Bundle* bundle)
int normalScreen = 1;
int largeScreen = 1;
int xlargeScreen = 1;
int anyDensity = 1;
String8 pkg;
String8 activityName;
String8 activityLabel;
@@ -742,14 +781,6 @@ int doDump(Bundle* bundle)
printf(" reqFiveWayNav='%d'", reqFiveWayNav);
}
printf("\n");
} else if (tag == "supports-density") {
int32_t dens = getIntegerAttribute(tree, DENSITY_ATTR, &error);
if (error != "") {
fprintf(stderr, "ERROR getting 'android:density' attribute: %s\n",
error.string());
goto bail;
}
printf("supports-density:'%d'\n", dens);
} else if (tag == "supports-screens") {
smallScreen = getIntegerAttribute(tree,
SMALL_SCREEN_ATTR, NULL, 1);
@@ -759,6 +790,8 @@ int doDump(Bundle* bundle)
LARGE_SCREEN_ATTR, NULL, 1);
xlargeScreen = getIntegerAttribute(tree,
XLARGE_SCREEN_ATTR, NULL, 1);
anyDensity = getIntegerAttribute(tree,
ANY_DENSITY_ATTR, NULL, 1);
} else if (tag == "uses-feature") {
String8 name = getAttribute(tree, NAME_ATTR, &error);
@@ -883,6 +916,9 @@ int doDump(Bundle* bundle)
error.string());
goto bail;
}
} else if (tag == "compatible-screens") {
printCompatibleScreens(tree);
depth--;
}
} else if (depth == 3 && withinApplication) {
withinActivity = false;
@@ -1109,6 +1145,9 @@ int doDump(Bundle* bundle)
// Introduced in Honeycomb.
xlargeScreen = targetSdk >= 10 ? -1 : 0;
}
if (anyDensity > 0) {
anyDensity = targetSdk >= 4 ? -1 : 0;
}
printf("supports-screens:");
if (smallScreen != 0) printf(" 'small'");
if (normalScreen != 0) printf(" 'normal'");
@@ -1116,6 +1155,8 @@ int doDump(Bundle* bundle)
if (xlargeScreen != 0) printf(" 'xlarge'");
printf("\n");
printf("supports-any-density: '%s'\n", anyDensity ? "true" : "false");
printf("locales:");
Vector<String8> locales;
res.getLocales(&locales);