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.notification.row; 18 19 import com.android.systemui.dagger.SysUISingleton; 20 import com.android.systemui.statusbar.notification.row.icon.AppIconProviderModule; 21 import com.android.systemui.statusbar.notification.row.icon.NotificationIconStyleProviderModule; 22 import com.android.systemui.statusbar.notification.row.shared.NotificationRowContentBinderRefactor; 23 24 import dagger.Binds; 25 import dagger.Module; 26 import dagger.Provides; 27 28 import javax.inject.Provider; 29 30 /** 31 * Dagger Module containing notification row and view inflation implementations. 32 */ 33 @Module(includes = {AppIconProviderModule.class, NotificationIconStyleProviderModule.class}) 34 public abstract class NotificationRowModule { 35 36 /** 37 * Provides notification row content binder instance. 38 */ 39 @Provides 40 @SysUISingleton provideNotificationRowContentBinder( Provider<NotificationContentInflater> legacyImpl, Provider<NotificationRowContentBinderImpl> refactoredImpl )41 public static NotificationRowContentBinder provideNotificationRowContentBinder( 42 Provider<NotificationContentInflater> legacyImpl, 43 Provider<NotificationRowContentBinderImpl> refactoredImpl 44 ) { 45 if (NotificationRowContentBinderRefactor.isEnabled()) { 46 return refactoredImpl.get(); 47 } else { 48 return legacyImpl.get(); 49 } 50 } 51 52 /** 53 * Provides notification remote view cache instance. 54 */ 55 @Binds 56 @SysUISingleton provideNotifRemoteViewCache( NotifRemoteViewCacheImpl cacheImpl)57 public abstract NotifRemoteViewCache provideNotifRemoteViewCache( 58 NotifRemoteViewCacheImpl cacheImpl); 59 60 /** 61 * Provides notification remote view factory container 62 */ 63 @Binds 64 @SysUISingleton provideNotifRemoteViewsFactoryContainer( NotifRemoteViewsFactoryContainerImpl containerImpl)65 public abstract NotifRemoteViewsFactoryContainer provideNotifRemoteViewsFactoryContainer( 66 NotifRemoteViewsFactoryContainerImpl containerImpl); 67 68 /** 69 * Provides heads up style manager 70 */ 71 @Binds 72 @SysUISingleton provideHeadsUpStyleManager( HeadsUpStyleProviderImpl headsUpStyleManagerImpl)73 public abstract HeadsUpStyleProvider provideHeadsUpStyleManager( 74 HeadsUpStyleProviderImpl headsUpStyleManagerImpl); 75 } 76