Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinator.kt +4 −4 Original line number Diff line number Diff line Loading @@ -37,8 +37,8 @@ import com.android.systemui.statusbar.notification.collection.coordinator.dagger import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifFilter import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener import com.android.systemui.statusbar.notification.collection.provider.SectionHeaderVisibilityProvider import com.android.systemui.statusbar.notification.domain.interactor.SeenNotificationsInteractor import com.android.systemui.statusbar.notification.interruption.KeyguardNotificationVisibilityProvider import com.android.systemui.statusbar.notification.stack.domain.interactor.NotificationListInteractor import com.android.systemui.statusbar.policy.HeadsUpManager import com.android.systemui.statusbar.policy.headsUpEvents import com.android.systemui.util.asIndenting Loading Loading @@ -85,7 +85,7 @@ constructor( @Application private val scope: CoroutineScope, private val sectionHeaderVisibilityProvider: SectionHeaderVisibilityProvider, private val secureSettings: SecureSettings, private val notificationListInteractor: NotificationListInteractor, private val seenNotificationsInteractor: SeenNotificationsInteractor, private val statusBarStateController: StatusBarStateController, ) : Coordinator, Dumpable { Loading Loading @@ -351,7 +351,7 @@ constructor( override fun onCleanup() { logger.logProviderHasFilteredOutSeenNotifs(hasFilteredAnyNotifs) notificationListInteractor.setHasFilteredOutSeenNotifications(hasFilteredAnyNotifs) seenNotificationsInteractor.setHasFilteredOutSeenNotifications(hasFilteredAnyNotifs) hasFilteredAnyNotifs = false } } Loading Loading @@ -389,7 +389,7 @@ constructor( with(pw.asIndenting()) { println( "notificationListInteractor.hasFilteredOutSeenNotifications.value=" + notificationListInteractor.hasFilteredOutSeenNotifications.value seenNotificationsInteractor.hasFilteredOutSeenNotifications.value ) println("unseen notifications:") indentIfPossible { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/data/NotificationDataLayerModule.kt +1 −8 Original line number Diff line number Diff line Loading @@ -15,15 +15,8 @@ */ package com.android.systemui.statusbar.notification.data import com.android.systemui.statusbar.notification.data.repository.NotificationStackRepositoryModule import com.android.systemui.statusbar.notification.data.repository.NotificationsKeyguardStateRepositoryModule import dagger.Module @Module( includes = [ NotificationStackRepositoryModule::class, NotificationsKeyguardStateRepositoryModule::class, ] ) @Module(includes = [NotificationsKeyguardStateRepositoryModule::class]) interface NotificationDataLayerModule packages/SystemUI/src/com/android/systemui/statusbar/notification/data/repository/NotificationStackRepository.kt→packages/SystemUI/src/com/android/systemui/statusbar/notification/data/repository/ActiveNotificationListRepository.kt +7 −21 Original line number Diff line number Diff line Loading @@ -16,40 +16,26 @@ package com.android.systemui.statusbar.notification.data.repository import com.android.systemui.dagger.SysUISingleton import com.android.systemui.statusbar.notification.collection.ListEntry import dagger.Binds import dagger.Module import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow /** * Repository of notifications in the notification stack. * Repository of "active" notifications in the notification list. * * This repository serves as the boundary between the * [com.android.systemui.statusbar.notification.collection.NotifPipeline] and the modern * notifications presentation codebase. */ interface NotificationStackRepository { @SysUISingleton class ActiveNotificationListRepository @Inject constructor() { /** * Notifications actively presented to the user in the notification stack. * * @see com.android.systemui.statusbar.notification.collection.listbuilder.OnAfterRenderListListener */ val renderedEntries: Flow<List<ListEntry>> } /** * A mutable implementation of [NotificationStackRepository]. Like other "mutable" objects, the * mutable type should only be exposed where necessary; most consumers should only have access to it * from behind the immutable [NotificationStackRepository] interface. */ @SysUISingleton class MutableNotificationStackRepository @Inject constructor() : NotificationStackRepository { override val renderedEntries = MutableStateFlow(emptyList<ListEntry>()) } val activeNotifications = MutableStateFlow(emptyMap<String, ActiveNotificationModel>()) @Module interface NotificationStackRepositoryModule { @Binds fun bindImpl(impl: MutableNotificationStackRepository): NotificationStackRepository /** Are any already-seen notifications currently filtered out of the active list? */ val hasFilteredOutSeenNotifications = MutableStateFlow(false) } packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractor.kt 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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.domain.interactor import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationListRepository import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map class ActiveNotificationsInteractor @Inject constructor( repository: ActiveNotificationListRepository, ) { /** Notifications actively presented to the user in the notification stack, in order. */ val notifications: Flow<Collection<ActiveNotificationModel>> = repository.activeNotifications.map { it.values } } packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsInteractor.kt→packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractor.kt +2 −9 Original line number Diff line number Diff line Loading @@ -18,23 +18,16 @@ package com.android.systemui.statusbar.notification.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.statusbar.disableflags.data.repository.DisableFlagsRepository import com.android.systemui.statusbar.notification.collection.ListEntry import com.android.systemui.statusbar.notification.data.repository.NotificationStackRepository import javax.inject.Inject import kotlinx.coroutines.flow.Flow /** Interactor for notifications in general. */ /** Interactor for notification alerting. */ @SysUISingleton class NotificationsInteractor class NotificationAlertsInteractor @Inject constructor( private val disableFlagsRepository: DisableFlagsRepository, stackRepository: NotificationStackRepository, ) { /** Returns true if notification alerts are allowed. */ fun areNotificationAlertsEnabled(): Boolean = disableFlagsRepository.disableFlags.value.areNotificationAlertsEnabled() /** Notifications actively presented to the user in the notification stack. */ val notifications: Flow<List<ListEntry>> = stackRepository.renderedEntries } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinator.kt +4 −4 Original line number Diff line number Diff line Loading @@ -37,8 +37,8 @@ import com.android.systemui.statusbar.notification.collection.coordinator.dagger import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifFilter import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener import com.android.systemui.statusbar.notification.collection.provider.SectionHeaderVisibilityProvider import com.android.systemui.statusbar.notification.domain.interactor.SeenNotificationsInteractor import com.android.systemui.statusbar.notification.interruption.KeyguardNotificationVisibilityProvider import com.android.systemui.statusbar.notification.stack.domain.interactor.NotificationListInteractor import com.android.systemui.statusbar.policy.HeadsUpManager import com.android.systemui.statusbar.policy.headsUpEvents import com.android.systemui.util.asIndenting Loading Loading @@ -85,7 +85,7 @@ constructor( @Application private val scope: CoroutineScope, private val sectionHeaderVisibilityProvider: SectionHeaderVisibilityProvider, private val secureSettings: SecureSettings, private val notificationListInteractor: NotificationListInteractor, private val seenNotificationsInteractor: SeenNotificationsInteractor, private val statusBarStateController: StatusBarStateController, ) : Coordinator, Dumpable { Loading Loading @@ -351,7 +351,7 @@ constructor( override fun onCleanup() { logger.logProviderHasFilteredOutSeenNotifs(hasFilteredAnyNotifs) notificationListInteractor.setHasFilteredOutSeenNotifications(hasFilteredAnyNotifs) seenNotificationsInteractor.setHasFilteredOutSeenNotifications(hasFilteredAnyNotifs) hasFilteredAnyNotifs = false } } Loading Loading @@ -389,7 +389,7 @@ constructor( with(pw.asIndenting()) { println( "notificationListInteractor.hasFilteredOutSeenNotifications.value=" + notificationListInteractor.hasFilteredOutSeenNotifications.value seenNotificationsInteractor.hasFilteredOutSeenNotifications.value ) println("unseen notifications:") indentIfPossible { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/data/NotificationDataLayerModule.kt +1 −8 Original line number Diff line number Diff line Loading @@ -15,15 +15,8 @@ */ package com.android.systemui.statusbar.notification.data import com.android.systemui.statusbar.notification.data.repository.NotificationStackRepositoryModule import com.android.systemui.statusbar.notification.data.repository.NotificationsKeyguardStateRepositoryModule import dagger.Module @Module( includes = [ NotificationStackRepositoryModule::class, NotificationsKeyguardStateRepositoryModule::class, ] ) @Module(includes = [NotificationsKeyguardStateRepositoryModule::class]) interface NotificationDataLayerModule
packages/SystemUI/src/com/android/systemui/statusbar/notification/data/repository/NotificationStackRepository.kt→packages/SystemUI/src/com/android/systemui/statusbar/notification/data/repository/ActiveNotificationListRepository.kt +7 −21 Original line number Diff line number Diff line Loading @@ -16,40 +16,26 @@ package com.android.systemui.statusbar.notification.data.repository import com.android.systemui.dagger.SysUISingleton import com.android.systemui.statusbar.notification.collection.ListEntry import dagger.Binds import dagger.Module import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow /** * Repository of notifications in the notification stack. * Repository of "active" notifications in the notification list. * * This repository serves as the boundary between the * [com.android.systemui.statusbar.notification.collection.NotifPipeline] and the modern * notifications presentation codebase. */ interface NotificationStackRepository { @SysUISingleton class ActiveNotificationListRepository @Inject constructor() { /** * Notifications actively presented to the user in the notification stack. * * @see com.android.systemui.statusbar.notification.collection.listbuilder.OnAfterRenderListListener */ val renderedEntries: Flow<List<ListEntry>> } /** * A mutable implementation of [NotificationStackRepository]. Like other "mutable" objects, the * mutable type should only be exposed where necessary; most consumers should only have access to it * from behind the immutable [NotificationStackRepository] interface. */ @SysUISingleton class MutableNotificationStackRepository @Inject constructor() : NotificationStackRepository { override val renderedEntries = MutableStateFlow(emptyList<ListEntry>()) } val activeNotifications = MutableStateFlow(emptyMap<String, ActiveNotificationModel>()) @Module interface NotificationStackRepositoryModule { @Binds fun bindImpl(impl: MutableNotificationStackRepository): NotificationStackRepository /** Are any already-seen notifications currently filtered out of the active list? */ val hasFilteredOutSeenNotifications = MutableStateFlow(false) }
packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractor.kt 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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.domain.interactor import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationListRepository import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map class ActiveNotificationsInteractor @Inject constructor( repository: ActiveNotificationListRepository, ) { /** Notifications actively presented to the user in the notification stack, in order. */ val notifications: Flow<Collection<ActiveNotificationModel>> = repository.activeNotifications.map { it.values } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsInteractor.kt→packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractor.kt +2 −9 Original line number Diff line number Diff line Loading @@ -18,23 +18,16 @@ package com.android.systemui.statusbar.notification.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.statusbar.disableflags.data.repository.DisableFlagsRepository import com.android.systemui.statusbar.notification.collection.ListEntry import com.android.systemui.statusbar.notification.data.repository.NotificationStackRepository import javax.inject.Inject import kotlinx.coroutines.flow.Flow /** Interactor for notifications in general. */ /** Interactor for notification alerting. */ @SysUISingleton class NotificationsInteractor class NotificationAlertsInteractor @Inject constructor( private val disableFlagsRepository: DisableFlagsRepository, stackRepository: NotificationStackRepository, ) { /** Returns true if notification alerts are allowed. */ fun areNotificationAlertsEnabled(): Boolean = disableFlagsRepository.disableFlags.value.areNotificationAlertsEnabled() /** Notifications actively presented to the user in the notification stack. */ val notifications: Flow<List<ListEntry>> = stackRepository.renderedEntries }