2018-08-16 04:46:37 +10:00
|
|
|
# GENERAL OPTIONS
|
|
|
|
|
|
|
|
# turn on all optimizations except those that are known to cause problems on Android
|
|
|
|
-optimizations !code/simplification/cast,!field/*,!class/merging/*
|
|
|
|
-optimizationpasses 6
|
|
|
|
-allowaccessmodification
|
|
|
|
-dontpreverify
|
|
|
|
|
|
|
|
-dontusemixedcaseclassnames
|
|
|
|
-dontskipnonpubliclibraryclasses
|
|
|
|
-keepattributes *Annotation*
|
|
|
|
|
|
|
|
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
|
|
|
|
-keepclasseswithmembernames class * {
|
|
|
|
native <methods>;
|
|
|
|
}
|
|
|
|
# keep setters in Views so that animations can still work.
|
|
|
|
# see http://proguard.sourceforge.net/manual/examples.html#beans
|
|
|
|
-keepclassmembers public class * extends android.view.View {
|
2020-06-05 04:17:07 +10:00
|
|
|
void set*(***);
|
|
|
|
*** get*();
|
2018-08-16 04:46:37 +10:00
|
|
|
}
|
|
|
|
# We want to keep methods in Activity that could be used in the XML attribute onClick
|
|
|
|
-keepclassmembers class * extends android.app.Activity {
|
2020-06-05 04:17:07 +10:00
|
|
|
public void *(android.view.View);
|
2018-08-16 04:46:37 +10:00
|
|
|
}
|
|
|
|
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
|
|
|
|
-keepclassmembers enum * {
|
|
|
|
public static **[] values();
|
|
|
|
public static ** valueOf(java.lang.String);
|
|
|
|
}
|
|
|
|
-keepclassmembers class * implements android.os.Parcelable {
|
2020-06-05 04:17:07 +10:00
|
|
|
public static final ** CREATOR;
|
2018-08-16 04:46:37 +10:00
|
|
|
}
|
|
|
|
|
2022-01-21 07:10:32 +11:00
|
|
|
-keepclassmembers class **.R$* {
|
|
|
|
public static <fields>;
|
|
|
|
}
|
|
|
|
|
2018-08-16 04:46:37 +10:00
|
|
|
# TUSKY SPECIFIC OPTIONS
|
2017-04-08 08:08:51 +10:00
|
|
|
|
2020-06-05 04:17:07 +10:00
|
|
|
# keep members of our model classes, they are used in json de/serialization
|
|
|
|
-keepclassmembers class com.keylesspalace.tusky.entity.* { *; }
|
2017-04-08 08:08:51 +10:00
|
|
|
|
|
|
|
-keep public enum com.keylesspalace.tusky.entity.*$** {
|
|
|
|
**[] $VALUES;
|
|
|
|
public *;
|
|
|
|
}
|
|
|
|
|
2022-02-15 05:20:15 +11:00
|
|
|
-keepclassmembers class com.keylesspalace.tusky.components.conversation.ConversationAccountEntity { *; }
|
|
|
|
-keepclassmembers class com.keylesspalace.tusky.db.DraftAttachment { *; }
|
|
|
|
|
2021-01-26 02:23:43 +11:00
|
|
|
-keep enum com.keylesspalace.tusky.db.DraftAttachment$Type {
|
|
|
|
public *;
|
|
|
|
}
|
|
|
|
|
2022-01-21 07:10:32 +11:00
|
|
|
# https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg
|
2022-01-22 04:26:57 +11:00
|
|
|
|
|
|
|
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
|
|
|
|
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
|
|
|
|
-keep class * extends com.google.gson.TypeAdapter
|
|
|
|
-keep class * implements com.google.gson.TypeAdapterFactory
|
|
|
|
-keep class * implements com.google.gson.JsonSerializer
|
|
|
|
-keep class * implements com.google.gson.JsonDeserializer
|
|
|
|
|
2022-01-21 07:10:32 +11:00
|
|
|
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
|
|
|
|
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
|
|
|
|
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
|
|
|
|
|
|
|
|
# Retain generic signatures of classes used in MastodonApi so Retrofit works
|
|
|
|
-keep,allowobfuscation,allowshrinking class io.reactivex.rxjava3.core.Single
|
|
|
|
-keep,allowobfuscation,allowshrinking class retrofit2.Response
|
|
|
|
-keep,allowobfuscation,allowshrinking class kotlin.collections.List
|
|
|
|
-keep,allowobfuscation,allowshrinking class kotlin.collections.Map
|
|
|
|
-keep,allowobfuscation,allowshrinking class retrofit2.Call
|
|
|
|
|
2022-02-10 06:46:13 +11:00
|
|
|
# https://r8.googlesource.com/r8/+/refs/heads/master/compatibility-faq.md#retrofit
|
|
|
|
-keepattributes Signature
|
|
|
|
-keep class kotlin.coroutines.Continuation
|
|
|
|
|
2023-02-26 07:40:13 +11:00
|
|
|
# We can remove these rules after updating to OkHttp 4.10.1
|
|
|
|
# https://github.com/square/okhttp/blob/339732e3a1b78be5d792860109047f68a011b5eb/okhttp/src/jvmMain/resources/META-INF/proguard/okhttp3.pro#L11-L14
|
|
|
|
-dontwarn okhttp3.internal.platform.**
|
|
|
|
-dontwarn org.conscrypt.**
|
|
|
|
-dontwarn org.bouncycastle.**
|
|
|
|
-dontwarn org.openjsse.**
|
|
|
|
|
2017-04-08 08:08:51 +10:00
|
|
|
# preserve line numbers for crash reporting
|
|
|
|
-keepattributes SourceFile,LineNumberTable
|
2018-08-16 04:46:37 +10:00
|
|
|
-renamesourcefileattribute SourceFile
|
2017-04-08 08:08:51 +10:00
|
|
|
|
2022-05-19 15:19:16 +10:00
|
|
|
# Bouncy Castle -- Keep EC
|
|
|
|
-keep class org.bouncycastle.jcajce.provider.asymmetric.EC$* { *; }
|
|
|
|
-keep class org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi$EC
|
|
|
|
|
2017-04-08 08:08:51 +10:00
|
|
|
# remove all logging from production apk
|
2017-08-12 03:19:35 +10:00
|
|
|
-assumenosideeffects class android.util.Log {
|
|
|
|
public static *** getStackTraceString(...);
|
|
|
|
public static *** d(...);
|
|
|
|
public static *** w(...);
|
|
|
|
public static *** v(...);
|
|
|
|
public static *** i(...);
|
|
|
|
}
|
2020-09-02 20:27:51 +10:00
|
|
|
-assumenosideeffects class java.lang.String {
|
|
|
|
public static java.lang.String format(...);
|
|
|
|
}
|
2018-03-02 05:01:44 +11:00
|
|
|
|
|
|
|
# remove some kotlin overhead
|
|
|
|
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
|
2021-06-12 04:50:42 +10:00
|
|
|
static void checkNotNull(java.lang.Object);
|
|
|
|
static void checkNotNull(java.lang.Object, java.lang.String);
|
2018-03-02 05:01:44 +11:00
|
|
|
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
|
2021-06-12 04:50:42 +10:00
|
|
|
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
|
|
|
|
static void checkNotNullParameter(java.lang.Object, java.lang.String);
|
2018-12-18 09:15:31 +11:00
|
|
|
static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String);
|
2021-06-12 04:50:42 +10:00
|
|
|
static void checkNotNullExpressionValue(java.lang.Object, java.lang.String);
|
|
|
|
static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String);
|
|
|
|
static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String);
|
2018-12-18 09:15:31 +11:00
|
|
|
static void throwUninitializedPropertyAccessException(java.lang.String);
|
2018-03-02 05:01:44 +11:00
|
|
|
}
|
2023-01-14 05:51:42 +11:00
|
|
|
|
|
|
|
# Preference fragments can be referenced by name, ensure they remain
|
|
|
|
# https://github.com/tuskyapp/Tusky/issues/3161
|
|
|
|
-keep class * extends androidx.preference.PreferenceFragmentCompat
|