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.dagger;
18 
19 import android.content.Context;
20 
21 import com.android.systemui.SystemUIFactory;
22 import com.android.systemui.tv.TvWMComponent;
23 import com.android.wm.shell.ShellCommandHandler;
24 import com.android.wm.shell.ShellInit;
25 import com.android.wm.shell.TaskViewFactory;
26 import com.android.wm.shell.apppairs.AppPairs;
27 import com.android.wm.shell.bubbles.Bubbles;
28 import com.android.wm.shell.compatui.CompatUI;
29 import com.android.wm.shell.dagger.TvWMShellModule;
30 import com.android.wm.shell.dagger.WMShellModule;
31 import com.android.wm.shell.dagger.WMSingleton;
32 import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
33 import com.android.wm.shell.draganddrop.DragAndDrop;
34 import com.android.wm.shell.hidedisplaycutout.HideDisplayCutout;
35 import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
36 import com.android.wm.shell.onehanded.OneHanded;
37 import com.android.wm.shell.pip.Pip;
38 import com.android.wm.shell.recents.RecentTasks;
39 import com.android.wm.shell.splitscreen.SplitScreen;
40 import com.android.wm.shell.startingsurface.StartingSurface;
41 import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelper;
42 import com.android.wm.shell.transition.ShellTransitions;
43 
44 import java.util.Optional;
45 
46 import dagger.Subcomponent;
47 
48 /**
49  * Dagger Subcomponent for WindowManager.  This class explicitly describes the interfaces exported
50  * from the WM component into the SysUI component (in
51  * {@link SystemUIFactory#init(Context, boolean)}), and references the specific dependencies
52  * provided by its particular device/form-factor SystemUI implementation.
53  *
54  * ie. {@link WMComponent} includes {@link WMShellModule}
55  *     and {@link TvWMComponent} includes {@link TvWMShellModule}
56  */
57 @WMSingleton
58 @Subcomponent(modules = {WMShellModule.class})
59 public interface WMComponent {
60 
61     /**
62      * Builder for a WMComponent.
63      */
64     @Subcomponent.Builder
65     interface Builder {
build()66         WMComponent build();
67     }
68 
69     /**
70      * Initializes all the WMShell components before starting any of the SystemUI components.
71      */
init()72     default void init() {
73         getShellInit().init();
74     }
75 
76     @WMSingleton
getShellInit()77     ShellInit getShellInit();
78 
79     @WMSingleton
getShellCommandHandler()80     Optional<ShellCommandHandler> getShellCommandHandler();
81 
82     @WMSingleton
getOneHanded()83     Optional<OneHanded> getOneHanded();
84 
85     @WMSingleton
getPip()86     Optional<Pip> getPip();
87 
88     @WMSingleton
getLegacySplitScreen()89     Optional<LegacySplitScreen> getLegacySplitScreen();
90 
91     @WMSingleton
getSplitScreen()92     Optional<SplitScreen> getSplitScreen();
93 
94     @WMSingleton
getAppPairs()95     Optional<AppPairs> getAppPairs();
96 
97     @WMSingleton
getBubbles()98     Optional<Bubbles> getBubbles();
99 
100     @WMSingleton
getHideDisplayCutout()101     Optional<HideDisplayCutout> getHideDisplayCutout();
102 
103     @WMSingleton
getTaskViewFactory()104     Optional<TaskViewFactory> getTaskViewFactory();
105 
106     @WMSingleton
getTransitions()107     ShellTransitions getTransitions();
108 
109     @WMSingleton
getStartingSurface()110     Optional<StartingSurface> getStartingSurface();
111 
112     @WMSingleton
getDisplayAreaHelper()113     Optional<DisplayAreaHelper> getDisplayAreaHelper();
114 
115     @WMSingleton
getTaskSurfaceHelper()116     Optional<TaskSurfaceHelper> getTaskSurfaceHelper();
117 
118     @WMSingleton
getRecentTasks()119     Optional<RecentTasks> getRecentTasks();
120 
121     @WMSingleton
getCompatUI()122     CompatUI getCompatUI();
123 
124     @WMSingleton
getDragAndDrop()125     DragAndDrop getDragAndDrop();
126 }
127