| OLD | NEW |
| 1 # As of August 11, 2016, obfuscation was tested and passed on the trybots, |
| 2 # saving us 660kb on our .dex size and 53kb memory/process. Enable obfuscation |
| 3 # as soon as Crash supports ReTrace's deobfuscation of stack traces. |
| 4 # |
| 5 # To enable obfuscation, remove the -keepnames rule for |
| 6 # com.google.android.apps.chrome.** and org.chromium.**, and uncomment the |
| 7 # following two lines: |
| 8 # -renamesourcefileattribute PG |
| 9 # -repackageclasses "" |
| 10 |
| 1 # Disable obfuscation for the following two packages. | 11 # Disable obfuscation for the following two packages. |
| 2 -keepnames,allowoptimization class com.google.android.apps.chrome.**,org.chromiu
m.** { | 12 -keepnames,allowoptimization class com.google.android.apps.chrome.**,org.chromiu
m.** { |
| 3 *; | 13 *; |
| 4 } | 14 } |
| 5 | 15 |
| 6 # Fragments are loaded using reflection via Fragment.instantiate(Context,String) | 16 # Fragments are loaded using reflection via Fragment.instantiate(Context,String) |
| 7 # This can be improved upon - see crbug.com/622023. | 17 # This can be improved upon - see crbug.com/622023. |
| 8 -keep public class com.google.android.apps.chrome** extends android.app.Fragment | 18 -keep public class com.google.android.apps.chrome** extends android.app.Fragment |
| 9 -keep public class org.chromium** extends android.app.Fragment | 19 -keep public class org.chromium** extends android.app.Fragment |
| 10 | 20 |
| 11 # Keep protobuf code used via reflection | 21 # Keep protobuf code used via reflection |
| 12 # 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 |
| 13 # 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 |
| 14 # with a -dontnote after more testing. | 24 # with a -dontnote after more testing. |
| 15 -keep class com.google.protobuf.** { | 25 -keep class com.google.protobuf.** { |
| 16 *** newBuilder(); | 26 *** newBuilder(); |
| 17 *** parseFrom(java.io.InputStream); | 27 *** parseFrom(java.io.InputStream); |
| 18 } | 28 } |
| 19 | 29 |
| 20 # Keep the client interfaces for cacheinvalidation as they are used as | 30 # Keep the client interfaces for cacheinvalidation as they are used as |
| 21 # 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 |
| 22 # otherwise. | 32 # otherwise. |
| 23 -keep class com.google.ipc.invalidation.external.client.** { | 33 -keep class com.google.ipc.invalidation.external.client.** { |
| 24 *; | 34 *; |
| 25 } | 35 } |
| 26 | 36 |
| 37 # These classes aren't themselves referenced, but __ProcessService[0,1,2...] are |
| 38 # referenced, and we look up these services by appending a number onto the name |
| 39 # of the base class. Thus, we need to keep the base class name around so that |
| 40 # the child classes can be looked up. |
| 41 -keep class org.chromium.content.app.SandboxedProcessService |
| 42 -keep class org.chromium.content.app.PrivilegedProcessService |
| 43 |
| 27 # Keep all Parcelables as they might be marshalled outside Chrome. | 44 # Keep all Parcelables as they might be marshalled outside Chrome. |
| 28 -keepnames class * implements android.os.Parcelable { | 45 -keepnames class * implements android.os.Parcelable { |
| 29 public static final ** CREATOR; | 46 public static final ** CREATOR; |
| 30 } | 47 } |
| 31 | 48 |
| 32 # SearchView is used in website_preferences_menu.xml and is constructed by | 49 # SearchView is used in website_preferences_menu.xml and is constructed by |
| 33 # Android using reflection. | 50 # Android using reflection. |
| 34 -keep class android.support.v7.widget.SearchView { | 51 -keep class android.support.v7.widget.SearchView { |
| 35 public <init>(...); | 52 public <init>(...); |
| 36 } | 53 } |
| 37 | 54 |
| 38 # Google Play Services warnings are about its resources. | 55 # Google Play Services warnings are about its resources. |
| 39 -dontwarn com.google.android.gms.R** | 56 -dontwarn com.google.android.gms.R** |
| 40 | 57 |
| 41 # The support library contains references to newer platform versions. | 58 # The support library contains references to newer platform versions. |
| 42 # Don't warn about those in case this app is linking against an older | 59 # Don't warn about those in case this app is linking against an older |
| 43 # platform version. We know about them, and they are safe. | 60 # platform version. We know about them, and they are safe. |
| 44 -dontwarn android.support.** | 61 -dontwarn android.support.** |
| 45 | 62 |
| 46 # Proguard mistakenly optimizes away some null checks on final fields | 63 # Proguard mistakenly optimizes away some null checks on final fields |
| 47 # in the support library. | 64 # in the support library. |
| 48 # See https://sourceforge.net/p/proguard/bugs/531/#fdc9/41e2 | 65 # See https://sourceforge.net/p/proguard/bugs/531/#fdc9/41e2 |
| 49 -keepclassmembers,allowshrinking,allowobfuscation class android.support.v7.widge
t.AppCompatButton { | 66 -keepclassmembers,allowshrinking,allowobfuscation class android.support.v7.widge
t.AppCompatButton { |
| 50 !static final <fields>; | 67 !static final <fields>; |
| 51 } | 68 } |
| OLD | NEW |