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

Commit 2009d2ce authored by Matt Pietal's avatar Matt Pietal
Browse files

Allow shelf to overlap UDFPS/lock icon

Port the logic over from NotificationPanelViewController into the
interactors. This allows overlap with UDFPS, or with lock icon and no
ambient indication content present.

Fixes: 315344116
Test: atest SharedNotificationContainerInteractorTest
Flag: ACONFIG com.android.systemui.keyguard_shade_migration_nssl
DEVELOPMENT

Change-Id: I989d92bc81bbb2f2b365f61b03f36184de32db51
parent 42f9b0d5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -160,6 +160,9 @@ interface KeyguardRepository {
    /** Last point that [KeyguardRootView] was tapped */
    val lastRootViewTapPosition: MutableStateFlow<Point?>

    /** Is the ambient indication area visible? */
    val ambientIndicationVisible: MutableStateFlow<Boolean>

    /** Observable for the [StatusBarState] */
    val statusBarState: StateFlow<StatusBarState>

@@ -423,6 +426,8 @@ constructor(

    override val lastRootViewTapPosition: MutableStateFlow<Point?> = MutableStateFlow(null)

    override val ambientIndicationVisible: MutableStateFlow<Boolean> = MutableStateFlow(false)

    override val isDreamingWithOverlay: Flow<Boolean> =
        conflatedCallbackFlow {
                val callback =
+7 −0
Original line number Diff line number Diff line
@@ -174,6 +174,9 @@ constructor(
    /** Last point that [KeyguardRootView] view was tapped */
    val lastRootViewTapPosition: Flow<Point?> = repository.lastRootViewTapPosition.asStateFlow()

    /** Is the ambient indication area visible? */
    val ambientIndicationVisible: Flow<Boolean> = repository.ambientIndicationVisible.asStateFlow()

    /** Whether the primary bouncer is showing or not. */
    val primaryBouncerShowing: Flow<Boolean> = bouncerRepository.primaryBouncerShow

@@ -311,6 +314,10 @@ constructor(
        repository.lastRootViewTapPosition.value = point
    }

    fun setAmbientIndicationVisible(isVisible: Boolean) {
        repository.ambientIndicationVisible.value = isVisible
    }

    companion object {
        private const val TAG = "KeyguardInteractor"
    }
+19 −1
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ package com.android.systemui.statusbar.notification.stack.domain.interactor
import android.content.Context
import com.android.systemui.common.ui.data.repository.ConfigurationRepository
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryUdfpsInteractor
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.res.R
import com.android.systemui.statusbar.policy.SplitShadeStateController
import javax.inject.Inject
@@ -28,6 +30,7 @@ import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
@@ -39,7 +42,9 @@ class SharedNotificationContainerInteractor
constructor(
    configurationRepository: ConfigurationRepository,
    private val context: Context,
    private val splitShadeStateController: SplitShadeStateController
    private val splitShadeStateController: SplitShadeStateController,
    keyguardInteractor: KeyguardInteractor,
    deviceEntryUdfpsInteractor: DeviceEntryUdfpsInteractor,
) {

    private val _topPosition = MutableStateFlow(0f)
@@ -75,6 +80,19 @@ constructor(
            }
            .distinctUntilChanged()

    /**
     * The notification shelf can extend over the lock icon area if:
     * * UDFPS supported. Ambient indication will always appear below
     * * UDFPS not supported and ambient indication not visible, which will appear above lock icon
     */
    val useExtraShelfSpace: Flow<Boolean> =
        combine(
            keyguardInteractor.ambientIndicationVisible,
            deviceEntryUdfpsInteractor.isUdfpsSupported,
        ) { ambientIndicationVisible, isUdfpsSupported ->
            isUdfpsSupported || !ambientIndicationVisible
        }

    val isSplitShadeEnabled: Flow<Boolean> =
        configurationBasedDimensions
            .map { dimens: ConfigurationBasedDimensions -> dimens.useSplitShade }
+4 −3
Original line number Diff line number Diff line
@@ -101,12 +101,13 @@ object SharedNotificationContainerBinder {

                    launch {
                        viewModel
                            .getMaxNotifications { space ->
                            .getMaxNotifications { space, extraShelfSpace ->
                                val shelfHeight = controller.getShelfHeight().toFloat()
                                notificationStackSizeCalculator.computeMaxKeyguardNotifications(
                                    controller.getView(),
                                    space,
                                    0f, // Vertical space for shelf is already accounted for
                                    controller.getShelfHeight().toFloat(),
                                    if (extraShelfSpace) shelfHeight else 0f,
                                    shelfHeight,
                                )
                            }
                            .collect { controller.setMaxDisplayedNotifications(it) }
+10 −4
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ constructor(
     * When expanding or when the user is interacting with the shade, keep the count stable; do not
     * emit a value.
     */
    fun getMaxNotifications(calculateSpace: (Float) -> Int): Flow<Int> {
    fun getMaxNotifications(calculateSpace: (Float, Boolean) -> Int): Flow<Int> {
        val showLimitedNotifications = isOnLockscreenWithoutShade
        val showUnlimitedNotifications =
            combine(
@@ -245,11 +245,17 @@ constructor(
                shadeInteractor.isUserInteracting,
                bounds,
                interactor.notificationStackChanged.onStart { emit(Unit) },
            ) { showLimitedNotifications, showUnlimitedNotifications, isUserInteracting, bounds, _
                ->
                interactor.useExtraShelfSpace,
            ) { flows ->
                val showLimitedNotifications = flows[0] as Boolean
                val showUnlimitedNotifications = flows[1] as Boolean
                val isUserInteracting = flows[2] as Boolean
                val bounds = flows[3] as NotificationContainerBounds
                val useExtraShelfSpace = flows[5] as Boolean

                if (!isUserInteracting) {
                    if (showLimitedNotifications) {
                        emit(calculateSpace(bounds.bottom - bounds.top))
                        emit(calculateSpace(bounds.bottom - bounds.top, useExtraShelfSpace))
                    } else if (showUnlimitedNotifications) {
                        emit(-1)
                    }
Loading