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

Commit f05e0f2f authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Move topClippingBounds to main immediate dispatcher" into main

parents fbe14337 22497a5e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import com.android.systemui.CoreStartable
import com.android.systemui.biometrics.ui.binder.DeviceEntryUnlockTrackerViewBinder
import com.android.systemui.common.ui.ConfigurationState
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryHapticsInteractor
import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor
import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor
@@ -73,6 +74,7 @@ import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator
import dagger.Lazy
import java.util.Optional
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.ExperimentalCoroutinesApi

@@ -108,6 +110,7 @@ constructor(
    private val clockInteractor: KeyguardClockInteractor,
    private val keyguardViewMediator: KeyguardViewMediator,
    private val deviceEntryUnlockTrackerViewBinder: Optional<DeviceEntryUnlockTrackerViewBinder>,
    @Main private val mainDispatcher: CoroutineDispatcher,
) : CoreStartable {

    private var rootViewHandle: DisposableHandle? = null
@@ -215,6 +218,7 @@ constructor(
                vibratorHelper,
                falsingManager,
                keyguardViewMediator,
                mainDispatcher,
            )
    }

+27 −17
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import androidx.activity.setViewTreeOnBackPressedDispatcherOwner
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.app.animation.Interpolators
import com.android.app.tracing.coroutines.launch
import com.android.internal.jank.InteractionJankMonitor
import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF_SHOW_AOD
import com.android.systemui.Flags.newAodTransition
@@ -80,6 +81,7 @@ import com.android.systemui.util.ui.isAnimating
import com.android.systemui.util.ui.stopAnimating
import com.android.systemui.util.ui.value
import kotlin.math.min
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.coroutineScope
@@ -110,6 +112,7 @@ object KeyguardRootViewBinder {
        vibratorHelper: VibratorHelper?,
        falsingManager: FalsingManager?,
        keyguardViewMediator: KeyguardViewMediator?,
        mainImmediateDispatcher: CoroutineDispatcher,
    ): DisposableHandle {
        val disposables = DisposableHandles()
        val childViews = mutableMapOf<Int, View>()
@@ -128,6 +131,30 @@ object KeyguardRootViewBinder {

        val burnInParams = MutableStateFlow(BurnInParameters())
        val viewState = ViewStateAccessor(alpha = { view.alpha })

        disposables +=
            view.repeatWhenAttached(mainImmediateDispatcher) {
                repeatOnLifecycle(Lifecycle.State.CREATED) {
                    if (MigrateClocksToBlueprint.isEnabled) {
                        launch("$TAG#topClippingBounds") {
                            val clipBounds = Rect()
                            viewModel.topClippingBounds.collect { clipTop ->
                                if (clipTop == null) {
                                    view.setClipBounds(null)
                                } else {
                                    clipBounds.apply {
                                        top = clipTop
                                        left = view.getLeft()
                                        right = view.getRight()
                                        bottom = view.getBottom()
                                    }
                                    view.setClipBounds(clipBounds)
                                }
                            }
                        }
                    }
                }
            }
        disposables +=
            view.repeatWhenAttached {
                repeatOnLifecycle(Lifecycle.State.CREATED) {
@@ -191,23 +218,6 @@ object KeyguardRootViewBinder {
                            }
                        }

                        launch {
                            val clipBounds = Rect()
                            viewModel.topClippingBounds.collect { clipTop ->
                                if (clipTop == null) {
                                    view.setClipBounds(null)
                                } else {
                                    clipBounds.apply {
                                        top = clipTop
                                        left = view.getLeft()
                                        right = view.getRight()
                                        bottom = view.getBottom()
                                    }
                                    view.setClipBounds(clipBounds)
                                }
                            }
                        }

                        launch {
                            viewModel.lockscreenStateAlpha(viewState).collect { alpha ->
                                childViews[statusViewId]?.alpha = alpha
+1 −0
Original line number Diff line number Diff line
@@ -394,6 +394,7 @@ constructor(
                    null, // device entry haptics not required for preview mode
                    null, // falsing manager not required for preview mode
                    null, // keyguard view mediator is not required for preview mode
                    mainDispatcher,
                )
        }
        rootView.addView(