1 /* 2 * Copyright (C) 2021 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.flags 18 19 import android.content.Context 20 import android.os.Handler 21 import com.android.systemui.dagger.qualifiers.Main 22 import com.android.systemui.util.settings.SettingsUtilModule 23 import dagger.Binds 24 import dagger.Module 25 import dagger.Provides 26 import dagger.multibindings.IntoSet 27 import javax.inject.Named 28 29 @Module(includes = [ 30 FeatureFlagsDebugStartableModule::class, 31 FlagsCommonModule::class, 32 ServerFlagReaderModule::class, 33 SettingsUtilModule::class, 34 ]) 35 abstract class FlagsModule { bindsFeatureFlagDebugnull36 @Binds abstract fun bindsFeatureFlagDebug(impl: FeatureFlagsClassicDebug): FeatureFlagsClassic 37 38 @Binds 39 @IntoSet 40 abstract fun bindsScreenIdleCondition(impl: ScreenIdleCondition): ConditionalRestarter.Condition 41 42 @Binds 43 @IntoSet 44 abstract fun bindsNotOccludedCondition( 45 impl: NotOccludedCondition 46 ): ConditionalRestarter.Condition 47 48 @Module 49 companion object { 50 @JvmStatic 51 @Provides 52 fun provideFlagManager(context: Context, @Main handler: Handler): FlagManager { 53 return FlagManager(context, handler) 54 } 55 56 @JvmStatic 57 @Provides 58 @Named(ConditionalRestarter.RESTART_DELAY) 59 fun provideRestartDelaySec(): Long = 1 60 } 61 } 62