summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/Android.bp7
-rw-r--r--packages/SystemUI/proguard_common.flags3
-rw-r--r--packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactoryBase.kt4
3 files changed, 11 insertions, 3 deletions
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index 77925d6f03cd..608010156fcf 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -203,6 +203,9 @@ android_library {
"LowLightDreamLib",
"motion_tool_lib",
],
+ libs: [
+ "keepanno-annotations",
+ ],
manifest: "AndroidManifest.xml",
javacflags: ["-Adagger.fastInit=enabled"],
@@ -466,6 +469,7 @@ android_library {
"android.test.runner",
"android.test.base",
"android.test.mock",
+ "keepanno-annotations",
],
kotlincflags: ["-Xjvm-default=all"],
aaptflags: [
@@ -497,6 +501,9 @@ android_app {
static_libs: [
"SystemUI-tests-base",
],
+ libs: [
+ "keepanno-annotations",
+ ],
aaptflags: [
"--extra-packages",
"com.android.systemui",
diff --git a/packages/SystemUI/proguard_common.flags b/packages/SystemUI/proguard_common.flags
index e2d889168516..be1e6554baf1 100644
--- a/packages/SystemUI/proguard_common.flags
+++ b/packages/SystemUI/proguard_common.flags
@@ -1,8 +1,5 @@
-keep class com.android.systemui.VendorServices
-# the `#inject` methods are accessed via reflection to work on ContentProviders
--keepclassmembers class * extends com.android.systemui.dagger.SysUIComponent { void inject(***); }
-
# Needed to ensure callback field references are kept in their respective
# owning classes when the downstream callback registrars only store weak refs.
# TODO(b/264686688): Handle these cases with more targeted annotations.
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactoryBase.kt b/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactoryBase.kt
index 12108b01ab28..b15aaaf9a00e 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactoryBase.kt
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactoryBase.kt
@@ -25,6 +25,9 @@ import android.content.Intent
import android.util.Log
import androidx.core.app.AppComponentFactory
import com.android.systemui.dagger.ContextComponentHelper
+import com.android.systemui.dagger.SysUIComponent
+import com.android.tools.r8.keepanno.annotations.KeepTarget
+import com.android.tools.r8.keepanno.annotations.UsesReflection
import java.lang.reflect.InvocationTargetException
import java.util.concurrent.ExecutionException
import javax.inject.Inject
@@ -88,6 +91,7 @@ abstract class SystemUIAppComponentFactoryBase : AppComponentFactory() {
return app
}
+ @UsesReflection(KeepTarget(extendsClassConstant = SysUIComponent::class, methodName = "inject"))
override fun instantiateProviderCompat(cl: ClassLoader, className: String): ContentProvider {
val contentProvider = super.instantiateProviderCompat(cl, className)
if (contentProvider is ContextInitializer) {