Don't dismiss app if auth is from screen off/AOD
OccludingAppDeviceEntryInteractor should only run if flag FP_LISTEN_OCCLUDING_APPS is enabled. Fixes: 295112731 Test: atest OccludingAppDeviceEntryInteractorTest Change-Id: I88a46f67a91ca94e65c1e9c7155df1e49c85d28b
This commit is contained in:
@@ -22,10 +22,14 @@ import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor
|
||||
import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
import com.android.systemui.dagger.qualifiers.Application
|
||||
import com.android.systemui.flags.FeatureFlags
|
||||
import com.android.systemui.flags.Flags
|
||||
import com.android.systemui.keyguard.data.repository.DeviceEntryFingerprintAuthRepository
|
||||
import com.android.systemui.keyguard.shared.model.ErrorFingerprintAuthenticationStatus
|
||||
import com.android.systemui.keyguard.shared.model.SuccessFingerprintAuthenticationStatus
|
||||
import com.android.systemui.plugins.ActivityStarter
|
||||
import com.android.systemui.power.domain.interactor.PowerInteractor
|
||||
import com.android.systemui.util.kotlin.sample
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
@@ -55,6 +59,8 @@ constructor(
|
||||
@Application scope: CoroutineScope,
|
||||
private val context: Context,
|
||||
activityStarter: ActivityStarter,
|
||||
powerInteractor: PowerInteractor,
|
||||
featureFlags: FeatureFlags,
|
||||
) {
|
||||
private val keyguardOccludedByApp: Flow<Boolean> =
|
||||
combine(
|
||||
@@ -87,29 +93,37 @@ constructor(
|
||||
.ifKeyguardOccludedByApp(/* elseFlow */ flowOf(null))
|
||||
|
||||
init {
|
||||
scope.launch {
|
||||
// On fingerprint success, go to the home screen
|
||||
fingerprintUnlockSuccessEvents.collect { goToHomeScreen() }
|
||||
}
|
||||
if (featureFlags.isEnabled(Flags.FP_LISTEN_OCCLUDING_APPS)) {
|
||||
scope.launch {
|
||||
// On fingerprint success when the screen is on, go to the home screen
|
||||
fingerprintUnlockSuccessEvents.sample(powerInteractor.isInteractive).collect {
|
||||
if (it) {
|
||||
goToHomeScreen()
|
||||
}
|
||||
// don't go to the home screen if the authentication is from AOD/dozing/off
|
||||
}
|
||||
}
|
||||
|
||||
scope.launch {
|
||||
// On device fingerprint lockout, request the bouncer with a runnable to
|
||||
// go to the home screen. Without this, the bouncer won't proceed to the home screen.
|
||||
fingerprintLockoutEvents.collect {
|
||||
activityStarter.dismissKeyguardThenExecute(
|
||||
object : ActivityStarter.OnDismissAction {
|
||||
override fun onDismiss(): Boolean {
|
||||
goToHomeScreen()
|
||||
return false
|
||||
}
|
||||
scope.launch {
|
||||
// On device fingerprint lockout, request the bouncer with a runnable to
|
||||
// go to the home screen. Without this, the bouncer won't proceed to the home
|
||||
// screen.
|
||||
fingerprintLockoutEvents.collect {
|
||||
activityStarter.dismissKeyguardThenExecute(
|
||||
object : ActivityStarter.OnDismissAction {
|
||||
override fun onDismiss(): Boolean {
|
||||
goToHomeScreen()
|
||||
return false
|
||||
}
|
||||
|
||||
override fun willRunAnimationOnKeyguard(): Boolean {
|
||||
return false
|
||||
}
|
||||
},
|
||||
/* cancel= */ null,
|
||||
/* afterKeyguardGone */ false
|
||||
)
|
||||
override fun willRunAnimationOnKeyguard(): Boolean {
|
||||
return false
|
||||
}
|
||||
},
|
||||
/* cancel= */ null,
|
||||
/* afterKeyguardGone */ false
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ import com.android.systemui.keyguard.shared.model.SuccessFingerprintAuthenticati
|
||||
import com.android.systemui.keyguard.util.IndicationHelper
|
||||
import com.android.systemui.plugins.ActivityStarter
|
||||
import com.android.systemui.plugins.ActivityStarter.OnDismissAction
|
||||
import com.android.systemui.power.data.repository.FakePowerRepository
|
||||
import com.android.systemui.power.domain.interactor.PowerInteractor
|
||||
import com.android.systemui.util.mockito.any
|
||||
import com.android.systemui.util.mockito.mock
|
||||
import com.android.systemui.util.mockito.whenever
|
||||
@@ -80,6 +82,7 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() {
|
||||
private lateinit var configurationRepository: FakeConfigurationRepository
|
||||
private lateinit var featureFlags: FakeFeatureFlags
|
||||
private lateinit var trustRepository: FakeTrustRepository
|
||||
private lateinit var powerRepository: FakePowerRepository
|
||||
|
||||
@Mock private lateinit var indicationHelper: IndicationHelper
|
||||
@Mock private lateinit var keyguardUpdateMonitor: KeyguardUpdateMonitor
|
||||
@@ -102,6 +105,7 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() {
|
||||
set(Flags.DELAY_BOUNCER, false)
|
||||
}
|
||||
trustRepository = FakeTrustRepository()
|
||||
powerRepository = FakePowerRepository()
|
||||
underTest =
|
||||
OccludingAppDeviceEntryInteractor(
|
||||
BiometricMessageInteractor(
|
||||
@@ -145,6 +149,14 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() {
|
||||
testScope.backgroundScope,
|
||||
mockedContext,
|
||||
activityStarter,
|
||||
PowerInteractor(
|
||||
powerRepository,
|
||||
keyguardRepository,
|
||||
falsingCollector = mock(),
|
||||
screenOffAnimationController = mock(),
|
||||
statusBarStateController = mock(),
|
||||
),
|
||||
FakeFeatureFlags().apply { set(Flags.FP_LISTEN_OCCLUDING_APPS, true) },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -159,6 +171,18 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() {
|
||||
verifyGoToHomeScreen()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fingerprintSuccess_notInteractive_doesNotGoToHomeScreen() =
|
||||
testScope.runTest {
|
||||
givenOnOccludingApp(true)
|
||||
powerRepository.setInteractive(false)
|
||||
fingerprintAuthRepository.setAuthenticationStatus(
|
||||
SuccessFingerprintAuthenticationStatus(0, true)
|
||||
)
|
||||
runCurrent()
|
||||
verifyNeverGoToHomeScreen()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fingerprintSuccess_notOnOccludingApp_doesNotGoToHomeScreen() =
|
||||
testScope.runTest {
|
||||
@@ -291,6 +315,7 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
private fun givenOnOccludingApp(isOnOccludingApp: Boolean) {
|
||||
powerRepository.setInteractive(true)
|
||||
keyguardRepository.setKeyguardOccluded(isOnOccludingApp)
|
||||
keyguardRepository.setKeyguardShowing(isOnOccludingApp)
|
||||
bouncerRepository.setPrimaryShow(!isOnOccludingApp)
|
||||
|
||||
Reference in New Issue
Block a user