Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java +0 −2 Original line number Diff line number Diff line Loading @@ -60,7 +60,6 @@ import com.android.systemui.statusbar.notification.collection.render.Notificatio import com.android.systemui.statusbar.notification.data.NotificationDataLayerModule; import com.android.systemui.statusbar.notification.domain.NotificationDomainLayerModule; import com.android.systemui.statusbar.notification.domain.interactor.NotificationLaunchAnimationInteractor; import com.android.systemui.statusbar.notification.footer.ui.viewmodel.FooterViewModelModule; import com.android.systemui.statusbar.notification.headsup.HeadsUpManager; import com.android.systemui.statusbar.notification.icon.ConversationIconManager; import com.android.systemui.statusbar.notification.icon.IconManager; Loading Loading @@ -109,7 +108,6 @@ import javax.inject.Provider; * Dagger Module for classes found within the com.android.systemui.statusbar.notification package. */ @Module(includes = { FooterViewModelModule.class, KeyguardNotificationVisibilityProviderModule.class, NotificationDataLayerModule.class, NotificationDomainLayerModule.class, Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java +2 −3 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import com.android.systemui.res.R; import com.android.systemui.scene.shared.flag.SceneContainerFlag; import com.android.systemui.statusbar.notification.ColorUpdateLogger; import com.android.systemui.statusbar.notification.footer.shared.NotifRedesignFooter; import com.android.systemui.statusbar.notification.row.FooterViewButton; Loading Loading @@ -333,11 +334,9 @@ public class FooterView extends StackScrollerDecorView { /** * Whether the touch is outside the Clear all button. * * TODO(b/293167744): This is an artifact from the time when we could press underneath the * shade to dismiss it. Check if it's safe to remove. */ public boolean isOnEmptySpace(float touchX, float touchY) { SceneContainerFlag.assertInLegacyMode(); return touchX < mContent.getX() || touchX > mContent.getX() + mContent.getWidth() || touchY < mContent.getY() Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModel.kt +9 −26 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.notification.footer.ui.viewmodel import android.content.Intent import android.provider.Settings import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.res.R import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.shared.notifications.domain.interactor.NotificationSettingsInteractor Loading @@ -32,10 +31,8 @@ import com.android.systemui.util.kotlin.sample import com.android.systemui.util.ui.AnimatableEvent import com.android.systemui.util.ui.AnimatedValue import com.android.systemui.util.ui.toAnimatedValueFlow import dagger.Module import dagger.Provides import java.util.Optional import javax.inject.Provider import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged Loading @@ -44,7 +41,9 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onStart /** ViewModel for [FooterView]. */ class FooterViewModel( class FooterViewModel @AssistedInject constructor( activeNotificationsInteractor: ActiveNotificationsInteractor, notificationSettingsInteractor: NotificationSettingsInteractor, seenNotificationsInteractor: SeenNotificationsInteractor, Loading Loading @@ -141,25 +140,9 @@ class FooterViewModel( AnimatedValue.NotAnimating(!messageVisible) }, ) } // TODO: b/293167744 - remove this, use new viewmodel style @Module object FooterViewModelModule { @Provides @SysUISingleton fun provideOptional( activeNotificationsInteractor: Provider<ActiveNotificationsInteractor>, notificationSettingsInteractor: Provider<NotificationSettingsInteractor>, seenNotificationsInteractor: Provider<SeenNotificationsInteractor>, shadeInteractor: Provider<ShadeInteractor>, ): Optional<FooterViewModel> = Optional.of( FooterViewModel( activeNotificationsInteractor.get(), notificationSettingsInteractor.get(), seenNotificationsInteractor.get(), shadeInteractor.get(), ) ) @AssistedFactory interface Factory { fun create(): FooterViewModel } } packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationListViewBinder.kt +37 −26 Original line number Diff line number Diff line Loading @@ -99,6 +99,9 @@ constructor( .inflate(R.layout.status_bar_notification_shelf, view, false) as NotificationShelf view.setShelf(shelf) // Create viewModels once, and only when needed. val footerViewModel by lazy { viewModel.footerViewModelFactory.create() } val emptyShadeViewModel by lazy { viewModel.emptyShadeViewModelFactory.create() } view.repeatWhenAttached { lifecycleScope.launch { if (SceneContainerFlag.isEnabled) { Loading @@ -109,12 +112,18 @@ constructor( val hasNonClearableSilentNotifications: StateFlow<Boolean> = viewModel.hasNonClearableSilentNotifications.stateIn(this) launch { reinflateAndBindFooter(view, hasNonClearableSilentNotifications) } launch { reinflateAndBindFooter( footerViewModel, view, hasNonClearableSilentNotifications, ) } launch { if (ModesEmptyShadeFix.isEnabled) { reinflateAndBindEmptyShade(view) reinflateAndBindEmptyShade(emptyShadeViewModel, view) } else { bindEmptyShadeLegacy(viewModel.emptyShadeViewFactory.create(), view) bindEmptyShadeLegacy(emptyShadeViewModel, view) } } launch { bindSilentHeaderClickListener(view, hasNonClearableSilentNotifications) } Loading @@ -134,10 +143,10 @@ constructor( } private suspend fun reinflateAndBindFooter( footerViewModel: FooterViewModel, parentView: NotificationStackScrollLayout, hasNonClearableSilentNotifications: StateFlow<Boolean>, ) { viewModel.footer.getOrNull()?.let { footerViewModel -> // The footer needs to be re-inflated every time the theme or the font size changes. configuration .inflateLayout<FooterView>( Loading @@ -159,7 +168,6 @@ constructor( } } } } /** * Binds the footer (including its visibility) and dispose of the [DisposableHandle] when done. Loading Loading @@ -219,7 +227,10 @@ constructor( notificationActivityStarter.get().startHistoryIntent(view, /* showHistory= */ true) } private suspend fun reinflateAndBindEmptyShade(parentView: NotificationStackScrollLayout) { private suspend fun reinflateAndBindEmptyShade( emptyShadeViewModel: EmptyShadeViewModel, parentView: NotificationStackScrollLayout, ) { ModesEmptyShadeFix.assertInNewMode() // The empty shade needs to be re-inflated every time the theme or the font size // changes. Loading @@ -233,7 +244,7 @@ constructor( .collectLatest { emptyShadeView: EmptyShadeView -> traceAsync("bind EmptyShadeView") { parentView.setEmptyShadeView(emptyShadeView) bindEmptyShade(emptyShadeView, viewModel.emptyShadeViewFactory.create()) bindEmptyShade(emptyShadeView, emptyShadeViewModel) } } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt +2 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,8 @@ class NotificationListViewModel constructor( val shelf: NotificationShelfViewModel, val hideListViewModel: HideListViewModel, val footer: Optional<FooterViewModel>, val emptyShadeViewFactory: EmptyShadeViewModel.Factory, val footerViewModelFactory: FooterViewModel.Factory, val emptyShadeViewModelFactory: EmptyShadeViewModel.Factory, val logger: Optional<NotificationLoggerViewModel>, activeNotificationsInteractor: ActiveNotificationsInteractor, notificationStackInteractor: NotificationStackInteractor, Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java +0 −2 Original line number Diff line number Diff line Loading @@ -60,7 +60,6 @@ import com.android.systemui.statusbar.notification.collection.render.Notificatio import com.android.systemui.statusbar.notification.data.NotificationDataLayerModule; import com.android.systemui.statusbar.notification.domain.NotificationDomainLayerModule; import com.android.systemui.statusbar.notification.domain.interactor.NotificationLaunchAnimationInteractor; import com.android.systemui.statusbar.notification.footer.ui.viewmodel.FooterViewModelModule; import com.android.systemui.statusbar.notification.headsup.HeadsUpManager; import com.android.systemui.statusbar.notification.icon.ConversationIconManager; import com.android.systemui.statusbar.notification.icon.IconManager; Loading Loading @@ -109,7 +108,6 @@ import javax.inject.Provider; * Dagger Module for classes found within the com.android.systemui.statusbar.notification package. */ @Module(includes = { FooterViewModelModule.class, KeyguardNotificationVisibilityProviderModule.class, NotificationDataLayerModule.class, NotificationDomainLayerModule.class, Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java +2 −3 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import com.android.systemui.res.R; import com.android.systemui.scene.shared.flag.SceneContainerFlag; import com.android.systemui.statusbar.notification.ColorUpdateLogger; import com.android.systemui.statusbar.notification.footer.shared.NotifRedesignFooter; import com.android.systemui.statusbar.notification.row.FooterViewButton; Loading Loading @@ -333,11 +334,9 @@ public class FooterView extends StackScrollerDecorView { /** * Whether the touch is outside the Clear all button. * * TODO(b/293167744): This is an artifact from the time when we could press underneath the * shade to dismiss it. Check if it's safe to remove. */ public boolean isOnEmptySpace(float touchX, float touchY) { SceneContainerFlag.assertInLegacyMode(); return touchX < mContent.getX() || touchX > mContent.getX() + mContent.getWidth() || touchY < mContent.getY() Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModel.kt +9 −26 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.notification.footer.ui.viewmodel import android.content.Intent import android.provider.Settings import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.res.R import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.shared.notifications.domain.interactor.NotificationSettingsInteractor Loading @@ -32,10 +31,8 @@ import com.android.systemui.util.kotlin.sample import com.android.systemui.util.ui.AnimatableEvent import com.android.systemui.util.ui.AnimatedValue import com.android.systemui.util.ui.toAnimatedValueFlow import dagger.Module import dagger.Provides import java.util.Optional import javax.inject.Provider import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged Loading @@ -44,7 +41,9 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onStart /** ViewModel for [FooterView]. */ class FooterViewModel( class FooterViewModel @AssistedInject constructor( activeNotificationsInteractor: ActiveNotificationsInteractor, notificationSettingsInteractor: NotificationSettingsInteractor, seenNotificationsInteractor: SeenNotificationsInteractor, Loading Loading @@ -141,25 +140,9 @@ class FooterViewModel( AnimatedValue.NotAnimating(!messageVisible) }, ) } // TODO: b/293167744 - remove this, use new viewmodel style @Module object FooterViewModelModule { @Provides @SysUISingleton fun provideOptional( activeNotificationsInteractor: Provider<ActiveNotificationsInteractor>, notificationSettingsInteractor: Provider<NotificationSettingsInteractor>, seenNotificationsInteractor: Provider<SeenNotificationsInteractor>, shadeInteractor: Provider<ShadeInteractor>, ): Optional<FooterViewModel> = Optional.of( FooterViewModel( activeNotificationsInteractor.get(), notificationSettingsInteractor.get(), seenNotificationsInteractor.get(), shadeInteractor.get(), ) ) @AssistedFactory interface Factory { fun create(): FooterViewModel } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationListViewBinder.kt +37 −26 Original line number Diff line number Diff line Loading @@ -99,6 +99,9 @@ constructor( .inflate(R.layout.status_bar_notification_shelf, view, false) as NotificationShelf view.setShelf(shelf) // Create viewModels once, and only when needed. val footerViewModel by lazy { viewModel.footerViewModelFactory.create() } val emptyShadeViewModel by lazy { viewModel.emptyShadeViewModelFactory.create() } view.repeatWhenAttached { lifecycleScope.launch { if (SceneContainerFlag.isEnabled) { Loading @@ -109,12 +112,18 @@ constructor( val hasNonClearableSilentNotifications: StateFlow<Boolean> = viewModel.hasNonClearableSilentNotifications.stateIn(this) launch { reinflateAndBindFooter(view, hasNonClearableSilentNotifications) } launch { reinflateAndBindFooter( footerViewModel, view, hasNonClearableSilentNotifications, ) } launch { if (ModesEmptyShadeFix.isEnabled) { reinflateAndBindEmptyShade(view) reinflateAndBindEmptyShade(emptyShadeViewModel, view) } else { bindEmptyShadeLegacy(viewModel.emptyShadeViewFactory.create(), view) bindEmptyShadeLegacy(emptyShadeViewModel, view) } } launch { bindSilentHeaderClickListener(view, hasNonClearableSilentNotifications) } Loading @@ -134,10 +143,10 @@ constructor( } private suspend fun reinflateAndBindFooter( footerViewModel: FooterViewModel, parentView: NotificationStackScrollLayout, hasNonClearableSilentNotifications: StateFlow<Boolean>, ) { viewModel.footer.getOrNull()?.let { footerViewModel -> // The footer needs to be re-inflated every time the theme or the font size changes. configuration .inflateLayout<FooterView>( Loading @@ -159,7 +168,6 @@ constructor( } } } } /** * Binds the footer (including its visibility) and dispose of the [DisposableHandle] when done. Loading Loading @@ -219,7 +227,10 @@ constructor( notificationActivityStarter.get().startHistoryIntent(view, /* showHistory= */ true) } private suspend fun reinflateAndBindEmptyShade(parentView: NotificationStackScrollLayout) { private suspend fun reinflateAndBindEmptyShade( emptyShadeViewModel: EmptyShadeViewModel, parentView: NotificationStackScrollLayout, ) { ModesEmptyShadeFix.assertInNewMode() // The empty shade needs to be re-inflated every time the theme or the font size // changes. Loading @@ -233,7 +244,7 @@ constructor( .collectLatest { emptyShadeView: EmptyShadeView -> traceAsync("bind EmptyShadeView") { parentView.setEmptyShadeView(emptyShadeView) bindEmptyShade(emptyShadeView, viewModel.emptyShadeViewFactory.create()) bindEmptyShade(emptyShadeView, emptyShadeViewModel) } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt +2 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,8 @@ class NotificationListViewModel constructor( val shelf: NotificationShelfViewModel, val hideListViewModel: HideListViewModel, val footer: Optional<FooterViewModel>, val emptyShadeViewFactory: EmptyShadeViewModel.Factory, val footerViewModelFactory: FooterViewModel.Factory, val emptyShadeViewModelFactory: EmptyShadeViewModel.Factory, val logger: Optional<NotificationLoggerViewModel>, activeNotificationsInteractor: ActiveNotificationsInteractor, notificationStackInteractor: NotificationStackInteractor, Loading