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.systemui.LatencyTester; 20 import com.android.systemui.ScreenDecorations; 21 import com.android.systemui.SliceBroadcastRelayHandler; 22 import com.android.systemui.SystemUI; 23 import com.android.systemui.accessibility.SystemActions; 24 import com.android.systemui.accessibility.WindowMagnification; 25 import com.android.systemui.biometrics.AuthController; 26 import com.android.systemui.globalactions.GlobalActionsComponent; 27 import com.android.systemui.keyguard.KeyguardViewMediator; 28 import com.android.systemui.keyguard.dagger.KeyguardModule; 29 import com.android.systemui.media.systemsounds.HomeSoundEffectController; 30 import com.android.systemui.power.PowerUI; 31 import com.android.systemui.privacy.television.TvOngoingPrivacyChip; 32 import com.android.systemui.recents.Recents; 33 import com.android.systemui.recents.RecentsModule; 34 import com.android.systemui.shortcut.ShortcutKeyDispatcher; 35 import com.android.systemui.statusbar.dagger.StatusBarModule; 36 import com.android.systemui.statusbar.notification.InstantAppNotifier; 37 import com.android.systemui.statusbar.phone.StatusBar; 38 import com.android.systemui.statusbar.tv.TvStatusBar; 39 import com.android.systemui.statusbar.tv.notifications.TvNotificationPanel; 40 import com.android.systemui.theme.ThemeOverlayController; 41 import com.android.systemui.toast.ToastUI; 42 import com.android.systemui.util.leak.GarbageMonitor; 43 import com.android.systemui.volume.VolumeUI; 44 import com.android.systemui.wmshell.WMShell; 45 46 import dagger.Binds; 47 import dagger.Module; 48 import dagger.multibindings.ClassKey; 49 import dagger.multibindings.IntoMap; 50 51 /** 52 * SystemUI objects that are injectable should go here. 53 */ 54 @Module(includes = {RecentsModule.class, StatusBarModule.class, KeyguardModule.class}) 55 public abstract class SystemUIBinder { 56 /** Inject into AuthController. */ 57 @Binds 58 @IntoMap 59 @ClassKey(AuthController.class) bindAuthController(AuthController service)60 public abstract SystemUI bindAuthController(AuthController service); 61 62 /** Inject into GarbageMonitor.Service. */ 63 @Binds 64 @IntoMap 65 @ClassKey(GarbageMonitor.Service.class) bindGarbageMonitorService(GarbageMonitor.Service sysui)66 public abstract SystemUI bindGarbageMonitorService(GarbageMonitor.Service sysui); 67 68 /** Inject into GlobalActionsComponent. */ 69 @Binds 70 @IntoMap 71 @ClassKey(GlobalActionsComponent.class) bindGlobalActionsComponent(GlobalActionsComponent sysui)72 public abstract SystemUI bindGlobalActionsComponent(GlobalActionsComponent sysui); 73 74 /** Inject into InstantAppNotifier. */ 75 @Binds 76 @IntoMap 77 @ClassKey(InstantAppNotifier.class) bindInstantAppNotifier(InstantAppNotifier sysui)78 public abstract SystemUI bindInstantAppNotifier(InstantAppNotifier sysui); 79 80 /** Inject into KeyguardViewMediator. */ 81 @Binds 82 @IntoMap 83 @ClassKey(KeyguardViewMediator.class) bindKeyguardViewMediator(KeyguardViewMediator sysui)84 public abstract SystemUI bindKeyguardViewMediator(KeyguardViewMediator sysui); 85 86 /** Inject into LatencyTests. */ 87 @Binds 88 @IntoMap 89 @ClassKey(LatencyTester.class) bindLatencyTester(LatencyTester sysui)90 public abstract SystemUI bindLatencyTester(LatencyTester sysui); 91 92 /** Inject into PowerUI. */ 93 @Binds 94 @IntoMap 95 @ClassKey(PowerUI.class) bindPowerUI(PowerUI sysui)96 public abstract SystemUI bindPowerUI(PowerUI sysui); 97 98 /** Inject into Recents. */ 99 @Binds 100 @IntoMap 101 @ClassKey(Recents.class) bindRecents(Recents sysui)102 public abstract SystemUI bindRecents(Recents sysui); 103 104 /** Inject into ScreenDecorations. */ 105 @Binds 106 @IntoMap 107 @ClassKey(ScreenDecorations.class) bindScreenDecorations(ScreenDecorations sysui)108 public abstract SystemUI bindScreenDecorations(ScreenDecorations sysui); 109 110 /** Inject into ShortcutKeyDispatcher. */ 111 @Binds 112 @IntoMap 113 @ClassKey(ShortcutKeyDispatcher.class) bindsShortcutKeyDispatcher(ShortcutKeyDispatcher sysui)114 public abstract SystemUI bindsShortcutKeyDispatcher(ShortcutKeyDispatcher sysui); 115 116 /** Inject into SliceBroadcastRelayHandler. */ 117 @Binds 118 @IntoMap 119 @ClassKey(SliceBroadcastRelayHandler.class) bindSliceBroadcastRelayHandler(SliceBroadcastRelayHandler sysui)120 public abstract SystemUI bindSliceBroadcastRelayHandler(SliceBroadcastRelayHandler sysui); 121 122 /** Inject into StatusBar. */ 123 @Binds 124 @IntoMap 125 @ClassKey(StatusBar.class) bindsStatusBar(StatusBar sysui)126 public abstract SystemUI bindsStatusBar(StatusBar sysui); 127 128 /** Inject into SystemActions. */ 129 @Binds 130 @IntoMap 131 @ClassKey(SystemActions.class) bindSystemActions(SystemActions sysui)132 public abstract SystemUI bindSystemActions(SystemActions sysui); 133 134 /** Inject into ThemeOverlayController. */ 135 @Binds 136 @IntoMap 137 @ClassKey(ThemeOverlayController.class) bindThemeOverlayController(ThemeOverlayController sysui)138 public abstract SystemUI bindThemeOverlayController(ThemeOverlayController sysui); 139 140 /** Inject into ToastUI. */ 141 @Binds 142 @IntoMap 143 @ClassKey(ToastUI.class) bindToastUI(ToastUI service)144 public abstract SystemUI bindToastUI(ToastUI service); 145 146 /** Inject into TvStatusBar. */ 147 @Binds 148 @IntoMap 149 @ClassKey(TvStatusBar.class) bindsTvStatusBar(TvStatusBar sysui)150 public abstract SystemUI bindsTvStatusBar(TvStatusBar sysui); 151 152 /** Inject into TvNotificationPanel. */ 153 @Binds 154 @IntoMap 155 @ClassKey(TvNotificationPanel.class) bindsTvNotificationPanel(TvNotificationPanel sysui)156 public abstract SystemUI bindsTvNotificationPanel(TvNotificationPanel sysui); 157 158 /** Inject into TvOngoingPrivacyChip. */ 159 @Binds 160 @IntoMap 161 @ClassKey(TvOngoingPrivacyChip.class) bindsTvOngoingPrivacyChip(TvOngoingPrivacyChip sysui)162 public abstract SystemUI bindsTvOngoingPrivacyChip(TvOngoingPrivacyChip sysui); 163 164 /** Inject into VolumeUI. */ 165 @Binds 166 @IntoMap 167 @ClassKey(VolumeUI.class) bindVolumeUI(VolumeUI sysui)168 public abstract SystemUI bindVolumeUI(VolumeUI sysui); 169 170 /** Inject into WindowMagnification. */ 171 @Binds 172 @IntoMap 173 @ClassKey(WindowMagnification.class) bindWindowMagnification(WindowMagnification sysui)174 public abstract SystemUI bindWindowMagnification(WindowMagnification sysui); 175 176 /** Inject into WMShell. */ 177 @Binds 178 @IntoMap 179 @ClassKey(WMShell.class) bindWMShell(WMShell sysui)180 public abstract SystemUI bindWMShell(WMShell sysui); 181 182 /** Inject into HomeSoundEffectController. */ 183 @Binds 184 @IntoMap 185 @ClassKey(HomeSoundEffectController.class) bindHomeSoundEffectController(HomeSoundEffectController sysui)186 public abstract SystemUI bindHomeSoundEffectController(HomeSoundEffectController sysui); 187 } 188