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 com.android.keyguard.clock.ClockOptionsProvider; 20 import com.android.systemui.BootCompleteCacheImpl; 21 import com.android.systemui.Dependency; 22 import com.android.systemui.InitController; 23 import com.android.systemui.SystemUIAppComponentFactory; 24 import com.android.systemui.dump.DumpManager; 25 import com.android.systemui.keyguard.KeyguardSliceProvider; 26 import com.android.systemui.people.PeopleProvider; 27 import com.android.systemui.statusbar.policy.ConfigurationController; 28 import com.android.systemui.util.InjectionInflationController; 29 import com.android.wm.shell.ShellCommandHandler; 30 import com.android.wm.shell.TaskViewFactory; 31 import com.android.wm.shell.apppairs.AppPairs; 32 import com.android.wm.shell.bubbles.Bubbles; 33 import com.android.wm.shell.hidedisplaycutout.HideDisplayCutout; 34 import com.android.wm.shell.legacysplitscreen.LegacySplitScreen; 35 import com.android.wm.shell.onehanded.OneHanded; 36 import com.android.wm.shell.pip.Pip; 37 import com.android.wm.shell.splitscreen.SplitScreen; 38 import com.android.wm.shell.startingsurface.StartingSurface; 39 import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelper; 40 import com.android.wm.shell.transition.ShellTransitions; 41 42 import java.util.Optional; 43 44 import dagger.BindsInstance; 45 import dagger.Subcomponent; 46 47 /** 48 * Dagger Subcomponent for Core SysUI. 49 */ 50 @SysUISingleton 51 @Subcomponent(modules = { 52 DefaultComponentBinder.class, 53 DependencyProvider.class, 54 SystemUIBinder.class, 55 SystemUIModule.class, 56 SystemUIDefaultModule.class}) 57 public interface SysUIComponent { 58 59 /** 60 * Builder for a SysUIComponent. 61 */ 62 @SysUISingleton 63 @Subcomponent.Builder 64 interface Builder { 65 @BindsInstance setPip(Optional<Pip> p)66 Builder setPip(Optional<Pip> p); 67 68 @BindsInstance setLegacySplitScreen(Optional<LegacySplitScreen> s)69 Builder setLegacySplitScreen(Optional<LegacySplitScreen> s); 70 71 @BindsInstance setSplitScreen(Optional<SplitScreen> s)72 Builder setSplitScreen(Optional<SplitScreen> s); 73 74 @BindsInstance setAppPairs(Optional<AppPairs> s)75 Builder setAppPairs(Optional<AppPairs> s); 76 77 @BindsInstance setOneHanded(Optional<OneHanded> o)78 Builder setOneHanded(Optional<OneHanded> o); 79 80 @BindsInstance setBubbles(Optional<Bubbles> b)81 Builder setBubbles(Optional<Bubbles> b); 82 83 @BindsInstance setTaskViewFactory(Optional<TaskViewFactory> t)84 Builder setTaskViewFactory(Optional<TaskViewFactory> t); 85 86 @BindsInstance setHideDisplayCutout(Optional<HideDisplayCutout> h)87 Builder setHideDisplayCutout(Optional<HideDisplayCutout> h); 88 89 @BindsInstance setShellCommandHandler(Optional<ShellCommandHandler> shellDump)90 Builder setShellCommandHandler(Optional<ShellCommandHandler> shellDump); 91 92 @BindsInstance setTransitions(ShellTransitions t)93 Builder setTransitions(ShellTransitions t); 94 95 @BindsInstance setStartingSurface(Optional<StartingSurface> s)96 Builder setStartingSurface(Optional<StartingSurface> s); 97 98 @BindsInstance setTaskSurfaceHelper(Optional<TaskSurfaceHelper> t)99 Builder setTaskSurfaceHelper(Optional<TaskSurfaceHelper> t); 100 build()101 SysUIComponent build(); 102 } 103 104 /** 105 * Initializes all the SysUI components. 106 */ init()107 default void init() { 108 // Do nothing 109 } 110 111 /** 112 * Provides a BootCompleteCache. 113 */ 114 @SysUISingleton provideBootCacheImpl()115 BootCompleteCacheImpl provideBootCacheImpl(); 116 117 /** 118 * Creates a ContextComponentHelper. 119 */ 120 @SysUISingleton getConfigurationController()121 ConfigurationController getConfigurationController(); 122 123 /** 124 * Creates a ContextComponentHelper. 125 */ 126 @SysUISingleton getContextComponentHelper()127 ContextComponentHelper getContextComponentHelper(); 128 129 /** 130 * Main dependency providing module. 131 */ 132 @SysUISingleton createDependency()133 Dependency createDependency(); 134 135 /** */ 136 @SysUISingleton createDumpManager()137 DumpManager createDumpManager(); 138 139 /** 140 * Creates a InitController. 141 */ 142 @SysUISingleton getInitController()143 InitController getInitController(); 144 145 /** 146 * ViewInstanceCreator generates all Views that need injection. 147 */ createViewInstanceCreatorFactory()148 InjectionInflationController.ViewInstanceCreator.Factory createViewInstanceCreatorFactory(); 149 150 /** 151 * Member injection into the supplied argument. 152 */ inject(SystemUIAppComponentFactory factory)153 void inject(SystemUIAppComponentFactory factory); 154 155 /** 156 * Member injection into the supplied argument. 157 */ inject(KeyguardSliceProvider keyguardSliceProvider)158 void inject(KeyguardSliceProvider keyguardSliceProvider); 159 160 /** 161 * Member injection into the supplied argument. 162 */ inject(ClockOptionsProvider clockOptionsProvider)163 void inject(ClockOptionsProvider clockOptionsProvider); 164 165 /** 166 * Member injection into the supplied argument. 167 */ inject(PeopleProvider peopleProvider)168 void inject(PeopleProvider peopleProvider); 169 } 170