• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 android.annotation.FloatRange
21 import com.android.systemui.keyguard.shared.model.TransitionInfo
22 import com.android.systemui.keyguard.shared.model.TransitionState
23 import com.android.systemui.keyguard.shared.model.TransitionStep
24 import java.util.UUID
25 import kotlinx.coroutines.channels.BufferOverflow
26 import kotlinx.coroutines.flow.MutableSharedFlow
27 import kotlinx.coroutines.flow.SharedFlow
28 
29 /** Fake implementation of [KeyguardTransitionRepository] */
30 class FakeKeyguardTransitionRepository : KeyguardTransitionRepository {
31 
32     private val _transitions =
33         MutableSharedFlow<TransitionStep>(replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
34     override val transitions: SharedFlow<TransitionStep> = _transitions
35 
sendTransitionStepnull36     suspend fun sendTransitionStep(step: TransitionStep) {
37         _transitions.emit(step)
38     }
39 
startTransitionnull40     override fun startTransition(info: TransitionInfo, resetIfCanceled: Boolean): UUID? {
41         return null
42     }
43 
updateTransitionnull44     override fun updateTransition(
45         transitionId: UUID,
46         @FloatRange(from = 0.0, to = 1.0) value: Float,
47         state: TransitionState
48     ) = Unit
49 }
50