blob: 627ae0d1674e93830d93ece6921628613fedac48 [file] [log] [blame]
# Keep line number information, useful for stack traces.
-keepattributes SourceFile,LineNumberTable
# Keep the annotations.
-keep @interface ***
# Disable obfuscation for the following two packages.
-keepnames class com.google.android.apps.chrome.**,org.chromium.** {
*;
}
# Keep all the primitive and String constants for for the following two packages.
-keepclassmembers class com.google.android.apps.chrome.**,org.chromium.** {
!private static final % *;
!private static final java.lang.String *;
}
# Fragments are loaded using reflection via Fragment.instantiate(Context,String)
# This can be improved upon - see crbug.com/622023.
-keep public class com.google.android.apps.chrome** extends android.app.Fragment
-keep public class org.chromium** extends android.app.Fragment
# Keeps for class level annotations.
-keep @**.UsedByReflection class *
-keep @**.VisibleForTesting class *
# Keeps for method level annotations.
-keepclasseswithmembers class com.google.android.apps.chrome.** {
@**.AccessedByNative <fields>;
}
-keepclasseswithmembers class com.google.android.apps.chrome.** {
@**.CalledByNative <methods>;
}
-keepclasseswithmembers class com.google.android.apps.chrome.** {
@**.CalledByNativeUnchecked <methods>;
}
-keepclasseswithmembers class com.google.android.apps.chrome.** {
@**.JavascriptInterface <methods>;
}
-keepclasseswithmembers class com.google.android.apps.chrome.** {
@**.NativeCall <methods>;
}
-keepclasseswithmembers class com.google.android.apps.chrome.** {
@**.UsedByReflection <methods>;
}
-keepclasseswithmembers class com.google.android.apps.chrome.** {
@**.VisibleForTesting <methods>;
}
-keepclasseswithmembers class com.google.android.apps.chrome.** {
native <methods>;
}
-keepclasseswithmembers class org.chromium.** {
@**.AccessedByNative <fields>;
}
-keepclasseswithmembers class org.chromium.** {
@**.CalledByNative <methods>;
}
-keepclasseswithmembers class org.chromium.** {
@**.CalledByNativeUnchecked <methods>;
}
-keepclasseswithmembers class org.chromium.** {
@**.JavascriptInterface <methods>;
}
-keepclasseswithmembers class org.chromium.** {
@**.NativeCall <methods>;
}
-keepclasseswithmembers class org.chromium.** {
@**.UsedByReflection <methods>;
}
-keepclasseswithmembers class org.chromium.** {
@**.VisibleForTesting <methods>;
}
-keepclasseswithmembers class org.chromium.** {
native <methods>;
}
# Class merging provides negligible .dex size reduction and method count
# reduction (about 0.3% improvement on method count, and 0.1% savings on size),
# and it messes up stack traces if the classes are optimized. Thus, it is in our
# best interests to turn it off. See crbug.com/620323
-optimizations !class/merging/*
# Keep all runtime visible annotations
-keepattributes RuntimeVisibleAnnotations
# Remove methods annotated with this if their return value is unused
-assumenosideeffects class ** {
@org.chromium.base.annotations.RemovableInRelease <methods>;
}
# TODO(aurimas): figure out why we need to keep these classes.
-keep class org.chromium.base.test.** {
*;
}
# Keep protobuf code used via reflection
# TODO(tonyg): Removing these -keeps results in new notes, but nothing seems to
# break. This exclusion costs almost 100k of dex size so consider replacing it
# with a -dontnote after more testing.
-keep class com.google.protobuf.** {
*** newBuilder();
*** parseFrom(java.io.InputStream);
}
# Keep the client interfaces for cacheinvalidation as they are used as
# argument types for some of our code that we're keeping and proguard warns
# otherwise.
-keep class com.google.ipc.invalidation.external.client.** {
*;
}
# 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();
public static ** valueOf(java.lang.String);
}
# Keep all Parcelables as they might be marshalled outside Chrome.
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
# SearchView is used in website_preferences_menu.xml and is constructed by
# Android using reflection.
-keep class android.support.v7.widget.SearchView {
public <init>(...);
}
# Google Play Services warnings are about its resources.
-dontwarn com.google.android.gms.R**
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn android.support.**
# Proguard mistakenly optimizes away some null checks on final fields
# in the support library.
# See https://sourceforge.net/p/proguard/bugs/531/#fdc9/41e2
-keepclassmembers,allowshrinking,allowobfuscation class android.support.v7.widget.AppCompatButton {
!static final <fields>;
}
# Allowing Proguard to change modifiers. This change shrinks the .dex size by
# ~1.1%, and reduces the method count by ~4.3%.
-allowaccessmodification
# Allows Proguard freedom in removing these log related calls. We ask for debug
# and verbose logs to be stripped out in base.Log, so we are just ensuring we
# get rid of all other debug/verbose logs.
-assumenosideeffects class android.util.Log {
static *** d(...);
static *** v(...);
static *** isLoggable(...);
}
# Everything below this is kept because they are referenced by the test APK.
-keep class android.support.v7.mediarouter.R* {
*;
}
-keep class android.support.v7.media.MediaRouteProvider** {
*;
}
-keep class android.support.v4.app.FragmentManager** {
*;
}
-keep class android.support.v4.app.DialogFragment** {
*;
}
-keep class android.support.v7.app.NotificationCompat** {
*;
}
-keep class android.support.v7.app.AlertDialog** {
*;
}
-keep class com.google.android.gms.cast.CastMediaControlIntent* {
*;
}
-keepnames class com.google.android.gms.gcm.** {
*;
}
-keepclassmembers class com.google.android.gms.gcm.TaskParams {
public <init>(java.lang.String);
}
-keepnames class jp.tomorrowkey.android.gifplayer.** {
public *;
}
# Used in tests.
-keep class android.support.v4.view.ViewCompat {
public static int getLayoutDirection(android.view.View);
}
# flingViewport is used by Android WebView and a Chrome test.
-keepclassmembers class org.chromium.content.browser.ContentViewCore {
public void flingViewport(long, int, int);
}
# Needed to compile ChromeTest.apk
-keep class android.support.customtabs.** {
*;
}
# TODO(yfriedman): Remove when crbug.com/488192 is fixed.
-dontwarn org.apache.http.conn.scheme.LayeredSocketFactory
# Needed to run ChromeTest.apk
-keepnames class com.google.android.gms.common.GoogleApiAvailability {
*;
}
# Needed for chrome_sync_shell_test_apk. Note - these do no affect chrome_apk's
# size.
-keep class org.chromium.sync.protocol.* { *; }
# These resources are referenced in tests, but not in the real application.
-keepclassmembers class org.chromium.chrome.R$id {
int webapp_splash_space;
int mr_chooser_list;
int find_toolbar;
}