From 022c490d563028427ae7154b3f024fc05300dd43 Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Mon, 17 Apr 2023 15:30:25 +0000 Subject: [PATCH] [Central Surfaces] Make NotificationPanelView a singleton. Bug: 277762009 Test: compiles; shade works Change-Id: I69cadfeb95892105784fcf4718a3ba9b5e13298f --- .../systemui/shade/NotificationShadeWindowView.java | 4 ---- .../src/com/android/systemui/shade/ShadeModule.kt | 9 +++++++++ .../statusbar/phone/dagger/StatusBarViewModule.java | 8 -------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowView.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowView.java index 2b6327f3eedf3..d75190e7289a3 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowView.java @@ -84,10 +84,6 @@ public class NotificationShadeWindowView extends FrameLayout { setMotionEventSplittingEnabled(false); } - public NotificationPanelView getNotificationPanelView() { - return findViewById(R.id.notification_panel); - } - @Override public WindowInsets onApplyWindowInsets(WindowInsets windowInsets) { final Insets insets = windowInsets.getInsetsIgnoringVisibility(systemBars()); diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt index efa7d89128431..b0b9ab240988f 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt @@ -50,5 +50,14 @@ abstract class ShadeModule { ): NotificationStackScrollLayout { return notificationShadeWindowView.findViewById(R.id.notification_stack_scroller) } + + // TODO(b/277762009): Only allow this view's controller to inject the view. See above. + @Provides + @SysUISingleton + fun providesNotificationPanelView( + notificationShadeWindowView: NotificationShadeWindowView, + ): NotificationPanelView { + return notificationShadeWindowView.findViewById(R.id.notification_panel) + } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java index b8007a2b1ff65..53c4cf79c4787 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java @@ -134,14 +134,6 @@ public abstract class StatusBarViewModule { } } - /** */ - @Provides - @CentralSurfacesComponent.CentralSurfacesScope - public static NotificationPanelView getNotificationPanelView( - NotificationShadeWindowView notificationShadeWindowView) { - return notificationShadeWindowView.getNotificationPanelView(); - } - /** */ @Binds @CentralSurfacesComponent.CentralSurfacesScope