Allow face auth to run even when secure camera is launched if primary bouncer is also visible
Test: atest DeviceEntryFaceAuthRepositoryTest Fixes: 285521712 Change-Id: I1af59924054ed3f01a43774cf306b39b300ab8df
This commit is contained in:
@@ -317,13 +317,14 @@ constructor(
|
||||
tableLogBuffer
|
||||
),
|
||||
logAndObserve(
|
||||
combine(
|
||||
keyguardInteractor.isSecureCameraActive,
|
||||
alternateBouncerInteractor.isVisible
|
||||
) { a, b ->
|
||||
!a || b
|
||||
},
|
||||
"secureCameraNotActiveOrAltBouncerIsShowing",
|
||||
keyguardInteractor.isSecureCameraActive
|
||||
.isFalse()
|
||||
.or(
|
||||
alternateBouncerInteractor.isVisible.or(
|
||||
keyguardInteractor.primaryBouncerShowing
|
||||
)
|
||||
),
|
||||
"secureCameraNotActiveOrAnyBouncerIsShowing",
|
||||
tableLogBuffer
|
||||
),
|
||||
logAndObserve(
|
||||
@@ -640,6 +641,10 @@ constructor(
|
||||
private fun and(flow: Flow<Boolean>, anotherFlow: Flow<Boolean>) =
|
||||
flow.combine(anotherFlow) { a, b -> a && b }
|
||||
|
||||
/** Combine two boolean flows by or-ing both of them */
|
||||
private fun Flow<Boolean>.or(anotherFlow: Flow<Boolean>) =
|
||||
this.combine(anotherFlow) { a, b -> a || b }
|
||||
|
||||
/** "Not" the given flow. The return [Flow] will be true when [this] flow is false. */
|
||||
private fun Flow<Boolean>.isFalse(): Flow<Boolean> {
|
||||
return this.map { !it }
|
||||
|
||||
@@ -572,6 +572,29 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun authenticateRunsWhenSecureCameraIsActiveIfBouncerIsShowing() =
|
||||
testScope.runTest {
|
||||
initCollectors()
|
||||
allPreconditionsToRunFaceAuthAreTrue()
|
||||
bouncerRepository.setAlternateVisible(false)
|
||||
bouncerRepository.setPrimaryShow(false)
|
||||
|
||||
assertThat(canFaceAuthRun()).isTrue()
|
||||
|
||||
// launch secure camera
|
||||
fakeCommandQueue.doForEachCallback {
|
||||
it.onCameraLaunchGestureDetected(CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP)
|
||||
}
|
||||
keyguardRepository.setKeyguardOccluded(true)
|
||||
runCurrent()
|
||||
assertThat(canFaceAuthRun()).isFalse()
|
||||
|
||||
// but bouncer is shown after that.
|
||||
bouncerRepository.setPrimaryShow(true)
|
||||
assertThat(canFaceAuthRun()).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun authenticateDoesNotRunOnUnsupportedPosture() =
|
||||
testScope.runTest {
|
||||
|
||||
Reference in New Issue
Block a user