Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0ab455c authored by Nikolas Havrikov's avatar Nikolas Havrikov Committed by Android (Google) Code Review
Browse files

Merge "Use keep annotations in SystemUI" into main

parents ee8f9f78 c70cb07a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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",
+0 −3
Original line number Diff line number Diff line
-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.
+4 −0
Original line number Diff line number Diff line
@@ -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) {