1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.systemui.statusbar.phone.dagger; 18 19 import static com.android.systemui.statusbar.phone.dagger.StatusBarViewModule.STATUS_BAR_FRAGMENT; 20 21 import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 23 import com.android.keyguard.LockIconViewController; 24 import com.android.systemui.biometrics.AuthRippleController; 25 import com.android.systemui.shade.NotificationPanelViewController; 26 import com.android.systemui.shade.NotificationShadeWindowView; 27 import com.android.systemui.shade.NotificationShadeWindowViewController; 28 import com.android.systemui.shade.QuickSettingsController; 29 import com.android.systemui.shade.ShadeHeaderController; 30 import com.android.systemui.statusbar.NotificationPresenter; 31 import com.android.systemui.statusbar.NotificationShelfController; 32 import com.android.systemui.statusbar.core.StatusBarInitializer; 33 import com.android.systemui.statusbar.notification.NotificationActivityStarter; 34 import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl; 35 import com.android.systemui.statusbar.notification.stack.NotificationListContainer; 36 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; 37 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutListContainerModule; 38 import com.android.systemui.statusbar.phone.CentralSurfacesCommandQueueCallbacks; 39 import com.android.systemui.statusbar.phone.CentralSurfacesImpl; 40 import com.android.systemui.statusbar.phone.StatusBarHeadsUpChangeListener; 41 import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarterModule; 42 import com.android.systemui.statusbar.phone.StatusBarNotificationPresenterModule; 43 import com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment; 44 45 import java.lang.annotation.Documented; 46 import java.lang.annotation.Retention; 47 import java.util.Set; 48 49 import javax.inject.Named; 50 import javax.inject.Scope; 51 52 import dagger.Subcomponent; 53 54 /** 55 * Dagger subcomponent for classes (semi-)related to the status bar. The component is created once 56 * inside {@link CentralSurfacesImpl} and never re-created. 57 * 58 * TODO(b/197137564): This should likely be re-factored a bit. It includes classes that aren't 59 * directly related to status bar functionality, like multiple notification classes. And, the fact 60 * that it has many getter methods indicates that we need to access many of these classes from 61 * outside the component. Should more items be moved *into* this component to avoid so many getters? 62 */ 63 @Subcomponent(modules = { 64 CentralSurfacesStartableModule.class, 65 NotificationStackScrollLayoutListContainerModule.class, 66 StatusBarViewModule.class, 67 StatusBarNotificationActivityStarterModule.class, 68 StatusBarNotificationPresenterModule.class, 69 }) 70 @CentralSurfacesComponent.CentralSurfacesScope 71 public interface CentralSurfacesComponent { 72 /** 73 * Builder for {@link CentralSurfacesComponent}. 74 */ 75 @Subcomponent.Factory 76 interface Factory { create()77 CentralSurfacesComponent create(); 78 } 79 80 /** 81 * Scope annotation for singleton items within the CentralSurfacesComponent. 82 */ 83 @Documented 84 @Retention(RUNTIME) 85 @Scope 86 @interface CentralSurfacesScope {} 87 88 /** 89 * Performs initialization logic after {@link CentralSurfacesComponent} has been constructed. 90 */ 91 interface Startable { start()92 void start(); stop()93 void stop(); 94 } 95 96 /** 97 * Creates a {@link NotificationShadeWindowView}. 98 */ getNotificationShadeWindowView()99 NotificationShadeWindowView getNotificationShadeWindowView(); 100 101 /** */ getNotificationShelfController()102 NotificationShelfController getNotificationShelfController(); 103 104 /** */ getNotificationStackScrollLayoutController()105 NotificationStackScrollLayoutController getNotificationStackScrollLayoutController(); 106 107 /** 108 * Creates a NotificationShadeWindowViewController. 109 */ getNotificationShadeWindowViewController()110 NotificationShadeWindowViewController getNotificationShadeWindowViewController(); 111 112 /** 113 * Creates a NotificationPanelViewController. 114 */ getNotificationPanelViewController()115 NotificationPanelViewController getNotificationPanelViewController(); 116 117 /** Creates a QuickSettingsController. */ getQuickSettingsController()118 QuickSettingsController getQuickSettingsController(); 119 120 /** 121 * Creates a LockIconViewController. Must be init after creation. 122 */ getLockIconViewController()123 LockIconViewController getLockIconViewController(); 124 125 /** 126 * Creates an AuthRippleViewController. Must be init after creation. 127 */ getAuthRippleController()128 AuthRippleController getAuthRippleController(); 129 130 /** 131 * Creates a StatusBarHeadsUpChangeListener. 132 */ getStatusBarHeadsUpChangeListener()133 StatusBarHeadsUpChangeListener getStatusBarHeadsUpChangeListener(); 134 135 /** 136 * Creates a CentralSurfacesCommandQueueCallbacks. 137 */ getCentralSurfacesCommandQueueCallbacks()138 CentralSurfacesCommandQueueCallbacks getCentralSurfacesCommandQueueCallbacks(); 139 140 /** 141 * Creates a {@link ShadeHeaderController}. 142 */ getLargeScreenShadeHeaderController()143 ShadeHeaderController getLargeScreenShadeHeaderController(); 144 145 /** 146 * Creates a new {@link CollapsedStatusBarFragment} each time it's called. See 147 * {@link StatusBarViewModule#createCollapsedStatusBarFragment}. 148 */ 149 @Named(STATUS_BAR_FRAGMENT) createCollapsedStatusBarFragment()150 CollapsedStatusBarFragment createCollapsedStatusBarFragment(); 151 152 /** 153 * Creates a StatusBarInitializer 154 */ getStatusBarInitializer()155 StatusBarInitializer getStatusBarInitializer(); 156 157 /** 158 * Set of startables to be run after a CentralSurfacesComponent has been constructed. 159 */ getStartables()160 Set<Startable> getStartables(); 161 getNotificationActivityStarter()162 NotificationActivityStarter getNotificationActivityStarter(); 163 getNotificationPresenter()164 NotificationPresenter getNotificationPresenter(); 165 getBindRowCallback()166 NotificationRowBinderImpl.BindRowCallback getBindRowCallback(); 167 getNotificationListContainer()168 NotificationListContainer getNotificationListContainer(); 169 } 170