Merge "Remove visibility and show race condition." into tm-qpr-dev am: c1ed09a399
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21915461 Change-Id: I740e93a4942cd33c78319b7883abb1295988b342 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -55,4 +55,5 @@ interface BouncerViewDelegate {
|
|||||||
fun willRunDismissFromKeyguard(): Boolean
|
fun willRunDismissFromKeyguard(): Boolean
|
||||||
/** @return the {@link OnBackAnimationCallback} to animate Bouncer during a back gesture. */
|
/** @return the {@link OnBackAnimationCallback} to animate Bouncer during a back gesture. */
|
||||||
fun getBackCallback(): OnBackAnimationCallback
|
fun getBackCallback(): OnBackAnimationCallback
|
||||||
|
fun showPromptReason(reason: Int)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.android.systemui.dagger.SysUISingleton
|
|||||||
import com.android.systemui.dagger.qualifiers.Application
|
import com.android.systemui.dagger.qualifiers.Application
|
||||||
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN
|
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN
|
||||||
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
|
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
|
||||||
import com.android.systemui.keyguard.shared.model.KeyguardBouncerModel
|
|
||||||
import com.android.systemui.log.dagger.BouncerLog
|
import com.android.systemui.log.dagger.BouncerLog
|
||||||
import com.android.systemui.log.table.TableLogBuffer
|
import com.android.systemui.log.table.TableLogBuffer
|
||||||
import com.android.systemui.log.table.logDiffsForTable
|
import com.android.systemui.log.table.logDiffsForTable
|
||||||
@@ -43,10 +42,8 @@ import kotlinx.coroutines.flow.map
|
|||||||
*/
|
*/
|
||||||
interface KeyguardBouncerRepository {
|
interface KeyguardBouncerRepository {
|
||||||
/** Values associated with the PrimaryBouncer (pin/pattern/password) input. */
|
/** Values associated with the PrimaryBouncer (pin/pattern/password) input. */
|
||||||
val primaryBouncerVisible: StateFlow<Boolean>
|
val primaryBouncerShow: StateFlow<Boolean>
|
||||||
val primaryBouncerShow: StateFlow<KeyguardBouncerModel?>
|
|
||||||
val primaryBouncerShowingSoon: StateFlow<Boolean>
|
val primaryBouncerShowingSoon: StateFlow<Boolean>
|
||||||
val primaryBouncerHide: StateFlow<Boolean>
|
|
||||||
val primaryBouncerStartingToHide: StateFlow<Boolean>
|
val primaryBouncerStartingToHide: StateFlow<Boolean>
|
||||||
val primaryBouncerStartingDisappearAnimation: StateFlow<Runnable?>
|
val primaryBouncerStartingDisappearAnimation: StateFlow<Runnable?>
|
||||||
/** Determines if we want to instantaneously show the primary bouncer instead of translating. */
|
/** Determines if we want to instantaneously show the primary bouncer instead of translating. */
|
||||||
@@ -76,14 +73,10 @@ interface KeyguardBouncerRepository {
|
|||||||
|
|
||||||
fun setPrimaryScrimmed(isScrimmed: Boolean)
|
fun setPrimaryScrimmed(isScrimmed: Boolean)
|
||||||
|
|
||||||
fun setPrimaryVisible(isVisible: Boolean)
|
fun setPrimaryShow(isShowing: Boolean)
|
||||||
|
|
||||||
fun setPrimaryShow(keyguardBouncerModel: KeyguardBouncerModel?)
|
|
||||||
|
|
||||||
fun setPrimaryShowingSoon(showingSoon: Boolean)
|
fun setPrimaryShowingSoon(showingSoon: Boolean)
|
||||||
|
|
||||||
fun setPrimaryHide(hide: Boolean)
|
|
||||||
|
|
||||||
fun setPrimaryStartingToHide(startingToHide: Boolean)
|
fun setPrimaryStartingToHide(startingToHide: Boolean)
|
||||||
|
|
||||||
fun setPrimaryStartDisappearAnimation(runnable: Runnable?)
|
fun setPrimaryStartDisappearAnimation(runnable: Runnable?)
|
||||||
@@ -117,14 +110,10 @@ constructor(
|
|||||||
@BouncerLog private val buffer: TableLogBuffer,
|
@BouncerLog private val buffer: TableLogBuffer,
|
||||||
) : KeyguardBouncerRepository {
|
) : KeyguardBouncerRepository {
|
||||||
/** Values associated with the PrimaryBouncer (pin/pattern/password) input. */
|
/** Values associated with the PrimaryBouncer (pin/pattern/password) input. */
|
||||||
private val _primaryBouncerVisible = MutableStateFlow(false)
|
private val _primaryBouncerShow = MutableStateFlow(false)
|
||||||
override val primaryBouncerVisible = _primaryBouncerVisible.asStateFlow()
|
|
||||||
private val _primaryBouncerShow = MutableStateFlow<KeyguardBouncerModel?>(null)
|
|
||||||
override val primaryBouncerShow = _primaryBouncerShow.asStateFlow()
|
override val primaryBouncerShow = _primaryBouncerShow.asStateFlow()
|
||||||
private val _primaryBouncerShowingSoon = MutableStateFlow(false)
|
private val _primaryBouncerShowingSoon = MutableStateFlow(false)
|
||||||
override val primaryBouncerShowingSoon = _primaryBouncerShowingSoon.asStateFlow()
|
override val primaryBouncerShowingSoon = _primaryBouncerShowingSoon.asStateFlow()
|
||||||
private val _primaryBouncerHide = MutableStateFlow(false)
|
|
||||||
override val primaryBouncerHide = _primaryBouncerHide.asStateFlow()
|
|
||||||
private val _primaryBouncerStartingToHide = MutableStateFlow(false)
|
private val _primaryBouncerStartingToHide = MutableStateFlow(false)
|
||||||
override val primaryBouncerStartingToHide = _primaryBouncerStartingToHide.asStateFlow()
|
override val primaryBouncerStartingToHide = _primaryBouncerStartingToHide.asStateFlow()
|
||||||
private val _primaryBouncerDisappearAnimation = MutableStateFlow<Runnable?>(null)
|
private val _primaryBouncerDisappearAnimation = MutableStateFlow<Runnable?>(null)
|
||||||
@@ -177,10 +166,6 @@ constructor(
|
|||||||
_primaryBouncerScrimmed.value = isScrimmed
|
_primaryBouncerScrimmed.value = isScrimmed
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPrimaryVisible(isVisible: Boolean) {
|
|
||||||
_primaryBouncerVisible.value = isVisible
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setAlternateVisible(isVisible: Boolean) {
|
override fun setAlternateVisible(isVisible: Boolean) {
|
||||||
if (isVisible && !_alternateBouncerVisible.value) {
|
if (isVisible && !_alternateBouncerVisible.value) {
|
||||||
lastAlternateBouncerVisibleTime = clock.uptimeMillis()
|
lastAlternateBouncerVisibleTime = clock.uptimeMillis()
|
||||||
@@ -194,18 +179,14 @@ constructor(
|
|||||||
_alternateBouncerUIAvailable.value = isAvailable
|
_alternateBouncerUIAvailable.value = isAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPrimaryShow(keyguardBouncerModel: KeyguardBouncerModel?) {
|
override fun setPrimaryShow(isShowing: Boolean) {
|
||||||
_primaryBouncerShow.value = keyguardBouncerModel
|
_primaryBouncerShow.value = isShowing
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPrimaryShowingSoon(showingSoon: Boolean) {
|
override fun setPrimaryShowingSoon(showingSoon: Boolean) {
|
||||||
_primaryBouncerShowingSoon.value = showingSoon
|
_primaryBouncerShowingSoon.value = showingSoon
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPrimaryHide(hide: Boolean) {
|
|
||||||
_primaryBouncerHide.value = hide
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setPrimaryStartingToHide(startingToHide: Boolean) {
|
override fun setPrimaryStartingToHide(startingToHide: Boolean) {
|
||||||
_primaryBouncerStartingToHide.value = startingToHide
|
_primaryBouncerStartingToHide.value = startingToHide
|
||||||
}
|
}
|
||||||
@@ -248,19 +229,12 @@ constructor(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
primaryBouncerVisible
|
|
||||||
.logDiffsForTable(buffer, "", "PrimaryBouncerVisible", false)
|
|
||||||
.launchIn(applicationScope)
|
|
||||||
primaryBouncerShow
|
primaryBouncerShow
|
||||||
.map { it != null }
|
|
||||||
.logDiffsForTable(buffer, "", "PrimaryBouncerShow", false)
|
.logDiffsForTable(buffer, "", "PrimaryBouncerShow", false)
|
||||||
.launchIn(applicationScope)
|
.launchIn(applicationScope)
|
||||||
primaryBouncerShowingSoon
|
primaryBouncerShowingSoon
|
||||||
.logDiffsForTable(buffer, "", "PrimaryBouncerShowingSoon", false)
|
.logDiffsForTable(buffer, "", "PrimaryBouncerShowingSoon", false)
|
||||||
.launchIn(applicationScope)
|
.launchIn(applicationScope)
|
||||||
primaryBouncerHide
|
|
||||||
.logDiffsForTable(buffer, "", "PrimaryBouncerHide", false)
|
|
||||||
.launchIn(applicationScope)
|
|
||||||
primaryBouncerStartingToHide
|
primaryBouncerStartingToHide
|
||||||
.logDiffsForTable(buffer, "", "PrimaryBouncerStartingToHide", false)
|
.logDiffsForTable(buffer, "", "PrimaryBouncerStartingToHide", false)
|
||||||
.launchIn(applicationScope)
|
.launchIn(applicationScope)
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ constructor(
|
|||||||
/** Whether the keyguard is going away. */
|
/** Whether the keyguard is going away. */
|
||||||
val isKeyguardGoingAway: Flow<Boolean> = repository.isKeyguardGoingAway
|
val isKeyguardGoingAway: Flow<Boolean> = repository.isKeyguardGoingAway
|
||||||
/** Whether the primary bouncer is showing or not. */
|
/** Whether the primary bouncer is showing or not. */
|
||||||
val primaryBouncerShowing: Flow<Boolean> = bouncerRepository.primaryBouncerVisible
|
val primaryBouncerShowing: Flow<Boolean> = bouncerRepository.primaryBouncerShow
|
||||||
/** Whether the alternate bouncer is showing or not. */
|
/** Whether the alternate bouncer is showing or not. */
|
||||||
val alternateBouncerShowing: Flow<Boolean> = bouncerRepository.alternateBouncerVisible
|
val alternateBouncerShowing: Flow<Boolean> = bouncerRepository.alternateBouncerVisible
|
||||||
/** Observable for the [StatusBarState] */
|
/** Observable for the [StatusBarState] */
|
||||||
@@ -159,7 +159,7 @@ constructor(
|
|||||||
if (featureFlags.isEnabled(Flags.FACE_AUTH_REFACTOR)) {
|
if (featureFlags.isEnabled(Flags.FACE_AUTH_REFACTOR)) {
|
||||||
combine(
|
combine(
|
||||||
isKeyguardVisible,
|
isKeyguardVisible,
|
||||||
bouncerRepository.primaryBouncerVisible,
|
primaryBouncerShowing,
|
||||||
onCameraLaunchDetected,
|
onCameraLaunchDetected,
|
||||||
) { isKeyguardVisible, isPrimaryBouncerShowing, cameraLaunchEvent ->
|
) { isKeyguardVisible, isPrimaryBouncerShowing, cameraLaunchEvent ->
|
||||||
when {
|
when {
|
||||||
|
|||||||
@@ -23,12 +23,13 @@ import android.os.Handler
|
|||||||
import android.os.Trace
|
import android.os.Trace
|
||||||
import android.os.UserHandle
|
import android.os.UserHandle
|
||||||
import android.os.UserManager
|
import android.os.UserManager
|
||||||
import android.view.View
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import android.view.View
|
||||||
import com.android.keyguard.KeyguardConstants
|
import com.android.keyguard.KeyguardConstants
|
||||||
import com.android.keyguard.KeyguardSecurityModel
|
import com.android.keyguard.KeyguardSecurityModel
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor
|
import com.android.keyguard.KeyguardUpdateMonitor
|
||||||
import com.android.keyguard.KeyguardUpdateMonitorCallback
|
import com.android.keyguard.KeyguardUpdateMonitorCallback
|
||||||
|
import com.android.settingslib.Utils
|
||||||
import com.android.systemui.DejankUtils
|
import com.android.systemui.DejankUtils
|
||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
import com.android.systemui.classifier.FalsingCollector
|
import com.android.systemui.classifier.FalsingCollector
|
||||||
@@ -39,7 +40,6 @@ import com.android.systemui.keyguard.data.BouncerView
|
|||||||
import com.android.systemui.keyguard.data.repository.KeyguardBouncerRepository
|
import com.android.systemui.keyguard.data.repository.KeyguardBouncerRepository
|
||||||
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants
|
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants
|
||||||
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
|
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
|
||||||
import com.android.systemui.keyguard.shared.model.KeyguardBouncerModel
|
|
||||||
import com.android.systemui.plugins.ActivityStarter
|
import com.android.systemui.plugins.ActivityStarter
|
||||||
import com.android.systemui.shared.system.SysUiStatsLog
|
import com.android.systemui.shared.system.SysUiStatsLog
|
||||||
import com.android.systemui.statusbar.phone.KeyguardBypassController
|
import com.android.systemui.statusbar.phone.KeyguardBypassController
|
||||||
@@ -83,23 +83,21 @@ constructor(
|
|||||||
|
|
||||||
/** Runnable to show the primary bouncer. */
|
/** Runnable to show the primary bouncer. */
|
||||||
val showRunnable = Runnable {
|
val showRunnable = Runnable {
|
||||||
repository.setPrimaryVisible(true)
|
repository.setPrimaryShow(true)
|
||||||
repository.setPrimaryShow(
|
primaryBouncerView.delegate?.showPromptReason(repository.bouncerPromptReason)
|
||||||
KeyguardBouncerModel(
|
(repository.bouncerErrorMessage as? String)?.let {
|
||||||
promptReason = repository.bouncerPromptReason ?: 0,
|
repository.setShowMessage(
|
||||||
errorMessage = repository.bouncerErrorMessage,
|
BouncerShowMessageModel(message = it, Utils.getColorError(context))
|
||||||
expansionAmount = repository.panelExpansionAmount.value
|
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
repository.setPrimaryShowingSoon(false)
|
repository.setPrimaryShowingSoon(false)
|
||||||
primaryBouncerCallbackInteractor.dispatchVisibilityChanged(View.VISIBLE)
|
primaryBouncerCallbackInteractor.dispatchVisibilityChanged(View.VISIBLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
val keyguardAuthenticated: Flow<Boolean> = repository.keyguardAuthenticated.filterNotNull()
|
val keyguardAuthenticated: Flow<Boolean> = repository.keyguardAuthenticated.filterNotNull()
|
||||||
val show: Flow<KeyguardBouncerModel> = repository.primaryBouncerShow.filterNotNull()
|
val show: Flow<Unit> = repository.primaryBouncerShow.filter { it }.map {}
|
||||||
val hide: Flow<Unit> = repository.primaryBouncerHide.filter { it }.map {}
|
val hide: Flow<Unit> = repository.primaryBouncerShow.filter { !it }.map {}
|
||||||
val startingToHide: Flow<Unit> = repository.primaryBouncerStartingToHide.filter { it }.map {}
|
val startingToHide: Flow<Unit> = repository.primaryBouncerStartingToHide.filter { it }.map {}
|
||||||
val isVisible: Flow<Boolean> = repository.primaryBouncerVisible
|
|
||||||
val isBackButtonEnabled: Flow<Boolean> = repository.isBackButtonEnabled.filterNotNull()
|
val isBackButtonEnabled: Flow<Boolean> = repository.isBackButtonEnabled.filterNotNull()
|
||||||
val showMessage: Flow<BouncerShowMessageModel> = repository.showMessage.filterNotNull()
|
val showMessage: Flow<BouncerShowMessageModel> = repository.showMessage.filterNotNull()
|
||||||
val startingDisappearAnimation: Flow<Runnable> =
|
val startingDisappearAnimation: Flow<Runnable> =
|
||||||
@@ -109,10 +107,11 @@ constructor(
|
|||||||
val panelExpansionAmount: Flow<Float> = repository.panelExpansionAmount
|
val panelExpansionAmount: Flow<Float> = repository.panelExpansionAmount
|
||||||
/** 0f = bouncer fully hidden. 1f = bouncer fully visible. */
|
/** 0f = bouncer fully hidden. 1f = bouncer fully visible. */
|
||||||
val bouncerExpansion: Flow<Float> =
|
val bouncerExpansion: Flow<Float> =
|
||||||
combine(repository.panelExpansionAmount, repository.primaryBouncerVisible) {
|
combine(
|
||||||
panelExpansion,
|
repository.panelExpansionAmount,
|
||||||
primaryBouncerVisible ->
|
repository.primaryBouncerShow
|
||||||
if (primaryBouncerVisible) {
|
) { panelExpansion, primaryBouncerIsShowing ->
|
||||||
|
if (primaryBouncerIsShowing) {
|
||||||
1f - panelExpansion
|
1f - panelExpansion
|
||||||
} else {
|
} else {
|
||||||
0f
|
0f
|
||||||
@@ -122,21 +121,20 @@ constructor(
|
|||||||
val isInteractable: Flow<Boolean> = bouncerExpansion.map { it > 0.9 }
|
val isInteractable: Flow<Boolean> = bouncerExpansion.map { it > 0.9 }
|
||||||
val sideFpsShowing: Flow<Boolean> = repository.sideFpsShowing
|
val sideFpsShowing: Flow<Boolean> = repository.sideFpsShowing
|
||||||
|
|
||||||
/**
|
/** This callback needs to be a class field so it does not get garbage collected. */
|
||||||
* This callback needs to be a class field so it does not get garbage collected.
|
val keyguardUpdateMonitorCallback =
|
||||||
*/
|
object : KeyguardUpdateMonitorCallback() {
|
||||||
val keyguardUpdateMonitorCallback = object : KeyguardUpdateMonitorCallback() {
|
override fun onBiometricRunningStateChanged(
|
||||||
override fun onBiometricRunningStateChanged(
|
running: Boolean,
|
||||||
running: Boolean,
|
biometricSourceType: BiometricSourceType?
|
||||||
biometricSourceType: BiometricSourceType?
|
) {
|
||||||
) {
|
updateSideFpsVisibility()
|
||||||
updateSideFpsVisibility()
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStrongAuthStateChanged(userId: Int) {
|
override fun onStrongAuthStateChanged(userId: Int) {
|
||||||
updateSideFpsVisibility()
|
updateSideFpsVisibility()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
keyguardUpdateMonitor.registerCallback(keyguardUpdateMonitorCallback)
|
keyguardUpdateMonitor.registerCallback(keyguardUpdateMonitorCallback)
|
||||||
@@ -149,14 +147,13 @@ constructor(
|
|||||||
fun show(isScrimmed: Boolean) {
|
fun show(isScrimmed: Boolean) {
|
||||||
// Reset some states as we show the bouncer.
|
// Reset some states as we show the bouncer.
|
||||||
repository.setKeyguardAuthenticated(null)
|
repository.setKeyguardAuthenticated(null)
|
||||||
repository.setPrimaryHide(false)
|
|
||||||
repository.setPrimaryStartingToHide(false)
|
repository.setPrimaryStartingToHide(false)
|
||||||
|
|
||||||
val resumeBouncer =
|
val resumeBouncer =
|
||||||
(repository.primaryBouncerVisible.value ||
|
(isBouncerShowing() || repository.primaryBouncerShowingSoon.value) &&
|
||||||
repository.primaryBouncerShowingSoon.value) && needsFullscreenBouncer()
|
needsFullscreenBouncer()
|
||||||
|
|
||||||
if (!resumeBouncer && repository.primaryBouncerShow.value != null) {
|
if (!resumeBouncer && isBouncerShowing()) {
|
||||||
// If bouncer is visible, the bouncer is already showing.
|
// If bouncer is visible, the bouncer is already showing.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -209,9 +206,7 @@ constructor(
|
|||||||
keyguardStateController.notifyPrimaryBouncerShowing(false /* showing */)
|
keyguardStateController.notifyPrimaryBouncerShowing(false /* showing */)
|
||||||
cancelShowRunnable()
|
cancelShowRunnable()
|
||||||
repository.setPrimaryShowingSoon(false)
|
repository.setPrimaryShowingSoon(false)
|
||||||
repository.setPrimaryVisible(false)
|
repository.setPrimaryShow(false)
|
||||||
repository.setPrimaryHide(true)
|
|
||||||
repository.setPrimaryShow(null)
|
|
||||||
primaryBouncerCallbackInteractor.dispatchVisibilityChanged(View.INVISIBLE)
|
primaryBouncerCallbackInteractor.dispatchVisibilityChanged(View.INVISIBLE)
|
||||||
Trace.endSection()
|
Trace.endSection()
|
||||||
}
|
}
|
||||||
@@ -328,9 +323,8 @@ constructor(
|
|||||||
val fpsDetectionRunning: Boolean = keyguardUpdateMonitor.isFingerprintDetectionRunning
|
val fpsDetectionRunning: Boolean = keyguardUpdateMonitor.isFingerprintDetectionRunning
|
||||||
val isUnlockingWithFpAllowed: Boolean =
|
val isUnlockingWithFpAllowed: Boolean =
|
||||||
keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed
|
keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed
|
||||||
val bouncerVisible = repository.primaryBouncerVisible.value
|
|
||||||
val toShow =
|
val toShow =
|
||||||
(repository.primaryBouncerVisible.value &&
|
(isBouncerShowing() &&
|
||||||
sfpsEnabled &&
|
sfpsEnabled &&
|
||||||
fpsDetectionRunning &&
|
fpsDetectionRunning &&
|
||||||
isUnlockingWithFpAllowed &&
|
isUnlockingWithFpAllowed &&
|
||||||
@@ -340,7 +334,7 @@ constructor(
|
|||||||
Log.d(
|
Log.d(
|
||||||
TAG,
|
TAG,
|
||||||
("sideFpsToShow=$toShow\n" +
|
("sideFpsToShow=$toShow\n" +
|
||||||
"bouncerVisible=$bouncerVisible\n" +
|
"isBouncerShowing=${isBouncerShowing()}\n" +
|
||||||
"configEnabled=$sfpsEnabled\n" +
|
"configEnabled=$sfpsEnabled\n" +
|
||||||
"fpsDetectionRunning=$fpsDetectionRunning\n" +
|
"fpsDetectionRunning=$fpsDetectionRunning\n" +
|
||||||
"isUnlockingWithFpAllowed=$isUnlockingWithFpAllowed\n" +
|
"isUnlockingWithFpAllowed=$isUnlockingWithFpAllowed\n" +
|
||||||
@@ -352,8 +346,7 @@ constructor(
|
|||||||
|
|
||||||
/** Returns whether bouncer is fully showing. */
|
/** Returns whether bouncer is fully showing. */
|
||||||
fun isFullyShowing(): Boolean {
|
fun isFullyShowing(): Boolean {
|
||||||
return (repository.primaryBouncerShowingSoon.value ||
|
return (repository.primaryBouncerShowingSoon.value || isBouncerShowing()) &&
|
||||||
repository.primaryBouncerVisible.value) &&
|
|
||||||
repository.panelExpansionAmount.value == KeyguardBouncerConstants.EXPANSION_VISIBLE &&
|
repository.panelExpansionAmount.value == KeyguardBouncerConstants.EXPANSION_VISIBLE &&
|
||||||
repository.primaryBouncerStartingDisappearAnimation.value == null
|
repository.primaryBouncerStartingDisappearAnimation.value == null
|
||||||
}
|
}
|
||||||
@@ -399,6 +392,10 @@ constructor(
|
|||||||
mainHandler.removeCallbacks(showRunnable)
|
mainHandler.removeCallbacks(showRunnable)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun isBouncerShowing(): Boolean {
|
||||||
|
return repository.primaryBouncerShow.value
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "PrimaryBouncerInteractor"
|
private const val TAG = "PrimaryBouncerInteractor"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.android.systemui.keyguard.shared.model
|
|
||||||
|
|
||||||
/** Models the state of the lock-screen bouncer */
|
|
||||||
data class KeyguardBouncerModel(
|
|
||||||
val promptReason: Int = 0,
|
|
||||||
val errorMessage: CharSequence? = null,
|
|
||||||
val expansionAmount: Float = 0f,
|
|
||||||
)
|
|
||||||
@@ -27,7 +27,6 @@ import com.android.keyguard.KeyguardSecurityModel
|
|||||||
import com.android.keyguard.KeyguardSecurityView
|
import com.android.keyguard.KeyguardSecurityView
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor
|
import com.android.keyguard.KeyguardUpdateMonitor
|
||||||
import com.android.keyguard.dagger.KeyguardBouncerComponent
|
import com.android.keyguard.dagger.KeyguardBouncerComponent
|
||||||
import com.android.settingslib.Utils
|
|
||||||
import com.android.systemui.keyguard.data.BouncerViewDelegate
|
import com.android.systemui.keyguard.data.BouncerViewDelegate
|
||||||
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_VISIBLE
|
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_VISIBLE
|
||||||
import com.android.systemui.keyguard.ui.viewmodel.KeyguardBouncerViewModel
|
import com.android.systemui.keyguard.ui.viewmodel.KeyguardBouncerViewModel
|
||||||
@@ -101,6 +100,10 @@ object KeyguardBouncerViewBinder {
|
|||||||
override fun willRunDismissFromKeyguard(): Boolean {
|
override fun willRunDismissFromKeyguard(): Boolean {
|
||||||
return securityContainerController.willRunDismissFromKeyguard()
|
return securityContainerController.willRunDismissFromKeyguard()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun showPromptReason(reason: Int) {
|
||||||
|
securityContainerController.showPromptReason(reason)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
view.repeatWhenAttached {
|
view.repeatWhenAttached {
|
||||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
@@ -109,14 +112,11 @@ object KeyguardBouncerViewBinder {
|
|||||||
launch {
|
launch {
|
||||||
viewModel.show.collect {
|
viewModel.show.collect {
|
||||||
// Reset Security Container entirely.
|
// Reset Security Container entirely.
|
||||||
|
view.visibility = View.VISIBLE
|
||||||
|
securityContainerController.onBouncerVisibilityChanged(
|
||||||
|
/* isVisible= */ true
|
||||||
|
)
|
||||||
securityContainerController.reinflateViewFlipper()
|
securityContainerController.reinflateViewFlipper()
|
||||||
securityContainerController.showPromptReason(it.promptReason)
|
|
||||||
it.errorMessage?.let { errorMessage ->
|
|
||||||
securityContainerController.showMessage(
|
|
||||||
errorMessage,
|
|
||||||
Utils.getColorError(view.context)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
securityContainerController.showPrimarySecurityScreen(
|
securityContainerController.showPrimarySecurityScreen(
|
||||||
/* turningOff= */ false
|
/* turningOff= */ false
|
||||||
)
|
)
|
||||||
@@ -127,8 +127,13 @@ object KeyguardBouncerViewBinder {
|
|||||||
|
|
||||||
launch {
|
launch {
|
||||||
viewModel.hide.collect {
|
viewModel.hide.collect {
|
||||||
|
view.visibility = View.INVISIBLE
|
||||||
|
securityContainerController.onBouncerVisibilityChanged(
|
||||||
|
/* isVisible= */ false
|
||||||
|
)
|
||||||
securityContainerController.cancelDismissAction()
|
securityContainerController.cancelDismissAction()
|
||||||
securityContainerController.reset()
|
securityContainerController.reset()
|
||||||
|
securityContainerController.onPause()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,19 +170,6 @@ object KeyguardBouncerViewBinder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
launch {
|
|
||||||
viewModel.isBouncerVisible.collect { isVisible ->
|
|
||||||
view.visibility = if (isVisible) View.VISIBLE else View.INVISIBLE
|
|
||||||
securityContainerController.onBouncerVisibilityChanged(isVisible)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
launch {
|
|
||||||
viewModel.isBouncerVisible
|
|
||||||
.filter { !it }
|
|
||||||
.collect { securityContainerController.onPause() }
|
|
||||||
}
|
|
||||||
|
|
||||||
launch {
|
launch {
|
||||||
viewModel.isInteractable.collect { isInteractable ->
|
viewModel.isInteractable.collect { isInteractable ->
|
||||||
securityContainerController.setInteractable(isInteractable)
|
securityContainerController.setInteractable(isInteractable)
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import com.android.systemui.keyguard.data.BouncerView
|
|||||||
import com.android.systemui.keyguard.data.BouncerViewDelegate
|
import com.android.systemui.keyguard.data.BouncerViewDelegate
|
||||||
import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor
|
import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor
|
||||||
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
|
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
|
||||||
import com.android.systemui.keyguard.shared.model.KeyguardBouncerModel
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.filterNotNull
|
import kotlinx.coroutines.flow.filterNotNull
|
||||||
@@ -38,14 +37,11 @@ constructor(
|
|||||||
/** Observe on bouncer expansion amount. */
|
/** Observe on bouncer expansion amount. */
|
||||||
val bouncerExpansionAmount: Flow<Float> = interactor.panelExpansionAmount
|
val bouncerExpansionAmount: Flow<Float> = interactor.panelExpansionAmount
|
||||||
|
|
||||||
/** Observe on bouncer visibility. */
|
|
||||||
val isBouncerVisible: Flow<Boolean> = interactor.isVisible
|
|
||||||
|
|
||||||
/** Can the user interact with the view? */
|
/** Can the user interact with the view? */
|
||||||
val isInteractable: Flow<Boolean> = interactor.isInteractable
|
val isInteractable: Flow<Boolean> = interactor.isInteractable
|
||||||
|
|
||||||
/** Observe whether bouncer is showing. */
|
/** Observe whether bouncer is showing. */
|
||||||
val show: Flow<KeyguardBouncerModel> = interactor.show
|
val show: Flow<Unit> = interactor.show
|
||||||
|
|
||||||
/** Observe whether bouncer is hiding. */
|
/** Observe whether bouncer is hiding. */
|
||||||
val hide: Flow<Unit> = interactor.hide
|
val hide: Flow<Unit> = interactor.hide
|
||||||
@@ -75,7 +71,7 @@ constructor(
|
|||||||
val shouldUpdateSideFps: Flow<Unit> =
|
val shouldUpdateSideFps: Flow<Unit> =
|
||||||
merge(
|
merge(
|
||||||
interactor.startingToHide,
|
interactor.startingToHide,
|
||||||
interactor.isVisible.map {},
|
interactor.show,
|
||||||
interactor.startingDisappearAnimation.filterNotNull().map {}
|
interactor.startingDisappearAnimation.filterNotNull().map {}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class UdfpsKeyguardViewControllerWithCoroutinesTest : UdfpsKeyguardViewControlle
|
|||||||
|
|
||||||
// WHEN the bouncer expansion is VISIBLE
|
// WHEN the bouncer expansion is VISIBLE
|
||||||
val job = mController.listenForBouncerExpansion(this)
|
val job = mController.listenForBouncerExpansion(this)
|
||||||
keyguardBouncerRepository.setPrimaryVisible(true)
|
keyguardBouncerRepository.setPrimaryShow(true)
|
||||||
keyguardBouncerRepository.setPanelExpansion(KeyguardBouncerConstants.EXPANSION_VISIBLE)
|
keyguardBouncerRepository.setPanelExpansion(KeyguardBouncerConstants.EXPANSION_VISIBLE)
|
||||||
yield()
|
yield()
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class KeyguardBouncerRepositoryTest : SysuiTestCase() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun changingFlowValueTriggersLogging() = runBlocking {
|
fun changingFlowValueTriggersLogging() = runBlocking {
|
||||||
underTest.setPrimaryHide(true)
|
underTest.setPrimaryShow(true)
|
||||||
verify(bouncerLogger).logChange("", "PrimaryBouncerHide", false)
|
verify(bouncerLogger).logChange("", "PrimaryBouncerShow", false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class KeyguardInteractorTest : SysuiTestCase() {
|
|||||||
repository.setKeyguardOccluded(true)
|
repository.setKeyguardOccluded(true)
|
||||||
assertThat(secureCameraActive()).isTrue()
|
assertThat(secureCameraActive()).isTrue()
|
||||||
|
|
||||||
bouncerRepository.setPrimaryVisible(true)
|
bouncerRepository.setPrimaryShow(true)
|
||||||
assertThat(secureCameraActive()).isFalse()
|
assertThat(secureCameraActive()).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
runCurrent()
|
runCurrent()
|
||||||
|
|
||||||
// WHEN the primary bouncer is set to show
|
// WHEN the primary bouncer is set to show
|
||||||
bouncerRepository.setPrimaryVisible(true)
|
bouncerRepository.setPrimaryShow(true)
|
||||||
runCurrent()
|
runCurrent()
|
||||||
|
|
||||||
val info =
|
val info =
|
||||||
@@ -741,7 +741,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
reset(mockTransitionRepository)
|
reset(mockTransitionRepository)
|
||||||
|
|
||||||
// WHEN the alternateBouncer stops showing and then the primary bouncer shows
|
// WHEN the alternateBouncer stops showing and then the primary bouncer shows
|
||||||
bouncerRepository.setPrimaryVisible(true)
|
bouncerRepository.setPrimaryShow(true)
|
||||||
runCurrent()
|
runCurrent()
|
||||||
|
|
||||||
val info =
|
val info =
|
||||||
@@ -779,7 +779,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
reset(mockTransitionRepository)
|
reset(mockTransitionRepository)
|
||||||
|
|
||||||
// GIVEN the primary bouncer isn't showing, aod available and starting to sleep
|
// GIVEN the primary bouncer isn't showing, aod available and starting to sleep
|
||||||
bouncerRepository.setPrimaryVisible(false)
|
bouncerRepository.setPrimaryShow(false)
|
||||||
keyguardRepository.setAodAvailable(true)
|
keyguardRepository.setAodAvailable(true)
|
||||||
keyguardRepository.setWakefulnessModel(startingToSleep())
|
keyguardRepository.setWakefulnessModel(startingToSleep())
|
||||||
|
|
||||||
@@ -823,7 +823,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
|
|
||||||
// GIVEN the primary bouncer isn't showing, aod not available and starting to sleep
|
// GIVEN the primary bouncer isn't showing, aod not available and starting to sleep
|
||||||
// to sleep
|
// to sleep
|
||||||
bouncerRepository.setPrimaryVisible(false)
|
bouncerRepository.setPrimaryShow(false)
|
||||||
keyguardRepository.setAodAvailable(false)
|
keyguardRepository.setAodAvailable(false)
|
||||||
keyguardRepository.setWakefulnessModel(startingToSleep())
|
keyguardRepository.setWakefulnessModel(startingToSleep())
|
||||||
|
|
||||||
@@ -866,7 +866,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
reset(mockTransitionRepository)
|
reset(mockTransitionRepository)
|
||||||
|
|
||||||
// GIVEN the primary bouncer isn't showing and device not sleeping
|
// GIVEN the primary bouncer isn't showing and device not sleeping
|
||||||
bouncerRepository.setPrimaryVisible(false)
|
bouncerRepository.setPrimaryShow(false)
|
||||||
keyguardRepository.setWakefulnessModel(startingToWake())
|
keyguardRepository.setWakefulnessModel(startingToWake())
|
||||||
|
|
||||||
// WHEN the alternateBouncer stops showing
|
// WHEN the alternateBouncer stops showing
|
||||||
@@ -890,7 +890,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
fun `PRIMARY_BOUNCER to AOD`() =
|
fun `PRIMARY_BOUNCER to AOD`() =
|
||||||
testScope.runTest {
|
testScope.runTest {
|
||||||
// GIVEN a prior transition has run to PRIMARY_BOUNCER
|
// GIVEN a prior transition has run to PRIMARY_BOUNCER
|
||||||
bouncerRepository.setPrimaryVisible(true)
|
bouncerRepository.setPrimaryShow(true)
|
||||||
runner.startTransition(
|
runner.startTransition(
|
||||||
testScope,
|
testScope,
|
||||||
TransitionInfo(
|
TransitionInfo(
|
||||||
@@ -912,7 +912,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
keyguardRepository.setWakefulnessModel(startingToSleep())
|
keyguardRepository.setWakefulnessModel(startingToSleep())
|
||||||
|
|
||||||
// WHEN the primaryBouncer stops showing
|
// WHEN the primaryBouncer stops showing
|
||||||
bouncerRepository.setPrimaryVisible(false)
|
bouncerRepository.setPrimaryShow(false)
|
||||||
runCurrent()
|
runCurrent()
|
||||||
|
|
||||||
val info =
|
val info =
|
||||||
@@ -932,7 +932,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
fun `PRIMARY_BOUNCER to DOZING`() =
|
fun `PRIMARY_BOUNCER to DOZING`() =
|
||||||
testScope.runTest {
|
testScope.runTest {
|
||||||
// GIVEN a prior transition has run to PRIMARY_BOUNCER
|
// GIVEN a prior transition has run to PRIMARY_BOUNCER
|
||||||
bouncerRepository.setPrimaryVisible(true)
|
bouncerRepository.setPrimaryShow(true)
|
||||||
runner.startTransition(
|
runner.startTransition(
|
||||||
testScope,
|
testScope,
|
||||||
TransitionInfo(
|
TransitionInfo(
|
||||||
@@ -954,7 +954,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
keyguardRepository.setWakefulnessModel(startingToSleep())
|
keyguardRepository.setWakefulnessModel(startingToSleep())
|
||||||
|
|
||||||
// WHEN the primaryBouncer stops showing
|
// WHEN the primaryBouncer stops showing
|
||||||
bouncerRepository.setPrimaryVisible(false)
|
bouncerRepository.setPrimaryShow(false)
|
||||||
runCurrent()
|
runCurrent()
|
||||||
|
|
||||||
val info =
|
val info =
|
||||||
@@ -974,7 +974,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
fun `PRIMARY_BOUNCER to LOCKSCREEN`() =
|
fun `PRIMARY_BOUNCER to LOCKSCREEN`() =
|
||||||
testScope.runTest {
|
testScope.runTest {
|
||||||
// GIVEN a prior transition has run to PRIMARY_BOUNCER
|
// GIVEN a prior transition has run to PRIMARY_BOUNCER
|
||||||
bouncerRepository.setPrimaryVisible(true)
|
bouncerRepository.setPrimaryShow(true)
|
||||||
runner.startTransition(
|
runner.startTransition(
|
||||||
testScope,
|
testScope,
|
||||||
TransitionInfo(
|
TransitionInfo(
|
||||||
@@ -995,7 +995,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
keyguardRepository.setWakefulnessModel(startingToWake())
|
keyguardRepository.setWakefulnessModel(startingToWake())
|
||||||
|
|
||||||
// WHEN the alternateBouncer stops showing
|
// WHEN the alternateBouncer stops showing
|
||||||
bouncerRepository.setPrimaryVisible(false)
|
bouncerRepository.setPrimaryShow(false)
|
||||||
runCurrent()
|
runCurrent()
|
||||||
|
|
||||||
val info =
|
val info =
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import com.android.systemui.keyguard.data.repository.KeyguardBouncerRepository
|
|||||||
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN
|
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN
|
||||||
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_VISIBLE
|
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_VISIBLE
|
||||||
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
|
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
|
||||||
import com.android.systemui.keyguard.shared.model.KeyguardBouncerModel
|
|
||||||
import com.android.systemui.plugins.ActivityStarter
|
import com.android.systemui.plugins.ActivityStarter
|
||||||
import com.android.systemui.statusbar.phone.KeyguardBypassController
|
import com.android.systemui.statusbar.phone.KeyguardBypassController
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
@@ -92,7 +91,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
|
|||||||
keyguardBypassController,
|
keyguardBypassController,
|
||||||
)
|
)
|
||||||
`when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null)
|
`when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null)
|
||||||
`when`(repository.primaryBouncerShow.value).thenReturn(null)
|
`when`(repository.primaryBouncerShow.value).thenReturn(false)
|
||||||
`when`(bouncerView.delegate).thenReturn(bouncerViewDelegate)
|
`when`(bouncerView.delegate).thenReturn(bouncerViewDelegate)
|
||||||
resources = context.orCreateTestableResources
|
resources = context.orCreateTestableResources
|
||||||
}
|
}
|
||||||
@@ -101,15 +100,13 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
|
|||||||
fun testShow_isScrimmed() {
|
fun testShow_isScrimmed() {
|
||||||
underTest.show(true)
|
underTest.show(true)
|
||||||
verify(repository).setKeyguardAuthenticated(null)
|
verify(repository).setKeyguardAuthenticated(null)
|
||||||
verify(repository).setPrimaryHide(false)
|
|
||||||
verify(repository).setPrimaryStartingToHide(false)
|
verify(repository).setPrimaryStartingToHide(false)
|
||||||
verify(repository).setPrimaryScrimmed(true)
|
verify(repository).setPrimaryScrimmed(true)
|
||||||
verify(repository).setPanelExpansion(EXPANSION_VISIBLE)
|
verify(repository).setPanelExpansion(EXPANSION_VISIBLE)
|
||||||
verify(repository).setPrimaryShowingSoon(true)
|
verify(repository).setPrimaryShowingSoon(true)
|
||||||
verify(keyguardStateController).notifyPrimaryBouncerShowing(true)
|
verify(keyguardStateController).notifyPrimaryBouncerShowing(true)
|
||||||
verify(mPrimaryBouncerCallbackInteractor).dispatchStartingToShow()
|
verify(mPrimaryBouncerCallbackInteractor).dispatchStartingToShow()
|
||||||
verify(repository).setPrimaryVisible(true)
|
verify(repository).setPrimaryShow(true)
|
||||||
verify(repository).setPrimaryShow(any(KeyguardBouncerModel::class.java))
|
|
||||||
verify(repository).setPrimaryShowingSoon(false)
|
verify(repository).setPrimaryShowingSoon(false)
|
||||||
verify(mPrimaryBouncerCallbackInteractor).dispatchVisibilityChanged(View.VISIBLE)
|
verify(mPrimaryBouncerCallbackInteractor).dispatchVisibilityChanged(View.VISIBLE)
|
||||||
}
|
}
|
||||||
@@ -132,9 +129,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
|
|||||||
verify(falsingCollector).onBouncerHidden()
|
verify(falsingCollector).onBouncerHidden()
|
||||||
verify(keyguardStateController).notifyPrimaryBouncerShowing(false)
|
verify(keyguardStateController).notifyPrimaryBouncerShowing(false)
|
||||||
verify(repository).setPrimaryShowingSoon(false)
|
verify(repository).setPrimaryShowingSoon(false)
|
||||||
verify(repository).setPrimaryVisible(false)
|
verify(repository).setPrimaryShow(false)
|
||||||
verify(repository).setPrimaryHide(true)
|
|
||||||
verify(repository).setPrimaryShow(null)
|
|
||||||
verify(mPrimaryBouncerCallbackInteractor).dispatchVisibilityChanged(View.INVISIBLE)
|
verify(mPrimaryBouncerCallbackInteractor).dispatchVisibilityChanged(View.INVISIBLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,9 +155,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
|
|||||||
`when`(repository.panelExpansionAmount.value).thenReturn(0.5f)
|
`when`(repository.panelExpansionAmount.value).thenReturn(0.5f)
|
||||||
`when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null)
|
`when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null)
|
||||||
underTest.setPanelExpansion(EXPANSION_HIDDEN)
|
underTest.setPanelExpansion(EXPANSION_HIDDEN)
|
||||||
verify(repository).setPrimaryVisible(false)
|
verify(repository).setPrimaryShow(false)
|
||||||
verify(repository).setPrimaryShow(null)
|
|
||||||
verify(repository).setPrimaryHide(true)
|
|
||||||
verify(falsingCollector).onBouncerHidden()
|
verify(falsingCollector).onBouncerHidden()
|
||||||
verify(mPrimaryBouncerCallbackInteractor).dispatchReset()
|
verify(mPrimaryBouncerCallbackInteractor).dispatchReset()
|
||||||
verify(mPrimaryBouncerCallbackInteractor).dispatchFullyHidden()
|
verify(mPrimaryBouncerCallbackInteractor).dispatchFullyHidden()
|
||||||
@@ -243,11 +236,11 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIsFullShowing() {
|
fun testIsFullShowing() {
|
||||||
`when`(repository.primaryBouncerVisible.value).thenReturn(true)
|
`when`(repository.primaryBouncerShow.value).thenReturn(true)
|
||||||
`when`(repository.panelExpansionAmount.value).thenReturn(EXPANSION_VISIBLE)
|
`when`(repository.panelExpansionAmount.value).thenReturn(EXPANSION_VISIBLE)
|
||||||
`when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null)
|
`when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null)
|
||||||
assertThat(underTest.isFullyShowing()).isTrue()
|
assertThat(underTest.isFullyShowing()).isTrue()
|
||||||
`when`(repository.primaryBouncerVisible.value).thenReturn(false)
|
`when`(repository.primaryBouncerShow.value).thenReturn(false)
|
||||||
assertThat(underTest.isFullyShowing()).isFalse()
|
assertThat(underTest.isFullyShowing()).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,7 +363,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
|
|||||||
isUnlockingWithFpAllowed: Boolean,
|
isUnlockingWithFpAllowed: Boolean,
|
||||||
isAnimatingAway: Boolean
|
isAnimatingAway: Boolean
|
||||||
) {
|
) {
|
||||||
`when`(repository.primaryBouncerVisible.value).thenReturn(isVisible)
|
`when`(repository.primaryBouncerShow.value).thenReturn(isVisible)
|
||||||
resources.addOverride(R.bool.config_show_sidefps_hint_on_bouncer, sfpsEnabled)
|
resources.addOverride(R.bool.config_show_sidefps_hint_on_bouncer, sfpsEnabled)
|
||||||
`when`(keyguardUpdateMonitor.isFingerprintDetectionRunning).thenReturn(fpsDetectionRunning)
|
`when`(keyguardUpdateMonitor.isFingerprintDetectionRunning).thenReturn(fpsDetectionRunning)
|
||||||
`when`(keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed)
|
`when`(keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed)
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class PrimaryBouncerInteractorWithCoroutinesTest : SysuiTestCase() {
|
|||||||
fun notInteractableWhenExpansionIsBelow90Percent() = runTest {
|
fun notInteractableWhenExpansionIsBelow90Percent() = runTest {
|
||||||
val isInteractable = collectLastValue(underTest.isInteractable)
|
val isInteractable = collectLastValue(underTest.isInteractable)
|
||||||
|
|
||||||
repository.setPrimaryVisible(true)
|
repository.setPrimaryShow(true)
|
||||||
repository.setPanelExpansion(0.15f)
|
repository.setPanelExpansion(0.15f)
|
||||||
|
|
||||||
assertThat(isInteractable()).isFalse()
|
assertThat(isInteractable()).isFalse()
|
||||||
@@ -87,7 +87,7 @@ class PrimaryBouncerInteractorWithCoroutinesTest : SysuiTestCase() {
|
|||||||
fun notInteractableWhenExpansionAbove90PercentButNotVisible() = runTest {
|
fun notInteractableWhenExpansionAbove90PercentButNotVisible() = runTest {
|
||||||
val isInteractable = collectLastValue(underTest.isInteractable)
|
val isInteractable = collectLastValue(underTest.isInteractable)
|
||||||
|
|
||||||
repository.setPrimaryVisible(false)
|
repository.setPrimaryShow(false)
|
||||||
repository.setPanelExpansion(0.05f)
|
repository.setPanelExpansion(0.05f)
|
||||||
|
|
||||||
assertThat(isInteractable()).isFalse()
|
assertThat(isInteractable()).isFalse()
|
||||||
@@ -97,7 +97,7 @@ class PrimaryBouncerInteractorWithCoroutinesTest : SysuiTestCase() {
|
|||||||
fun isInteractableWhenExpansionAbove90PercentAndVisible() = runTest {
|
fun isInteractableWhenExpansionAbove90PercentAndVisible() = runTest {
|
||||||
var isInteractable = collectLastValue(underTest.isInteractable)
|
var isInteractable = collectLastValue(underTest.isInteractable)
|
||||||
|
|
||||||
repository.setPrimaryVisible(true)
|
repository.setPrimaryShow(true)
|
||||||
repository.setPanelExpansion(0.09f)
|
repository.setPanelExpansion(0.09f)
|
||||||
|
|
||||||
assertThat(isInteractable()).isTrue()
|
assertThat(isInteractable()).isTrue()
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class KeyguardBouncerViewModelTest : SysuiTestCase() {
|
|||||||
fun shouldUpdateSideFps() = runTest {
|
fun shouldUpdateSideFps() = runTest {
|
||||||
var count = 0
|
var count = 0
|
||||||
val job = underTest.shouldUpdateSideFps.onEach { count++ }.launchIn(this)
|
val job = underTest.shouldUpdateSideFps.onEach { count++ }.launchIn(this)
|
||||||
repository.setPrimaryVisible(true)
|
repository.setPrimaryShow(true)
|
||||||
// Run the tasks that are pending at this point of virtual time.
|
// Run the tasks that are pending at this point of virtual time.
|
||||||
runCurrent()
|
runCurrent()
|
||||||
assertThat(count).isEqualTo(1)
|
assertThat(count).isEqualTo(1)
|
||||||
|
|||||||
@@ -19,21 +19,16 @@ package com.android.systemui.keyguard.data.repository
|
|||||||
|
|
||||||
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN
|
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN
|
||||||
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
|
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
|
||||||
import com.android.systemui.keyguard.shared.model.KeyguardBouncerModel
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
|
||||||
/** Fake implementation of [KeyguardRepository] */
|
/** Fake implementation of [KeyguardRepository] */
|
||||||
class FakeKeyguardBouncerRepository : KeyguardBouncerRepository {
|
class FakeKeyguardBouncerRepository : KeyguardBouncerRepository {
|
||||||
private val _primaryBouncerVisible = MutableStateFlow(false)
|
private val _primaryBouncerShow = MutableStateFlow(false)
|
||||||
override val primaryBouncerVisible = _primaryBouncerVisible.asStateFlow()
|
|
||||||
private val _primaryBouncerShow = MutableStateFlow<KeyguardBouncerModel?>(null)
|
|
||||||
override val primaryBouncerShow = _primaryBouncerShow.asStateFlow()
|
override val primaryBouncerShow = _primaryBouncerShow.asStateFlow()
|
||||||
private val _primaryBouncerShowingSoon = MutableStateFlow(false)
|
private val _primaryBouncerShowingSoon = MutableStateFlow(false)
|
||||||
override val primaryBouncerShowingSoon = _primaryBouncerShowingSoon.asStateFlow()
|
override val primaryBouncerShowingSoon = _primaryBouncerShowingSoon.asStateFlow()
|
||||||
private val _primaryBouncerHide = MutableStateFlow(false)
|
|
||||||
override val primaryBouncerHide = _primaryBouncerHide.asStateFlow()
|
|
||||||
private val _primaryBouncerStartingToHide = MutableStateFlow(false)
|
private val _primaryBouncerStartingToHide = MutableStateFlow(false)
|
||||||
override val primaryBouncerStartingToHide = _primaryBouncerStartingToHide.asStateFlow()
|
override val primaryBouncerStartingToHide = _primaryBouncerStartingToHide.asStateFlow()
|
||||||
private val _primaryBouncerDisappearAnimation = MutableStateFlow<Runnable?>(null)
|
private val _primaryBouncerDisappearAnimation = MutableStateFlow<Runnable?>(null)
|
||||||
@@ -67,10 +62,6 @@ class FakeKeyguardBouncerRepository : KeyguardBouncerRepository {
|
|||||||
_primaryBouncerScrimmed.value = isScrimmed
|
_primaryBouncerScrimmed.value = isScrimmed
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPrimaryVisible(isVisible: Boolean) {
|
|
||||||
_primaryBouncerVisible.value = isVisible
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setAlternateVisible(isVisible: Boolean) {
|
override fun setAlternateVisible(isVisible: Boolean) {
|
||||||
_isAlternateBouncerVisible.value = isVisible
|
_isAlternateBouncerVisible.value = isVisible
|
||||||
}
|
}
|
||||||
@@ -79,18 +70,14 @@ class FakeKeyguardBouncerRepository : KeyguardBouncerRepository {
|
|||||||
_isAlternateBouncerUIAvailable.value = isAvailable
|
_isAlternateBouncerUIAvailable.value = isAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPrimaryShow(keyguardBouncerModel: KeyguardBouncerModel?) {
|
override fun setPrimaryShow(isShowing: Boolean) {
|
||||||
_primaryBouncerShow.value = keyguardBouncerModel
|
_primaryBouncerShow.value = isShowing
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPrimaryShowingSoon(showingSoon: Boolean) {
|
override fun setPrimaryShowingSoon(showingSoon: Boolean) {
|
||||||
_primaryBouncerShowingSoon.value = showingSoon
|
_primaryBouncerShowingSoon.value = showingSoon
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPrimaryHide(hide: Boolean) {
|
|
||||||
_primaryBouncerHide.value = hide
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setPrimaryStartingToHide(startingToHide: Boolean) {
|
override fun setPrimaryStartingToHide(startingToHide: Boolean) {
|
||||||
_primaryBouncerStartingToHide.value = startingToHide
|
_primaryBouncerStartingToHide.value = startingToHide
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user