| OLD | NEW |
| 1 # As of August 11, 2016, obfuscation was tested and passed on the trybots, | 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 | 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. | 3 # as soon as Crash supports ReTrace's deobfuscation of stack traces. |
| 4 # | 4 # |
| 5 # To enable obfuscation, remove the -keepnames rule for | 5 # To enable obfuscation, remove the -keepnames rule for |
| 6 # com.google.android.apps.chrome.** and org.chromium.**, and uncomment the | 6 # com.google.android.apps.chrome.** and org.chromium.**, and uncomment the |
| 7 # following two lines: | 7 # following two lines: |
| 8 # -renamesourcefileattribute PG | 8 # -renamesourcefileattribute PG |
| 9 # -repackageclasses "" | 9 # -repackageclasses "" |
| 10 | 10 |
| 11 # Disable obfuscation for the following two packages. | 11 # Disable obfuscation for the following two packages. |
| 12 -keepnames,allowoptimization class com.google.android.apps.chrome.**,org.chromiu
m.** { | 12 -keepnames,allowoptimization class com.google.android.apps.chrome.**,org.chromiu
m.** { |
| 13 *; | 13 *; |
| 14 } | 14 } |
| 15 | 15 |
| 16 # The following chart was created on July 20, 2016, to decide on 3 optimization | |
| 17 # passes. | |
| 18 # optimization passes | time | .dex size | dirty memory per process | |
| 19 # ----------------------------------------------------------------- | |
| 20 # 1 | 0:48 | 5805676 | 488972 | |
| 21 # 2 | 1:07 | 5777376 | 487092 | |
| 22 # 3 | 1:24 | 5772192 | 486596 | |
| 23 # 4 | 1:42 | 5771124 | 486484 | |
| 24 # 5 | 1:56 | 5770504 | 486432 | |
| 25 -optimizationpasses 3 | |
| 26 | |
| 27 # Class merging messes up stacktraces beyond the point of them being | |
| 28 # deobfuscatable. If turned on, it would give us a 2% reduction in .dex size. | |
| 29 -optimizations !class/merging/* | |
| 30 | |
| 31 # Allowing Proguard to change modifiers. This change shrinks the .dex size by | |
| 32 # ~1.1%, and reduces the method count by ~4.3%. | |
| 33 -allowaccessmodification | |
| 34 | |
| 35 # Allows Proguard freedom in removing these log related calls. We ask for debug | |
| 36 # and verbose logs to be stripped out in base.Log, so we are just ensuring we | |
| 37 # get rid of all other debug/verbose logs. | |
| 38 -assumenosideeffects class android.util.Log { | |
| 39 static *** d(...); | |
| 40 static *** v(...); | |
| 41 static *** isLoggable(...); | |
| 42 } | |
| 43 | |
| 44 # Fragments are loaded using reflection via Fragment.instantiate(Context,String) | 16 # Fragments are loaded using reflection via Fragment.instantiate(Context,String) |
| 45 # This can be improved upon - see crbug.com/622023. | 17 # This can be improved upon - see crbug.com/622023. |
| 46 -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 |
| 47 -keep public class org.chromium** extends android.app.Fragment | 19 -keep public class org.chromium** extends android.app.Fragment |
| 48 | 20 |
| 49 # These classes aren't themselves referenced, but __ProcessService[0,1,2...] are | 21 # These classes aren't themselves referenced, but __ProcessService[0,1,2...] are |
| 50 # referenced, and we look up these services by appending a number onto the name | 22 # referenced, and we look up these services by appending a number onto the name |
| 51 # of the base class. Thus, we need to keep the base class name around so that | 23 # of the base class. Thus, we need to keep the base class name around so that |
| 52 # the child classes can be looked up. | 24 # the child classes can be looked up. |
| 53 -keep class org.chromium.content.app.SandboxedProcessService | 25 -keep class org.chromium.content.app.SandboxedProcessService |
| 54 -keep class org.chromium.content.app.PrivilegedProcessService | 26 -keep class org.chromium.content.app.PrivilegedProcessService |
| 55 | 27 |
| 56 # Keep all Parcelables as they might be marshalled outside Chrome. | 28 # Keep all Parcelables as they might be marshalled outside Chrome. |
| 57 -keepnames class * implements android.os.Parcelable { | 29 -keepnames class * implements android.os.Parcelable { |
| 58 public static final ** CREATOR; | 30 public static final ** CREATOR; |
| 59 } | 31 } |
| 60 | 32 |
| 61 # SearchView is used in website_preferences_menu.xml and is constructed by | 33 # SearchView is used in website_preferences_menu.xml and is constructed by |
| 62 # Android using reflection. | 34 # Android using reflection. |
| 63 -keep class android.support.v7.widget.SearchView { | 35 -keep class android.support.v7.widget.SearchView { |
| 64 public <init>(...); | 36 public <init>(...); |
| 65 } | 37 } |
| 66 | 38 |
| 67 # Google Play Services warnings are about its resources. | 39 # Google Play Services warnings are about its resources. |
| 68 -dontwarn com.google.android.gms.R** | 40 -dontwarn com.google.android.gms.R** |
| 69 | |
| 70 # The support library contains references to newer platform versions. | |
| 71 # Don't warn about those in case this app is linking against an older | |
| 72 # platform version. We know about them, and they are safe. | |
| 73 -dontwarn android.support.** | |
| OLD | NEW |