diff options
| author | Suchi Amalapurapu <asuchitra@google.com> | 2009-06-05 10:26:19 -0700 | 
|---|---|---|
| committer | Suchi Amalapurapu <asuchitra@google.com> | 2009-06-05 13:49:09 -0700 | 
| commit | d299b8194dde8c4875e5f032918ab35ebad8b1f1 (patch) | |
| tree | 27fb20be4db7b7bdb4da2832df0a8146ee1f4cd3 /core/java | |
| parent | b1c2874790908d1bbb9b99242fc7cc96c7b45a8a (diff) | |
| download | frameworks_base-d299b8194dde8c4875e5f032918ab35ebad8b1f1.zip frameworks_base-d299b8194dde8c4875e5f032918ab35ebad8b1f1.tar.gz frameworks_base-d299b8194dde8c4875e5f032918ab35ebad8b1f1.tar.bz2 | |
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.
Diffstat (limited to 'core/java')
| -rwxr-xr-x | core/java/android/content/pm/ConfigurationInfo.java | 30 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageParser.java | 12 | 
2 files changed, 40 insertions, 2 deletions
| diff --git a/core/java/android/content/pm/ConfigurationInfo.java b/core/java/android/content/pm/ConfigurationInfo.java index dcc7463..fb7a47f 100755 --- a/core/java/android/content/pm/ConfigurationInfo.java +++ b/core/java/android/content/pm/ConfigurationInfo.java @@ -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 <uses-configuration> tags. + * AndroidManifest.xml's <uses-configuration> and the   <uses-feature>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);      }  } diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index e2c0fe6..ab8559c 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -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, | 
