Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 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 | |
Dave Mankoff | f473681 | 2019-10-18 17:25:50 -0400 | [diff] [blame] | 17 | package com.android.systemui.dagger; |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 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 | |
Dave Mankoff | 613c7c6 | 2019-11-04 11:46:36 -0500 | [diff] [blame] | 22 | import android.content.Context; |
| 23 | |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 24 | import androidx.annotation.Nullable; |
| 25 | |
kwaky | 198b5dc | 2020-02-28 11:14:37 -0800 | [diff] [blame] | 26 | import com.android.keyguard.KeyguardViewController; |
Evan Laird | 31ca547 | 2020-04-08 17:45:24 -0400 | [diff] [blame] | 27 | import com.android.systemui.broadcast.BroadcastDispatcher; |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 28 | import com.android.systemui.dock.DockManager; |
| 29 | import com.android.systemui.dock.DockManagerImpl; |
John Li | 4e3dddc | 2020-03-04 21:35:43 +0800 | [diff] [blame] | 30 | import com.android.systemui.plugins.qs.QSFactory; |
Dave Mankoff | ff63780 | 2019-11-11 17:13:51 -0500 | [diff] [blame] | 31 | import com.android.systemui.plugins.statusbar.StatusBarStateController; |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 32 | import com.android.systemui.power.EnhancedEstimates; |
| 33 | import com.android.systemui.power.EnhancedEstimatesImpl; |
John Li | 4e3dddc | 2020-03-04 21:35:43 +0800 | [diff] [blame] | 34 | import com.android.systemui.qs.tileimpl.QSFactoryImpl; |
Dave Mankoff | ae3b432 | 2019-11-05 19:48:24 -0500 | [diff] [blame] | 35 | import com.android.systemui.recents.Recents; |
| 36 | import com.android.systemui.recents.RecentsImplementation; |
Evan Laird | 31ca547 | 2020-04-08 17:45:24 -0400 | [diff] [blame] | 37 | import com.android.systemui.settings.CurrentUserContextTracker; |
Evan Rosky | cf05fd9 | 2019-12-20 13:55:56 -0800 | [diff] [blame] | 38 | import com.android.systemui.stackdivider.DividerModule; |
Dave Mankoff | ae3b432 | 2019-11-05 19:48:24 -0500 | [diff] [blame] | 39 | import com.android.systemui.statusbar.CommandQueue; |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 40 | import com.android.systemui.statusbar.NotificationLockscreenUserManager; |
| 41 | import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl; |
Evan Laird | 181de62 | 2019-10-24 09:53:02 -0400 | [diff] [blame] | 42 | import com.android.systemui.statusbar.notification.NotificationEntryManager; |
Dave Mankoff | ff63780 | 2019-11-11 17:13:51 -0500 | [diff] [blame] | 43 | import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; |
| 44 | import com.android.systemui.statusbar.phone.KeyguardBypassController; |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 45 | import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl; |
Beverly | 95a0802ac | 2020-02-10 15:27:40 -0500 | [diff] [blame] | 46 | import com.android.systemui.statusbar.phone.NotificationGroupManager; |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 47 | import com.android.systemui.statusbar.phone.ShadeController; |
Heemin Seog | ba6337f | 2019-12-10 15:34:37 -0800 | [diff] [blame] | 48 | import com.android.systemui.statusbar.phone.ShadeControllerImpl; |
kwaky | 198b5dc | 2020-02-28 11:14:37 -0800 | [diff] [blame] | 49 | import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; |
John Li | 8360e4e | 2020-02-20 19:21:47 +0800 | [diff] [blame] | 50 | import com.android.systemui.statusbar.policy.BatteryController; |
| 51 | import com.android.systemui.statusbar.policy.BatteryControllerImpl; |
Beverly | 95a0802ac | 2020-02-10 15:27:40 -0500 | [diff] [blame] | 52 | import com.android.systemui.statusbar.policy.ConfigurationController; |
Abhijoy Saha | ee51369 | 2019-12-10 13:52:26 -0800 | [diff] [blame] | 53 | import com.android.systemui.statusbar.policy.DeviceProvisionedController; |
| 54 | import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl; |
Dave Mankoff | ff63780 | 2019-11-11 17:13:51 -0500 | [diff] [blame] | 55 | import com.android.systemui.statusbar.policy.HeadsUpManager; |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 56 | |
| 57 | import javax.inject.Named; |
| 58 | import javax.inject.Singleton; |
| 59 | |
| 60 | import dagger.Binds; |
| 61 | import dagger.Module; |
| 62 | import dagger.Provides; |
| 63 | |
| 64 | /** |
| 65 | * A dagger module for injecting default implementations of components of System UI that may be |
| 66 | * overridden by the System UI implementation. |
| 67 | */ |
Evan Rosky | cf05fd9 | 2019-12-20 13:55:56 -0800 | [diff] [blame] | 68 | @Module(includes = {DividerModule.class}) |
Sergey Nikolaienkov | 7842bac | 2019-12-19 16:34:11 +0100 | [diff] [blame] | 69 | public abstract class SystemUIDefaultModule { |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 70 | |
| 71 | @Singleton |
| 72 | @Provides |
| 73 | @Named(LEAK_REPORT_EMAIL_NAME) |
| 74 | @Nullable |
| 75 | static String provideLeakReportEmail() { |
| 76 | return null; |
| 77 | } |
| 78 | |
| 79 | @Binds |
| 80 | abstract EnhancedEstimates bindEnhancedEstimates(EnhancedEstimatesImpl enhancedEstimates); |
| 81 | |
| 82 | @Binds |
| 83 | abstract NotificationLockscreenUserManager bindNotificationLockscreenUserManager( |
| 84 | NotificationLockscreenUserManagerImpl notificationLockscreenUserManager); |
| 85 | |
| 86 | @Binds |
John Li | 8360e4e | 2020-02-20 19:21:47 +0800 | [diff] [blame] | 87 | @Singleton |
| 88 | public abstract BatteryController provideBatteryController( |
| 89 | BatteryControllerImpl controllerImpl); |
| 90 | |
| 91 | @Binds |
John Li | 4e3dddc | 2020-03-04 21:35:43 +0800 | [diff] [blame] | 92 | @Singleton |
| 93 | public abstract QSFactory provideQSFactory(QSFactoryImpl qsFactoryImpl); |
| 94 | |
| 95 | @Binds |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 96 | abstract DockManager bindDockManager(DockManagerImpl dockManager); |
| 97 | |
| 98 | @Binds |
Evan Laird | 181de62 | 2019-10-24 09:53:02 -0400 | [diff] [blame] | 99 | abstract NotificationEntryManager.KeyguardEnvironment bindKeyguardEnvironment( |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 100 | KeyguardEnvironmentImpl keyguardEnvironment); |
| 101 | |
Dave Mankoff | 0cf8dfc | 2019-09-27 12:46:41 -0400 | [diff] [blame] | 102 | @Binds |
Heemin Seog | ba6337f | 2019-12-10 15:34:37 -0800 | [diff] [blame] | 103 | abstract ShadeController provideShadeController(ShadeControllerImpl shadeController); |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 104 | |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 105 | @Singleton |
| 106 | @Provides |
| 107 | @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) |
| 108 | static boolean provideAllowNotificationLongPress() { |
| 109 | return true; |
| 110 | } |
Dave Mankoff | 613c7c6 | 2019-11-04 11:46:36 -0500 | [diff] [blame] | 111 | |
| 112 | @Singleton |
| 113 | @Provides |
Beverly | 95a0802ac | 2020-02-10 15:27:40 -0500 | [diff] [blame] | 114 | static HeadsUpManagerPhone provideHeadsUpManagerPhone( |
| 115 | Context context, |
Dave Mankoff | ff63780 | 2019-11-11 17:13:51 -0500 | [diff] [blame] | 116 | StatusBarStateController statusBarStateController, |
Beverly | 95a0802ac | 2020-02-10 15:27:40 -0500 | [diff] [blame] | 117 | KeyguardBypassController bypassController, |
| 118 | NotificationGroupManager groupManager, |
| 119 | ConfigurationController configurationController) { |
| 120 | return new HeadsUpManagerPhone(context, statusBarStateController, bypassController, |
| 121 | groupManager, configurationController); |
Dave Mankoff | ff63780 | 2019-11-11 17:13:51 -0500 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | @Binds |
| 125 | abstract HeadsUpManager bindHeadsUpManagerPhone(HeadsUpManagerPhone headsUpManagerPhone); |
| 126 | |
Dave Mankoff | ae3b432 | 2019-11-05 19:48:24 -0500 | [diff] [blame] | 127 | @Provides |
| 128 | @Singleton |
| 129 | static Recents provideRecents(Context context, RecentsImplementation recentsImplementation, |
| 130 | CommandQueue commandQueue) { |
| 131 | return new Recents(context, recentsImplementation, commandQueue); |
| 132 | } |
Abhijoy Saha | ee51369 | 2019-12-10 13:52:26 -0800 | [diff] [blame] | 133 | |
| 134 | @Binds |
| 135 | abstract DeviceProvisionedController bindDeviceProvisionedController( |
| 136 | DeviceProvisionedControllerImpl deviceProvisionedController); |
kwaky | 198b5dc | 2020-02-28 11:14:37 -0800 | [diff] [blame] | 137 | |
| 138 | @Binds |
| 139 | abstract KeyguardViewController bindKeyguardViewController( |
| 140 | StatusBarKeyguardViewManager statusBarKeyguardViewManager); |
Evan Laird | 31ca547 | 2020-04-08 17:45:24 -0400 | [diff] [blame] | 141 | |
| 142 | @Singleton |
| 143 | @Provides |
| 144 | static CurrentUserContextTracker provideCurrentUserContextTracker( |
| 145 | Context context, |
| 146 | BroadcastDispatcher broadcastDispatcher) { |
| 147 | CurrentUserContextTracker tracker = |
| 148 | new CurrentUserContextTracker(context, broadcastDispatcher); |
| 149 | tracker.initialize(); |
| 150 | return tracker; |
| 151 | } |
Govinda Wasserman | 2e86fb6 | 2019-08-13 11:35:44 -0400 | [diff] [blame] | 152 | } |