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

Commit efb56873 authored by Fengjiang Li's avatar Fengjiang Li Committed by Android (Google) Code Review
Browse files

Merge "[Launcher Jank] Avoid SmartspaceView making binder call from main thread" into main

parents f8a9bb95 9f626500
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.smartspace.SmartspaceSession
import android.app.smartspace.SmartspaceTarget
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Handler
import android.testing.TestableLooper
import android.view.View
import android.widget.FrameLayout
@@ -86,6 +87,8 @@ class CommunalSmartspaceControllerTest : SysuiTestCase() {

        override fun setUiSurface(uiSurface: String) {}

        override fun setBgHandler(bgHandler: Handler?) {}

        override fun setDozeAmount(amount: Float) {}

        override fun setIntentStarter(intentStarter: BcSmartspaceDataPlugin.IntentStarter?) {}
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.smartspace.SmartspaceSession
import android.app.smartspace.SmartspaceTarget
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Handler
import android.testing.TestableLooper
import android.view.View
import android.view.ViewGroup
@@ -119,6 +120,8 @@ class DreamSmartspaceControllerTest : SysuiTestCase() {

        override fun setUiSurface(uiSurface: String) {}

        override fun setBgHandler(bgHandler: Handler?) {}

        override fun setDozeAmount(amount: Float) {}

        override fun setIntentStarter(intentStarter: BcSmartspaceDataPlugin.IntentStarter?) {}
+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.app.smartspace.uitemplatedata.TapAction;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Parcelable;
import android.util.Log;
import android.view.View;
@@ -123,6 +124,9 @@ public interface BcSmartspaceDataPlugin extends Plugin {
         */
        void setUiSurface(String uiSurface);

        /** Set background handler to make binder calls. */
        void setBgHandler(Handler bgHandler);

        /**
         * Range [0.0 - 1.0] when transitioning from Lockscreen to/from AOD
         */
+11 −8
Original line number Diff line number Diff line
@@ -18,8 +18,10 @@ package com.android.systemui.smartspace.dagger
import android.app.ActivityOptions
import android.app.PendingIntent
import android.content.Intent
import android.os.Handler
import android.view.View
import android.view.ViewGroup
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.plugins.BcSmartspaceDataPlugin
import com.android.systemui.plugins.BcSmartspaceDataPlugin.UI_SURFACE_DREAM
@@ -56,14 +58,15 @@ interface SmartspaceViewComponent {
                parent: ViewGroup,
                @Named(PLUGIN) plugin: BcSmartspaceDataPlugin,
                viewWithCustomLayout: View?,
            onAttachListener: View.OnAttachStateChangeListener
        ):
                BcSmartspaceDataPlugin.SmartspaceView {
                onAttachListener: View.OnAttachStateChangeListener,
                @Background bgHandler: Handler,
        ): BcSmartspaceDataPlugin.SmartspaceView {
            val ssView = viewWithCustomLayout
                    as? BcSmartspaceDataPlugin.SmartspaceView
                    ?: plugin.getView(parent)
            // Currently, this is only used to provide SmartspaceView on Dream surface.
            ssView.setUiSurface(UI_SURFACE_DREAM)
            ssView.setBgHandler(bgHandler)
            ssView.registerDataProvider(plugin)

            ssView.setIntentStarter(object : BcSmartspaceDataPlugin.IntentStarter {
+2 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ constructor(
        @Main private val uiExecutor: Executor,
        @Background private val bgExecutor: Executor,
        @Main private val handler: Handler,
        @Background private val bgHandler: Handler,
        @Named(DATE_SMARTSPACE_DATA_PLUGIN)
        optionalDatePlugin: Optional<BcSmartspaceDataPlugin>,
        @Named(WEATHER_SMARTSPACE_DATA_PLUGIN)
@@ -412,6 +413,7 @@ constructor(

        val ssView = plugin.getView(parent)
        configPlugin?.let { ssView.registerConfigProvider(it) }
        ssView.setBgHandler(bgHandler)
        ssView.setUiSurface(BcSmartspaceDataPlugin.UI_SURFACE_LOCK_SCREEN_AOD)
        ssView.setTimeChangedDelegate(SmartspaceTimeChangedDelegate(keyguardUpdateMonitor))
        ssView.registerDataProvider(plugin)
Loading