Ensure weakly referenced Kotlin callback fields are kept
This is an extension of earlier work for keeping callback fields that are weakly referenced in the registrar. Private Kotlin fields for anonymous objects default to using the anonymous type. This breaks the existing keep pattern matching for such callbacks. Extend the rules to handle this case, also keeping any fields that extend the callback type. A better solution will be to annotate the Callback types directly, and define a single rule that keeps any fields of a correspondingly annotated type, but that requires more invasive changes. This should fix any issues now while we work on that solution. Bug: 264686688 Test: m + `dexdump SystemUI.apk | grep MediaDataFilter$userTracker` Change-Id: Ib4d75c4cc3b121b818250e7191747b01413bd71a
This commit is contained in:
@@ -21,12 +21,44 @@
|
||||
# TODO(b/264686688): Handle these cases with more targeted annotations.
|
||||
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
|
||||
private com.android.keyguard.KeyguardUpdateMonitorCallback *;
|
||||
private com.android.systemui.privacy.PrivacyConfig$Callback *;
|
||||
private com.android.systemui.privacy.PrivacyItemController$Callback *;
|
||||
private com.android.systemui.settings.UserTracker$Callback *;
|
||||
private com.android.systemui.statusbar.phone.StatusBarWindowCallback *;
|
||||
private com.android.systemui.util.service.Observer$Callback *;
|
||||
private com.android.systemui.util.service.ObservableServiceConnection$Callback *;
|
||||
}
|
||||
# Note that these rules are temporary companions to the above rules, required
|
||||
# for cases like Kotlin where fields with anonymous types use the anonymous type
|
||||
# rather than the supertype.
|
||||
-if class * extends com.android.keyguard.KeyguardUpdateMonitorCallback
|
||||
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
|
||||
<1> *;
|
||||
}
|
||||
-if class * extends com.android.systemui.privacy.PrivacyConfig$Callback
|
||||
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
|
||||
<1> *;
|
||||
}
|
||||
-if class * extends com.android.systemui.privacy.PrivacyItemController$Callback
|
||||
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
|
||||
<1> *;
|
||||
}
|
||||
-if class * extends com.android.systemui.settings.UserTracker$Callback
|
||||
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
|
||||
<1> *;
|
||||
}
|
||||
-if class * extends com.android.systemui.statusbar.phone.StatusBarWindowCallback
|
||||
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
|
||||
<1> *;
|
||||
}
|
||||
-if class * extends com.android.systemui.util.service.Observer$Callback
|
||||
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
|
||||
<1> *;
|
||||
}
|
||||
-if class * extends com.android.systemui.util.service.ObservableServiceConnection$Callback
|
||||
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
|
||||
<1> *;
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
|
||||
Reference in New Issue
Block a user