# Copyright 2016 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Contains flags that we'd like all Chromium .apks to use. # Keep line number information, useful for stack traces. -keepattributes SourceFile,LineNumberTable # Enable protobuf-related optimizations. -shrinkunusedprotofields # Allowing Proguard to change modifiers. -allowaccessmodification # Keep all CREATOR fields within Parcelable that are kept. -keepclassmembers class * implements android.os.Parcelable { public static *** CREATOR; } # Keep all default constructors for used Fragments. Required since they are # called reflectively when fragments are reinflated after the app is killed. -keepclassmembers class * extends android.app.Fragment { public (); } -keepclassmembers class * extends androidx.fragment.app.Fragment { public (); } # AndroidX classes that are inflated via reflection. -keep public class androidx.preference.Preference { public (android.content.Context, android.util.AttributeSet); } -keep public class androidx.preference.PreferenceScreen { public (android.content.Context, android.util.AttributeSet); } -keep public class androidx.preference.PreferenceCategory { public (android.content.Context, android.util.AttributeSet); } -keep public class androidx.preference.ListPreference { public (android.content.Context, android.util.AttributeSet); } # SearchView is used in website_preferences_menu.xml and is constructed by # Android using reflection. -keep class androidx.appcompat.widget.SearchView { public (...); } # Referenced by androidx.preference.PreferenceInflater. -keep public class androidx.preference.SwitchPreference {} # Don't obfuscate Parcelables as they might be marshalled outside Chrome. # If we annotated all Parcelables that get put into Bundles other than # for saveInstanceState (e.g. PendingIntents), then we could actually keep the # names of just those ones. For now, we'll just keep them all. -keepnames class * implements android.os.Parcelable {} # Keep all enum values and valueOf methods. See # http://proguard.sourceforge.net/index.html#manual/examples.html # for the reason for this. Also, see http://crbug.com/248037. -keepclassmembers enum * { public static **[] values(); } # This is to workaround crbug.com/1204690 - an old GMS app version crashes when # ObjectWrapper contains > 1 fields, and this prevents R8 from inserting a # synthetic field. -keep,allowaccessmodification class com.google.android.gms.dynamic.ObjectWrapper { ; } # Remove calls to String.format() where the result goes unused. This can mask # exceptions if the parameters to String.format() are invalid, but such cases # are generally programming bugs anyways. # Not using the return value generally occurs due to logging being stripped. -assumenosideeffects class java.lang.String { static java.lang.String format(...); } # Allows R8 to remove static field accesses to library APIs when the results # are unused (E.g. tell it that it's okay to not trigger ). # Not using the return value generally occurs due to logging being stripped. -assumenosideeffects class android.**, java.** { static ; }