summaryrefslogtreecommitdiffstats
path: root/tools/aapt/Resource.cpp
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2010-01-12 16:08:23 -0800
committerYing Wang <wangying@google.com>2010-01-12 16:08:23 -0800
commit4199528aab2cbc3ba3c6540670fabb2040c8e081 (patch)
tree903585d3dab0768ef2321d9a22346a1b32c43fd5 /tools/aapt/Resource.cpp
parentce63c639e90daafc3382020bb2d9e2b17350f1f0 (diff)
downloadframeworks_base-4199528aab2cbc3ba3c6540670fabb2040c8e081.zip
frameworks_base-4199528aab2cbc3ba3c6540670fabb2040c8e081.tar.gz
frameworks_base-4199528aab2cbc3ba3c6540670fabb2040c8e081.tar.bz2
Only output proguard keep for nonempty attribute name in the AndroidManifest.xml.
Before this change, aapt generates proguard keep flags like "-keep class com.android.somepackage.", which proguard doesn't recognize.
Diffstat (limited to 'tools/aapt/Resource.cpp')
-rw-r--r--tools/aapt/Resource.cpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index fdcada4..02b46aa 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1745,31 +1745,33 @@ writeProguardForAndroidManifest(ProguardKeepSet* keep, const sp<AaptAssets>& ass
fprintf(stderr, "ERROR: %s\n", error.string());
return -1;
}
- // asdf --> package.asdf
- // .asdf .a.b --> package.asdf package.a.b
- // asdf.adsf --> asdf.asdf
- String8 rule("-keep class ");
- const char* p = name.string();
- const char* q = strchr(p, '.');
- if (p == q) {
- rule += pkg;
- rule += name;
- } else if (q == NULL) {
- rule += pkg;
- rule += ".";
- rule += name;
- } else {
- rule += name;
- }
+ if (name.length() > 0) {
+ // asdf --> package.asdf
+ // .asdf .a.b --> package.asdf package.a.b
+ // asdf.adsf --> asdf.asdf
+ String8 rule("-keep class ");
+ const char* p = name.string();
+ const char* q = strchr(p, '.');
+ if (p == q) {
+ rule += pkg;
+ rule += name;
+ } else if (q == NULL) {
+ rule += pkg;
+ rule += ".";
+ rule += name;
+ } else {
+ rule += name;
+ }
- String8 location = tag;
- location += " ";
- location += assFile->getSourceFile();
- char lineno[20];
- sprintf(lineno, ":%d", tree.getLineNumber());
- location += lineno;
+ String8 location = tag;
+ location += " ";
+ location += assFile->getSourceFile();
+ char lineno[20];
+ sprintf(lineno, ":%d", tree.getLineNumber());
+ location += lineno;
- keep->add(rule, location);
+ keep->add(rule, location);
+ }
}
}
}