diff options
author | Adam Lesinski <adamlesinski@google.com> | 2014-07-25 14:38:54 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2014-07-25 22:45:33 +0000 |
commit | d7a94da476e9b783acf0673ed938cc3fc2cc6ba5 (patch) | |
tree | 5ccb769c5fa39a847a39523a98ad8ffbb8882013 | |
parent | eb527ef7a651def56ab29c0595e75df76ea63e3b (diff) |
Have AEP GL feature depend on GLES 3.1 in badging
AAPT dump badging should output the uses-gl-es tag with
a version of 3.1 when android.hardware.opengles.aep is
declared as a feature.
Change-Id: I8affc6dad574c8303c6ba9810ad8e6e205ea9506
-rw-r--r-- | tests/UsesFeature2Test/AndroidManifest.xml | 1 | ||||
-rw-r--r-- | tools/aapt/Command.cpp | 54 |
2 files changed, 42 insertions, 13 deletions
diff --git a/tests/UsesFeature2Test/AndroidManifest.xml b/tests/UsesFeature2Test/AndroidManifest.xml index 724d1861bf11..6b6c4dab67f8 100644 --- a/tests/UsesFeature2Test/AndroidManifest.xml +++ b/tests/UsesFeature2Test/AndroidManifest.xml @@ -30,6 +30,7 @@ </feature-group> <feature-group android:label="@string/gamepad"> <uses-feature android:name="android.hardware.gamepad" /> + <uses-feature android:name="android.hardware.opengles.aep" /> </feature-group> <application android:label="@string/app_title"> diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index ac1ae70b2309..afeb5460b25f 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -611,6 +611,8 @@ struct ImpliedFeature { * Represents a <feature-group> tag in the AndroidManifest.xml */ struct FeatureGroup { + FeatureGroup() : openGLESVersion(-1) {} + /** * Human readable label */ @@ -620,6 +622,11 @@ struct FeatureGroup { * Explicit features defined in the group */ KeyedVector<String8, bool> features; + + /** + * OpenGL ES version required + */ + int openGLESVersion; }; static void addImpliedFeature(KeyedVector<String8, ImpliedFeature>* impliedFeatures, @@ -637,6 +644,10 @@ static void printFeatureGroup(const FeatureGroup& grp, const KeyedVector<String8, ImpliedFeature>* impliedFeatures = NULL) { printf("feature-group: label='%s'\n", grp.label.string()); + if (grp.openGLESVersion > 0) { + printf(" uses-gl-es: '0x%x'\n", grp.openGLESVersion); + } + const size_t numFeatures = grp.features.size(); for (size_t i = 0; i < numFeatures; i++) { if (!grp.features[i]) { @@ -688,6 +699,11 @@ static void addParentFeatures(FeatureGroup* grp, const String8& name) { } else if (name == "android.hardware.touchscreen.multitouch.distinct") { grp->features.add(String8("android.hardware.touchscreen.multitouch"), true); grp->features.add(String8("android.hardware.touchscreen"), true); + } else if (name == "android.hardware.opengles.aep") { + const int openGLESVersion31 = 0x00030001; + if (openGLESVersion31 > grp->openGLESVersion) { + grp->openGLESVersion = openGLESVersion31; + } } } @@ -1316,14 +1332,16 @@ int doDump(Bundle* bundle) int vers = getIntegerAttribute(tree, GL_ES_VERSION_ATTR, &error); if (error == "") { - printf("uses-gl-es:'0x%x'\n", vers); + if (vers > commonFeatures.openGLESVersion) { + commonFeatures.openGLESVersion = vers; + } } } } else if (tag == "uses-permission") { String8 name = getAttribute(tree, NAME_ATTR, &error); if (name != "" && error == "") { if (name == "android.permission.CAMERA") { - addImpliedFeature(&impliedFeatures, "android.hardware.feature", + addImpliedFeature(&impliedFeatures, "android.hardware.camera", String8::format("requested %s permission", name.string()) .string()); } else if (name == "android.permission.ACCESS_FINE_LOCATION") { @@ -1639,18 +1657,23 @@ int doDump(Bundle* bundle) } } } else if (withinFeatureGroup && tag == "uses-feature") { + FeatureGroup& top = featureGroups.editTop(); + String8 name = getResolvedAttribute(&res, tree, NAME_ATTR, &error); - if (error != "") { - fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", - error.string()); - goto bail; - } + if (name != "" && error == "") { + int required = getIntegerAttribute(tree, REQUIRED_ATTR, NULL, 1); + top.features.add(name, required); + if (required) { + addParentFeatures(&top, name); + } - int required = getIntegerAttribute(tree, REQUIRED_ATTR, NULL, 1); - FeatureGroup& top = featureGroups.editTop(); - top.features.add(name, required); - if (required) { - addParentFeatures(&top, name); + } else { + int vers = getIntegerAttribute(tree, GL_ES_VERSION_ATTR, &error); + if (error == "") { + if (vers > top.openGLESVersion) { + top.openGLESVersion = vers; + } + } } } } else if (depth == 4) { @@ -1839,12 +1862,17 @@ int doDump(Bundle* bundle) for (size_t i = 0; i < numFeatureGroups; i++) { FeatureGroup& grp = featureGroups.editItemAt(i); + if (commonFeatures.openGLESVersion > grp.openGLESVersion) { + grp.openGLESVersion = commonFeatures.openGLESVersion; + } + // Merge the features defined in the top level (not inside a <feature-group>) // with this feature group. const size_t numCommonFeatures = commonFeatures.features.size(); for (size_t j = 0; j < numCommonFeatures; j++) { if (grp.features.indexOfKey(commonFeatures.features.keyAt(j)) < 0) { - grp.features.add(commonFeatures.features.keyAt(j), commonFeatures.features[j]); + grp.features.add(commonFeatures.features.keyAt(j), + commonFeatures.features[j]); } } |