• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 import android.os.HandlerThread;
21 
22 import androidx.annotation.Nullable;
23 
24 import com.android.systemui.SystemUIInitializerFactory;
25 import com.android.systemui.tv.TvWMComponent;
26 import com.android.wm.shell.TaskViewFactory;
27 import com.android.wm.shell.back.BackAnimation;
28 import com.android.wm.shell.bubbles.Bubbles;
29 import com.android.wm.shell.common.annotations.ShellMainThread;
30 import com.android.wm.shell.dagger.TvWMShellModule;
31 import com.android.wm.shell.dagger.WMShellModule;
32 import com.android.wm.shell.dagger.WMSingleton;
33 import com.android.wm.shell.desktopmode.DesktopMode;
34 import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
35 import com.android.wm.shell.onehanded.OneHanded;
36 import com.android.wm.shell.pip.Pip;
37 import com.android.wm.shell.recents.RecentTasks;
38 import com.android.wm.shell.splitscreen.SplitScreen;
39 import com.android.wm.shell.startingsurface.StartingSurface;
40 import com.android.wm.shell.sysui.ShellInterface;
41 import com.android.wm.shell.transition.ShellTransitions;
42 
43 import java.util.Optional;
44 
45 import dagger.BindsInstance;
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 SystemUIInitializerFactory#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 {
66 
67         @BindsInstance
setShellMainThread(@ullable @hellMainThread HandlerThread t)68         Builder setShellMainThread(@Nullable @ShellMainThread HandlerThread t);
69 
build()70         WMComponent build();
71     }
72 
73     /**
74      * Initializes all the WMShell components before starting any of the SystemUI components.
75      */
init()76     default void init() {
77         getShell().onInit();
78     }
79 
80     @WMSingleton
getShell()81     ShellInterface getShell();
82 
83     @WMSingleton
getOneHanded()84     Optional<OneHanded> getOneHanded();
85 
86     @WMSingleton
getPip()87     Optional<Pip> getPip();
88 
89     @WMSingleton
getSplitScreen()90     Optional<SplitScreen> getSplitScreen();
91 
92     @WMSingleton
getBubbles()93     Optional<Bubbles> getBubbles();
94 
95     @WMSingleton
getTaskViewFactory()96     Optional<TaskViewFactory> getTaskViewFactory();
97 
98     @WMSingleton
getTransitions()99     ShellTransitions getTransitions();
100 
101     @WMSingleton
getStartingSurface()102     Optional<StartingSurface> getStartingSurface();
103 
104     @WMSingleton
getDisplayAreaHelper()105     Optional<DisplayAreaHelper> getDisplayAreaHelper();
106 
107     @WMSingleton
getRecentTasks()108     Optional<RecentTasks> getRecentTasks();
109 
110     @WMSingleton
getBackAnimation()111     Optional<BackAnimation> getBackAnimation();
112 
113     /**
114      * Optional {@link DesktopMode} component for interacting with desktop mode.
115      */
116     @WMSingleton
getDesktopMode()117     Optional<DesktopMode> getDesktopMode();
118 }
119