Bug 1821005 - Restore reverted Gradle 8 upgrade due to startup crashes"
[gecko.git] / mobile / android / fenix / app / proguard-rules.pro
blob982ef996de7b4f27e7bec4153725f6f2aeefa00c
1 -dontobfuscate
3 ####################################################################################################
4 # Sentry
5 ####################################################################################################
7 # Recommended config via https://docs.sentry.io/clients/java/modules/android/#manual-integration
8 # Since we don't obfuscate, we don't need to use their Gradle plugin to upload ProGuard mappings.
9 -keepattributes LineNumberTable,SourceFile
10 -dontwarn org.slf4j.**
11 -dontwarn javax.**
13 # Our addition: this class is saved to disk via Serializable, which ProGuard doesn't like.
14 # If we exclude this, upload silently fails (Sentry swallows a NPE so we don't crash).
15 # I filed https://github.com/getsentry/sentry-java/issues/572
17 # If Sentry ever mysteriously stops working after we upgrade it, this could be why.
18 -keep class io.sentry.event.Event { *; }
20 ####################################################################################################
21 # Android and GeckoView built-ins
22 ####################################################################################################
24 -dontwarn android.**
25 -dontwarn androidx.**
26 -dontwarn com.google.**
27 -dontwarn org.mozilla.geckoview.**
29 # Raptor now writes a *-config.yaml file to specify Gecko runtime settings (e.g. the profile dir). This
30 # file gets deserialized into a DebugConfig object, which is why we need to keep this class
31 # and its members.
32 -keep class org.mozilla.gecko.util.DebugConfig { *; }
34 ####################################################################################################
35 # kotlinx.coroutines: use the fast service loader to init MainDispatcherLoader by including a rule
36 # to rewrite this property to return true:
37 # https://github.com/Kotlin/kotlinx.coroutines/blob/8c98180f177bbe4b26f1ed9685a9280fea648b9c/kotlinx-coroutines-core/jvm/src/internal/MainDispatchers.kt#L19
39 # R8 is expected to optimize the default implementation to avoid a performance issue but a bug in R8
40 # as bundled with AGP v7.0.0 causes this optimization to fail so we use the fast service loader instead. See:
41 # https://github.com/mozilla-mobile/focus-android/issues/5102#issuecomment-897854121
43 # The fast service loader appears to be as performant as the R8 optimization so it's not worth the
44 # churn to later remove this workaround. If needed, the upstream fix is being handled in
45 # https://issuetracker.google.com/issues/196302685
46 ####################################################################################################
47 -assumenosideeffects class kotlinx.coroutines.internal.MainDispatcherLoader {
48 boolean FAST_SERVICE_LOADER_ENABLED return true;
51 ####################################################################################################
52 # Remove debug logs from release builds
53 ####################################################################################################
54 -assumenosideeffects class android.util.Log {
55 public static boolean isLoggable(java.lang.String, int);
56 public static int v(...);
57 public static int d(...);
60 ####################################################################################################
61 # Mozilla Application Services
62 ####################################################################################################
64 -keep class mozilla.appservices.** { *; }
66 ####################################################################################################
67 # ViewModels
68 ####################################################################################################
70 -keep class org.mozilla.fenix.**ViewModel { *; }
72 ####################################################################################################
73 # Adjust
74 ####################################################################################################
76 -keep public class com.adjust.sdk.** { *; }
77 -keep class com.google.android.gms.common.ConnectionResult {
78 int SUCCESS;
80 -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
81 com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
83 -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
84 java.lang.String getId();
85 boolean isLimitAdTrackingEnabled();
87 -keep public class com.android.installreferrer.** { *; }
88 -keep class dalvik.system.VMRuntime {
89 java.lang.String getRuntime();
91 -keep class android.os.Build {
92 java.lang.String[] SUPPORTED_ABIS;
93 java.lang.String CPU_ABI;
95 -keep class android.content.res.Configuration {
96 android.os.LocaledList getLocales();
97 java.util.Locale locale;
99 -keep class android.os.LocaleList {
100 java.util.Locale get(int);
103 # Keep code generated from Glean Metrics
104 -keep class org.mozilla.fenix.GleanMetrics.** { *; }
106 # Keep motionlayout internal methods
107 # https://github.com/mozilla-mobile/fenix/issues/2094
108 -keep class androidx.constraintlayout.** { *; }
110 # Keep adjust relevant classes
111 -keep class com.adjust.sdk.** { *; }
112 -keep class com.google.android.gms.common.ConnectionResult {
113 int SUCCESS;
115 -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
116 com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
118 -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
119 java.lang.String getId();
120 boolean isLimitAdTrackingEnabled();
122 -keep public class com.android.installreferrer.** { *; }
124 # Keep Android Lifecycle methods
125 # https://bugzilla.mozilla.org/show_bug.cgi?id=1596302
126 -keep class androidx.lifecycle.** { *; }
128 -dontwarn java.beans.BeanInfo
129 -dontwarn java.beans.FeatureDescriptor
130 -dontwarn java.beans.IntrospectionException
131 -dontwarn java.beans.Introspector
132 -dontwarn java.beans.PropertyDescriptor