Only move private attrs when building framework
When aapt was changed to move private attributes into a different type
(9b624c186c), attributes only were moved
when building the framework. When this functionality was ported to
aapt2, all apps using the public tag would have their private
attributes moved. The change does not appear to be intentional and
thus is a parity issue.
This change only moves private attributes when building a package with
an id of 0x01.
Bug: 151683505
Test: manual
Change-Id: Ic9843f99e428f94cb6a55988a3881b8a91c7d7e2
This commit is contained in:
@@ -78,6 +78,8 @@ using ::android::base::StringPrintf;
|
||||
|
||||
namespace aapt {
|
||||
|
||||
constexpr uint8_t kAndroidPackageId = 0x01;
|
||||
|
||||
class LinkContext : public IAaptContext {
|
||||
public:
|
||||
explicit LinkContext(IDiagnostics* diagnostics)
|
||||
@@ -1804,7 +1806,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) {
|
||||
@@ -1861,7 +1863,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user