• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.systemui.bouncer.data.repository
2 
3 import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants
4 import com.android.systemui.bouncer.shared.model.BouncerShowMessageModel
5 import kotlinx.coroutines.flow.MutableStateFlow
6 import kotlinx.coroutines.flow.StateFlow
7 import kotlinx.coroutines.flow.asStateFlow
8 
9 /** Fake implementation of [KeyguardRepository] */
10 class FakeKeyguardBouncerRepository : KeyguardBouncerRepository {
11     private val _primaryBouncerShow = MutableStateFlow(false)
12     override val primaryBouncerShow = _primaryBouncerShow.asStateFlow()
13     private val _primaryBouncerShowingSoon = MutableStateFlow(false)
14     override val primaryBouncerShowingSoon = _primaryBouncerShowingSoon.asStateFlow()
15     private val _primaryBouncerStartingToHide = MutableStateFlow(false)
16     override val primaryBouncerStartingToHide = _primaryBouncerStartingToHide.asStateFlow()
17     private val _primaryBouncerDisappearAnimation = MutableStateFlow<Runnable?>(null)
18     override val primaryBouncerStartingDisappearAnimation =
19         _primaryBouncerDisappearAnimation.asStateFlow()
20     private val _primaryBouncerScrimmed = MutableStateFlow(false)
21     override val primaryBouncerScrimmed = _primaryBouncerScrimmed.asStateFlow()
22     private val _panelExpansionAmount = MutableStateFlow(KeyguardBouncerConstants.EXPANSION_HIDDEN)
23     override val panelExpansionAmount = _panelExpansionAmount.asStateFlow()
24     private val _keyguardPosition = MutableStateFlow<Float?>(null)
25     override val keyguardPosition = _keyguardPosition.asStateFlow()
26     private val _isBackButtonEnabled = MutableStateFlow<Boolean?>(null)
27     override val isBackButtonEnabled = _isBackButtonEnabled.asStateFlow()
28     private val _keyguardAuthenticated = MutableStateFlow<Boolean?>(null)
29     override val keyguardAuthenticated = _keyguardAuthenticated.asStateFlow()
30     private val _showMessage = MutableStateFlow<BouncerShowMessageModel?>(null)
31     override val showMessage = _showMessage.asStateFlow()
32     private val _resourceUpdateRequests = MutableStateFlow(false)
33     override val resourceUpdateRequests = _resourceUpdateRequests.asStateFlow()
34     private val _isAlternateBouncerVisible = MutableStateFlow(false)
35     override val alternateBouncerVisible = _isAlternateBouncerVisible.asStateFlow()
36     override var lastAlternateBouncerVisibleTime: Long = 0L
37     private val _isAlternateBouncerUIAvailable = MutableStateFlow<Boolean>(false)
38     override val alternateBouncerUIAvailable = _isAlternateBouncerUIAvailable.asStateFlow()
39     private val _sideFpsShowing: MutableStateFlow<Boolean> = MutableStateFlow(false)
40     override val sideFpsShowing: StateFlow<Boolean> = _sideFpsShowing.asStateFlow()
41 
setPrimaryScrimmednull42     override fun setPrimaryScrimmed(isScrimmed: Boolean) {
43         _primaryBouncerScrimmed.value = isScrimmed
44     }
45 
setAlternateVisiblenull46     override fun setAlternateVisible(isVisible: Boolean) {
47         _isAlternateBouncerVisible.value = isVisible
48     }
49 
setAlternateBouncerUIAvailablenull50     override fun setAlternateBouncerUIAvailable(isAvailable: Boolean) {
51         _isAlternateBouncerUIAvailable.value = isAvailable
52     }
53 
setPrimaryShownull54     override fun setPrimaryShow(isShowing: Boolean) {
55         _primaryBouncerShow.value = isShowing
56     }
57 
setPrimaryShowingSoonnull58     override fun setPrimaryShowingSoon(showingSoon: Boolean) {
59         _primaryBouncerShowingSoon.value = showingSoon
60     }
61 
setPrimaryStartingToHidenull62     override fun setPrimaryStartingToHide(startingToHide: Boolean) {
63         _primaryBouncerStartingToHide.value = startingToHide
64     }
65 
setPrimaryStartDisappearAnimationnull66     override fun setPrimaryStartDisappearAnimation(runnable: Runnable?) {
67         _primaryBouncerDisappearAnimation.value = runnable
68     }
69 
setPanelExpansionnull70     override fun setPanelExpansion(panelExpansion: Float) {
71         _panelExpansionAmount.value = panelExpansion
72     }
73 
setKeyguardPositionnull74     override fun setKeyguardPosition(keyguardPosition: Float) {
75         _keyguardPosition.value = keyguardPosition
76     }
77 
setResourceUpdateRequestsnull78     override fun setResourceUpdateRequests(willUpdateResources: Boolean) {
79         _resourceUpdateRequests.value = willUpdateResources
80     }
81 
setShowMessagenull82     override fun setShowMessage(bouncerShowMessageModel: BouncerShowMessageModel?) {
83         _showMessage.value = bouncerShowMessageModel
84     }
85 
setKeyguardAuthenticatednull86     override fun setKeyguardAuthenticated(keyguardAuthenticated: Boolean?) {
87         _keyguardAuthenticated.value = keyguardAuthenticated
88     }
89 
setIsBackButtonEnablednull90     override fun setIsBackButtonEnabled(isBackButtonEnabled: Boolean) {
91         _isBackButtonEnabled.value = isBackButtonEnabled
92     }
93 
setSideFpsShowingnull94     override fun setSideFpsShowing(isShowing: Boolean) {
95         _sideFpsShowing.value = isShowing
96     }
97 }
98