Keep all subclasses of PreferenceFragmentCompat (#3162)

* Mark *PreferencesFragment as @Keep

PreferenceFragment references them by string name, which doesn't work after
ProGuard has obfuscated the code in release mode. The name is no longer
valid and the app crashes.

Fixes https://github.com/tuskyapp/Tusky/issues/3161

* Prefer to keep Preference classes with a Proguard rule

Ensures that all PreferenceFragmentCompat are kept, to prevent the risk
that this could break in a new fragment where `@Keep` is accidentally
omitted.
This commit is contained in:
Nik Clayton 2023-01-13 19:51:42 +01:00 committed by GitHub
parent d6e7905e01
commit f28252bfd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -111,3 +111,7 @@
static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String); static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String);
static void throwUninitializedPropertyAccessException(java.lang.String); static void throwUninitializedPropertyAccessException(java.lang.String);
} }
# Preference fragments can be referenced by name, ensure they remain
# https://github.com/tuskyapp/Tusky/issues/3161
-keep class * extends androidx.preference.PreferenceFragmentCompat