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.keyguard.dagger; 18 19 import android.app.trust.TrustManager; 20 import android.content.Context; 21 import android.os.PowerManager; 22 23 import com.android.internal.jank.InteractionJankMonitor; 24 import com.android.internal.widget.LockPatternUtils; 25 import com.android.keyguard.KeyguardDisplayManager; 26 import com.android.keyguard.KeyguardUpdateMonitor; 27 import com.android.keyguard.KeyguardViewController; 28 import com.android.keyguard.ViewMediatorCallback; 29 import com.android.keyguard.dagger.KeyguardQsUserSwitchComponent; 30 import com.android.keyguard.dagger.KeyguardStatusBarViewComponent; 31 import com.android.keyguard.dagger.KeyguardStatusViewComponent; 32 import com.android.keyguard.dagger.KeyguardUserSwitcherComponent; 33 import com.android.keyguard.mediator.ScreenOnCoordinator; 34 import com.android.systemui.animation.ActivityLaunchAnimator; 35 import com.android.systemui.broadcast.BroadcastDispatcher; 36 import com.android.systemui.classifier.FalsingCollector; 37 import com.android.systemui.classifier.FalsingModule; 38 import com.android.systemui.dagger.SysUISingleton; 39 import com.android.systemui.dagger.qualifiers.UiBackground; 40 import com.android.systemui.dreams.DreamOverlayStateController; 41 import com.android.systemui.dump.DumpManager; 42 import com.android.systemui.keyguard.DismissCallbackRegistry; 43 import com.android.systemui.keyguard.KeyguardUnlockAnimationController; 44 import com.android.systemui.keyguard.KeyguardViewMediator; 45 import com.android.systemui.keyguard.data.quickaffordance.KeyguardDataQuickAffordanceModule; 46 import com.android.systemui.keyguard.data.repository.KeyguardRepositoryModule; 47 import com.android.systemui.keyguard.domain.interactor.StartKeyguardTransitionModule; 48 import com.android.systemui.keyguard.domain.quickaffordance.KeyguardQuickAffordanceModule; 49 import com.android.systemui.navigationbar.NavigationModeController; 50 import com.android.systemui.settings.UserTracker; 51 import com.android.systemui.shade.ShadeController; 52 import com.android.systemui.statusbar.NotificationShadeDepthController; 53 import com.android.systemui.statusbar.NotificationShadeWindowController; 54 import com.android.systemui.statusbar.SysuiStatusBarStateController; 55 import com.android.systemui.statusbar.phone.DozeParameters; 56 import com.android.systemui.statusbar.phone.ScreenOffAnimationController; 57 import com.android.systemui.statusbar.phone.ScrimController; 58 import com.android.systemui.statusbar.policy.KeyguardStateController; 59 import com.android.systemui.statusbar.policy.UserSwitcherController; 60 import com.android.systemui.util.DeviceConfigProxy; 61 62 import java.util.concurrent.Executor; 63 64 import dagger.Lazy; 65 import dagger.Module; 66 import dagger.Provides; 67 68 /** 69 * Dagger Module providing keyguard. 70 */ 71 @Module(subcomponents = { 72 KeyguardQsUserSwitchComponent.class, 73 KeyguardStatusBarViewComponent.class, 74 KeyguardStatusViewComponent.class, 75 KeyguardUserSwitcherComponent.class}, 76 includes = { 77 FalsingModule.class, 78 KeyguardDataQuickAffordanceModule.class, 79 KeyguardQuickAffordanceModule.class, 80 KeyguardRepositoryModule.class, 81 StartKeyguardTransitionModule.class, 82 }) 83 public class KeyguardModule { 84 /** 85 * Provides our instance of KeyguardViewMediator which is considered optional. 86 */ 87 @Provides 88 @SysUISingleton newKeyguardViewMediator( Context context, UserTracker userTracker, FalsingCollector falsingCollector, LockPatternUtils lockPatternUtils, BroadcastDispatcher broadcastDispatcher, Lazy<KeyguardViewController> statusBarKeyguardViewManagerLazy, DismissCallbackRegistry dismissCallbackRegistry, KeyguardUpdateMonitor updateMonitor, DumpManager dumpManager, PowerManager powerManager, TrustManager trustManager, UserSwitcherController userSwitcherController, @UiBackground Executor uiBgExecutor, DeviceConfigProxy deviceConfig, NavigationModeController navigationModeController, KeyguardDisplayManager keyguardDisplayManager, DozeParameters dozeParameters, SysuiStatusBarStateController statusBarStateController, KeyguardStateController keyguardStateController, Lazy<KeyguardUnlockAnimationController> keyguardUnlockAnimationController, ScreenOffAnimationController screenOffAnimationController, Lazy<NotificationShadeDepthController> notificationShadeDepthController, ScreenOnCoordinator screenOnCoordinator, InteractionJankMonitor interactionJankMonitor, DreamOverlayStateController dreamOverlayStateController, Lazy<ShadeController> shadeController, Lazy<NotificationShadeWindowController> notificationShadeWindowController, Lazy<ActivityLaunchAnimator> activityLaunchAnimator, Lazy<ScrimController> scrimControllerLazy)89 public static KeyguardViewMediator newKeyguardViewMediator( 90 Context context, 91 UserTracker userTracker, 92 FalsingCollector falsingCollector, 93 LockPatternUtils lockPatternUtils, 94 BroadcastDispatcher broadcastDispatcher, 95 Lazy<KeyguardViewController> statusBarKeyguardViewManagerLazy, 96 DismissCallbackRegistry dismissCallbackRegistry, 97 KeyguardUpdateMonitor updateMonitor, 98 DumpManager dumpManager, 99 PowerManager powerManager, 100 TrustManager trustManager, 101 UserSwitcherController userSwitcherController, 102 @UiBackground Executor uiBgExecutor, 103 DeviceConfigProxy deviceConfig, 104 NavigationModeController navigationModeController, 105 KeyguardDisplayManager keyguardDisplayManager, 106 DozeParameters dozeParameters, 107 SysuiStatusBarStateController statusBarStateController, 108 KeyguardStateController keyguardStateController, 109 Lazy<KeyguardUnlockAnimationController> keyguardUnlockAnimationController, 110 ScreenOffAnimationController screenOffAnimationController, 111 Lazy<NotificationShadeDepthController> notificationShadeDepthController, 112 ScreenOnCoordinator screenOnCoordinator, 113 InteractionJankMonitor interactionJankMonitor, 114 DreamOverlayStateController dreamOverlayStateController, 115 Lazy<ShadeController> shadeController, 116 Lazy<NotificationShadeWindowController> notificationShadeWindowController, 117 Lazy<ActivityLaunchAnimator> activityLaunchAnimator, 118 Lazy<ScrimController> scrimControllerLazy) { 119 return new KeyguardViewMediator( 120 context, 121 userTracker, 122 falsingCollector, 123 lockPatternUtils, 124 broadcastDispatcher, 125 statusBarKeyguardViewManagerLazy, 126 dismissCallbackRegistry, 127 updateMonitor, 128 dumpManager, 129 uiBgExecutor, 130 powerManager, 131 trustManager, 132 userSwitcherController, 133 deviceConfig, 134 navigationModeController, 135 keyguardDisplayManager, 136 dozeParameters, 137 statusBarStateController, 138 keyguardStateController, 139 keyguardUnlockAnimationController, 140 screenOffAnimationController, 141 notificationShadeDepthController, 142 screenOnCoordinator, 143 interactionJankMonitor, 144 dreamOverlayStateController, 145 shadeController, 146 notificationShadeWindowController, 147 activityLaunchAnimator, 148 scrimControllerLazy); 149 } 150 151 /** */ 152 @Provides providesViewMediatorCallback(KeyguardViewMediator viewMediator)153 public ViewMediatorCallback providesViewMediatorCallback(KeyguardViewMediator viewMediator) { 154 return viewMediator.getViewMediatorCallback(); 155 } 156 } 157