1# Preserve line number information for debugging stack traces. 2-keepattributes SourceFile,LineNumberTable 3 4-keep class com.android.systemui.VendorServices 5 6# the `#inject` methods are accessed via reflection to work on ContentProviders 7-keepclassmembers class * extends com.android.systemui.dagger.SysUIComponent { void inject(***); } 8 9# Needed for builds to properly initialize KeyFrames from xml scene 10-keepclassmembers class * extends androidx.constraintlayout.motion.widget.Key { 11 public <init>(); 12} 13 14# Needed to ensure callback field references are kept in their respective 15# owning classes when the downstream callback registrars only store weak refs. 16# TODO(b/264686688): Handle these cases with more targeted annotations. 17-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { 18 private com.android.keyguard.KeyguardUpdateMonitorCallback *; 19 private com.android.systemui.privacy.PrivacyConfig$Callback *; 20 private com.android.systemui.privacy.PrivacyItemController$Callback *; 21 private com.android.systemui.settings.UserTracker$Callback *; 22 private com.android.systemui.statusbar.phone.StatusBarWindowCallback *; 23 private com.android.systemui.util.service.Observer$Callback *; 24 private com.android.systemui.util.service.ObservableServiceConnection$Callback *; 25} 26# Note that these rules are temporary companions to the above rules, required 27# for cases like Kotlin where fields with anonymous types use the anonymous type 28# rather than the supertype. 29-if class * extends com.android.keyguard.KeyguardUpdateMonitorCallback 30-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { 31 <1> *; 32} 33-if class * extends com.android.systemui.privacy.PrivacyConfig$Callback 34-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { 35 <1> *; 36} 37-if class * extends com.android.systemui.privacy.PrivacyItemController$Callback 38-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { 39 <1> *; 40} 41-if class * extends com.android.systemui.settings.UserTracker$Callback 42-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { 43 <1> *; 44} 45-if class * extends com.android.systemui.statusbar.phone.StatusBarWindowCallback 46-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { 47 <1> *; 48} 49-if class * extends com.android.systemui.util.service.Observer$Callback 50-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { 51 <1> *; 52} 53-if class * extends com.android.systemui.util.service.ObservableServiceConnection$Callback 54-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { 55 <1> *; 56} 57 58-keepclasseswithmembers class * { 59 public <init>(android.content.Context, android.util.AttributeSet); 60} 61 62-keep class ** extends androidx.preference.PreferenceFragment 63-keep class com.android.systemui.tuner.* 64 65# The plugins, log & common subpackages act as shared libraries that might be referenced in 66# dynamically-loaded plugin APKs. 67-keep class com.android.systemui.plugins.** { *; } 68-keep class com.android.systemui.log.core.** { *; } 69-keep class com.android.systemui.fragments.FragmentService$FragmentCreator { 70 *; 71} 72-keep class androidx.core.app.CoreComponentFactory 73 74# Keep the wm shell lib 75-keep class com.android.wm.shell.* 76# Keep the protolog group methods that are called by the generated code 77-keepclassmembers class com.android.wm.shell.protolog.ShellProtoLogGroup { 78 *; 79} 80 81# Prevent optimization or access modification of any referenced code that may 82# conflict with code in the bootclasspath. 83# TODO(b/222468116): Resolve such collisions in the build system. 84-keepnames class android.**.nano.** { *; } 85-keepnames class com.android.**.nano.** { *; } 86-keepnames class com.android.internal.protolog.** { *; } 87-keepnames class android.hardware.common.** { *; } 88 89# Allows proguard to make private and protected methods and fields public as 90# part of optimization. This lets proguard inline trivial getter/setter methods. 91-allowaccessmodification 92 93# Removes runtime checks added through Kotlin to JVM code genereration to 94# avoid linear growth as more Kotlin code is converted / added to the codebase. 95# These checks are generally applied to Java platform types (values returned 96# from Java code that don't have nullness annotations), but we remove them to 97# avoid code size increases. 98# 99# See also https://kotlinlang.org/docs/reference/java-interop.html 100# 101# TODO(b/199941987): Consider standardizing these rules in a central place as 102# Kotlin gains adoption with other platform targets. 103-assumenosideeffects class kotlin.jvm.internal.Intrinsics { 104 # Remove check for method parameters being null 105 static void checkParameterIsNotNull(java.lang.Object, java.lang.String); 106 107 # When a Java platform type is returned and passed to Kotlin NonNull method, 108 # remove the null check 109 static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String); 110 static void checkNotNullExpressionValue(java.lang.Object, java.lang.String); 111 112 # Remove check that final value returned from method is null, if passing 113 # back Java platform type. 114 static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String); 115 static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String); 116 117 # Null check for accessing a field from a parent class written in Java. 118 static void checkFieldIsNotNull(java.lang.Object, java.lang.String, java.lang.String); 119 static void checkFieldIsNotNull(java.lang.Object, java.lang.String); 120 121 # Removes code generated from !! operator which converts Nullable type to 122 # NonNull type. These would throw an NPE immediate after on access. 123 static void checkNotNull(java.lang.Object, java.lang.String); 124 static void checkNotNullParameter(java.lang.Object, java.lang.String); 125 126 # Removes lateinit var check being used before being set. Check is applied 127 # on every field access without this. 128 static void throwUninitializedPropertyAccessException(java.lang.String); 129} 130 131 132# Strip verbose logs. 133-assumenosideeffects class android.util.Log { 134 static *** v(...); 135 static *** isLoggable(...); 136} 137-assumenosideeffects class android.util.Slog { 138 static *** v(...); 139} 140-maximumremovedandroidloglevel 2 141