1 /* 2 * Copyright (C) 2024 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 android.widget.flags.Flags.notifLinearlayoutOptimized 20 import com.android.systemui.flags.FeatureFlags 21 import com.android.systemui.flags.Flags 22 import com.android.systemui.statusbar.notification.row.icon.NotificationRowIconViewInflaterFactory 23 import com.android.systemui.statusbar.notification.shared.NotificationViewFlipperPausing 24 import javax.inject.Inject 25 import javax.inject.Provider 26 27 interface NotifRemoteViewsFactoryContainer { 28 val factories: Set<NotifRemoteViewsFactory> 29 } 30 31 class NotifRemoteViewsFactoryContainerImpl 32 @Inject 33 constructor( 34 featureFlags: FeatureFlags, 35 precomputedTextViewFactory: PrecomputedTextViewFactory, 36 bigPictureLayoutInflaterFactory: BigPictureLayoutInflaterFactory, 37 optimizedLinearLayoutFactory: NotificationOptimizedLinearLayoutFactory, 38 notificationViewFlipperFactory: Provider<NotificationViewFlipperFactory>, 39 notificationRowIconViewInflaterFactory: NotificationRowIconViewInflaterFactory, 40 ) : NotifRemoteViewsFactoryContainer { <lambda>null41 override val factories: Set<NotifRemoteViewsFactory> = buildSet { 42 add(precomputedTextViewFactory) 43 if (featureFlags.isEnabled(Flags.BIGPICTURE_NOTIFICATION_LAZY_LOADING)) { 44 add(bigPictureLayoutInflaterFactory) 45 } 46 if (notifLinearlayoutOptimized()) { 47 add(optimizedLinearLayoutFactory) 48 } 49 if (NotificationViewFlipperPausing.isEnabled) { 50 add(notificationViewFlipperFactory.get()) 51 } 52 if (android.app.Flags.notificationsRedesignAppIcons()) { 53 add(notificationRowIconViewInflaterFactory) 54 } 55 } 56 } 57