1# Copyright 2016 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# Contains flags that can be safely shared with Cronet, and thus would be 6# appropriate for third-party apps to include. 7 8# Keep all annotation related attributes that can affect runtime 9-keepattributes RuntimeVisible*Annotations 10-keepattributes AnnotationDefault 11 12# Keep the annotations, because if we don't, the ProGuard rules that use them 13# will not be respected. These classes then show up in our final dex, which we 14# do not want - see crbug.com/628226. 15-keep @interface org.chromium.base.annotations.AccessedByNative 16-keep @interface org.chromium.base.annotations.CalledByNative 17-keep @interface org.chromium.base.annotations.CalledByNativeUnchecked 18-keep @interface org.chromium.base.annotations.DoNotInline 19-keep @interface org.chromium.base.annotations.RemovableInRelease 20-keep @interface org.chromium.base.annotations.UsedByReflection 21 22# Keeps for class level annotations. 23-keep @org.chromium.base.annotations.UsedByReflection class * 24 25# Keeps for method level annotations. 26-keepclasseswithmembers class * { 27 @org.chromium.base.annotations.AccessedByNative <fields>; 28} 29-keepclasseswithmembers,includedescriptorclasses class * { 30 @org.chromium.base.annotations.CalledByNative <methods>; 31} 32-keepclasseswithmembers,includedescriptorclasses class * { 33 @org.chromium.base.annotations.CalledByNativeUnchecked <methods>; 34} 35-keepclasseswithmembers class * { 36 @org.chromium.base.annotations.UsedByReflection <methods>; 37} 38-keepclasseswithmembers class * { 39 @org.chromium.base.annotations.UsedByReflection <fields>; 40} 41-keepclasseswithmembers,includedescriptorclasses class * { 42 native <methods>; 43} 44 45# Remove methods annotated with this if their return value is unused. 46-assumenosideeffects class ** { 47 @org.chromium.base.annotations.RemovableInRelease <methods>; 48} 49 50# Never inline classes or methods with this annotation, but allow shrinking and 51# obfuscation. 52-keepnames,allowobfuscation @org.chromium.base.annotations.DoNotInline class * { 53 *; 54} 55-keepclassmembernames,allowobfuscation class * { 56 @org.chromium.base.annotations.DoNotInline <methods>; 57} 58 59# Keep all CREATOR fields within Parcelable that are kept. 60-keepclassmembers class org.chromium.** implements android.os.Parcelable { 61 public static *** CREATOR; 62} 63 64# Don't obfuscate Parcelables as they might be marshalled outside Chrome. 65# If we annotated all Parcelables that get put into Bundles other than 66# for saveInstanceState (e.g. PendingIntents), then we could actually keep the 67# names of just those ones. For now, we'll just keep them all. 68-keepnames class org.chromium.** implements android.os.Parcelable 69 70# Keep all enum values and valueOf methods. See 71# http://proguard.sourceforge.net/index.html#manual/examples.html 72# for the reason for this. Also, see http://crbug.com/248037. 73-keepclassmembers enum org.chromium.** { 74 public static **[] values(); 75} 76