blob: 981acaedd25b3eb73646c7b02f87ddc2b3c4dca9 [file] [log] [blame]
# 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 !cr_allowunused,** implements android.os.Parcelable {
public static *** CREATOR;
}
# 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 !cr_allowunused,** implements android.os.Parcelable {}
# Keep all default constructors for used Fragments. Required since they are
# called reflectively when fragments are reinflated after the app is killed.
-keepclassmembers class !cr_allowunused,** extends android.app.Fragment {
public <init>();
}
-keepclassmembers class !cr_allowunused,** extends androidx.fragment.app.Fragment {
public <init>();
}
# 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 !cr_allowunused,** {
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 !cr_allowunused,com.google.android.gms.dynamic.ObjectWrapper {
<fields>;
}
# 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 <clinit>).
# Not using the return value generally occurs due to logging being stripped.
-assumenosideeffects class android.**, java.** {
static <fields>;
}
# Keep the names of exception types, to make it easier to understand stack
# traces in contexts where it's not trivial to deobfuscate them - for example
# when reported to app developers who are using WebView.
-keepnames class ** extends java.lang.Throwable {}