]> git.saurik.com Git - android/aapt.git/blobdiff - Command.cpp
am 3c05f1fb: am b5fb50a1: Merge "Add instrumentation as a source tag for proguard...
[android/aapt.git] / Command.cpp
index db4ac974da0875dfe3169ddeb72643de7d15833a..5d345e6d246ba79a18113c27e58384b877338572 100644 (file)
@@ -412,6 +412,7 @@ int doDump(Bundle* bundle)
             }
             tree.restart();
             printXMLBlock(&tree);
+            tree.uninit();
             delete asset;
             asset = NULL;
         }
@@ -678,7 +679,7 @@ int doDump(Bundle* bundle)
                                 REQ_NAVIGATION_ATTR, NULL, 0);
                         int32_t reqFiveWayNav = getIntegerAttribute(tree,
                                 REQ_FIVE_WAY_NAV_ATTR, NULL, 0);
-                        printf("uses-configuation:");
+                        printf("uses-configuration:");
                         if (reqTouchScreen != 0) {
                             printf(" reqTouchScreen='%d'", reqTouchScreen);
                         }
@@ -712,7 +713,8 @@ int doDump(Bundle* bundle)
                                 LARGE_SCREEN_ATTR, NULL, 1);
                     } else if (tag == "uses-feature") {
                         String8 name = getAttribute(tree, NAME_ATTR, &error);
-                        if (error == "") {
+
+                        if (name != "" && error == "") {
                             int req = getIntegerAttribute(tree,
                                     REQUIRED_ATTR, NULL, 1);
                             if (name == "android.hardware.camera") {
@@ -729,7 +731,7 @@ int doDump(Bundle* bundle)
                         }
                     } else if (tag == "uses-permission") {
                         String8 name = getAttribute(tree, NAME_ATTR, &error);
-                        if (error == "") {
+                        if (name != "" && error == "") {
                             if (name == "android.permission.CAMERA") {
                                 hasCameraPermission = true;
                             }
@@ -847,7 +849,7 @@ int doDump(Bundle* bundle)
                 printf("uses-feature:'android.hardware.camera'\n");
                 printf("uses-feature:'android.hardware.camera.autofocus'\n");
             }
-            
+
             if (hasMainActivity) {
                 printf("main\n");
             }
@@ -996,8 +998,15 @@ int doAdd(Bundle* bundle)
             printf(" '%s'... (from gzip)\n", fileName);
             result = zip->addGzip(fileName, String8(fileName).getBasePath().string(), NULL);
         } else {
-            printf(" '%s'...\n", fileName);
-            result = zip->add(fileName, bundle->getCompressionMethod(), NULL);
+            if (bundle->getJunkPath()) {
+                String8 storageName = String8(fileName).getPathLeaf();
+                printf(" '%s' as '%s'...\n", fileName, storageName.string());
+                result = zip->add(fileName, storageName.string(),
+                                  bundle->getCompressionMethod(), NULL);
+            } else {
+                printf(" '%s'...\n", fileName);
+                result = zip->add(fileName, bundle->getCompressionMethod(), NULL);
+            }
         }
         if (result != NO_ERROR) {
             fprintf(stderr, "Unable to add '%s' to '%s'", bundle->getFileSpecEntry(i), zipFileName);
@@ -1143,7 +1152,12 @@ int doPackage(Bundle* bundle)
 
     // Write out R.java constants
     if (assets->getPackage() == assets->getSymbolsPrivatePackage()) {
-        err = writeResourceSymbols(bundle, assets, assets->getPackage(), true);
+        if (bundle->getCustomPackage() == NULL) {
+            err = writeResourceSymbols(bundle, assets, assets->getPackage(), true);
+        } else {
+            const String8 customPkg(bundle->getCustomPackage());
+            err = writeResourceSymbols(bundle, assets, customPkg, true);
+        }
         if (err < 0) {
             goto bail;
         }