From d299b8194dde8c4875e5f032918ab35ebad8b1f1 Mon Sep 17 00:00:00 2001 From: Suchi Amalapurapu Date: Fri, 5 Jun 2009 10:26:19 -0700 Subject: [PATCH] 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. --- api/current.xml | 54 +++++++++++++++---- .../android/content/pm/ConfigurationInfo.java | 30 ++++++++++- .../android/content/pm/PackageParser.java | 12 +++++ core/res/res/values/attrs_manifest.xml | 19 ++++++- core/res/res/values/public.xml | 1 + 5 files changed, 102 insertions(+), 14 deletions(-) diff --git a/api/current.xml b/api/current.xml index 69660d646fc65..c98a5c4a7f3de 100644 --- a/api/current.xml +++ b/api/current.xml @@ -3518,17 +3518,6 @@ visibility="public" > - - + + + + + + + + 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 e2c0fe69f3452..ab8559c0eb810 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, diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 0a2d2088992ba..91cd9fdd1b1b9 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -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}. --> @@ -765,6 +766,22 @@ + + + + + +