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 { 36 @Binds 37 abstract fun bindsFeatureFlagDebug(impl: FeatureFlagsDebug): FeatureFlags 38 39 @Binds 40 @IntoSet 41 abstract fun bindsScreenIdleCondition(impl: ScreenIdleCondition): ConditionalRestarter.Condition 42 43 @Module 44 companion object { 45 @JvmStatic 46 @Provides 47 fun provideFlagManager(context: Context, @Main handler: Handler): FlagManager { 48 return FlagManager(context, handler) 49 } 50 51 @JvmStatic 52 @Provides 53 @Named(ConditionalRestarter.RESTART_DELAY) 54 fun provideRestartDelaySec(): Long = 1 55 } 56 } 57