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

Commit 9ae796c5 authored by William Leshner's avatar William Leshner Committed by Android (Google) Code Review
Browse files

Revert "Fix a crash when registering/unregistering a smartspace timer listener."

This reverts commit e90606d9.

Reason for revert: seems to be the culprit for b/323782475

Change-Id: I7b864821fe1df20446a21a08e779ec0441e553a4
parent e90606d9
Loading
Loading
Loading
Loading
+4 −13
Original line number Original line Diff line number Diff line
@@ -21,9 +21,7 @@ import android.os.Parcelable
import android.widget.RemoteViews
import android.widget.RemoteViews
import com.android.systemui.communal.smartspace.CommunalSmartspaceController
import com.android.systemui.communal.smartspace.CommunalSmartspaceController
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.plugins.BcSmartspaceDataPlugin
import com.android.systemui.plugins.BcSmartspaceDataPlugin
import java.util.concurrent.Executor
import javax.inject.Inject
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.MutableStateFlow
@@ -43,7 +41,6 @@ class SmartspaceRepositoryImpl
@Inject
@Inject
constructor(
constructor(
    private val communalSmartspaceController: CommunalSmartspaceController,
    private val communalSmartspaceController: CommunalSmartspaceController,
    @Main private val uiExecutor: Executor,
) : SmartspaceRepository, BcSmartspaceDataPlugin.SmartspaceTargetListener {
) : SmartspaceRepository, BcSmartspaceDataPlugin.SmartspaceTargetListener {


    override val isSmartspaceRemoteViewsEnabled: Boolean
    override val isSmartspaceRemoteViewsEnabled: Boolean
@@ -54,19 +51,13 @@ constructor(
    override val communalSmartspaceTargets: Flow<List<SmartspaceTarget>> =
    override val communalSmartspaceTargets: Flow<List<SmartspaceTarget>> =
        _communalSmartspaceTargets
        _communalSmartspaceTargets
            .onStart {
            .onStart {
                uiExecutor.execute {
                communalSmartspaceController.addListener(listener = this@SmartspaceRepositoryImpl)
                    communalSmartspaceController.addListener(
                        listener = this@SmartspaceRepositoryImpl
                    )
                }
            }
            }
            .onCompletion {
            .onCompletion {
                uiExecutor.execute {
                communalSmartspaceController.removeListener(
                communalSmartspaceController.removeListener(
                    listener = this@SmartspaceRepositoryImpl
                    listener = this@SmartspaceRepositoryImpl
                )
                )
            }
            }
            }


    override fun onSmartspaceTargetsUpdated(targetsNullable: MutableList<out Parcelable>?) {
    override fun onSmartspaceTargetsUpdated(targetsNullable: MutableList<out Parcelable>?) {
        targetsNullable?.let { targets ->
        targetsNullable?.let { targets ->