Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Keep line number information, useful for stack traces. | |
| 2 -keepattributes SourceFile,LineNumberTable | |
| 3 | |
| 4 # Keep the annotations. | |
| 5 -keep @interface *** | |
| 6 | |
| 7 # Disable obfuscation for the following two packages. | 1 # Disable obfuscation for the following two packages. |
| 8 -keepnames class com.google.android.apps.chrome.**,org.chromium.** { | 2 -keepnames class com.google.android.apps.chrome.**,org.chromium.** { |
| 9 *; | 3 *; |
| 10 } | 4 } |
| 11 | 5 |
| 12 # Fragments are loaded using reflection via Fragment.instantiate(Context,String) | 6 # Fragments are loaded using reflection via Fragment.instantiate(Context,String) |
| 13 # This can be improved upon - see crbug.com/622023. | 7 # This can be improved upon - see crbug.com/622023. |
| 14 -keep public class com.google.android.apps.chrome** extends android.app.Fragment | 8 -keep public class com.google.android.apps.chrome** extends android.app.Fragment |
| 15 -keep public class org.chromium** extends android.app.Fragment | 9 -keep public class org.chromium** extends android.app.Fragment |
| 16 | 10 |
| 17 # Keeps for class level annotations. | 11 # Keeping all our native methods |
| 18 -keep @**.UsedByReflection class * | 12 -keepclasseswithmembers,includedescriptorclasses class com.google.android.apps.c hrome.** { |
|
agrieve
2016/07/18 18:02:21
I think it might be better to have the version of
smaier
2016/07/18 18:50:09
Done.
| |
| 19 -keep @**.VisibleForTesting class * | |
| 20 | |
| 21 # Keeps for method level annotations. | |
| 22 -keepclasseswithmembers class com.google.android.apps.chrome.** { | |
| 23 @**.AccessedByNative <fields>; | |
| 24 } | |
| 25 -keepclasseswithmembers class com.google.android.apps.chrome.** { | |
| 26 @**.CalledByNative <methods>; | |
| 27 } | |
| 28 -keepclasseswithmembers class com.google.android.apps.chrome.** { | |
| 29 @**.CalledByNativeUnchecked <methods>; | |
| 30 } | |
| 31 -keepclasseswithmembers class com.google.android.apps.chrome.** { | |
| 32 @**.JavascriptInterface <methods>; | |
| 33 } | |
| 34 -keepclasseswithmembers class com.google.android.apps.chrome.** { | |
| 35 @**.NativeCall <methods>; | |
| 36 } | |
| 37 -keepclasseswithmembers class com.google.android.apps.chrome.** { | |
| 38 @**.UsedByReflection <methods>; | |
| 39 } | |
| 40 -keepclasseswithmembers class com.google.android.apps.chrome.** { | |
| 41 @**.VisibleForTesting <methods>; | |
| 42 } | |
| 43 -keepclasseswithmembers class com.google.android.apps.chrome.** { | |
| 44 native <methods>; | 13 native <methods>; |
| 45 } | 14 } |
| 46 -keepclasseswithmembers class org.chromium.** { | |
| 47 @**.AccessedByNative <fields>; | |
| 48 } | |
| 49 -keepclasseswithmembers class org.chromium.** { | |
| 50 @**.CalledByNative <methods>; | |
| 51 } | |
| 52 -keepclasseswithmembers class org.chromium.** { | |
| 53 @**.CalledByNativeUnchecked <methods>; | |
| 54 } | |
| 55 -keepclasseswithmembers class org.chromium.** { | |
| 56 @**.JavascriptInterface <methods>; | |
| 57 } | |
| 58 -keepclasseswithmembers class org.chromium.** { | |
| 59 @**.NativeCall <methods>; | |
| 60 } | |
| 61 -keepclasseswithmembers class org.chromium.** { | |
| 62 @**.UsedByReflection <methods>; | |
| 63 } | |
| 64 -keepclasseswithmembers class org.chromium.** { | |
| 65 @**.VisibleForTesting <methods>; | |
| 66 } | |
| 67 -keepclasseswithmembers class org.chromium.** { | |
| 68 native <methods>; | |
| 69 } | |
| 70 | |
| 71 # Class merging provides negligible .dex size reduction and method count | |
| 72 # reduction (about 0.3% improvement on method count, and 0.1% savings on size), | |
| 73 # and it messes up stack traces if the classes are optimized. Thus, it is in our | |
| 74 # best interests to turn it off. See crbug.com/620323 | |
| 75 -optimizations !class/merging/* | |
| 76 | |
| 77 # Keep all runtime visible annotations | |
| 78 -keepattributes RuntimeVisibleAnnotations | |
| 79 | |
| 80 # Remove methods annotated with this if their return value is unused | |
| 81 -assumenosideeffects class ** { | |
| 82 @org.chromium.base.annotations.RemovableInRelease <methods>; | |
| 83 } | |
| 84 | 15 |
| 85 # TODO(aurimas): figure out why we need to keep these classes. | 16 # TODO(aurimas): figure out why we need to keep these classes. |
| 86 -keep class org.chromium.base.test.** { | 17 -keep class org.chromium.base.test.** { |
| 87 *; | 18 *; |
| 88 } | 19 } |
| 89 | 20 |
| 90 # Keep protobuf code used via reflection | 21 # Keep protobuf code used via reflection |
| 91 # TODO(tonyg): Removing these -keeps results in new notes, but nothing seems to | 22 # TODO(tonyg): Removing these -keeps results in new notes, but nothing seems to |
| 92 # break. This exclusion costs almost 100k of dex size so consider replacing it | 23 # break. This exclusion costs almost 100k of dex size so consider replacing it |
| 93 # with a -dontnote after more testing. | 24 # with a -dontnote after more testing. |
| 94 -keep class com.google.protobuf.** { | 25 -keep class com.google.protobuf.** { |
| 95 *** newBuilder(); | 26 *** newBuilder(); |
| 96 *** parseFrom(java.io.InputStream); | 27 *** parseFrom(java.io.InputStream); |
| 97 } | 28 } |
| 98 | 29 |
| 99 # Keep the client interfaces for cacheinvalidation as they are used as | 30 # Keep the client interfaces for cacheinvalidation as they are used as |
| 100 # argument types for some of our code that we're keeping and proguard warns | 31 # argument types for some of our code that we're keeping and proguard warns |
| 101 # otherwise. | 32 # otherwise. |
| 102 -keep class com.google.ipc.invalidation.external.client.** { | 33 -keep class com.google.ipc.invalidation.external.client.** { |
| 103 *; | 34 *; |
| 104 } | 35 } |
| 105 | 36 |
| 106 # Keep all enum values and valueOf methods. See | |
| 107 # http://proguard.sourceforge.net/index.html#manual/examples.html | |
| 108 # for the reason for this. Also, see http://crbug.com/248037. | |
| 109 -keepclassmembers enum * { | |
| 110 public static **[] values(); | |
| 111 public static ** valueOf(java.lang.String); | |
| 112 } | |
| 113 | |
| 114 # Keep all Parcelables as they might be marshalled outside Chrome. | 37 # Keep all Parcelables as they might be marshalled outside Chrome. |
| 115 -keepnames class * implements android.os.Parcelable { | 38 -keepnames class * implements android.os.Parcelable { |
| 116 public static final ** CREATOR; | 39 public static final ** CREATOR; |
| 117 } | 40 } |
| 118 | 41 |
| 119 # SearchView is used in website_preferences_menu.xml and is constructed by | 42 # SearchView is used in website_preferences_menu.xml and is constructed by |
| 120 # Android using reflection. | 43 # Android using reflection. |
| 121 -keep class android.support.v7.widget.SearchView { | 44 -keep class android.support.v7.widget.SearchView { |
| 122 public <init>(...); | 45 public <init>(...); |
| 123 } | 46 } |
| 124 | 47 |
| 125 # Google Play Services warnings are about its resources. | 48 # Google Play Services warnings are about its resources. |
| 126 -dontwarn com.google.android.gms.R** | 49 -dontwarn com.google.android.gms.R** |
| 127 | 50 |
| 128 # The support library contains references to newer platform versions. | 51 # The support library contains references to newer platform versions. |
| 129 # Don't warn about those in case this app is linking against an older | 52 # Don't warn about those in case this app is linking against an older |
| 130 # platform version. We know about them, and they are safe. | 53 # platform version. We know about them, and they are safe. |
| 131 -dontwarn android.support.** | 54 -dontwarn android.support.** |
| 132 | 55 |
| 133 # Proguard mistakenly optimizes away some null checks on final fields | 56 # Proguard mistakenly optimizes away some null checks on final fields |
| 134 # in the support library. | 57 # in the support library. |
| 135 # See https://sourceforge.net/p/proguard/bugs/531/#fdc9/41e2 | 58 # See https://sourceforge.net/p/proguard/bugs/531/#fdc9/41e2 |
| 136 -keepclassmembers,allowshrinking,allowobfuscation class android.support.v7.widge t.AppCompatButton { | 59 -keepclassmembers,allowshrinking,allowobfuscation class android.support.v7.widge t.AppCompatButton { |
| 137 !static final <fields>; | 60 !static final <fields>; |
| 138 } | 61 } |
| 139 | 62 |
| 140 # Allowing Proguard to change modifiers. This change shrinks the .dex size by | |
| 141 # ~1.1%, and reduces the method count by ~4.3%. | |
| 142 -allowaccessmodification | |
| 143 | |
| 144 # Allows Proguard freedom in removing these log related calls. We ask for debug | |
| 145 # and verbose logs to be stripped out in base.Log, so we are just ensuring we | |
| 146 # get rid of all other debug/verbose logs. | |
| 147 -assumenosideeffects class android.util.Log { | |
| 148 static *** d(...); | |
| 149 static *** v(...); | |
| 150 static *** isLoggable(...); | |
| 151 } | |
| 152 | |
| 153 # Everything below this is kept because they are referenced by the test APK. | 63 # Everything below this is kept because they are referenced by the test APK. |
| 154 -keep class android.support.v7.mediarouter.R* { | 64 -keep class android.support.v7.mediarouter.R* { |
| 155 *; | 65 *; |
| 156 } | 66 } |
| 157 | 67 |
| 158 -keep class android.support.v7.media.MediaRouteProvider** { | 68 -keep class android.support.v7.media.MediaRouteProvider** { |
| 159 *; | 69 *; |
| 160 } | 70 } |
| 161 | 71 |
| 162 -keep class android.support.v4.app.FragmentManager** { | 72 -keep class android.support.v4.app.FragmentManager** { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 184 } | 94 } |
| 185 | 95 |
| 186 -keepclassmembers class com.google.android.gms.gcm.TaskParams { | 96 -keepclassmembers class com.google.android.gms.gcm.TaskParams { |
| 187 public <init>(java.lang.String); | 97 public <init>(java.lang.String); |
| 188 } | 98 } |
| 189 | 99 |
| 190 -keepnames class jp.tomorrowkey.android.gifplayer.** { | 100 -keepnames class jp.tomorrowkey.android.gifplayer.** { |
| 191 public *; | 101 public *; |
| 192 } | 102 } |
| 193 | 103 |
| 104 # Keeping @VisibleForTesting and its annotated classes + methods | |
| 105 -keep @interface org.chromium.base.VisibleForTesting | |
| 106 -keep @org.chromium.base.VisibleForTesting class ** | |
| 107 -keepclasseswithmembers class * { | |
| 108 @org.chromium.base.VisibleForTesting <methods>; | |
| 109 } | |
| 110 | |
| 194 # Used in tests. | 111 # Used in tests. |
| 195 -keep class android.support.v4.view.ViewCompat { | 112 -keep class android.support.v4.view.ViewCompat { |
| 196 public static int getLayoutDirection(android.view.View); | 113 public static int getLayoutDirection(android.view.View); |
| 197 } | 114 } |
| 198 | 115 |
| 199 # flingViewport is used by Android WebView and a Chrome test. | 116 # flingViewport is used by Android WebView and a Chrome test. |
| 200 -keepclassmembers class org.chromium.content.browser.ContentViewCore { | 117 -keepclassmembers class org.chromium.content.browser.ContentViewCore { |
| 201 public void flingViewport(long, int, int); | 118 public void flingViewport(long, int, int); |
| 202 } | 119 } |
| 203 | 120 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 217 # Needed for chrome_sync_shell_test_apk. Note - these do no affect chrome_apk's | 134 # Needed for chrome_sync_shell_test_apk. Note - these do no affect chrome_apk's |
| 218 # size. | 135 # size. |
| 219 -keep class org.chromium.sync.protocol.* { *; } | 136 -keep class org.chromium.sync.protocol.* { *; } |
| 220 | 137 |
| 221 # These resources are referenced in tests, but not in the real application. | 138 # These resources are referenced in tests, but not in the real application. |
| 222 -keepclassmembers class org.chromium.chrome.R$id { | 139 -keepclassmembers class org.chromium.chrome.R$id { |
| 223 int webapp_splash_space; | 140 int webapp_splash_space; |
| 224 int mr_chooser_list; | 141 int mr_chooser_list; |
| 225 int find_toolbar; | 142 int find_toolbar; |
| 226 } | 143 } |
| OLD | NEW |