diff options
| author | 2023-11-03 02:02:49 +0000 | |
|---|---|---|
| committer | 2023-11-10 19:20:13 +0000 | |
| commit | d7769efa6fe91c52193ac293b1ac453b769a7665 (patch) | |
| tree | f292ae25f961aff9a6c6d12698723a70d90b57cf | |
| parent | ce9e0e7533467aa93436bba40d4c88b4df6a9a7a (diff) | |
Ensure inner classes of @SystemApi classes are kept
There are several cases where inner classes of @SystemApi-annotated
classes should be kept, but aren't. Add a conditional rule to ensure
this. This is probably overly conservative, but for now should avoid
issues with optimization.
A follow-up change will refactor this to reuse the rules in
system-api.pro, but that requires a bit of build file surgery first.
Bug: 300514883
Change-Id: Ibd561a9098881db1c7e78346d60f4c91d9c75894
Test: m + check services.jar dex diff
| -rw-r--r-- | services/proguard.flags | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/services/proguard.flags b/services/proguard.flags index e11e613adb5c..57afac308dc9 100644 --- a/services/proguard.flags +++ b/services/proguard.flags @@ -14,13 +14,20 @@ } # APIs referenced by dependent JAR files and modules --keep @interface android.annotation.SystemApi +# TODO(b/300514883): Pull @SystemApi keep rules from system-api.pro. +-keep interface android.annotation.SystemApi -keep @android.annotation.SystemApi class * { public protected *; } -keepclasseswithmembers class * { @android.annotation.SystemApi *; } +# Also ensure nested classes are kept. This is overly conservative, but handles +# cases where such classes aren't explicitly marked @SystemApi. +-if @android.annotation.SystemApi class * +-keep public class <1>$** { + public protected *; +} # Derivatives of SystemService and other services created via reflection -keep,allowoptimization,allowaccessmodification class * extends com.android.server.SystemService { |