summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ryan Mitchell <rtmitchell@google.com> 2020-08-07 16:18:31 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-08-07 16:18:31 +0000
commit0f60ef818f0ab8fb21233117daafcc3cd7fa3543 (patch)
tree0a2ccb9ade83556de83ebec9156f9baef34d2e67
parent065391ffb92b85cb1c4b3c004363bd5dc73156f6 (diff)
parent22dc5310a4bb88b5f539677156493722bb9a9447 (diff)
Merge "Only move private attrs when building framework"
-rw-r--r--tools/aapt2/cmd/Link.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index f9c54f645e2c..d84ca3d92f67 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -78,6 +78,8 @@ using ::android::base::StringPrintf;
namespace aapt {
+constexpr uint8_t kAndroidPackageId = 0x01;
+
class LinkContext : public IAaptContext {
public:
explicit LinkContext(IDiagnostics* diagnostics)
@@ -1805,7 +1807,7 @@ class Linker {
// Override the package ID when it is "android".
if (context_->GetCompilationPackage() == "android") {
- context_->SetPackageId(0x01);
+ context_->SetPackageId(kAndroidPackageId);
// Verify we're building a regular app.
if (context_->GetPackageType() != PackageType::kApp) {
@@ -1862,7 +1864,8 @@ class Linker {
if (context_->GetPackageType() != PackageType::kStaticLib) {
PrivateAttributeMover mover;
- if (!mover.Consume(context_, &final_table_)) {
+ if (context_->GetPackageId() == kAndroidPackageId &&
+ !mover.Consume(context_, &final_table_)) {
context_->GetDiagnostics()->Error(DiagMessage() << "failed moving private attributes");
return 1;
}