Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractor.kt +38 −5 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor import com.android.systemui.statusbar.notification.domain.interactor.HeadsUpNotificationInteractor import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUiAod import com.android.systemui.statusbar.notification.promoted.domain.interactor.AODPromotedNotificationInteractor import com.android.systemui.util.kotlin.combine import com.android.systemui.wallpapers.domain.interactor.WallpaperFocalAreaInteractor import javax.inject.Inject Loading @@ -45,6 +47,7 @@ import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn Loading @@ -57,6 +60,7 @@ class KeyguardClockInteractor constructor( mediaCarouselInteractor: MediaCarouselInteractor, activeNotificationsInteractor: ActiveNotificationsInteractor, aodPromotedNotificationInteractor: AODPromotedNotificationInteractor, shadeInteractor: ShadeInteractor, keyguardInteractor: KeyguardInteractor, keyguardTransitionInteractor: KeyguardTransitionInteractor, Loading @@ -80,11 +84,30 @@ constructor( var clock: ClockController? by keyguardClockRepository.clockEventController::clock private val isAodPromotedNotificationPresent: Flow<Boolean> = if (PromotedNotificationUiAod.isEnabled) { aodPromotedNotificationInteractor.isPresent } else { flowOf(false) } private val areAnyNotificationsPresent: Flow<Boolean> = if (PromotedNotificationUiAod.isEnabled) { combine( activeNotificationsInteractor.areAnyNotificationsPresent, isAodPromotedNotificationPresent, ) { areAnyNotificationsPresent, isAodPromotedNotificationPresent -> areAnyNotificationsPresent || isAodPromotedNotificationPresent } } else { activeNotificationsInteractor.areAnyNotificationsPresent } val clockSize: StateFlow<ClockSize> = if (SceneContainerFlag.isEnabled) { combine( shadeInteractor.isShadeLayoutWide, activeNotificationsInteractor.areAnyNotificationsPresent, areAnyNotificationsPresent, mediaCarouselInteractor.hasActiveMediaOrRecommendation, keyguardInteractor.isDozing, isOnAod, Loading @@ -110,23 +133,32 @@ constructor( if (SceneContainerFlag.isEnabled) { combine( shadeInteractor.isShadeLayoutWide, activeNotificationsInteractor.areAnyNotificationsPresent, areAnyNotificationsPresent, isAodPromotedNotificationPresent, isOnAod, headsUpNotificationInteractor.isHeadsUpOrAnimatingAway, keyguardInteractor.isDozing, ) { isShadeLayoutWide, areAnyNotificationsPresent, isOnAod, isHeadsUp, isDozing -> ) { isShadeLayoutWide, areAnyNotificationsPresent, isAodPromotedNotificationPresent, isOnAod, isHeadsUp, isDozing -> when { !isShadeLayoutWide -> true !areAnyNotificationsPresent -> true // Pulsing notification appears on the right. Move clock left to avoid overlap. isHeadsUp && isDozing -> false isAodPromotedNotificationPresent -> false else -> isOnAod } } } else { combine( shadeInteractor.isShadeLayoutWide, activeNotificationsInteractor.areAnyNotificationsPresent, areAnyNotificationsPresent, isAodPromotedNotificationPresent, keyguardInteractor.dozeTransitionModel, keyguardTransitionInteractor.startedKeyguardTransitionStep.map { it.to == AOD }, keyguardTransitionInteractor.startedKeyguardTransitionStep.map { Loading @@ -140,6 +172,7 @@ constructor( ) { isShadeLayoutWide, areAnyNotificationsPresent, isAodPromotedNotificationPresent, dozeTransitionModel, startedToAod, startedToLockScreen, Loading @@ -156,7 +189,7 @@ constructor( // use null to skip emitting wrong value startedToGone || startedToDoze -> null startedToLockScreen -> !areAnyNotificationsPresent startedToAod -> !isPulsing startedToAod -> !(isPulsing || isAodPromotedNotificationPresent) else -> true } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractor.kt +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.promoted.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.Style import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map Loading @@ -31,4 +32,6 @@ constructor(activeNotificationsInteractor: ActiveNotificationsInteractor) { activeNotificationsInteractor.topLevelRepresentativeNotifications.map { notifs -> notifs.firstNotNullOfOrNull { it.promotedContent } } val isPresent: Flow<Boolean> = content.map { (it != null) && (it.style != Style.Ineligible) } } packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.media.controls.domain.pipeline.interactor.mediaCarouselInteractor import com.android.systemui.shade.domain.interactor.shadeInteractor import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor import com.android.systemui.statusbar.notification.promoted.domain.interactor.aodPromotedNotificationInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor import com.android.systemui.wallpapers.domain.interactor.wallpaperFocalAreaInteractor Loading @@ -30,6 +31,7 @@ val Kosmos.keyguardClockInteractor by KeyguardClockInteractor( mediaCarouselInteractor = mediaCarouselInteractor, activeNotificationsInteractor = activeNotificationsInteractor, aodPromotedNotificationInteractor = aodPromotedNotificationInteractor, shadeInteractor = shadeInteractor, keyguardInteractor = keyguardInteractor, keyguardTransitionInteractor = keyguardTransitionInteractor, Loading packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractorKosmos.kt 0 → 100644 +27 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.notification.promoted.domain.interactor import com.android.systemui.kosmos.Kosmos import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor val Kosmos.aodPromotedNotificationInteractor by Kosmos.Fixture { AODPromotedNotificationInteractor( activeNotificationsInteractor = activeNotificationsInteractor ) } Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractor.kt +38 −5 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor import com.android.systemui.statusbar.notification.domain.interactor.HeadsUpNotificationInteractor import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUiAod import com.android.systemui.statusbar.notification.promoted.domain.interactor.AODPromotedNotificationInteractor import com.android.systemui.util.kotlin.combine import com.android.systemui.wallpapers.domain.interactor.WallpaperFocalAreaInteractor import javax.inject.Inject Loading @@ -45,6 +47,7 @@ import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn Loading @@ -57,6 +60,7 @@ class KeyguardClockInteractor constructor( mediaCarouselInteractor: MediaCarouselInteractor, activeNotificationsInteractor: ActiveNotificationsInteractor, aodPromotedNotificationInteractor: AODPromotedNotificationInteractor, shadeInteractor: ShadeInteractor, keyguardInteractor: KeyguardInteractor, keyguardTransitionInteractor: KeyguardTransitionInteractor, Loading @@ -80,11 +84,30 @@ constructor( var clock: ClockController? by keyguardClockRepository.clockEventController::clock private val isAodPromotedNotificationPresent: Flow<Boolean> = if (PromotedNotificationUiAod.isEnabled) { aodPromotedNotificationInteractor.isPresent } else { flowOf(false) } private val areAnyNotificationsPresent: Flow<Boolean> = if (PromotedNotificationUiAod.isEnabled) { combine( activeNotificationsInteractor.areAnyNotificationsPresent, isAodPromotedNotificationPresent, ) { areAnyNotificationsPresent, isAodPromotedNotificationPresent -> areAnyNotificationsPresent || isAodPromotedNotificationPresent } } else { activeNotificationsInteractor.areAnyNotificationsPresent } val clockSize: StateFlow<ClockSize> = if (SceneContainerFlag.isEnabled) { combine( shadeInteractor.isShadeLayoutWide, activeNotificationsInteractor.areAnyNotificationsPresent, areAnyNotificationsPresent, mediaCarouselInteractor.hasActiveMediaOrRecommendation, keyguardInteractor.isDozing, isOnAod, Loading @@ -110,23 +133,32 @@ constructor( if (SceneContainerFlag.isEnabled) { combine( shadeInteractor.isShadeLayoutWide, activeNotificationsInteractor.areAnyNotificationsPresent, areAnyNotificationsPresent, isAodPromotedNotificationPresent, isOnAod, headsUpNotificationInteractor.isHeadsUpOrAnimatingAway, keyguardInteractor.isDozing, ) { isShadeLayoutWide, areAnyNotificationsPresent, isOnAod, isHeadsUp, isDozing -> ) { isShadeLayoutWide, areAnyNotificationsPresent, isAodPromotedNotificationPresent, isOnAod, isHeadsUp, isDozing -> when { !isShadeLayoutWide -> true !areAnyNotificationsPresent -> true // Pulsing notification appears on the right. Move clock left to avoid overlap. isHeadsUp && isDozing -> false isAodPromotedNotificationPresent -> false else -> isOnAod } } } else { combine( shadeInteractor.isShadeLayoutWide, activeNotificationsInteractor.areAnyNotificationsPresent, areAnyNotificationsPresent, isAodPromotedNotificationPresent, keyguardInteractor.dozeTransitionModel, keyguardTransitionInteractor.startedKeyguardTransitionStep.map { it.to == AOD }, keyguardTransitionInteractor.startedKeyguardTransitionStep.map { Loading @@ -140,6 +172,7 @@ constructor( ) { isShadeLayoutWide, areAnyNotificationsPresent, isAodPromotedNotificationPresent, dozeTransitionModel, startedToAod, startedToLockScreen, Loading @@ -156,7 +189,7 @@ constructor( // use null to skip emitting wrong value startedToGone || startedToDoze -> null startedToLockScreen -> !areAnyNotificationsPresent startedToAod -> !isPulsing startedToAod -> !(isPulsing || isAodPromotedNotificationPresent) else -> true } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractor.kt +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.promoted.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.Style import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map Loading @@ -31,4 +32,6 @@ constructor(activeNotificationsInteractor: ActiveNotificationsInteractor) { activeNotificationsInteractor.topLevelRepresentativeNotifications.map { notifs -> notifs.firstNotNullOfOrNull { it.promotedContent } } val isPresent: Flow<Boolean> = content.map { (it != null) && (it.style != Style.Ineligible) } }
packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.media.controls.domain.pipeline.interactor.mediaCarouselInteractor import com.android.systemui.shade.domain.interactor.shadeInteractor import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor import com.android.systemui.statusbar.notification.promoted.domain.interactor.aodPromotedNotificationInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor import com.android.systemui.wallpapers.domain.interactor.wallpaperFocalAreaInteractor Loading @@ -30,6 +31,7 @@ val Kosmos.keyguardClockInteractor by KeyguardClockInteractor( mediaCarouselInteractor = mediaCarouselInteractor, activeNotificationsInteractor = activeNotificationsInteractor, aodPromotedNotificationInteractor = aodPromotedNotificationInteractor, shadeInteractor = shadeInteractor, keyguardInteractor = keyguardInteractor, keyguardTransitionInteractor = keyguardTransitionInteractor, Loading
packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractorKosmos.kt 0 → 100644 +27 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.notification.promoted.domain.interactor import com.android.systemui.kosmos.Kosmos import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor val Kosmos.aodPromotedNotificationInteractor by Kosmos.Fixture { AODPromotedNotificationInteractor( activeNotificationsInteractor = activeNotificationsInteractor ) }