| # As of August 11, 2016, obfuscation was tested and passed on the trybots, |
| # saving us 660kb on our .dex size and 53kb memory/process. Enable obfuscation |
| # as soon as Crash supports ReTrace's deobfuscation of stack traces. |
| # |
| # To enable obfuscation, remove the -keepnames rule for |
| # com.google.android.apps.chrome.** and org.chromium.**, and uncomment the |
| # following two lines: |
| # -renamesourcefileattribute PG |
| # -repackageclasses "" |
| |
| # Disable obfuscation for the following two packages. |
| -keepnames,allowoptimization class com.google.android.apps.chrome.**,org.chromium.** { |
| *; |
| } |
| |
| # The following chart was created on July 20, 2016, to decide on 3 optimization |
| # passes. |
| # optimization passes | time | .dex size | dirty memory per process |
| # ----------------------------------------------------------------- |
| # 1 | 0:48 | 5805676 | 488972 |
| # 2 | 1:07 | 5777376 | 487092 |
| # 3 | 1:24 | 5772192 | 486596 |
| # 4 | 1:42 | 5771124 | 486484 |
| # 5 | 1:56 | 5770504 | 486432 |
| -optimizationpasses 3 |
| |
| # Class merging messes up stacktraces beyond the point of them being |
| # deobfuscatable. If turned on, it would give us a 2% reduction in .dex size. |
| -optimizations !class/merging/* |
| |
| # Allowing Proguard to change modifiers. This change shrinks the .dex size by |
| # ~1.1%, and reduces the method count by ~4.3%. |
| -allowaccessmodification |
| |
| # 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 |
| |
| # These classes aren't themselves referenced, but __ProcessService[0,1,2...] are |
| # referenced, and we look up these services by appending a number onto the name |
| # of the base class. Thus, we need to keep the base class name around so that |
| # the child classes can be looked up. |
| -keep class org.chromium.content.app.SandboxedProcessService |
| -keep class org.chromium.content.app.PrivilegedProcessService |
| |
| # 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.** |