summaryrefslogtreecommitdiffstats
path: root/chrome/android/java/proguard.flags
blob: 188c70dbaa00c1c3ec46058d801712359c1c79b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# 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 *;
}

# Keep code annotated with the following annotations.
-keep class com.google.android.apps.chrome.**,org.chromium.** {
  @**.AccessedByNative <fields>;
  @**.CalledByNative <methods>;
  @**.CalledByNativeUnchecked <methods>;
  @**.JavascriptInterface <methods>;
  @**.NativeCall <methods>;
  @**.UsedByReflection <methods>;
  @**.VisibleForTesting *;
  native <methods>;
}

# 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**

# TODO(yfriedman): Remove when crbug.com/488192 is fixed.
-dontwarn org.apache.http.**

# 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.**

# Everything below this is kept because they are referenced by the test APK.
-dontwarn javax.annotation.Nullable

-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.AlertDialog** {
  *;
}

-keep class com.google.android.gms.cast.CastMediaControlIntent* {
  *;
}

-keepnames class com.google.android.gms.gcm.** {
  *;
}

-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);
}

# TODO(aurimas): remove this when Google Play Services no longer uses setLatestEventInfo call
# that was deprecated in Android M. It is save to suppress this according to b/18510449.
-dontwarn android.app.Notification

# IntentUtils uses reflection to access a method that is hidden until API level 18.
-dontnote org.chromium.chrome.browser.util.IntentUtils

# Needed to compile ChromeTest.apk
-keep class android.support.customtabs.ICustomTabsCallback** {
  *;
}

#-keep public class android.net.http.SslCertificate
#-keep public class android.webkit.WebVie

#-dontwarn android.webkit.WebView
-dontwarn android.net.http.SslCertificate

# Needed for assertions in BaseChromiumApplication.
# TODO(twellington): Remove these two lines when support for detecting a debug
# build lands (https://codereview.chromium.org/1597273005/).
-keep class android.support.v7.app.ToolbarActionBar$ToolbarCallbackWrapper {*;}
-keep class android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper {*;}