From 7751daa45f481be212db5c8920b9614bfc1002b5 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Fri, 19 Jun 2009 15:13:28 -0700 Subject: [PATCH] Report densities in badging, debugging for nine patch bug. The aapt tool now reports all available densities like it already did for locales. Also this includes more resource data output, which I was using to examine bug #1867049 (which at this point I am unable to reproduce). --- Bundle.h | 4 ++++ Command.cpp | 27 +++++++++++++++++++++++---- Main.cpp | 6 +++++- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Bundle.h b/Bundle.h index 2eb7a1d..a6fedf3 100644 --- a/Bundle.h +++ b/Bundle.h @@ -34,6 +34,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), @@ -72,6 +73,8 @@ public: 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; } @@ -151,6 +154,7 @@ private: bool mExtending; bool mRequireLocalization; bool mPseudolocalize; + bool mValues; int mCompressionMethod; const char* mOutputAPKFile; const char* mAssetSourceDir; diff --git a/Command.cpp b/Command.cpp index dc91a48..503f661 100644 --- a/Command.cpp +++ b/Command.cpp @@ -196,7 +196,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", @@ -380,7 +380,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) { @@ -732,11 +732,12 @@ int doDump(Bundle* bundle) activityIcon.string()); } } + printf("locales:"); Vector locales; res.getLocales(&locales); - const size_t N = locales.size(); - for (size_t i=0; i configs; + res.getConfigurations(&configs); + SortedVector densities; + const size_t NC = configs.size(); + for (size_t i=0; igetFileCount() > 0) { diff --git a/Main.cpp b/Main.cpp index 8bf2b07..12a0445 100644 --- a/Main.cpp +++ b/Main.cpp @@ -45,7 +45,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" @@ -123,6 +123,8 @@ void usage(void) " 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" @@ -396,6 +398,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; -- 2.45.2