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.brightness.dagger
18 
19 import com.android.systemui.brightness.data.repository.BrightnessPolicyRepository
20 import com.android.systemui.brightness.data.repository.BrightnessPolicyRepositoryImpl
21 import com.android.systemui.brightness.data.repository.ScreenBrightnessDisplayManagerRepository
22 import com.android.systemui.brightness.data.repository.ScreenBrightnessRepository
23 import com.android.systemui.brightness.shared.model.BrightnessLog
24 import com.android.systemui.dagger.SysUISingleton
25 import com.android.systemui.log.LogBuffer
26 import com.android.systemui.log.LogBufferFactory
27 import com.android.systemui.log.table.TableLogBuffer
28 import com.android.systemui.log.table.TableLogBufferFactory
29 import dagger.Binds
30 import dagger.Module
31 import dagger.Provides
32 
33 @Module
34 interface ScreenBrightnessModule {
35 
36     @Binds
bindScreenBrightnessRepositorynull37     fun bindScreenBrightnessRepository(
38         impl: ScreenBrightnessDisplayManagerRepository
39     ): ScreenBrightnessRepository
40 
41     @Binds
42     fun bindPolicyRepository(impl: BrightnessPolicyRepositoryImpl): BrightnessPolicyRepository
43 
44     companion object {
45         @Provides
46         @SysUISingleton
47         @BrightnessLog
48         fun providesBrightnessTableLog(factory: TableLogBufferFactory): TableLogBuffer {
49             return factory.create("BrightnessTableLog", 50)
50         }
51 
52         @Provides
53         @SysUISingleton
54         @BrightnessLog
55         fun providesBrightnessLog(factory: LogBufferFactory): LogBuffer {
56             return factory.create("BrightnessLog", 50)
57         }
58     }
59 }
60