Add a new attribute to android manifest for defining the GLES version number.

This attribute is parsed by the PackageParser into ConfigurationInfo. The major
and minor version numbers are defined as the higher and lower order bits.
This commit is contained in:
Suchi Amalapurapu
2009-06-05 10:26:19 -07:00
parent b1c2874790
commit d299b8194d
5 changed files with 102 additions and 14 deletions

View File

@ -3518,17 +3518,6 @@
visibility="public"
>
</field>
<field name="donut_resource_pad30"
type="int"
transient="false"
volatile="false"
value="16843394"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="donut_resource_pad4"
type="int"
transient="false"
@ -4453,6 +4442,17 @@
visibility="public"
>
</field>
<field name="glEsVersion"
type="int"
transient="false"
volatile="false"
value="16843394"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="gradientRadius"
type="int"
transient="false"
@ -35239,6 +35239,17 @@
visibility="public"
>
</method>
<method name="getGlEsVersion"
return="java.lang.String"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="writeToParcel"
return="void"
abstract="false"
@ -35264,6 +35275,17 @@
visibility="public"
>
</field>
<field name="GL_ES_VERSION_UNDEFINED"
type="int"
transient="false"
volatile="false"
value="0"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="INPUT_FEATURE_FIVE_WAY_NAV"
type="int"
transient="false"
@ -35286,6 +35308,16 @@
visibility="public"
>
</field>
<field name="reqGlEsVersion"
type="int"
transient="false"
volatile="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="reqInputFeatures"
type="int"
transient="false"

View File

@ -22,7 +22,7 @@ import android.os.Parcelable;
/**
* Information you can retrieve about hardware configuration preferences
* declared by an application. This corresponds to information collected from the
* AndroidManifest.xml's &lt;uses-configuration&gt; tags.
* AndroidManifest.xml's &lt;uses-configuration&gt; and the &lt;uses-feature&gt;tags.
*/
public class ConfigurationInfo implements Parcelable {
/**
@ -70,6 +70,16 @@ public class ConfigurationInfo implements Parcelable {
*/
public int reqInputFeatures = 0;
/**
* Default value for {@link #reqGlEsVersion};
*/
public static final int GL_ES_VERSION_UNDEFINED = 0;
/**
* The GLES version used by an application. The upper order 16 bits represent the
* major version and the lower order 16 bits the minor version.
*/
public int reqGlEsVersion;
public ConfigurationInfo() {
}
@ -78,6 +88,7 @@ public class ConfigurationInfo implements Parcelable {
reqKeyboardType = orig.reqKeyboardType;
reqNavigation = orig.reqNavigation;
reqInputFeatures = orig.reqInputFeatures;
reqGlEsVersion = orig.reqGlEsVersion;
}
public String toString() {
@ -86,7 +97,8 @@ public class ConfigurationInfo implements Parcelable {
+ ", touchscreen = " + reqTouchScreen + "}"
+ ", inputMethod = " + reqKeyboardType + "}"
+ ", navigation = " + reqNavigation + "}"
+ ", reqInputFeatures = " + reqInputFeatures + "}";
+ ", reqInputFeatures = " + reqInputFeatures + "}"
+ ", reqGlEsVersion = " + reqGlEsVersion + "}";
}
public int describeContents() {
@ -98,6 +110,7 @@ public class ConfigurationInfo implements Parcelable {
dest.writeInt(reqKeyboardType);
dest.writeInt(reqNavigation);
dest.writeInt(reqInputFeatures);
dest.writeInt(reqGlEsVersion);
}
public static final Creator<ConfigurationInfo> CREATOR =
@ -115,5 +128,18 @@ public class ConfigurationInfo implements Parcelable {
reqKeyboardType = source.readInt();
reqNavigation = source.readInt();
reqInputFeatures = source.readInt();
reqGlEsVersion = source.readInt();
}
/**
* This method extracts the major and minor version of reqGLEsVersion attribute
* and returns it as a string. Say reqGlEsVersion value of 0x00010002 is returned
* as 1.2
* @return String representation of the reqGlEsVersion attribute
*/
public String getGlEsVersion() {
int major = ((reqGlEsVersion & 0xffff0000) >> 16);
int minor = reqGlEsVersion & 0x0000ffff;
return String.valueOf(major)+"."+String.valueOf(minor);
}
}

View File

@ -748,6 +748,18 @@ public class PackageParser {
XmlUtils.skipCurrentTag(parser);
} else if (tagName.equals("uses-feature")) {
ConfigurationInfo cPref = new ConfigurationInfo();
sa = res.obtainAttributes(attrs,
com.android.internal.R.styleable.AndroidManifestUsesFeature);
cPref.reqGlEsVersion = sa.getInt(
com.android.internal.R.styleable.AndroidManifestUsesFeature_glEsVersion,
ConfigurationInfo.GL_ES_VERSION_UNDEFINED);
sa.recycle();
pkg.configPreferences.add(cPref);
XmlUtils.skipCurrentTag(parser);
} else if (tagName.equals("uses-sdk")) {
if (mSdkVersion > 0) {
sa = res.obtainAttributes(attrs,

View File

@ -596,7 +596,8 @@
{@link #AndroidManifestUsesPermission uses-permission},
{@link #AndroidManifestUsesConfiguration uses-configuration},
{@link #AndroidManifestApplication application},
{@link #AndroidManifestInstrumentation instrumentation}. -->
{@link #AndroidManifestInstrumentation instrumentation},
{@link #AndroidManifestUsesFeature uses-feature}. -->
<declare-styleable name="AndroidManifest">
<attr name="versionCode" />
<attr name="versionName" />
@ -765,6 +766,22 @@
<attr name="reqFiveWayNav" />
</declare-styleable>
<!-- The <code>uses-feature</code> tag specifies
a specific feature used by the application.
For example an application might specify that it requires
specific version of open gl. Multiple such attribute
values can be specified by the application.
<p>This appears as a child tag of the root
{@link #AndroidManifest manifest} tag. -->
<declare-styleable name="AndroidManifestUsesFeature" parent="AndroidManifest">
<!-- The GLES driver version number needed by an application.
The higher 16 bits represent the major number and the lower 16 bits
represent the minor number. For example for GL 1.2 referring to
0x00000102, the actual value should be set as 0x00010002. -->
<attr name="glEsVersion" format="integer"/>
</declare-styleable>
<!-- The <code>uses-sdk</code> tag describes the SDK features that the
containing package must be running on to operate correctly.

View File

@ -1115,6 +1115,7 @@
<public type="attr" name="fadeEnabled" />
<public type="attr" name="backupAgent" />
<public type="attr" name="allowBackup" />
<public type="attr" name="glEsVersion" />
<public-padding type="attr" name="donut_resource_pad" end="0x0101029f" />