jbudorick | 78730f18 | 2017-04-26 21:24:22 | [diff] [blame] | 1 | # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | # Proguard flags for what should be kept in the main dex. Only used |
| 6 | # during main dex list determination, not during actual proguarding. |
| 7 | |
Andrew Grieve | faee7be | 2018-03-26 20:00:13 | [diff] [blame] | 8 | -keep @org.chromium.base.annotations.MainDex class * { |
jbudorick | f091dcb | 2015-08-25 21:36:59 | [diff] [blame] | 9 | *; |
| 10 | } |
jbudorick | f667d3b3a | 2015-11-13 00:44:58 | [diff] [blame] | 11 | |
| 12 | -keepclasseswithmembers class * { |
Andrew Grieve | faee7be | 2018-03-26 20:00:13 | [diff] [blame] | 13 | @org.chromium.base.annotations.MainDex <methods>; |
Andrew Grieve | 524c5cdd | 2018-03-16 21:18:13 | [diff] [blame] | 14 | } |
| 15 | |
Andrew Grieve | faee7be | 2018-03-26 20:00:13 | [diff] [blame] | 16 | # Assume all IDL-generated classes should be kept. They can't reference other |
| 17 | # non-framework classes, so fairly low-risk. |
Andrew Grieve | 524c5cdd | 2018-03-16 21:18:13 | [diff] [blame] | 18 | -keepclasseswithmembers class * { |
jbudorick | f667d3b3a | 2015-11-13 00:44:58 | [diff] [blame] | 19 | public static ** asInterface(android.os.IBinder); |
| 20 | } |
agrieve | 23ea0f5 | 2016-01-06 01:58:58 | [diff] [blame] | 21 | |
| 22 | # Required when code coverage is enabled. |
| 23 | -keep class com.vladium.** { |
jbudorick | 73357e23 | 2017-05-02 18:59:06 | [diff] [blame] | 24 | *; |
| 25 | } |
| 26 | |
Andrew Grieve | faee7be | 2018-03-26 20:00:13 | [diff] [blame] | 27 | # Renderers / GPU process don't load secondary dex. |
Andrew Grieve | 4fdd012 | 2018-03-19 16:38:22 | [diff] [blame] | 28 | -keep public class * extends org.chromium.base.process_launcher.ChildProcessService { |
| 29 | *; |
| 30 | } |
| 31 | |
jbudorick | 73357e23 | 2017-05-02 18:59:06 | [diff] [blame] | 32 | # Used by tests for secondary dex extraction. |
| 33 | -keep class android.support.v4.content.ContextCompat { |
| 34 | *; |
agrieve | 23ea0f5 | 2016-01-06 01:58:58 | [diff] [blame] | 35 | } |
Andrew Grieve | ed8cd47 | 2018-03-16 02:06:11 | [diff] [blame] | 36 | |
Andrew Grieve | 524c5cdd | 2018-03-16 21:18:13 | [diff] [blame] | 37 | # The following are based on $SDK_BUILD_TOOLS/mainDexClasses.rules |
Andrew Grieve | 66b933a5 | 2018-03-20 01:32:24 | [diff] [blame] | 38 | # Ours differ in that: |
| 39 | # 1. It omits -keeps for application / instrumentation / backupagents (these are |
| 40 | # redundant since they are added by aapt's main dex list rules output). |
| 41 | # 2. Omits keep for Application.attachBaseContext(), which is overly broad. |
| 42 | # 3. Omits keep for all annotations, which is also overly broad (and pulls in |
| 43 | # any class that has an @IntDef). |
Andrew Grieve | 524c5cdd | 2018-03-16 21:18:13 | [diff] [blame] | 44 | |
| 45 | ######## START mainDexClasses.rules ######## |
| 46 | |
Andrew Grieve | 66b933a5 | 2018-03-20 01:32:24 | [diff] [blame] | 47 | # Keep old fashion tests in the main dex or they'll be silently ignored by InstrumentationTestRunner |
Andrew Grieve | 524c5cdd | 2018-03-16 21:18:13 | [diff] [blame] | 48 | -keep public class * extends android.test.InstrumentationTestCase { |
Andrew Grieve | 66b933a5 | 2018-03-20 01:32:24 | [diff] [blame] | 49 | <init>(); |
Andrew Grieve | 524c5cdd | 2018-03-16 21:18:13 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | ######## END mainDexClasses.rules ######## |