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

Commit cec7ce56 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[bc25] Reset ShadeSessionStorage when Dual Shade is visible." into main

parents 1c5c0f5c bd6890b9
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -152,15 +152,18 @@ private fun Modifier.panelPadding(): Modifier {
/** Creates a union of [paddingValues] by using the max padding of each edge. */
@Composable
private fun combinePaddings(vararg paddingValues: PaddingValues): PaddingValues {
    return if (paddingValues.isEmpty()) {
        PaddingValues(0.dp)
    } else {
        val layoutDirection = LocalLayoutDirection.current

    return PaddingValues(
        start = paddingValues.maxOfOrNull { it.calculateStartPadding(layoutDirection) } ?: 0.dp,
        top = paddingValues.maxOfOrNull { it.calculateTopPadding() } ?: 0.dp,
        end = paddingValues.maxOfOrNull { it.calculateEndPadding(layoutDirection) } ?: 0.dp,
        bottom = paddingValues.maxOfOrNull { it.calculateBottomPadding() } ?: 0.dp,
        PaddingValues(
            start = paddingValues.maxOf { it.calculateStartPadding(layoutDirection) },
            top = paddingValues.maxOf { it.calculateTopPadding() },
            end = paddingValues.maxOf { it.calculateEndPadding(layoutDirection) },
            bottom = paddingValues.maxOf { it.calculateBottomPadding() },
        )
    }
}

object OverlayShade {
    object Elements {
+6 −12
Original line number Diff line number Diff line
@@ -193,22 +193,16 @@ constructor(
                        // We are in a session if either Shade or QuickSettings is on the back stack
                        .map { backStack ->
                            backStack.asIterable().any {
                                // TODO(b/356596436): Include overlays in the back stack as well.
                                it == Scenes.Shade || it == Scenes.QuickSettings
                            }
                        }
                        .distinctUntilChanged(),
                    sceneInteractor.transitionState
                        .mapNotNull { state ->
                            // We are also in a session if either Shade or QuickSettings is the
                            // current scene
                            when (state) {
                                is ObservableTransitionState.Idle -> state.currentScene
                                is ObservableTransitionState.Transition -> state.fromContent
                            }.let { it == Scenes.Shade || it == Scenes.QuickSettings }
                        }
                        .distinctUntilChanged(),
                ) { inBackStack, isCurrentScene ->
                    inBackStack || isCurrentScene
                    // We are also in a session if either Notifications Shade or QuickSettings Shade
                    // is currently shown (whether idle or animating).
                    shadeInteractor.isAnyExpanded,
                ) { inBackStack, isShadeShown ->
                    inBackStack || isShadeShown
                }
                // Once a session has ended, clear the session storage.
                .filter { inSession -> !inSession }