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