1 /* 2 * Copyright (C) 2023 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.events 18 19 import com.android.systemui.dagger.SysUISingleton 20 import com.android.systemui.dagger.qualifiers.Application 21 import com.android.systemui.dagger.qualifiers.Main 22 import com.android.systemui.dump.DumpManager 23 import com.android.systemui.flags.FeatureFlags 24 import com.android.systemui.flags.Flags 25 import com.android.systemui.statusbar.window.StatusBarWindowController 26 import com.android.systemui.util.concurrency.DelayableExecutor 27 import com.android.systemui.util.time.SystemClock 28 import dagger.Module 29 import dagger.Provides 30 import kotlinx.coroutines.CoroutineScope 31 32 @Module 33 interface StatusBarEventsModule { 34 35 companion object { 36 37 @Provides 38 @SysUISingleton provideSystemStatusAnimationSchedulernull39 fun provideSystemStatusAnimationScheduler( 40 featureFlags: FeatureFlags, 41 coordinator: SystemEventCoordinator, 42 chipAnimationController: SystemEventChipAnimationController, 43 statusBarWindowController: StatusBarWindowController, 44 dumpManager: DumpManager, 45 systemClock: SystemClock, 46 @Application coroutineScope: CoroutineScope, 47 @Main executor: DelayableExecutor 48 ): SystemStatusAnimationScheduler { 49 return if (featureFlags.isEnabled(Flags.PLUG_IN_STATUS_BAR_CHIP)) { 50 SystemStatusAnimationSchedulerImpl( 51 coordinator, 52 chipAnimationController, 53 statusBarWindowController, 54 dumpManager, 55 systemClock, 56 coroutineScope 57 ) 58 } else { 59 SystemStatusAnimationSchedulerLegacyImpl( 60 coordinator, 61 chipAnimationController, 62 statusBarWindowController, 63 dumpManager, 64 systemClock, 65 executor 66 ) 67 } 68 } 69 } 70 } 71 72