• 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 com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN
21 import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
22 import kotlinx.coroutines.flow.MutableStateFlow
23 import kotlinx.coroutines.flow.StateFlow
24 import kotlinx.coroutines.flow.asStateFlow
25 
26 /** Fake implementation of [KeyguardRepository] */
27 class FakeKeyguardBouncerRepository : KeyguardBouncerRepository {
28     private val _primaryBouncerShow = MutableStateFlow(false)
29     override val primaryBouncerShow = _primaryBouncerShow.asStateFlow()
30     private val _primaryBouncerShowingSoon = MutableStateFlow(false)
31     override val primaryBouncerShowingSoon = _primaryBouncerShowingSoon.asStateFlow()
32     private val _primaryBouncerStartingToHide = MutableStateFlow(false)
33     override val primaryBouncerStartingToHide = _primaryBouncerStartingToHide.asStateFlow()
34     private val _primaryBouncerDisappearAnimation = MutableStateFlow<Runnable?>(null)
35     override val primaryBouncerStartingDisappearAnimation =
36         _primaryBouncerDisappearAnimation.asStateFlow()
37     private val _primaryBouncerScrimmed = MutableStateFlow(false)
38     override val primaryBouncerScrimmed = _primaryBouncerScrimmed.asStateFlow()
39     private val _panelExpansionAmount = MutableStateFlow(EXPANSION_HIDDEN)
40     override val panelExpansionAmount = _panelExpansionAmount.asStateFlow()
41     private val _keyguardPosition = MutableStateFlow(0f)
42     override val keyguardPosition = _keyguardPosition.asStateFlow()
43     private val _isBackButtonEnabled = MutableStateFlow<Boolean?>(null)
44     override val isBackButtonEnabled = _isBackButtonEnabled.asStateFlow()
45     private val _keyguardAuthenticated = MutableStateFlow<Boolean?>(null)
46     override val keyguardAuthenticated = _keyguardAuthenticated.asStateFlow()
47     private val _showMessage = MutableStateFlow<BouncerShowMessageModel?>(null)
48     override val showMessage = _showMessage.asStateFlow()
49     private val _resourceUpdateRequests = MutableStateFlow(false)
50     override val resourceUpdateRequests = _resourceUpdateRequests.asStateFlow()
51     override val bouncerPromptReason = 0
52     override val bouncerErrorMessage: CharSequence? = null
53     private val _isAlternateBouncerVisible = MutableStateFlow(false)
54     override val alternateBouncerVisible = _isAlternateBouncerVisible.asStateFlow()
55     override var lastAlternateBouncerVisibleTime: Long = 0L
56     private val _isAlternateBouncerUIAvailable = MutableStateFlow<Boolean>(false)
57     override val alternateBouncerUIAvailable = _isAlternateBouncerUIAvailable.asStateFlow()
58     private val _sideFpsShowing: MutableStateFlow<Boolean> = MutableStateFlow(false)
59     override val sideFpsShowing: StateFlow<Boolean> = _sideFpsShowing.asStateFlow()
60 
setPrimaryScrimmednull61     override fun setPrimaryScrimmed(isScrimmed: Boolean) {
62         _primaryBouncerScrimmed.value = isScrimmed
63     }
64 
setAlternateVisiblenull65     override fun setAlternateVisible(isVisible: Boolean) {
66         _isAlternateBouncerVisible.value = isVisible
67     }
68 
setAlternateBouncerUIAvailablenull69     override fun setAlternateBouncerUIAvailable(isAvailable: Boolean) {
70         _isAlternateBouncerUIAvailable.value = isAvailable
71     }
72 
setPrimaryShownull73     override fun setPrimaryShow(isShowing: Boolean) {
74         _primaryBouncerShow.value = isShowing
75     }
76 
setPrimaryShowingSoonnull77     override fun setPrimaryShowingSoon(showingSoon: Boolean) {
78         _primaryBouncerShowingSoon.value = showingSoon
79     }
80 
setPrimaryStartingToHidenull81     override fun setPrimaryStartingToHide(startingToHide: Boolean) {
82         _primaryBouncerStartingToHide.value = startingToHide
83     }
84 
setPrimaryStartDisappearAnimationnull85     override fun setPrimaryStartDisappearAnimation(runnable: Runnable?) {
86         _primaryBouncerDisappearAnimation.value = runnable
87     }
88 
setPanelExpansionnull89     override fun setPanelExpansion(panelExpansion: Float) {
90         _panelExpansionAmount.value = panelExpansion
91     }
92 
setKeyguardPositionnull93     override fun setKeyguardPosition(keyguardPosition: Float) {
94         _keyguardPosition.value = keyguardPosition
95     }
96 
setResourceUpdateRequestsnull97     override fun setResourceUpdateRequests(willUpdateResources: Boolean) {
98         _resourceUpdateRequests.value = willUpdateResources
99     }
100 
setShowMessagenull101     override fun setShowMessage(bouncerShowMessageModel: BouncerShowMessageModel?) {
102         _showMessage.value = bouncerShowMessageModel
103     }
104 
setKeyguardAuthenticatednull105     override fun setKeyguardAuthenticated(keyguardAuthenticated: Boolean?) {
106         _keyguardAuthenticated.value = keyguardAuthenticated
107     }
108 
setIsBackButtonEnablednull109     override fun setIsBackButtonEnabled(isBackButtonEnabled: Boolean) {
110         _isBackButtonEnabled.value = isBackButtonEnabled
111     }
112 
setSideFpsShowingnull113     override fun setSideFpsShowing(isShowing: Boolean) {
114         _sideFpsShowing.value = isShowing
115     }
116 }
117