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;
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 
24 import androidx.annotation.Nullable;
25 
26 import com.android.systemui.dock.DockManager;
27 import com.android.systemui.dock.DockManagerImpl;
28 import com.android.systemui.power.EnhancedEstimates;
29 import com.android.systemui.power.EnhancedEstimatesImpl;
30 import com.android.systemui.statusbar.NotificationLockscreenUserManager;
31 import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl;
32 import com.android.systemui.statusbar.notification.collection.NotificationData;
33 import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
34 import com.android.systemui.statusbar.phone.ShadeController;
35 import com.android.systemui.statusbar.phone.StatusBar;
36 
37 import javax.inject.Named;
38 import javax.inject.Singleton;
39 
40 import dagger.Binds;
41 import dagger.Module;
42 import dagger.Provides;
43 
44 /**
45  * A dagger module for injecting default implementations of components of System UI that may be
46  * overridden by the System UI implementation.
47  */
48 @Module
49 abstract class SystemUIDefaultModule {
50 
51     @Singleton
52     @Provides
53     @Named(LEAK_REPORT_EMAIL_NAME)
54     @Nullable
provideLeakReportEmail()55     static String provideLeakReportEmail() {
56         return null;
57     }
58 
59     @Binds
bindEnhancedEstimates(EnhancedEstimatesImpl enhancedEstimates)60     abstract EnhancedEstimates bindEnhancedEstimates(EnhancedEstimatesImpl enhancedEstimates);
61 
62     @Binds
bindNotificationLockscreenUserManager( NotificationLockscreenUserManagerImpl notificationLockscreenUserManager)63     abstract NotificationLockscreenUserManager bindNotificationLockscreenUserManager(
64             NotificationLockscreenUserManagerImpl notificationLockscreenUserManager);
65 
66     @Binds
bindDockManager(DockManagerImpl dockManager)67     abstract DockManager bindDockManager(DockManagerImpl dockManager);
68 
69     @Binds
bindKeyguardEnvironment( KeyguardEnvironmentImpl keyguardEnvironment)70     abstract NotificationData.KeyguardEnvironment bindKeyguardEnvironment(
71             KeyguardEnvironmentImpl keyguardEnvironment);
72 
73     @Singleton
74     @Provides
provideShadeController(Context context)75     static ShadeController provideShadeController(Context context) {
76         return SysUiServiceProvider.getComponent(context, StatusBar.class);
77     }
78 
79     @Singleton
80     @Provides
81     @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME)
provideAllowNotificationLongPress()82     static boolean provideAllowNotificationLongPress() {
83         return true;
84     }
85 }
86