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 java.lang.annotation.RetentionPolicy.RUNTIME;
20 
21 import com.android.keyguard.LockIconViewController;
22 import com.android.systemui.biometrics.AuthRippleController;
23 import com.android.systemui.statusbar.NotificationShelfController;
24 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
25 import com.android.systemui.statusbar.phone.NotificationPanelViewController;
26 import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
27 import com.android.systemui.statusbar.phone.NotificationShadeWindowViewController;
28 import com.android.systemui.statusbar.phone.SplitShadeHeaderController;
29 import com.android.systemui.statusbar.phone.StatusBarCommandQueueCallbacks;
30 import com.android.systemui.statusbar.phone.StatusBarDemoMode;
31 import com.android.systemui.statusbar.phone.StatusBarHeadsUpChangeListener;
32 import com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment;
33 
34 import java.lang.annotation.Documented;
35 import java.lang.annotation.Retention;
36 
37 import javax.inject.Scope;
38 
39 import dagger.Subcomponent;
40 
41 /**
42  * Dagger subcomponent for classes (semi-)related to the status bar. The component is created once
43  * inside {@link com.android.systemui.statusbar.phone.StatusBar} and never re-created.
44  *
45  * TODO(b/197137564): This should likely be re-factored a bit. It includes classes that aren't
46  * directly related to status bar functionality, like multiple notification classes. And, the fact
47  * that it has many getter methods indicates that we need to access many of these classes from
48  * outside the component. Should more items be moved *into* this component to avoid so many getters?
49  */
50 @Subcomponent(modules = {StatusBarViewModule.class})
51 @StatusBarComponent.StatusBarScope
52 public interface StatusBarComponent {
53     /**
54      * Builder for {@link StatusBarComponent}.
55      */
56     @Subcomponent.Factory
57     interface Factory {
create()58         StatusBarComponent create();
59     }
60 
61     /**
62      * Scope annotation for singleton items within the StatusBarComponent.
63      */
64     @Documented
65     @Retention(RUNTIME)
66     @Scope
67     @interface StatusBarScope {}
68 
69     /**
70      * Creates a {@link NotificationShadeWindowView}/
71      * @return
72      */
73     @StatusBarScope
getNotificationShadeWindowView()74     NotificationShadeWindowView getNotificationShadeWindowView();
75 
76     /** */
77     @StatusBarScope
getNotificationShelfController()78     NotificationShelfController getNotificationShelfController();
79 
80     /** */
81     @StatusBarScope
getNotificationStackScrollLayoutController()82     NotificationStackScrollLayoutController getNotificationStackScrollLayoutController();
83 
84     /**
85      * Creates a NotificationShadeWindowViewController.
86      */
87     @StatusBarScope
getNotificationShadeWindowViewController()88     NotificationShadeWindowViewController getNotificationShadeWindowViewController();
89 
90     /**
91      * Creates a NotificationPanelViewController.
92      */
93     @StatusBarScope
getNotificationPanelViewController()94     NotificationPanelViewController getNotificationPanelViewController();
95 
96     /**
97      * Creates a LockIconViewController. Must be init after creation.
98      */
99     @StatusBarScope
getLockIconViewController()100     LockIconViewController getLockIconViewController();
101 
102     /**
103      * Creates an AuthRippleViewController. Must be init after creation.
104      */
105     @StatusBarScope
getAuthRippleController()106     AuthRippleController getAuthRippleController();
107 
108     /**
109      * Creates a StatusBarDemoMode.
110      */
111     @StatusBarScope
getStatusBarDemoMode()112     StatusBarDemoMode getStatusBarDemoMode();
113 
114     /**
115      * Creates a StatusBarHeadsUpChangeListener.
116      */
117     @StatusBarScope
getStatusBarHeadsUpChangeListener()118     StatusBarHeadsUpChangeListener getStatusBarHeadsUpChangeListener();
119 
120     /**
121      * Creates a StatusBarCommandQueueCallbacks.
122      */
123     @StatusBarScope
getStatusBarCommandQueueCallbacks()124     StatusBarCommandQueueCallbacks getStatusBarCommandQueueCallbacks();
125 
126     /**
127      * Creates a SplitShadeHeaderController.
128      */
129     @StatusBarScope
getSplitShadeHeaderController()130     SplitShadeHeaderController getSplitShadeHeaderController();
131 
132     /**
133      * Creates a new {@link CollapsedStatusBarFragment} each time it's called. See
134      * {@link StatusBarViewModule#createCollapsedStatusBarFragment}.
135      */
createCollapsedStatusBarFragment()136     CollapsedStatusBarFragment createCollapsedStatusBarFragment();
137 }
138