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

Commit 0eed1b2a authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Fix the elements below smartspace in weather clock move when there's event on...

Fix the elements below smartspace in weather clock move when there's event on smartspace and there's aod notification icon

Bug: 342518771
Flag: com.android.systemui.migrate_clocks_to_blueprint
Test: 1) manually turn on flash light to show smartspace, and add notification by Notify.apk, observe that elements below smartspace move down to avoid overlap with aod notification icon; 2) swipe away notification, keep flashlight and observe there's no movement in weather clock; 3)add notification and turn off flashlight, observe that there's no movement in the clock; 4) turn off flashlight and clear notifications, there's no movement and proper space between time element and elemens below smartspace for weather clock.

Change-Id: Id97c04568c7bf83cbd226e0c6422347f477e177f
parent 4c5d3987
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import com.android.systemui.res.R
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.shade.shared.model.ShadeMode
import com.android.systemui.statusbar.notification.domain.interactor.NotificationsKeyguardInteractor
import com.android.systemui.statusbar.notification.icon.ui.viewmodel.NotificationIconContainerAlwaysOnDisplayViewModel
import com.android.systemui.statusbar.ui.SystemBarUtilsProxy
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
@@ -48,6 +49,7 @@ class KeyguardClockViewModel
constructor(
    keyguardClockInteractor: KeyguardClockInteractor,
    @Application private val applicationScope: CoroutineScope,
    aodNotificationIconViewModel: NotificationIconContainerAlwaysOnDisplayViewModel,
    notifsKeyguardInteractor: NotificationsKeyguardInteractor,
    @get:VisibleForTesting val shadeInteractor: ShadeInteractor,
    private val systemBarUtils: SystemBarUtilsProxy,
@@ -105,8 +107,13 @@ constructor(
            initialValue = false
        )

    val isAodIconsVisible: StateFlow<Boolean> =
        notifsKeyguardInteractor.areNotificationsFullyHidden.stateIn(
    // To translate elements below smartspace in weather clock to avoid overlapping between date
    // element in weather clock and aod icons
    val isAodIconsVisible: StateFlow<Boolean> = combine(aodNotificationIconViewModel.icons.map {
        it.visibleIcons.isNotEmpty()
    }, notifsKeyguardInteractor.areNotificationsFullyHidden) { hasIcons, visible ->
        hasIcons && visible
    }.stateIn(
            scope = applicationScope,
            started = SharingStarted.WhileSubscribed(),
            initialValue = false
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import com.android.systemui.keyguard.domain.interactor.keyguardClockInteractor
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.shade.domain.interactor.shadeInteractor
import com.android.systemui.statusbar.notification.icon.ui.viewmodel.notificationIconContainerAlwaysOnDisplayViewModel
import com.android.systemui.statusbar.notification.stack.domain.interactor.notificationsKeyguardInteractor
import com.android.systemui.statusbar.ui.systemBarUtilsProxy

@@ -30,6 +31,7 @@ val Kosmos.keyguardClockViewModel by
        KeyguardClockViewModel(
            keyguardClockInteractor = keyguardClockInteractor,
            applicationScope = applicationCoroutineScope,
            aodNotificationIconViewModel = notificationIconContainerAlwaysOnDisplayViewModel,
            notifsKeyguardInteractor = notificationsKeyguardInteractor,
            shadeInteractor = shadeInteractor,
            systemBarUtils = systemBarUtilsProxy,