summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/aapt/Bundle.h7
-rw-r--r--tools/aapt/Main.cpp14
-rw-r--r--tools/aapt/Resource.cpp6
-rw-r--r--tools/aapt/ResourceTable.cpp10
4 files changed, 35 insertions, 2 deletions
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h
index c29bb482c159..c4495509614e 100644
--- a/tools/aapt/Bundle.h
+++ b/tools/aapt/Bundle.h
@@ -127,6 +127,12 @@ public:
const android::String8& getPlatformBuildVersionName() { return mPlatformVersionName; }
void setPlatformBuildVersionName(const android::String8& name) { mPlatformVersionName = name; }
+ const android::String8& getPrivateSymbolsPackage() const { return mPrivateSymbolsPackage; }
+
+ void setPrivateSymbolsPackage(const android::String8& package) {
+ mPrivateSymbolsPackage = package;
+ }
+
bool getUTF16StringsOption() {
return mWantUTF16 || !isMinSdkAtLeast(SDK_FROYO);
}
@@ -333,6 +339,7 @@ private:
bool mBuildAppAsSharedLibrary;
android::String8 mPlatformVersionCode;
android::String8 mPlatformVersionName;
+ android::String8 mPrivateSymbolsPackage;
/* file specification */
int mArgc;
diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp
index 64112867a4b4..c424cc516b56 100644
--- a/tools/aapt/Main.cpp
+++ b/tools/aapt/Main.cpp
@@ -220,7 +220,9 @@ void usage(void)
" Prevents symbols from being generated for strings that do not have a default\n"
" localization\n"
" --no-version-vectors\n"
- " Do not automatically generate versioned copies of vector XML resources.\n",
+ " Do not automatically generate versioned copies of vector XML resources.\n"
+ " --private-symbols\n"
+ " Java package name to use when generating R.java for private resources.\n",
gDefaultIgnoreAssets);
}
@@ -689,6 +691,16 @@ int main(int argc, char* const argv[])
bundle.setPseudolocalize(PSEUDO_ACCENTED | PSEUDO_BIDI);
} else if (strcmp(cp, "-no-version-vectors") == 0) {
bundle.setNoVersionVectors(true);
+ } else if (strcmp(cp, "-private-symbols") == 0) {
+ argc--;
+ argv++;
+ if (!argc) {
+ fprintf(stderr, "ERROR: No argument supplied for "
+ "'--private-symbols' option\n");
+ wantUsage = true;
+ goto bail;
+ }
+ bundle.setPrivateSymbolsPackage(String8(argv[0]));
} else {
fprintf(stderr, "ERROR: Unknown option '-%s'\n", cp);
wantUsage = true;
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index fb0fe38da1ff..576f076f4a3f 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1161,6 +1161,12 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
printf("Creating resources for package %s\n", assets->getPackage().string());
}
+ // Set the private symbols package if it was declared.
+ // This can also be declared in XML as <private-symbols name="package" />
+ if (bundle->getPrivateSymbolsPackage().size() != 0) {
+ assets->setSymbolsPrivatePackage(bundle->getPrivateSymbolsPackage());
+ }
+
ResourceTable::PackageType packageType = ResourceTable::App;
if (bundle->getBuildSharedLibrary()) {
packageType = ResourceTable::SharedLibrary;
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 0e470d924f5a..e87c7d40f1d4 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -1141,7 +1141,15 @@ status_t compileResourceFile(Bundle* bundle,
}
pkg = String16(block.getAttributeStringValue(pkgIdx, &len));
if (!localHasErrors) {
- assets->setSymbolsPrivatePackage(String8(pkg));
+ SourcePos(in->getPrintableSource(), block.getLineNumber()).warning(
+ "<private-symbols> is deprecated. Use the command line flag "
+ "--private-symbols instead.\n");
+ if (assets->havePrivateSymbols()) {
+ SourcePos(in->getPrintableSource(), block.getLineNumber()).warning(
+ "private symbol package already specified. Ignoring...\n");
+ } else {
+ assets->setSymbolsPrivatePackage(String8(pkg));
+ }
}
while ((code=block.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {