# Copyright 2022 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Contains flags related to annotations in //build/android that can be safely # shared with Cronet, and thus would be appropriate for third-party apps to # include. # Keep all annotation related attributes that can affect runtime -keepattributes RuntimeVisible*Annotations -keepattributes AnnotationDefault # Keeps for class level annotations. -keep,allowaccessmodification @org.chromium.build.annotations.UsedByReflection class ** {} # Keeps for method level annotations. -keepclasseswithmembers,allowaccessmodification class ** { @org.chromium.build.annotations.UsedByReflection ; } -keepclasseswithmembers,allowaccessmodification class ** { @org.chromium.build.annotations.UsedByReflection ; } # Never inline classes, methods, or fields with this annotation, but allow # shrinking and obfuscation. # Relevant to fields when they are needed to store strong references to objects # that are held as weak references by native code. -if @org.chromium.build.annotations.DoNotInline class * { *** *(...); } -keep,allowobfuscation,allowaccessmodification class <1> { *** <2>(...); } -keepclassmembers,allowobfuscation,allowaccessmodification class * { @org.chromium.build.annotations.DoNotInline ; } -keepclassmembers,allowobfuscation,allowaccessmodification class * { @org.chromium.build.annotations.DoNotInline ; } -alwaysinline class * { @org.chromium.build.annotations.AlwaysInline *; } # Keep all logs (Log.VERBOSE = 2). R8 does not allow setting to 0. -maximumremovedandroidloglevel 1 class ** { @org.chromium.build.annotations.DoNotStripLogs ; } -maximumremovedandroidloglevel 1 @org.chromium.build.annotations.DoNotStripLogs class ** { ; } # Never merge classes horizontally or vertically with this annotation. # Relevant to classes being used as a key in maps or sets. -keep,allowaccessmodification,allowobfuscation,allowshrinking @org.chromium.build.annotations.DoNotClassMerge class * # Mark members annotated with IdentifierNameString as identifier name strings -identifiernamestring class * { @org.chromium.build.annotations.IdentifierNameString *; } # Mark fields with this to help R8 figure out that they cannot be null. # Use assumevalues in addition to assumenosideeffects block because Google3 proguard cannot parse # assumenosideeffects blocks which overwrite return value. -assumevalues class ** { @org.chromium.build.annotations.AssumeNonNull *** *(...) return _NONNULL_; } -assumenosideeffects class ** { @org.chromium.build.annotations.AssumeNonNull *** *(...); } -assumevalues class ** { @org.chromium.build.annotations.AssumeNonNull *** * return _NONNULL_; } -assumenosideeffects class ** { @org.chromium.build.annotations.AssumeNonNull *** *; }