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.car.notification; 18 19 import android.content.Context; 20 21 import com.android.car.notification.CarHeadsUpNotificationManager; 22 import com.android.car.notification.CarNotificationListener; 23 import com.android.car.notification.CarUxRestrictionManagerWrapper; 24 import com.android.car.notification.NotificationClickHandlerFactory; 25 import com.android.car.notification.NotificationDataManager; 26 import com.android.car.notification.headsup.CarHeadsUpNotificationContainer; 27 import com.android.internal.statusbar.IStatusBarService; 28 29 import javax.inject.Singleton; 30 31 import dagger.Binds; 32 import dagger.Module; 33 import dagger.Provides; 34 35 /** 36 * Module for Car SysUI Notifications 37 */ 38 @Module 39 public abstract class CarNotificationModule { 40 @Provides 41 @Singleton provideNotificationClickHandlerFactory( IStatusBarService barService)42 static NotificationClickHandlerFactory provideNotificationClickHandlerFactory( 43 IStatusBarService barService) { 44 return new NotificationClickHandlerFactory(barService); 45 } 46 47 @Provides 48 @Singleton provideNotificationDataManager()49 static NotificationDataManager provideNotificationDataManager() { 50 return new NotificationDataManager(); 51 } 52 53 @Provides 54 @Singleton provideCarUxRestrictionManagerWrapper()55 static CarUxRestrictionManagerWrapper provideCarUxRestrictionManagerWrapper() { 56 return new CarUxRestrictionManagerWrapper(); 57 } 58 59 @Provides 60 @Singleton provideCarNotificationListener(Context context, CarUxRestrictionManagerWrapper carUxRestrictionManagerWrapper, CarHeadsUpNotificationManager carHeadsUpNotificationManager, NotificationDataManager notificationDataManager)61 static CarNotificationListener provideCarNotificationListener(Context context, 62 CarUxRestrictionManagerWrapper carUxRestrictionManagerWrapper, 63 CarHeadsUpNotificationManager carHeadsUpNotificationManager, 64 NotificationDataManager notificationDataManager) { 65 CarNotificationListener listener = new CarNotificationListener(); 66 listener.registerAsSystemService(context, carUxRestrictionManagerWrapper, 67 carHeadsUpNotificationManager, notificationDataManager); 68 return listener; 69 } 70 71 @Provides 72 @Singleton provideCarHeadsUpNotificationManager(Context context, NotificationClickHandlerFactory notificationClickHandlerFactory, NotificationDataManager notificationDataManager, CarHeadsUpNotificationContainer headsUpNotificationDisplay)73 static CarHeadsUpNotificationManager provideCarHeadsUpNotificationManager(Context context, 74 NotificationClickHandlerFactory notificationClickHandlerFactory, 75 NotificationDataManager notificationDataManager, 76 CarHeadsUpNotificationContainer headsUpNotificationDisplay) { 77 return new CarHeadsUpNotificationManager(context, notificationClickHandlerFactory, 78 notificationDataManager, headsUpNotificationDisplay); 79 } 80 81 @Binds bindsCarHeadsUpNotificationContainer( CarHeadsUpNotificationSystemContainer carHeadsUpNotificationSystemContainer)82 abstract CarHeadsUpNotificationContainer bindsCarHeadsUpNotificationContainer( 83 CarHeadsUpNotificationSystemContainer carHeadsUpNotificationSystemContainer); 84 } 85