summaryrefslogtreecommitdiffstats
path: root/tools/aapt/Command.cpp
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-08-27 16:28:44 -0700
committerDianne Hackborn <hackbod@google.com>2009-08-27 16:28:44 -0700
commite5276a74746b5e8f09b05a50155e7aa0bbb4a747 (patch)
tree38f66bbad2a14adbee770b1d1c1caa842ecf4e28 /tools/aapt/Command.cpp
parentd6ac7c73e17f0ce0cc3b1290760c4f67cafcdec5 (diff)
downloadframeworks_base-e5276a74746b5e8f09b05a50155e7aa0bbb4a747.zip
frameworks_base-e5276a74746b5e8f09b05a50155e7aa0bbb4a747.tar.gz
frameworks_base-e5276a74746b5e8f09b05a50155e7aa0bbb4a747.tar.bz2
Fix issue #2084148: Define the format for the auto focus preview for barcode scanning
Add new manifest/aapt support for specifying device features an application requires. The aapt badging now returns these (as well as uses-permission since I need to look for those anyway); if an app doesn't explicitly request the camera feature but does request the permission, then aapt will say that it has requested both the basic camera feature as well as the autofocus feature. Here's what you put in your manifest to say you need a camera but don't need autofocus: <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /> Here's what will be seen from aapt: uses-permission:'android.permission.CAMERA' uses-feature:'android.hardware.camera' uses-feature-not-required:'android.hardware.camera.autofocus' Change-Id: I4dd19cee0486cc54771f5bf14fc9db0e892115d5
Diffstat (limited to 'tools/aapt/Command.cpp')
-rw-r--r--tools/aapt/Command.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index d8215e7..f4afd7f 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -332,9 +332,11 @@ enum {
TARGET_SDK_VERSION_ATTR = 0x01010270,
TEST_ONLY_ATTR = 0x01010272,
DENSITY_ATTR = 0x0101026c,
+ GL_ES_VERSION_ATTR = 0x01010281,
SMALL_SCREEN_ATTR = 0x01010284,
NORMAL_SCREEN_ATTR = 0x01010285,
LARGE_SCREEN_ATTR = 0x01010286,
+ REQUIRED_ATTR = 0x0101028e,
};
const char *getComponentName(String8 &pkgName, String8 &componentName) {
@@ -520,6 +522,8 @@ int doDump(Bundle* bundle)
bool actWidgetReceivers = false;
bool actImeService = false;
bool actWallpaperService = false;
+ bool specCameraFeature = false;
+ bool hasCameraPermission = false;
int targetSdk = 0;
int smallScreen = 1;
int normalScreen = 1;
@@ -706,6 +710,37 @@ int doDump(Bundle* bundle)
NORMAL_SCREEN_ATTR, NULL, 1);
largeScreen = getIntegerAttribute(tree,
LARGE_SCREEN_ATTR, NULL, 1);
+ } else if (tag == "uses-feature") {
+ String8 name = getAttribute(tree, NAME_ATTR, &error);
+ if (error == "") {
+ int req = getIntegerAttribute(tree,
+ REQUIRED_ATTR, NULL, 1);
+ if (name == "android.hardware.camera") {
+ specCameraFeature = true;
+ }
+ printf("uses-feature%s:'%s'\n",
+ req ? "" : "-not-required", name.string());
+ } else {
+ int vers = getIntegerAttribute(tree,
+ GL_ES_VERSION_ATTR, &error);
+ if (error == "") {
+ printf("uses-gl-es:'0x%x'\n", vers);
+ }
+ }
+ } else if (tag == "uses-permission") {
+ String8 name = getAttribute(tree, NAME_ATTR, &error);
+ if (error == "") {
+ int opt = getIntegerAttribute(tree,
+ REQUIRED_ATTR, NULL, 1);
+ if (name == "android.permission.CAMERA") {
+ hasCameraPermission = true;
+ }
+ printf("uses-permission:'%s'\n", name.string());
+ } else {
+ fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n",
+ error.string());
+ goto bail;
+ }
}
} else if (depth == 3 && withinApplication) {
withinActivity = false;
@@ -803,6 +838,15 @@ int doDump(Bundle* bundle)
}
}
+ if (!specCameraFeature && hasCameraPermission) {
+ // For applications that have not explicitly stated their
+ // camera feature requirements, but have requested the camera
+ // permission, we are going to give them compatibility treatment
+ // of requiring the equivalent to original android devices.
+ printf("uses-feature:'android.hardware.camera'\n");
+ printf("uses-feature:'android.hardware.camera.autofocus'\n");
+ }
+
if (hasMainActivity) {
printf("main\n");
}