Do not proguard com.android.systemui.log
Defensively also add com.android.systemui.common
Bug: 280569676
Test: Manually checked crashlooping device
Change-Id: I4959d2853f7bedc3f699999085b8a32c19a23ece
diff --git a/packages/SystemUI/plugin/Android.bp b/packages/SystemUI/plugin/Android.bp
index fec093b..bb47a2f 100644
--- a/packages/SystemUI/plugin/Android.bp
+++ b/packages/SystemUI/plugin/Android.bp
@@ -34,6 +34,8 @@
// If you add a static lib here, you may need to also add the package to the ClassLoaderFilter
// in PluginInstance. That will ensure that loaded plugins have access to the related classes.
+ // You should also add it to proguard_common.flags so that proguard does not remove the portions
+ // of the library which are used by the plugins but not by systemui itself.
static_libs: [
"androidx.annotation_annotation",
"PluginCoreLib",
diff --git a/packages/SystemUI/proguard_common.flags b/packages/SystemUI/proguard_common.flags
index 1d008cf..02d5510 100644
--- a/packages/SystemUI/proguard_common.flags
+++ b/packages/SystemUI/proguard_common.flags
@@ -62,11 +62,17 @@
-keep class ** extends androidx.preference.PreferenceFragment
-keep class com.android.systemui.tuner.*
-# The plugins subpackage acts as a shared library that might be referenced in
+# The plugins, log & common subpackages act as shared libraries that might be referenced in
# dynamically-loaded plugin APKs.
-keep class com.android.systemui.plugins.** {
*;
}
+-keep class com.android.systemui.log.** {
+ *;
+}
+-keep class com.android.systemui.common.** {
+ *;
+}
-keep class com.android.systemui.fragments.FragmentService$FragmentCreator {
*;
}
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstance.java b/packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstance.java
index 4a66562..9a9a242 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstance.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstance.java
@@ -230,7 +230,10 @@
private ClassLoader getParentClassLoader(ClassLoader baseClassLoader) {
return new PluginManagerImpl.ClassLoaderFilter(
- baseClassLoader, "com.android.systemui.log", "com.android.systemui.plugin");
+ baseClassLoader,
+ "com.android.systemui.common",
+ "com.android.systemui.log",
+ "com.android.systemui.plugin");
}
/** Returns class loader specific for the given plugin. */