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

Commit d816cd77 authored by Chandru S's avatar Chandru S
Browse files

Set early wakeup flag on surface flinger when lockscreen is visible or when shade dragging begins

This is required to keep surface flinger ready for bouncer or ambient AOD blur (in the future) or shade pull down.

Bug: 393199337
Test: verified early wake up is enabled through logs and trace
Flag: com.android.systemui.bouncer_ui_revamp
Change-Id: I368cb0cee0edbcb2dd9dd609e5b71bde22f355f3
parent d49583bb
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -59,6 +59,15 @@ object WindowRootViewBinder {
            ) { viewModel ->
                try {
                    Log.d(TAG, "Launching coroutines that update window root view state")
                    launchTraced("early-wakeup") {
                        viewModel.isPersistentEarlyWakeupRequired.collect { wakeupRequired ->
                            blurUtils.setPersistentEarlyWakeup(
                                wakeupRequired,
                                view.rootView?.viewRootImpl,
                            )
                        }
                    }

                    launchTraced("WindowBlur") {
                        var wasUpdateScheduledForThisFrame = false
                        var lastScheduledBlurRadius = 0
+23 −0
Original line number Diff line number Diff line
@@ -19,13 +19,16 @@ package com.android.systemui.window.ui.viewmodel
import android.os.Build
import android.util.Log
import com.android.systemui.Flags
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.ui.transitions.GlanceableHubTransition
import com.android.systemui.keyguard.ui.transitions.PrimaryBouncerTransition
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.window.domain.interactor.WindowRootViewBlurInteractor
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
@@ -41,6 +44,8 @@ constructor(
    primaryBouncerTransitions: Set<@JvmSuppressWildcards PrimaryBouncerTransition>,
    glanceableHubTransitions: Set<@JvmSuppressWildcards GlanceableHubTransition>,
    private val blurInteractor: WindowRootViewBlurInteractor,
    private val keyguardInteractor: KeyguardInteractor,
    private val shadeInteractor: ShadeInteractor,
) {

    private val bouncerBlurRadiusFlows =
@@ -70,6 +75,24 @@ constructor(
            }
        }

    val isPersistentEarlyWakeupRequired =
        blurInteractor.isBlurCurrentlySupported
            .flatMapLatest { blurSupported ->
                if (blurSupported) {
                    combine(
                        keyguardInteractor.isKeyguardShowing,
                        shadeInteractor.isUserInteracting,
                        shadeInteractor.isAnyExpanded,
                    ) { keyguardShowing, userDraggingShade, anyExpanded ->
                        keyguardShowing || userDraggingShade || anyExpanded
                    }
                } else {
                    flowOf(false)
                }
            }
            .distinctUntilChanged()
            .logIfPossible("isPersistentEarlyWakeupRequired")

    val isBlurOpaque =
        blurInteractor.isBlurCurrentlySupported.flatMapLatest { blurSupported ->
            if (blurSupported) {
+4 −0
Original line number Diff line number Diff line
@@ -16,9 +16,11 @@

package com.android.systemui.window.ui.viewmodel

import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.keyguard.ui.transitions.FakeBouncerTransition
import com.android.systemui.keyguard.ui.transitions.FakeGlanceableHubTransition
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.shade.domain.interactor.shadeInteractor
import com.android.systemui.window.domain.interactor.windowRootViewBlurInteractor
import org.mockito.internal.util.collections.Sets

@@ -38,5 +40,7 @@ val Kosmos.windowRootViewModel by
            fakeBouncerTransitions,
            fakeGlanceableHubTransitions,
            windowRootViewBlurInteractor,
            keyguardInteractor,
            shadeInteractor,
        )
    }