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