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

Commit dbf9baf9 authored by Danny Burakov's avatar Danny Burakov Committed by Android (Google) Code Review
Browse files

Merge "[Dual Shade] Match the HUN draw bounds to notifications stack alignment." into main

parents abcf5b7f 052fff12
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -37,14 +37,15 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.absoluteOffset
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imeAnimationTarget
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.windowInsetsBottomHeight
import androidx.compose.foundation.overscroll
import androidx.compose.foundation.shape.RoundedCornerShape
@@ -82,6 +83,7 @@ import androidx.compose.ui.layout.positionInWindow
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.platform.LocalWindowInfo
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntOffset
@@ -101,6 +103,7 @@ import com.android.compose.animation.scene.content.state.TransitionState
import com.android.compose.gesture.effect.OffsetOverscrollEffect
import com.android.compose.gesture.effect.rememberOffsetOverscrollEffect
import com.android.compose.modifiers.thenIf
import com.android.compose.modifiers.width
import com.android.compose.nestedscroll.OnStopScope
import com.android.compose.nestedscroll.PriorityNestedScrollConnection
import com.android.compose.nestedscroll.ScrollController
@@ -225,6 +228,9 @@ fun ContentScope.SnoozeableHeadsUpNotificationSpace(
            }
        }

    val horizontalAlignment = viewModel.horizontalAlignment
    val halfScreenWidth = LocalWindowInfo.current.containerSize.width / 2

    LaunchedEffect(isSnoozable) { scrollOffset = 0f }

    LaunchedEffect(scrollableState.isScrollInProgress) {
@@ -254,9 +260,13 @@ fun ContentScope.SnoozeableHeadsUpNotificationSpace(
        viewModel = viewModel,
        modifier =
            modifier
                .absoluteOffset {
                // In side-aligned layouts, HUNs are limited to half the screen width.
                .thenIf(horizontalAlignment != Alignment.CenterHorizontally) {
                    Modifier.width { halfScreenWidth }
                }
                .offset {
                    IntOffset(
                        x = 0,
                        x = if (horizontalAlignment == Alignment.End) halfScreenWidth else 0,
                        y =
                            calculateHeadsUpPlaceholderYOffset(
                                scrollOffset.roundToInt(),
+9 −4
Original line number Diff line number Diff line
@@ -17,10 +17,10 @@
package com.android.systemui.statusbar.notification.stack.ui.viewmodel

import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.compose.animation.scene.ContentKey
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.dump.DumpManager
import com.android.systemui.flags.FeatureFlagsClassic
import com.android.systemui.flags.Flags
@@ -46,7 +46,6 @@ import com.android.systemui.wallpapers.domain.interactor.WallpaperFocalAreaInter
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import java.util.function.Consumer
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filter
@@ -61,13 +60,12 @@ class NotificationsPlaceholderViewModel
constructor(
    private val interactor: NotificationStackAppearanceInteractor,
    private val sceneInteractor: SceneInteractor,
    private val shadeInteractor: ShadeInteractor,
    shadeInteractor: ShadeInteractor,
    shadeModeInteractor: ShadeModeInteractor,
    private val headsUpNotificationInteractor: HeadsUpNotificationInteractor,
    remoteInputInteractor: RemoteInputInteractor,
    featureFlags: FeatureFlagsClassic,
    dumpManager: DumpManager,
    @Main private val mainContext: CoroutineContext,
    private val wallpaperFocalAreaInteractor: WallpaperFocalAreaInteractor,
) :
    ExclusiveActivatable(),
@@ -94,6 +92,13 @@ constructor(
            source = shadeModeInteractor.shadeMode.map { getQuickSettingsShadeContentKey(it) },
        )

    /** @see NotificationStackAppearanceInteractor.notificationStackHorizontalAlignment */
    val horizontalAlignment: Alignment.Horizontal by
        hydrator.hydratedStateOf(
            traceName = "horizontalAlignment",
            source = interactor.notificationStackHorizontalAlignment,
        )

    /**
     * Whether the current gesture is expanding a Notification. If true, the NSSL has already
     * consumed the swipe amount to increase the Notification's size.
+0 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import com.android.systemui.dump.dumpManager
import com.android.systemui.flags.featureFlagsClassic
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.testScope
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.shade.domain.interactor.shadeInteractor
import com.android.systemui.shade.domain.interactor.shadeModeInteractor
@@ -39,7 +38,6 @@ val Kosmos.notificationsPlaceholderViewModel by Fixture {
        remoteInputInteractor = remoteInputInteractor,
        featureFlags = featureFlagsClassic,
        dumpManager = dumpManager,
        mainContext = testScope.coroutineContext,
        wallpaperFocalAreaInteractor = wallpaperFocalAreaInteractor,
    )
}