Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame^] | 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 subpackage acts as a shared library that might be referenced in |
| 66 | # dynamically-loaded plugin APKs. |
| 67 | -keep class com.android.systemui.plugins.** { |
| 68 | *; |
| 69 | } |
| 70 | -keep class com.android.systemui.fragments.FragmentService$FragmentCreator { |
| 71 | *; |
| 72 | } |
| 73 | -keep class androidx.core.app.CoreComponentFactory |
| 74 | |
| 75 | # Keep the wm shell lib |
| 76 | -keep class com.android.wm.shell.* |
| 77 | # Keep the protolog group methods that are called by the generated code |
| 78 | -keepclassmembers class com.android.wm.shell.protolog.ShellProtoLogGroup { |
| 79 | *; |
| 80 | } |
| 81 | |
| 82 | # Prevent optimization or access modification of any referenced code that may |
| 83 | # conflict with code in the bootclasspath. |
| 84 | # TODO(b/222468116): Resolve such collisions in the build system. |
| 85 | -keepnames class android.**.nano.** { *; } |
| 86 | -keepnames class com.android.**.nano.** { *; } |
| 87 | -keepnames class com.android.internal.protolog.** { *; } |
| 88 | -keepnames class android.hardware.common.** { *; } |
| 89 | |
| 90 | # Allows proguard to make private and protected methods and fields public as |
| 91 | # part of optimization. This lets proguard inline trivial getter/setter methods. |
| 92 | -allowaccessmodification |
| 93 | |
| 94 | # Removes runtime checks added through Kotlin to JVM code genereration to |
| 95 | # avoid linear growth as more Kotlin code is converted / added to the codebase. |
| 96 | # These checks are generally applied to Java platform types (values returned |
| 97 | # from Java code that don't have nullness annotations), but we remove them to |
| 98 | # avoid code size increases. |
| 99 | # |
| 100 | # See also https://kotlinlang.org/docs/reference/java-interop.html |
| 101 | # |
| 102 | # TODO(b/199941987): Consider standardizing these rules in a central place as |
| 103 | # Kotlin gains adoption with other platform targets. |
| 104 | -assumenosideeffects class kotlin.jvm.internal.Intrinsics { |
| 105 | # Remove check for method parameters being null |
| 106 | static void checkParameterIsNotNull(java.lang.Object, java.lang.String); |
| 107 | |
| 108 | # When a Java platform type is returned and passed to Kotlin NonNull method, |
| 109 | # remove the null check |
| 110 | static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String); |
| 111 | static void checkNotNullExpressionValue(java.lang.Object, java.lang.String); |
| 112 | |
| 113 | # Remove check that final value returned from method is null, if passing |
| 114 | # back Java platform type. |
| 115 | static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String); |
| 116 | static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String); |
| 117 | |
| 118 | # Null check for accessing a field from a parent class written in Java. |
| 119 | static void checkFieldIsNotNull(java.lang.Object, java.lang.String, java.lang.String); |
| 120 | static void checkFieldIsNotNull(java.lang.Object, java.lang.String); |
| 121 | |
| 122 | # Removes code generated from !! operator which converts Nullable type to |
| 123 | # NonNull type. These would throw an NPE immediate after on access. |
| 124 | static void checkNotNull(java.lang.Object, java.lang.String); |
| 125 | static void checkNotNullParameter(java.lang.Object, java.lang.String); |
| 126 | |
| 127 | # Removes lateinit var check being used before being set. Check is applied |
| 128 | # on every field access without this. |
| 129 | static void throwUninitializedPropertyAccessException(java.lang.String); |
| 130 | } |
| 131 | |
| 132 | |
| 133 | # Strip verbose logs. |
| 134 | -assumenosideeffects class android.util.Log { |
| 135 | static *** v(...); |
| 136 | static *** isLoggable(...); |
| 137 | } |
| 138 | -assumenosideeffects class android.util.Slog { |
| 139 | static *** v(...); |
| 140 | } |
| 141 | -maximumremovedandroidloglevel 2 |