1 /* 2 * Copyright (C) 2022 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.go; 18 19 import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; 20 import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME; 21 22 import android.content.Context; 23 import android.hardware.SensorPrivacyManager; 24 25 import com.android.keyguard.KeyguardViewController; 26 import com.android.systemui.ScreenDecorationsModule; 27 import com.android.systemui.accessibility.SystemActionsModule; 28 import com.android.systemui.battery.BatterySaverModule; 29 import com.android.systemui.biometrics.dagger.BiometricsModule; 30 import com.android.systemui.dagger.GlobalRootComponent; 31 import com.android.systemui.dagger.ReferenceSystemUIModule; 32 import com.android.systemui.dagger.SysUISingleton; 33 import com.android.systemui.display.ui.viewmodel.ConnectingDisplayViewModel; 34 import com.android.systemui.dock.DockManager; 35 import com.android.systemui.dock.DockManagerImpl; 36 import com.android.systemui.doze.DozeHost; 37 import com.android.systemui.keyguard.ui.view.layout.blueprints.KeyguardBlueprintModule; 38 import com.android.systemui.keyguard.ui.view.layout.sections.KeyguardSectionsModule; 39 import com.android.systemui.media.dagger.MediaModule; 40 import com.android.systemui.media.muteawait.MediaMuteAwaitConnectionCli; 41 import com.android.systemui.media.nearby.NearbyMediaDevicesManager; 42 import com.android.systemui.navigationbar.NavigationBarControllerModule; 43 import com.android.systemui.navigationbar.gestural.GestureModule; 44 import com.android.systemui.plugins.qs.QSFactory; 45 import com.android.systemui.power.dagger.PowerModule; 46 import com.android.systemui.qs.dagger.QSModule; 47 import com.android.systemui.qs.tileimpl.QSFactoryImpl; 48 import com.android.systemui.recents.Recents; 49 import com.android.systemui.recents.RecentsImplementation; 50 import com.android.systemui.recents.RecentsModule; 51 import com.android.systemui.rotationlock.RotationLockModule; 52 import com.android.systemui.screenshot.ReferenceScreenshotModule; 53 import com.android.systemui.settings.MultiUserUtilsModule; 54 import com.android.systemui.shade.NotificationShadeWindowControllerImpl; 55 import com.android.systemui.shade.ShadeModule; 56 import com.android.systemui.statusbar.CommandQueue; 57 import com.android.systemui.statusbar.NotificationLockscreenUserManager; 58 import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl; 59 import com.android.systemui.statusbar.NotificationShadeWindowController; 60 import com.android.systemui.statusbar.dagger.StartCentralSurfacesModule; 61 import com.android.systemui.statusbar.phone.DozeServiceHost; 62 import com.android.systemui.statusbar.phone.HeadsUpModule; 63 import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; 64 import com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragmentStartableModule; 65 import com.android.systemui.statusbar.policy.AospPolicyModule; 66 import com.android.systemui.statusbar.policy.DeviceProvisionedController; 67 import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl; 68 import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController; 69 import com.android.systemui.statusbar.policy.IndividualSensorPrivacyControllerImpl; 70 import com.android.systemui.statusbar.policy.SensorPrivacyController; 71 import com.android.systemui.statusbar.policy.SensorPrivacyControllerImpl; 72 import com.android.systemui.toast.ToastModule; 73 import com.android.systemui.unfold.SysUIUnfoldStartableModule; 74 import com.android.systemui.volume.dagger.VolumeModule; 75 import com.android.systemui.wallpapers.dagger.WallpaperModule; 76 77 import dagger.Binds; 78 import dagger.Module; 79 import dagger.Provides; 80 81 import javax.inject.Named; 82 83 /** 84 * A dagger module for overriding the default implementations of injected System UI components on 85 * Android Go. This is forked from {@link ReferenceSystemUIModule} 86 */ 87 @Module(includes = { 88 AospPolicyModule.class, 89 BatterySaverModule.class, 90 BiometricsModule.class, 91 CollapsedStatusBarFragmentStartableModule.class, 92 ConnectingDisplayViewModel.StartableModule.class, 93 GestureModule.class, 94 HeadsUpModule.class, 95 KeyguardBlueprintModule.class, 96 KeyguardSectionsModule.class, 97 MediaModule.class, 98 MediaMuteAwaitConnectionCli.StartableModule.class, 99 MultiUserUtilsModule.class, 100 NavigationBarControllerModule.class, 101 NearbyMediaDevicesManager.StartableModule.class, 102 PowerModule.class, 103 QSModule.class, 104 RecentsModule.class, 105 ReferenceScreenshotModule.class, 106 RotationLockModule.class, 107 ScreenDecorationsModule.class, 108 ShadeModule.class, 109 StartCentralSurfacesModule.class, 110 SystemActionsModule.class, 111 SysUIUnfoldStartableModule.class, 112 ToastModule.class, 113 WallpaperModule.class, 114 VolumeModule.class, 115 }) 116 public abstract class SystemUIGoModule { 117 118 @Binds bindGlobalRootComponent( SystemUIGoGlobalRootComponent globalRootComponent)119 abstract GlobalRootComponent bindGlobalRootComponent( 120 SystemUIGoGlobalRootComponent globalRootComponent); 121 122 @SysUISingleton 123 @Provides 124 @Named(LEAK_REPORT_EMAIL_NAME) provideLeakReportEmail()125 static String provideLeakReportEmail() { 126 return "buganizer-system+700073@google.com"; 127 } 128 129 @Binds bindNotificationLockscreenUserManager( NotificationLockscreenUserManagerImpl notificationLockscreenUserManager)130 abstract NotificationLockscreenUserManager bindNotificationLockscreenUserManager( 131 NotificationLockscreenUserManagerImpl notificationLockscreenUserManager); 132 133 @Provides 134 @SysUISingleton provideSensorPrivacyController( SensorPrivacyManager sensorPrivacyManager)135 static SensorPrivacyController provideSensorPrivacyController( 136 SensorPrivacyManager sensorPrivacyManager) { 137 SensorPrivacyController spC = new SensorPrivacyControllerImpl(sensorPrivacyManager); 138 spC.init(); 139 return spC; 140 } 141 142 @Provides 143 @SysUISingleton provideIndividualSensorPrivacyController( SensorPrivacyManager sensorPrivacyManager)144 static IndividualSensorPrivacyController provideIndividualSensorPrivacyController( 145 SensorPrivacyManager sensorPrivacyManager) { 146 IndividualSensorPrivacyController ispC = new IndividualSensorPrivacyControllerImpl( 147 sensorPrivacyManager); 148 ispC.init(); 149 return ispC; 150 } 151 152 @Binds 153 @SysUISingleton bindQSFactory(QSFactoryImpl qsFactoryImpl)154 public abstract QSFactory bindQSFactory(QSFactoryImpl qsFactoryImpl); 155 156 @Binds bindDockManager(DockManagerImpl dockManager)157 abstract DockManager bindDockManager(DockManagerImpl dockManager); 158 159 @SysUISingleton 160 @Provides 161 @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) provideAllowNotificationLongPress()162 static boolean provideAllowNotificationLongPress() { 163 return true; 164 } 165 166 @Provides 167 @SysUISingleton provideRecents(Context context, RecentsImplementation recentsImplementation, CommandQueue commandQueue)168 static Recents provideRecents(Context context, RecentsImplementation recentsImplementation, 169 CommandQueue commandQueue) { 170 return new Recents(context, recentsImplementation, commandQueue); 171 } 172 173 @SysUISingleton 174 @Provides bindDeviceProvisionedController( DeviceProvisionedControllerImpl deviceProvisionedController)175 static DeviceProvisionedController bindDeviceProvisionedController( 176 DeviceProvisionedControllerImpl deviceProvisionedController) { 177 deviceProvisionedController.init(); 178 return deviceProvisionedController; 179 } 180 181 @Binds bindKeyguardViewController( StatusBarKeyguardViewManager statusBarKeyguardViewManager)182 abstract KeyguardViewController bindKeyguardViewController( 183 StatusBarKeyguardViewManager statusBarKeyguardViewManager); 184 185 @Binds bindNotificationShadeController( NotificationShadeWindowControllerImpl notificationShadeWindowController)186 abstract NotificationShadeWindowController bindNotificationShadeController( 187 NotificationShadeWindowControllerImpl notificationShadeWindowController); 188 189 @Binds provideDozeHost(DozeServiceHost dozeServiceHost)190 abstract DozeHost provideDozeHost(DozeServiceHost dozeServiceHost); 191 } 192