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