1 /* 2 * Copyright (C) 2020 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.statusbar.dagger; 18 19 import android.app.NotificationManager; 20 import android.content.Context; 21 import android.os.Handler; 22 23 import com.android.internal.statusbar.IStatusBarService; 24 import com.android.systemui.bubbles.BubbleController; 25 import com.android.systemui.dagger.qualifiers.Main; 26 import com.android.systemui.media.MediaDataManager; 27 import com.android.systemui.plugins.statusbar.StatusBarStateController; 28 import com.android.systemui.statusbar.ActionClickLogger; 29 import com.android.systemui.statusbar.CommandQueue; 30 import com.android.systemui.statusbar.MediaArtworkProcessor; 31 import com.android.systemui.statusbar.NotificationClickNotifier; 32 import com.android.systemui.statusbar.NotificationListener; 33 import com.android.systemui.statusbar.NotificationLockscreenUserManager; 34 import com.android.systemui.statusbar.NotificationMediaManager; 35 import com.android.systemui.statusbar.NotificationRemoteInputManager; 36 import com.android.systemui.statusbar.NotificationViewHierarchyManager; 37 import com.android.systemui.statusbar.SmartReplyController; 38 import com.android.systemui.statusbar.notification.DynamicChildBindController; 39 import com.android.systemui.statusbar.notification.DynamicPrivacyController; 40 import com.android.systemui.statusbar.notification.NotificationEntryManager; 41 import com.android.systemui.statusbar.notification.VisualStabilityManager; 42 import com.android.systemui.statusbar.notification.collection.inflation.LowPriorityInflationHelper; 43 import com.android.systemui.statusbar.notification.stack.ForegroundServiceSectionController; 44 import com.android.systemui.statusbar.phone.KeyguardBypassController; 45 import com.android.systemui.statusbar.phone.NotificationGroupManager; 46 import com.android.systemui.statusbar.phone.NotificationShadeWindowController; 47 import com.android.systemui.statusbar.phone.StatusBar; 48 import com.android.systemui.statusbar.policy.RemoteInputUriController; 49 import com.android.systemui.tracing.ProtoTracer; 50 import com.android.systemui.util.DeviceConfigProxy; 51 import com.android.systemui.util.concurrency.DelayableExecutor; 52 53 import javax.inject.Singleton; 54 55 import dagger.Lazy; 56 import dagger.Module; 57 import dagger.Provides; 58 59 /** 60 * This module provides instances needed to construct {@link StatusBar}. These are moved to this 61 * separate from {@link StatusBarModule} module so that components that wish to build their own 62 * version of StatusBar can include just dependencies, without injecting StatusBar itself. 63 */ 64 @Module 65 public interface StatusBarDependenciesModule { 66 /** */ 67 @Singleton 68 @Provides provideNotificationRemoteInputManager( Context context, NotificationLockscreenUserManager lockscreenUserManager, SmartReplyController smartReplyController, NotificationEntryManager notificationEntryManager, Lazy<StatusBar> statusBarLazy, StatusBarStateController statusBarStateController, Handler mainHandler, RemoteInputUriController remoteInputUriController, NotificationClickNotifier clickNotifier, ActionClickLogger actionClickLogger)69 static NotificationRemoteInputManager provideNotificationRemoteInputManager( 70 Context context, 71 NotificationLockscreenUserManager lockscreenUserManager, 72 SmartReplyController smartReplyController, 73 NotificationEntryManager notificationEntryManager, 74 Lazy<StatusBar> statusBarLazy, 75 StatusBarStateController statusBarStateController, 76 Handler mainHandler, 77 RemoteInputUriController remoteInputUriController, 78 NotificationClickNotifier clickNotifier, 79 ActionClickLogger actionClickLogger) { 80 return new NotificationRemoteInputManager( 81 context, 82 lockscreenUserManager, 83 smartReplyController, 84 notificationEntryManager, 85 statusBarLazy, 86 statusBarStateController, 87 mainHandler, 88 remoteInputUriController, 89 clickNotifier, 90 actionClickLogger); 91 } 92 93 /** */ 94 @Singleton 95 @Provides provideNotificationMediaManager( Context context, Lazy<StatusBar> statusBarLazy, Lazy<NotificationShadeWindowController> notificationShadeWindowController, NotificationEntryManager notificationEntryManager, MediaArtworkProcessor mediaArtworkProcessor, KeyguardBypassController keyguardBypassController, @Main DelayableExecutor mainExecutor, DeviceConfigProxy deviceConfigProxy, MediaDataManager mediaDataManager)96 static NotificationMediaManager provideNotificationMediaManager( 97 Context context, 98 Lazy<StatusBar> statusBarLazy, 99 Lazy<NotificationShadeWindowController> notificationShadeWindowController, 100 NotificationEntryManager notificationEntryManager, 101 MediaArtworkProcessor mediaArtworkProcessor, 102 KeyguardBypassController keyguardBypassController, 103 @Main DelayableExecutor mainExecutor, 104 DeviceConfigProxy deviceConfigProxy, 105 MediaDataManager mediaDataManager) { 106 return new NotificationMediaManager( 107 context, 108 statusBarLazy, 109 notificationShadeWindowController, 110 notificationEntryManager, 111 mediaArtworkProcessor, 112 keyguardBypassController, 113 mainExecutor, 114 deviceConfigProxy, 115 mediaDataManager); 116 } 117 118 /** */ 119 @Singleton 120 @Provides provideNotificationListener( Context context, NotificationManager notificationManager, @Main Handler mainHandler)121 static NotificationListener provideNotificationListener( 122 Context context, 123 NotificationManager notificationManager, 124 @Main Handler mainHandler) { 125 return new NotificationListener( 126 context, notificationManager, mainHandler); 127 } 128 129 /** */ 130 @Singleton 131 @Provides provideSmartReplyController( NotificationEntryManager entryManager, IStatusBarService statusBarService, NotificationClickNotifier clickNotifier)132 static SmartReplyController provideSmartReplyController( 133 NotificationEntryManager entryManager, 134 IStatusBarService statusBarService, 135 NotificationClickNotifier clickNotifier) { 136 return new SmartReplyController(entryManager, statusBarService, clickNotifier); 137 } 138 139 /** */ 140 @Singleton 141 @Provides provideNotificationViewHierarchyManager( Context context, @Main Handler mainHandler, NotificationLockscreenUserManager notificationLockscreenUserManager, NotificationGroupManager groupManager, VisualStabilityManager visualStabilityManager, StatusBarStateController statusBarStateController, NotificationEntryManager notificationEntryManager, KeyguardBypassController bypassController, BubbleController bubbleController, DynamicPrivacyController privacyController, ForegroundServiceSectionController fgsSectionController, DynamicChildBindController dynamicChildBindController, LowPriorityInflationHelper lowPriorityInflationHelper)142 static NotificationViewHierarchyManager provideNotificationViewHierarchyManager( 143 Context context, 144 @Main Handler mainHandler, 145 NotificationLockscreenUserManager notificationLockscreenUserManager, 146 NotificationGroupManager groupManager, 147 VisualStabilityManager visualStabilityManager, 148 StatusBarStateController statusBarStateController, 149 NotificationEntryManager notificationEntryManager, 150 KeyguardBypassController bypassController, 151 BubbleController bubbleController, 152 DynamicPrivacyController privacyController, 153 ForegroundServiceSectionController fgsSectionController, 154 DynamicChildBindController dynamicChildBindController, 155 LowPriorityInflationHelper lowPriorityInflationHelper) { 156 return new NotificationViewHierarchyManager( 157 context, 158 mainHandler, 159 notificationLockscreenUserManager, 160 groupManager, 161 visualStabilityManager, 162 statusBarStateController, 163 notificationEntryManager, 164 bypassController, 165 bubbleController, 166 privacyController, 167 fgsSectionController, 168 dynamicChildBindController, 169 lowPriorityInflationHelper); 170 } 171 172 /** 173 * Provides our instance of CommandQueue which is considered optional. 174 */ 175 @Provides 176 @Singleton provideCommandQueue(Context context, ProtoTracer protoTracer)177 static CommandQueue provideCommandQueue(Context context, ProtoTracer protoTracer) { 178 return new CommandQueue(context, protoTracer); 179 } 180 } 181