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

Commit 8125d83f authored by Ale Nijamkin's avatar Ale Nijamkin Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Adds logging to help debug b/390904731" into main

parents 42a65019 738d7cfe
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

package com.android.systemui.scene.domain.resolver

import android.util.Log
import com.android.compose.animation.scene.SceneKey
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
@@ -85,8 +86,8 @@ constructor(
        isUnlocked: Boolean,
        isDreamingWithOverlay: Boolean,
        isAbleToDream: Boolean,
    ): SceneKey =
        when {
    ): SceneKey {
        val result = when {
            // Dream can run even if Keyguard is disabled, thus it has the highest priority here.
            isDreamingWithOverlay && isAbleToDream -> Scenes.Dream
            !isKeyguardEnabled -> Scenes.Gone
@@ -95,8 +96,21 @@ constructor(
            !isUnlocked -> Scenes.Lockscreen
            else -> Scenes.Gone
        }
        Log.d(TAG, "homeScene emitting $result, values:")
        Log.d(TAG, "  isKeyguardEnabled=$isKeyguardEnabled")
        Log.d(TAG, "  canSwipeToEnter=$canSwipeToEnter")
        Log.d(TAG, "  isDeviceEntered=$isDeviceEntered" )
        Log.d(TAG, "  isUnlocked=$isUnlocked")
        Log.d(TAG, "  isDreamingWithOverlay=$isDreamingWithOverlay")
        Log.d(TAG, "  isAbleToDream=$isAbleToDream")
        Log.d(TAG, "")
        return result
    }

    companion object {

        private const val TAG = "HomeSceneFamilyResolver"

        val homeScenes =
            setOf(
                Scenes.Gone,
+1 −1
Original line number Diff line number Diff line
@@ -564,7 +564,7 @@ constructor(
                .collect {
                    switchToScene(
                        targetSceneKey = Scenes.Lockscreen,
                        loggingReason = "device became non-interactive",
                        loggingReason = "device became non-interactive (SceneContainerStartable)",
                    )
                }
        }
+32 −8
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.shade.domain.interactor

import android.util.Log
import com.android.app.tracing.coroutines.flow.flowName
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
@@ -38,6 +39,7 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.stateIn

/** The non-empty SceneInteractor implementation. */
@@ -98,18 +100,36 @@ constructor(

    override val isShadeTouchable: Flow<Boolean> =
        combine(
            powerInteractor.isAsleep,
            keyguardTransitionInteractor.isInTransition(Edge.create(to = KeyguardState.AOD)),
            keyguardRepository.dozeTransitionModel.map { it.to == DozeStateModel.DOZE_PULSING },
        ) { isAsleep, goingToSleep, isPulsing ->
            when {
                // If the device is going to sleep, only accept touches if we're still
                // animating
                goingToSleep -> dozeParams.shouldControlScreenOff()
            powerInteractor.isAsleep
                .onEach { Log.d(TAG, "isShadeTouchable: upstream isAsleep=$it") },
            keyguardTransitionInteractor
                .isInTransition(Edge.create(to = KeyguardState.AOD))
                .onEach {
                    Log.d(
                        TAG,
                        "isShadeTouchable: upstream isTransitioningToAod=$it",
                    )
                },
            keyguardRepository.dozeTransitionModel
                .map { it.to == DozeStateModel.DOZE_PULSING }
                .onEach {
                    Log.d(TAG, "isShadeTouchable: upstream isPulsing=$it")
                },
        ) { isAsleep, isTransitioningToAod, isPulsing ->
            val downstream = when {
                // If the device is transitioning to AOD, only accept touches if
                // still animating.
                isTransitioningToAod -> dozeParams.shouldControlScreenOff()
                // If the device is asleep, only accept touches if there's a pulse
                isAsleep -> isPulsing
                else -> true
            }
            Log.d(TAG, "isShadeTouchable emitting $downstream, values:")
            Log.d(TAG, "  isAsleep=$isAsleep")
            Log.d(TAG, "  isTransitioningToAod=$isTransitioningToAod")
            Log.d(TAG, "  isPulsing=$isPulsing")
            Log.d(TAG, "")
            downstream
        }

    override val isExpandToQsEnabled: Flow<Boolean> =
@@ -128,4 +148,8 @@ constructor(
                disableFlags.isQuickSettingsEnabled() &&
                !isDozing
        }

    companion object {
        private const val TAG = "ShadeInteractor"
    }
}
+10 −4
Original line number Diff line number Diff line
@@ -199,11 +199,14 @@ constructor(
            )
        } else if (transitionKey == Instant) {
            // TODO(b/356596436): Define instant transition instead of snapToScene().
            sceneInteractor.snapToScene(toScene = SceneFamilies.Home, loggingReason = loggingReason)
            sceneInteractor.snapToScene(
                toScene = SceneFamilies.Home,
                loggingReason = loggingReason + " (collapseNotificationsShade)",
            )
        } else {
            sceneInteractor.changeScene(
                toScene = SceneFamilies.Home,
                loggingReason = loggingReason,
                loggingReason = loggingReason + " (collapseNotificationsShade)",
                transitionKey =
                    transitionKey ?: ToSplitShade.takeIf { shadeModeInteractor.isSplitShade },
            )
@@ -230,11 +233,14 @@ constructor(
            if (bypassNotificationsShade || isSplitShade) SceneFamilies.Home else Scenes.Shade
        if (transitionKey == Instant) {
            // TODO(b/356596436): Define instant transition instead of snapToScene().
            sceneInteractor.snapToScene(toScene = targetScene, loggingReason = loggingReason)
            sceneInteractor.snapToScene(
                toScene = targetScene,
                loggingReason = loggingReason + " (collapseQuickSettingsShade)",
            )
        } else {
            sceneInteractor.changeScene(
                toScene = targetScene,
                loggingReason = loggingReason,
                loggingReason = loggingReason + " (collapseQuickSettingsShade)",
                transitionKey = transitionKey ?: ToSplitShade.takeIf { isSplitShade },
            )
        }