diff options
4 files changed, 18 insertions, 12 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt b/packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt index d9665c5b5047..484be9ce1975 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt @@ -53,6 +53,7 @@ import com.android.systemui.statusbar.notification.InstantAppNotifier import com.android.systemui.statusbar.phone.KeyguardLiftController import com.android.systemui.statusbar.phone.LockscreenWallpaper import com.android.systemui.statusbar.phone.ScrimController +import com.android.systemui.statusbar.phone.StatusBarHeadsUpChangeListener import com.android.systemui.stylus.StylusUsiPowerStartable import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import com.android.systemui.theme.ThemeOverlayController @@ -331,4 +332,11 @@ abstract class SystemUICoreStartableModule { @IntoMap @ClassKey(ScrimController::class) abstract fun bindScrimController(impl: ScrimController): CoreStartable + + @Binds + @IntoMap + @ClassKey(StatusBarHeadsUpChangeListener::class) + abstract fun bindStatusBarHeadsUpChangeListener( + impl: StatusBarHeadsUpChangeListener + ): CoreStartable } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 632f241ddfff..cd6aae3b3291 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -1612,8 +1612,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mBackActionInteractor.setup(mQsController, mShadeSurface); mNotificationActivityStarter = mCentralSurfacesComponent.getNotificationActivityStarter(); - mHeadsUpManager.addListener(mCentralSurfacesComponent.getStatusBarHeadsUpChangeListener()); - // Listen for demo mode changes mDemoModeController.addCallback(mDemoModeCallback); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java index 9a295e63fb9e..4b39854e43ff 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java @@ -16,23 +16,24 @@ package com.android.systemui.statusbar.phone; +import com.android.systemui.CoreStartable; +import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shade.ShadeViewController; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; -import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import com.android.systemui.statusbar.window.StatusBarWindowController; import javax.inject.Inject; /** - * Ties the {@link CentralSurfaces} to {@link com.android.systemui.statusbar.policy.HeadsUpManager}. + * Ties the status bar to {@link com.android.systemui.statusbar.policy.HeadsUpManager}. */ -@CentralSurfacesComponent.CentralSurfacesScope -public class StatusBarHeadsUpChangeListener implements OnHeadsUpChangedListener { +@SysUISingleton +public class StatusBarHeadsUpChangeListener implements OnHeadsUpChangedListener, CoreStartable { private final NotificationShadeWindowController mNotificationShadeWindowController; private final StatusBarWindowController mStatusBarWindowController; private final ShadeViewController mShadeViewController; @@ -63,6 +64,11 @@ public class StatusBarHeadsUpChangeListener implements OnHeadsUpChangedListener } @Override + public void start() { + mHeadsUpManager.addListener(this); + } + + @Override public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) { if (inPinnedMode) { mNotificationShadeWindowController.setHeadsUpShowing(true); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/CentralSurfacesComponent.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/CentralSurfacesComponent.java index 3a3663d4d6c4..bbbe16f54734 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/CentralSurfacesComponent.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/CentralSurfacesComponent.java @@ -25,7 +25,6 @@ import com.android.systemui.shade.ShadeHeaderController; import com.android.systemui.statusbar.notification.NotificationActivityStarter; import com.android.systemui.statusbar.phone.CentralSurfacesCommandQueueCallbacks; import com.android.systemui.statusbar.phone.CentralSurfacesImpl; -import com.android.systemui.statusbar.phone.StatusBarHeadsUpChangeListener; import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarterModule; import com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment; @@ -72,11 +71,6 @@ public interface CentralSurfacesComponent { WindowRootView getWindowRootView(); /** - * Creates a StatusBarHeadsUpChangeListener. - */ - StatusBarHeadsUpChangeListener getStatusBarHeadsUpChangeListener(); - - /** * Creates a CentralSurfacesCommandQueueCallbacks. */ CentralSurfacesCommandQueueCallbacks getCentralSurfacesCommandQueueCallbacks(); |