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 
18 package com.android.systemui.keyguard.data.repository
19 
20 import com.android.systemui.CoreStartable
21 import com.android.systemui.dagger.SysUISingleton
22 import com.android.systemui.keyguard.domain.interactor.KeyguardFaceAuthInteractor
23 import com.android.systemui.keyguard.domain.interactor.SystemUIKeyguardFaceAuthInteractor
24 import com.android.systemui.log.table.TableLogBuffer
25 import com.android.systemui.log.table.TableLogBufferFactory
26 import dagger.Binds
27 import dagger.Module
28 import dagger.Provides
29 import dagger.multibindings.ClassKey
30 import dagger.multibindings.IntoMap
31 
32 @Module
33 interface KeyguardFaceAuthModule {
34     @Binds
35     fun deviceEntryFaceAuthRepository(
36         impl: DeviceEntryFaceAuthRepositoryImpl
37     ): DeviceEntryFaceAuthRepository
38 
39     @Binds
40     @IntoMap
41     @ClassKey(SystemUIKeyguardFaceAuthInteractor::class)
42     fun bind(impl: SystemUIKeyguardFaceAuthInteractor): CoreStartable
43 
44     @Binds
45     fun keyguardFaceAuthInteractor(
46         impl: SystemUIKeyguardFaceAuthInteractor
47     ): KeyguardFaceAuthInteractor
48 
49     companion object {
50         @Provides
51         @SysUISingleton
52         @FaceAuthTableLog
53         fun provideFaceAuthTableLog(factory: TableLogBufferFactory): TableLogBuffer {
54             return factory.create("FaceAuthTableLog", 100)
55         }
56 
57         @Provides
58         @SysUISingleton
59         @FaceDetectTableLog
60         fun provideFaceDetectTableLog(factory: TableLogBufferFactory): TableLogBuffer {
61             return factory.create("FaceDetectTableLog", 100)
62         }
63     }
64 }
65