Refine Settings proguard rules

Avoid keeping unused library classes and remove several redundant rules.
This saves ~700KB dex and a modest amount of Jetpack resources that are
no longer referenced.

Bug: 248580093
Test: m + presubmit + atest SettingsUnitTests
Change-Id: Ic2398345a35117ccab433d2fd1c31c0f453ed77c
This commit is contained in:
Jared Duke
2022-09-19 14:57:35 -07:00
parent 69202cf960
commit 4c8bae742b

View File

@@ -6,7 +6,7 @@
-keepattributes Exceptions
# Keep all Fragments in this package, which are used by reflection.
-keep public class com.android.settings.** extends androidx.fragment.app.Fragment
-keep public class com.android.settings*.** extends androidx.fragment.app.Fragment
# Keep all preference controllers needed by slice and DashboardFragment.
-keep class * extends com.android.settings.core.BasePreferenceController {
@@ -18,13 +18,13 @@
}
# We want to keep methods in Activity that could be used in the XML attribute onClick.
-keepclassmembers class * extends android.app.Activity {
-keepclassmembers class com.android.settings*.** extends android.app.Activity {
public void *(android.view.View);
public void *(android.view.MenuItem);
}
# Keep setters in Views so that animations can still work.
-keep public class * extends android.view.View {
-keep public class com.android.settings*.** extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
@@ -34,22 +34,16 @@
}
# Keep classes that may be inflated from XML.
-keepclasseswithmembers class * {
-keepclasseswithmembers class com.android.settings*.** {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
-keepclasseswithmembers class com.android.settings*.** {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclasseswithmembers class * {
-keepclasseswithmembers class com.android.settings*.** {
public <init>(android.content.Context, android.util.AttributeSet, int, int);
}
# Keep annotated classes or class members.
-keep @androidx.annotation.Keep class *
-keepclassmembers class * {
@androidx.annotation.Keep *;
}
# Keep specific fields used via reflection.
-keepclassmembers class * {
public static ** SEARCH_INDEX_DATA_PROVIDER;