Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bd749bf authored by Jared Duke's avatar Jared Duke
Browse files

Generalize @Keep annotation Proguard rules

Consolidate the Proguard rules for @Keep annotations for:
  * android.support.annotation.Keep (existing)
  * androidx.annotation.Keep (existing)
  * com.android.internal.annotation.Keep (new)

This ensures consistent semantics for clients using these annotations
across the codebase. Ideally there would be a single annotation, but
the support libraries are not available everywhere. In practice, this
change should be a no-op.

Bug: 210510433
Test: m + validate identical artifact sizes
Change-Id: Iab494e03269e5758d7f860331e971826ecc08cdd
parent 95ec3b89
Loading
Loading
Loading
Loading
+9 −20
Original line number Diff line number Diff line
@@ -15,35 +15,24 @@
@**.VisibleForTesting *;
}

# Understand the @Keep support annotation.
-keep class android.support.annotation.Keep
-keep class androidx.annotation.Keep
# Understand the common @Keep annotation from various Android packages:
#  * android.support.annotation
#  * androidx.annotation
#  * com.android.internal.annotations
-keep class **android**.annotation*.Keep

-keep @android.support.annotation.Keep class * {*;}
-keep @androidx.annotation.Keep class * {*;}
-keep @**android**.annotation*.Keep class * { *; }

-keepclasseswithmembers class * {
    @android.support.annotation.Keep <methods>;
    @**android**.annotation*.Keep <methods>;
}

-keepclasseswithmembers class * {
    @androidx.annotation.Keep <methods>;
    @**android**.annotation*.Keep <fields>;
}

-keepclasseswithmembers class * {
    @android.support.annotation.Keep <fields>;
}

-keepclasseswithmembers class * {
    @androidx.annotation.Keep <fields>;
}

-keepclasseswithmembers class * {
    @android.support.annotation.Keep <init>(...);
}

-keepclasseswithmembers class * {
    @androidx.annotation.Keep <init>(...);
    @**android**.annotation*.Keep <init>(...);
}

-include proguard_basic_keeps.flags