From 6f2b69d36211880261c0edcd8fff3ece68041a88 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Thu, 15 Apr 2021 07:55:07 -0600 Subject: [PATCH] Make @RequiresPermission RetentionPolicy.CLASS. As part of Error Prone checks, we're now placing these annotations directly on AIDL interfaces. However, many portions of the OS are built using prebuilt AIDL files, where RetentionPolicy.SOURCE annotations have been stripped away. To retain these annotations for aiding permission enforcement checks, this change upgrades to RetentionPolicy.CLASS. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: Ic88cbf470efc1d50926fe2ff16f0e2f6cd7b1173 --- core/java/android/annotation/RequiresPermission.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/annotation/RequiresPermission.java b/core/java/android/annotation/RequiresPermission.java index 1d89e31b2b991..303ab41bec8ef 100644 --- a/core/java/android/annotation/RequiresPermission.java +++ b/core/java/android/annotation/RequiresPermission.java @@ -20,7 +20,7 @@ import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; import java.lang.annotation.Retention; import java.lang.annotation.Target; @@ -76,7 +76,7 @@ import java.lang.annotation.Target; * * @hide */ -@Retention(SOURCE) +@Retention(CLASS) @Target({ANNOTATION_TYPE,METHOD,CONSTRUCTOR,FIELD,PARAMETER}) public @interface RequiresPermission { /**