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.systemui.scene.ui.view.WindowRootView;
24 import com.android.systemui.shade.ShadeHeaderController;
25 import com.android.systemui.statusbar.notification.NotificationActivityStarter;
26 import com.android.systemui.statusbar.phone.CentralSurfacesCommandQueueCallbacks;
27 import com.android.systemui.statusbar.phone.CentralSurfacesImpl;
28 import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarterModule;
29 import com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment;
30 
31 import dagger.Subcomponent;
32 
33 import java.lang.annotation.Documented;
34 import java.lang.annotation.Retention;
35 
36 import javax.inject.Named;
37 import javax.inject.Scope;
38 
39 /**
40  * Dagger subcomponent for classes (semi-)related to the status bar. The component is created once
41  * inside {@link CentralSurfacesImpl} and never re-created.
42  *
43  * TODO(b/197137564): This should likely be re-factored a bit. It includes classes that aren't
44  * directly related to status bar functionality, like multiple notification classes. And, the fact
45  * that it has many getter methods indicates that we need to access many of these classes from
46  * outside the component. Should more items be moved *into* this component to avoid so many getters?
47  */
48 @Subcomponent(modules = {
49         StatusBarViewModule.class,
50         StatusBarNotificationActivityStarterModule.class,
51 })
52 @CentralSurfacesComponent.CentralSurfacesScope
53 public interface CentralSurfacesComponent {
54     /**
55      * Builder for {@link CentralSurfacesComponent}.
56      */
57     @Subcomponent.Factory
58     interface Factory {
create()59         CentralSurfacesComponent create();
60     }
61 
62     /**
63      * Scope annotation for singleton items within the CentralSurfacesComponent.
64      */
65     @Documented
66     @Retention(RUNTIME)
67     @Scope
68     @interface CentralSurfacesScope {}
69 
70     /** Creates the root view of the main SysUI window}. */
getWindowRootView()71     WindowRootView getWindowRootView();
72 
73     /**
74      * Creates a CentralSurfacesCommandQueueCallbacks.
75      */
getCentralSurfacesCommandQueueCallbacks()76     CentralSurfacesCommandQueueCallbacks getCentralSurfacesCommandQueueCallbacks();
77 
78     /**
79      * Creates a {@link ShadeHeaderController}.
80      */
getLargeScreenShadeHeaderController()81     ShadeHeaderController getLargeScreenShadeHeaderController();
82 
83     /**
84      * Creates a new {@link CollapsedStatusBarFragment} each time it's called. See
85      * {@link StatusBarViewModule#createCollapsedStatusBarFragment}.
86      */
87     @Named(STATUS_BAR_FRAGMENT)
createCollapsedStatusBarFragment()88     CollapsedStatusBarFragment createCollapsedStatusBarFragment();
89 
getNotificationActivityStarter()90     NotificationActivityStarter getNotificationActivityStarter();
91 }
92