summaryrefslogtreecommitdiff
path: root/tools/aapt2
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2020-05-06 11:26:48 -0700
committerLiz Kammer <eakammer@google.com>2020-05-13 09:04:14 -0700
commit9ed5638125d3eb323f5ef92ddc6fd9e588e01492 (patch)
treede6ca5c5607be5005b341a1d69716d0648163208 /tools/aapt2
parent8adff7229cf3c339a6707b440c86ca304b5d61c2 (diff)
Do not rename R.java package
When the --rename-resources-package flag is used, only rename the package name within the resources.arsc. Generate the R.java under the package name defined by the manifest unless --custom-package is used. (This is a cherry pick.) Bug: 147434671 Test: manual Merged-In: Id9d10e16f32533da1b67ab72ac846791526e7a76 Change-Id: Id9d10e16f32533da1b67ab72ac846791526e7a76
Diffstat (limited to 'tools/aapt2')
-rw-r--r--tools/aapt2/cmd/Link.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index 77e2a6bb21de..e8970d48e404 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -1669,6 +1669,16 @@ class Linker {
context_->SetCompilationPackage(app_info.package);
}
+ // Determine the package name under which to merge resources.
+ if (options_.rename_resources_package) {
+ if (!options_.custom_java_package) {
+ // Generate the R.java under the original package name instead of the package name specified
+ // through --rename-resources-package.
+ options_.custom_java_package = context_->GetCompilationPackage();
+ }
+ context_->SetCompilationPackage(options_.rename_resources_package.value());
+ }
+
// Now that the compilation package is set, load the dependencies. This will also extract
// the Android framework's versionCode and versionName, if they exist.
if (!LoadSymbolsFromIncludePaths()) {