From 1c1544ff96e7f87154c2eff62c1da3aee46b569f Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Thu, 13 Feb 2020 14:33:47 +0000 Subject: aapt2: Preserve annotation parameters for SystemApi. SystemAPI can now be parameterized. Note that this change preserves the content of the annotation params without attempting to interpret them in any way. This means that references to types outside of java.lang must be fully qualified. Test: atest aapt2_tests Bug: 147581540 Change-Id: I0630fb1c7c7a7f5918ff2dca32fb8e078b367751 --- tools/aapt2/java/AnnotationProcessor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools/aapt2/java/AnnotationProcessor.h') diff --git a/tools/aapt2/java/AnnotationProcessor.h b/tools/aapt2/java/AnnotationProcessor.h index ae7bdb0c3ae2..fdb58468d995 100644 --- a/tools/aapt2/java/AnnotationProcessor.h +++ b/tools/aapt2/java/AnnotationProcessor.h @@ -19,6 +19,7 @@ #include #include +#include #include "androidfw/StringPiece.h" @@ -70,7 +71,7 @@ class AnnotationProcessor { std::stringstream comment_; std::stringstream mAnnotations; bool has_comments_ = false; - uint32_t annotation_bit_mask_ = 0; + std::unordered_map annotation_parameter_map_; void AppendCommentLine(std::string line); }; -- cgit v1.2.3 From de6e6f2098042bb91f7dac965d2b047c74c920f2 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Mon, 22 Jun 2020 10:17:02 -0700 Subject: Don't add API annotations in the internal R.java I'm trying to enable a check for the following structure: ``` /** @hide */ public class Class1 { /** @hide */ @SystemApi // Invalid because the class is hidden. public void method1() { } } ``` The internal R.java file violates this, which this change is going to fix. Bug: 159162473 Test: build (treehugger) Test: atest aapt2_tests Change-Id: I613e8611ddaf5f8e4761d351d4cd0142d59c7cc9 --- tools/aapt2/java/AnnotationProcessor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/aapt2/java/AnnotationProcessor.h') diff --git a/tools/aapt2/java/AnnotationProcessor.h b/tools/aapt2/java/AnnotationProcessor.h index fdb58468d995..f217afb16f32 100644 --- a/tools/aapt2/java/AnnotationProcessor.h +++ b/tools/aapt2/java/AnnotationProcessor.h @@ -65,7 +65,7 @@ class AnnotationProcessor { void AppendNewLine(); // Writes the comments and annotations to the Printer. - void Print(text::Printer* printer) const; + void Print(text::Printer* printer, bool strip_api_annotations = false) const; private: std::stringstream comment_; -- cgit v1.2.3