summaryrefslogtreecommitdiff
path: root/base/android/proguard/chromium_apk.flags
blob: ac3d7f8200255952acd7fdf78f7aa015278e4bdf (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
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Contains flags that we'd like all Chromium .apks to use.

# Not needed for Android and saves a bit of processing time.
-dontpreverify

# Keep line number information, useful for stack traces.
-keepattributes SourceFile,LineNumberTable

# Keep all CREATOR fields within Parcelable that are kept.
-keepclassmembers class * implements android.os.Parcelable {
  public static *** CREATOR;
}

# Don't obfuscate Parcelables as they might be marshalled outside Chrome.
# If we annotated all Parcelables that get put into Bundles other than
# for saveInstanceState (e.g. PendingIntents), then we could actually keep the
# names of just those ones. For now, we'll just keep them all.
-keepnames class * implements android.os.Parcelable

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

# Keep classes implementing ParameterProvider -- these will be instantiated
# via reflection.
-keep class * implements org.chromium.base.test.params.ParameterProvider

# Allows Proguard freedom in removing these log related calls. We ask for debug
# and verbose logs to be stripped out in base.Log, so we are just ensuring we
# get rid of all other debug/verbose logs.
-assumenosideeffects class android.util.Log {
  static *** d(...);
  static *** v(...);
  static *** isLoggable(...);
}

# The following chart was created on July 20, 2016, to decide on 3 optimization
# passes for Chrome.
# 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

# Horizontal class merging marginally increases dex size (as of Mar 2018).
-optimizations !class/merging/horizontal

# Allowing Proguard to change modifiers. This change shrinks the .dex size by
# ~1%, and reduces the method count by ~4%.
-allowaccessmodification

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