Only move private attrs when building framework

When aapt was changed to move private attributes into a different type
(9b624c186cb6059dfb3ec24bfb6386a0fc17b88c), 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
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index a7febdc..b37b74f 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -78,6 +78,8 @@
 
 namespace aapt {
 
+constexpr uint8_t kAndroidPackageId = 0x01;
+
 class LinkContext : public IAaptContext {
  public:
   explicit LinkContext(IDiagnostics* diagnostics)
@@ -1804,7 +1806,7 @@
 
     // 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 @@
 
     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;
       }