From b0f8c82e37cb1e7a57bff62f9f0cbe58bab7c4a3 Mon Sep 17 00:00:00 2001 From: Christoffer Adamsen Date: Fri, 17 Jan 2025 04:34:59 -0800 Subject: [PATCH] Do not keep runtime invisible annotations in proguard.flags This updates the corresponding Android.bp file to keep the runtime invisible annotations, meaning this should be a no-op. When RELEASE_R8_ONLY_RUNTIME_VISIBLE_ANNOTATIONS is enabled, keep_runtime_invisible_annotations will become a no-op, which should lead to all runtime invisible annotations being stripped from this build. Bug: 387958004 Change-Id: Ib0090cd30d44630a1b0a1d1f0605edb7fef8c5cf Test: existing --- Android.bp | 2 ++ proguard.flags | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Android.bp b/Android.bp index fd0ed55..05fd866 100644 --- a/Android.bp +++ b/Android.bp @@ -32,6 +32,7 @@ messaging_java_defaults { soong_config_variables: { build_variant_eng: { optimize: { + keep_runtime_invisible_annotations: true, proguard_flags_files: [ "proguard.flags", "proguard-test.flags", @@ -39,6 +40,7 @@ messaging_java_defaults { }, conditions_default: { optimize: { + keep_runtime_invisible_annotations: true, proguard_flags_files: [ "proguard.flags", "proguard-release.flags", diff --git a/proguard.flags b/proguard.flags index 5531a9c..9c4c022 100644 --- a/proguard.flags +++ b/proguard.flags @@ -14,7 +14,12 @@ # # Keep enough data for stack traces -renamesourcefileattribute SourceFile --keepattributes SourceFile,LineNumberTable,*Annotation* +-keepattributes SourceFile, + LineNumberTable, + RuntimeVisibleAnnotations, + RuntimeVisibleParameterAnnotations, + RuntimeVisibleTypeAnnotations, + AnnotationDefault # Keep classes and methods that have the guava @VisibleForTesting annotation # TODO(b/373579455): Evaluate if needs to be kept.