diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-06-23 17:11:14 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-06-23 17:11:14 +0000 |
commit | aed7bf43db224157cd160f588c377c48ec712931 (patch) | |
tree | 7bf485c140935670da4eb8f5e162fdd1ce0492bf /tools/aapt2/java/JavaClassGenerator.cpp | |
parent | 45900f61e9a77d0362d64980b97f94c77891ba4a (diff) | |
parent | 47d47a8ac5b0498473494ac5f82687ac43b462c4 (diff) |
Merge "Don't add API annotations in the internal R.java" into rvc-dev-plus-aosp am: 7c72b7f45e am: 780aeb116a am: 47d47a8ac5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11955280
Change-Id: I602f8515391d93daf1d538f965659dfdca62e550
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.cpp')
-rw-r--r-- | tools/aapt2/java/JavaClassGenerator.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/aapt2/java/JavaClassGenerator.cpp b/tools/aapt2/java/JavaClassGenerator.cpp index 0869c570f5d6..f0f839d968d5 100644 --- a/tools/aapt2/java/JavaClassGenerator.cpp +++ b/tools/aapt2/java/JavaClassGenerator.cpp @@ -601,6 +601,8 @@ bool JavaClassGenerator::Generate(const StringPiece& package_name_to_generate, rewrite_method->AppendStatement("final int packageIdBits = p << 24;"); } + const bool is_public = (options_.types == JavaClassGeneratorOptions::SymbolTypes::kPublic); + for (const auto& package : table_->packages) { for (const auto& type : package->types) { if (type->type == ResourceType::kAttrPrivate) { @@ -609,8 +611,7 @@ bool JavaClassGenerator::Generate(const StringPiece& package_name_to_generate, } // Stay consistent with AAPT and generate an empty type class if the R class is public. - const bool force_creation_if_empty = - (options_.types == JavaClassGeneratorOptions::SymbolTypes::kPublic); + const bool force_creation_if_empty = is_public; std::unique_ptr<ClassDefinition> class_def; if (out != nullptr) { @@ -634,8 +635,7 @@ bool JavaClassGenerator::Generate(const StringPiece& package_name_to_generate, } } - if (out != nullptr && type->type == ResourceType::kStyleable && - options_.types == JavaClassGeneratorOptions::SymbolTypes::kPublic) { + if (out != nullptr && type->type == ResourceType::kStyleable && is_public) { // When generating a public R class, we don't want Styleable to be part // of the API. It is only emitted for documentation purposes. class_def->GetCommentBuilder()->AppendComment("@doconly"); @@ -654,7 +654,7 @@ bool JavaClassGenerator::Generate(const StringPiece& package_name_to_generate, if (out != nullptr) { AppendJavaDocAnnotations(options_.javadoc_annotations, r_class.GetCommentBuilder()); - ClassDefinition::WriteJavaFile(&r_class, out_package_name, options_.use_final, out); + ClassDefinition::WriteJavaFile(&r_class, out_package_name, options_.use_final, !is_public, out); } return true; } |