Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame] | 1 | -keep class com.android.systemui.VendorServices |
| 2 | |
Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame] | 3 | # Needed to ensure callback field references are kept in their respective |
| 4 | # owning classes when the downstream callback registrars only store weak refs. |
Jared Duke | 8e74123 | 2023-09-19 22:51:05 +0000 | [diff] [blame^] | 5 | # Note that we restrict this to SysUISingleton classes, as other registering |
| 6 | # classes should either *always* unregister or *never* register from their |
| 7 | # constructor. We also keep callback class names for easier debugging. |
| 8 | -keepnames @com.android.systemui.util.annotations.WeaklyReferencedCallback class * |
| 9 | -keepnames class * extends @com.android.systemui.util.annotations.WeaklyReferencedCallback ** |
| 10 | -if @com.android.systemui.util.annotations.WeaklyReferencedCallback class * |
| 11 | -keepclassmembers,allowaccessmodification @com.android.systemui.dagger.SysUISingleton class * { |
Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame] | 12 | <1> *; |
| 13 | } |
Jared Duke | 8e74123 | 2023-09-19 22:51:05 +0000 | [diff] [blame^] | 14 | -if class * extends @com.android.systemui.util.annotations.WeaklyReferencedCallback ** |
| 15 | -keepclassmembers,allowaccessmodification @com.android.systemui.dagger.SysUISingleton class * { |
Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame] | 16 | <1> *; |
| 17 | } |
| 18 | |
| 19 | -keepclasseswithmembers class * { |
| 20 | public <init>(android.content.Context, android.util.AttributeSet); |
| 21 | } |
| 22 | |
Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame] | 23 | -keep class com.android.systemui.tuner.* |
| 24 | |
Darrell Shi | ae159d9 | 2023-06-07 18:41:26 +0000 | [diff] [blame] | 25 | # The plugins and core log subpackages act as shared libraries that might be referenced in |
Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame] | 26 | # dynamically-loaded plugin APKs. |
| 27 | -keep class com.android.systemui.plugins.** { |
| 28 | *; |
| 29 | } |
Darrell Shi | ae159d9 | 2023-06-07 18:41:26 +0000 | [diff] [blame] | 30 | -keep class com.android.systemui.log.core.** { |
Hawkwood Glazier | a3ebc6b | 2023-05-03 18:49:40 +0000 | [diff] [blame] | 31 | *; |
| 32 | } |
Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame] | 33 | -keep class androidx.core.app.CoreComponentFactory |
| 34 | |
| 35 | # Keep the wm shell lib |
| 36 | -keep class com.android.wm.shell.* |
| 37 | # Keep the protolog group methods that are called by the generated code |
| 38 | -keepclassmembers class com.android.wm.shell.protolog.ShellProtoLogGroup { |
| 39 | *; |
| 40 | } |
| 41 | |
| 42 | # Prevent optimization or access modification of any referenced code that may |
| 43 | # conflict with code in the bootclasspath. |
| 44 | # TODO(b/222468116): Resolve such collisions in the build system. |
| 45 | -keepnames class android.**.nano.** { *; } |
| 46 | -keepnames class com.android.**.nano.** { *; } |
| 47 | -keepnames class com.android.internal.protolog.** { *; } |
| 48 | -keepnames class android.hardware.common.** { *; } |
| 49 | |
| 50 | # Allows proguard to make private and protected methods and fields public as |
| 51 | # part of optimization. This lets proguard inline trivial getter/setter methods. |
| 52 | -allowaccessmodification |
| 53 | |
| 54 | # Removes runtime checks added through Kotlin to JVM code genereration to |
| 55 | # avoid linear growth as more Kotlin code is converted / added to the codebase. |
| 56 | # These checks are generally applied to Java platform types (values returned |
| 57 | # from Java code that don't have nullness annotations), but we remove them to |
| 58 | # avoid code size increases. |
| 59 | # |
| 60 | # See also https://kotlinlang.org/docs/reference/java-interop.html |
| 61 | # |
| 62 | # TODO(b/199941987): Consider standardizing these rules in a central place as |
| 63 | # Kotlin gains adoption with other platform targets. |
| 64 | -assumenosideeffects class kotlin.jvm.internal.Intrinsics { |
| 65 | # Remove check for method parameters being null |
| 66 | static void checkParameterIsNotNull(java.lang.Object, java.lang.String); |
| 67 | |
| 68 | # When a Java platform type is returned and passed to Kotlin NonNull method, |
| 69 | # remove the null check |
| 70 | static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String); |
| 71 | static void checkNotNullExpressionValue(java.lang.Object, java.lang.String); |
| 72 | |
| 73 | # Remove check that final value returned from method is null, if passing |
| 74 | # back Java platform type. |
| 75 | static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String); |
| 76 | static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String); |
| 77 | |
| 78 | # Null check for accessing a field from a parent class written in Java. |
| 79 | static void checkFieldIsNotNull(java.lang.Object, java.lang.String, java.lang.String); |
| 80 | static void checkFieldIsNotNull(java.lang.Object, java.lang.String); |
| 81 | |
| 82 | # Removes code generated from !! operator which converts Nullable type to |
| 83 | # NonNull type. These would throw an NPE immediate after on access. |
| 84 | static void checkNotNull(java.lang.Object, java.lang.String); |
| 85 | static void checkNotNullParameter(java.lang.Object, java.lang.String); |
| 86 | |
| 87 | # Removes lateinit var check being used before being set. Check is applied |
| 88 | # on every field access without this. |
| 89 | static void throwUninitializedPropertyAccessException(java.lang.String); |
| 90 | } |
| 91 | |
| 92 | |
| 93 | # Strip verbose logs. |
| 94 | -assumenosideeffects class android.util.Log { |
| 95 | static *** v(...); |
| 96 | static *** isLoggable(...); |
| 97 | } |
| 98 | -assumenosideeffects class android.util.Slog { |
| 99 | static *** v(...); |
| 100 | } |
| 101 | -maximumremovedandroidloglevel 2 |