]> git.saurik.com Git - android/aapt.git/commitdiff
am 1585bd24: Merge change 4828 into donut
authorAndroid (Google) Code Review <android-gerrit@google.com>
Fri, 19 Jun 2009 23:44:07 +0000 (16:44 -0700)
committerThe Android Open Source Project <initial-contribution@android.com>
Fri, 19 Jun 2009 23:44:07 +0000 (16:44 -0700)
Merge commit '1585bd24c10d16351f89e32dddbfa799f18db6bd'

* commit '1585bd24c10d16351f89e32dddbfa799f18db6bd':
  Report densities in badging, debugging for nine patch bug.

1  2 
Bundle.h
Command.cpp
Main.cpp

diff --combined Bundle.h
index 9e712b8883918a56c1d266954a906bf9e88fc28c,a6fedf3d34bd5b1b5526a16fa96044fa4c1a185d..a671bd748e97ca35f3ecd182dbfb44b8d72e8f9b
+++ b/Bundle.h
@@@ -7,10 -7,7 +7,10 @@@
  #define __BUNDLE_H
  
  #include <stdlib.h>
 -#include <utils.h>      // android
 +#include <utils/Log.h>
 +#include <utils/threads.h>
 +#include <utils/List.h>
 +#include <utils/Errors.h>
  #include <utils/String8.h>
  #include <utils/Vector.h>
  
@@@ -37,6 -34,7 +37,7 @@@ public
            mForce(false), mGrayscaleTolerance(0), mMakePackageDirs(false),
            mUpdate(false), mExtending(false),
            mRequireLocalization(false), mPseudolocalize(false),
+           mValues(false),
            mCompressionMethod(0), mOutputAPKFile(NULL),
            mAssetSourceDir(NULL),
            mAndroidManifestFile(NULL), mPublicOutputFile(NULL),
@@@ -75,6 -73,8 +76,8 @@@
      void setRequireLocalization(bool val) { mRequireLocalization = val; }
      bool getPseudolocalize(void) const { return mPseudolocalize; }
      void setPseudolocalize(bool val) { mPseudolocalize = val; }
+     bool getValues(void) const { return mValues; }
+     void setValues(bool val) { mValues = val; }
      int getCompressionMethod(void) const { return mCompressionMethod; }
      void setCompressionMethod(int val) { mCompressionMethod = val; }
      const char* getOutputAPKFile() const { return mOutputAPKFile; }
@@@ -154,6 -154,7 +157,7 @@@ private
      bool        mExtending;
      bool        mRequireLocalization;
      bool        mPseudolocalize;
+     bool        mValues;
      int         mCompressionMethod;
      const char* mOutputAPKFile;
      const char* mAssetSourceDir;
diff --combined Command.cpp
index 0e889f5d1a1e0883c1bd0951bcebffda39877ae8,503f66157e62fa7bf77f40f3af08dc1e62075da4..dcda379c7c18a5f2c031b4e1aa7b9c7ad0e1c61c
@@@ -8,10 -8,8 +8,10 @@@
  #include "ResourceTable.h"
  #include "XMLNode.h"
  
 -#include <utils.h>
 -#include <utils/ZipFile.h>
 +#include <utils/Log.h>
 +#include <utils/threads.h>
 +#include <utils/List.h>
 +#include <utils/Errors.h>
  
  #include <fcntl.h>
  #include <errno.h>
@@@ -198,7 -196,7 +198,7 @@@ int doList(Bundle* bundle
              printf("\nNo resource table found.\n");
          } else {
              printf("\nResource table:\n");
-             res.print();
+             res.print(false);
          }
  
          Asset* manifestAsset = assets.openNonAsset("AndroidManifest.xml",
@@@ -382,7 -380,7 +382,7 @@@ int doDump(Bundle* bundle
      }
  
      if (strcmp("resources", option) == 0) {
-         res.print();
+         res.print(bundle->getValues());
  
      } else if (strcmp("xmltree", option) == 0) {
          if (bundle->getFileSpecCount() < 3) {
                             activityIcon.string());
                  }
              }
+             
              printf("locales:");
              Vector<String8> locales;
              res.getLocales(&locales);
-             const size_t N = locales.size();
-             for (size_t i=0; i<N; i++) {
+             const size_t NL = locales.size();
+             for (size_t i=0; i<NL; i++) {
                  const char* localeStr =  locales[i].string();
                  if (localeStr == NULL || strlen(localeStr) == 0) {
                      localeStr = "--_--";
                  printf(" '%s'", localeStr);
              }
              printf("\n");
+             
+             Vector<ResTable_config> configs;
+             res.getConfigurations(&configs);
+             SortedVector<int> densities;
+             const size_t NC = configs.size();
+             for (size_t i=0; i<NC; i++) {
+                 int dens = configs[i].density;
+                 if (dens == 0) dens = 160;
+                 densities.add(dens);
+             }
+             
+             printf("densities:");
+             const size_t ND = densities.size();
+             for (size_t i=0; i<ND; i++) {
+                 printf(" '%d'", densities[i]);
+             }
+             printf("\n");
+             
              AssetDir* dir = assets.openNonAssetDir(assetsCookie, "lib");
              if (dir != NULL) {
                  if (dir->getFileCount() > 0) {
diff --combined Main.cpp
index a33b4d7113ddb859febc199282566774d3e9c95c,12a04454cb54fb7e52d2c165b69756a49d08570f..882714c9e09f4aee5b042fbbadcff242116d1561
+++ b/Main.cpp
@@@ -6,10 -6,8 +6,10 @@@
  #include "Main.h"
  #include "Bundle.h"
  
 -#include <utils.h>
 -#include <utils/ZipFile.h>
 +#include <utils/Log.h>
 +#include <utils/threads.h>
 +#include <utils/List.h>
 +#include <utils/Errors.h>
  
  #include <stdlib.h>
  #include <getopt.h>
@@@ -47,7 -45,7 +47,7 @@@ void usage(void
          " %s l[ist] [-v] [-a] file.{zip,jar,apk}\n"
          "   List contents of Zip-compatible archive.\n\n", gProgName);
      fprintf(stderr,
-         " %s d[ump] WHAT file.{apk} [asset [asset ...]]\n"
+         " %s d[ump] [--values] WHAT file.{apk} [asset [asset ...]]\n"
          "   badging          Print the label and icon for the app declared in APK.\n"
          "   permissions      Print the permissions from the APK.\n"
          "   resources        Print the resource table from the APK.\n"
          "       inserts android:targetSdkVersion in to manifest.\n"
          "   --max-sdk-version\n"
          "       inserts android:maxSdkVersion in to manifest.\n"
+         "   --values\n"
+         "       when used with \"dump resources\" also includes resource values.\n"
          "   --version-code\n"
          "       inserts android:versionCode in to manifest.\n"
          "   --version-name\n"
@@@ -398,6 -398,8 +400,8 @@@ int main(int argc, char* const argv[]
                          goto bail;
                      }
                      bundle.setVersionName(argv[0]);
+                 } else if (strcmp(cp, "-values") == 0) {
+                     bundle.setValues(true);
                  } else {
                      fprintf(stderr, "ERROR: Unknown option '-%s'\n", cp);
                      wantUsage = true;