Merge "Revert "Use biometricUnlockController state change to show the unlock ripple."" into tm-qpr-dev am: 8606354ee9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22212379 Change-Id: I717a08faa1b3be210659931287bc5cbb4a2ba53c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -41,8 +41,8 @@ import com.android.systemui.statusbar.NotificationShadeWindowController
|
|||||||
import com.android.systemui.statusbar.commandline.Command
|
import com.android.systemui.statusbar.commandline.Command
|
||||||
import com.android.systemui.statusbar.commandline.CommandRegistry
|
import com.android.systemui.statusbar.commandline.CommandRegistry
|
||||||
import com.android.systemui.statusbar.phone.BiometricUnlockController
|
import com.android.systemui.statusbar.phone.BiometricUnlockController
|
||||||
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_DISMISS_BOUNCER
|
|
||||||
import com.android.systemui.statusbar.phone.CentralSurfaces
|
import com.android.systemui.statusbar.phone.CentralSurfaces
|
||||||
|
import com.android.systemui.statusbar.phone.KeyguardBypassController
|
||||||
import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent.CentralSurfacesScope
|
import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent.CentralSurfacesScope
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController
|
import com.android.systemui.statusbar.policy.ConfigurationController
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
@@ -60,9 +60,7 @@ import javax.inject.Provider
|
|||||||
* The ripple uses the accent color of the current theme.
|
* The ripple uses the accent color of the current theme.
|
||||||
*/
|
*/
|
||||||
@CentralSurfacesScope
|
@CentralSurfacesScope
|
||||||
class AuthRippleController
|
class AuthRippleController @Inject constructor(
|
||||||
@Inject
|
|
||||||
constructor(
|
|
||||||
private val centralSurfaces: CentralSurfaces,
|
private val centralSurfaces: CentralSurfaces,
|
||||||
private val sysuiContext: Context,
|
private val sysuiContext: Context,
|
||||||
private val authController: AuthController,
|
private val authController: AuthController,
|
||||||
@@ -72,18 +70,18 @@ constructor(
|
|||||||
private val wakefulnessLifecycle: WakefulnessLifecycle,
|
private val wakefulnessLifecycle: WakefulnessLifecycle,
|
||||||
private val commandRegistry: CommandRegistry,
|
private val commandRegistry: CommandRegistry,
|
||||||
private val notificationShadeWindowController: NotificationShadeWindowController,
|
private val notificationShadeWindowController: NotificationShadeWindowController,
|
||||||
|
private val bypassController: KeyguardBypassController,
|
||||||
private val biometricUnlockController: BiometricUnlockController,
|
private val biometricUnlockController: BiometricUnlockController,
|
||||||
private val udfpsControllerProvider: Provider<UdfpsController>,
|
private val udfpsControllerProvider: Provider<UdfpsController>,
|
||||||
private val statusBarStateController: StatusBarStateController,
|
private val statusBarStateController: StatusBarStateController,
|
||||||
private val featureFlags: FeatureFlags,
|
private val featureFlags: FeatureFlags,
|
||||||
private val logger: KeyguardLogger,
|
private val logger: KeyguardLogger,
|
||||||
rippleView: AuthRippleView?
|
rippleView: AuthRippleView?
|
||||||
) :
|
) : ViewController<AuthRippleView>(rippleView), KeyguardStateController.Callback,
|
||||||
ViewController<AuthRippleView>(rippleView),
|
|
||||||
KeyguardStateController.Callback,
|
|
||||||
WakefulnessLifecycle.Observer {
|
WakefulnessLifecycle.Observer {
|
||||||
|
|
||||||
@VisibleForTesting internal var startLightRevealScrimOnKeyguardFadingAway = false
|
@VisibleForTesting
|
||||||
|
internal var startLightRevealScrimOnKeyguardFadingAway = false
|
||||||
var lightRevealScrimAnimator: ValueAnimator? = null
|
var lightRevealScrimAnimator: ValueAnimator? = null
|
||||||
var fingerprintSensorLocation: Point? = null
|
var fingerprintSensorLocation: Point? = null
|
||||||
private var faceSensorLocation: Point? = null
|
private var faceSensorLocation: Point? = null
|
||||||
@@ -92,16 +90,6 @@ constructor(
|
|||||||
private var udfpsController: UdfpsController? = null
|
private var udfpsController: UdfpsController? = null
|
||||||
private var udfpsRadius: Float = -1f
|
private var udfpsRadius: Float = -1f
|
||||||
|
|
||||||
private val biometricModeListener = object : BiometricUnlockController.BiometricModeListener {
|
|
||||||
override fun onModeChanged(mode: Int) {
|
|
||||||
// isBiometricUnlock does not cover the scenario when biometrics unlocks
|
|
||||||
// the device while the bouncer is showing.
|
|
||||||
if (biometricUnlockController.isBiometricUnlock || mode == MODE_DISMISS_BOUNCER) {
|
|
||||||
showUnlockRipple(biometricUnlockController.biometricType)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public override fun onViewAttached() {
|
public override fun onViewAttached() {
|
||||||
authController.addCallback(authControllerCallback)
|
authController.addCallback(authControllerCallback)
|
||||||
@@ -113,7 +101,6 @@ constructor(
|
|||||||
keyguardStateController.addCallback(this)
|
keyguardStateController.addCallback(this)
|
||||||
wakefulnessLifecycle.addObserver(this)
|
wakefulnessLifecycle.addObserver(this)
|
||||||
commandRegistry.registerCommand("auth-ripple") { AuthRippleCommand() }
|
commandRegistry.registerCommand("auth-ripple") { AuthRippleCommand() }
|
||||||
biometricUnlockController.addBiometricModeListener(biometricModeListener)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -125,7 +112,6 @@ constructor(
|
|||||||
keyguardStateController.removeCallback(this)
|
keyguardStateController.removeCallback(this)
|
||||||
wakefulnessLifecycle.removeObserver(this)
|
wakefulnessLifecycle.removeObserver(this)
|
||||||
commandRegistry.unregisterCommand("auth-ripple")
|
commandRegistry.unregisterCommand("auth-ripple")
|
||||||
biometricUnlockController.removeBiometricModeListener(biometricModeListener)
|
|
||||||
|
|
||||||
notificationShadeWindowController.setForcePluginOpen(false, this)
|
notificationShadeWindowController.setForcePluginOpen(false, this)
|
||||||
}
|
}
|
||||||
@@ -156,6 +142,9 @@ constructor(
|
|||||||
showUnlockedRipple()
|
showUnlockedRipple()
|
||||||
}
|
}
|
||||||
} else if (biometricSourceType == BiometricSourceType.FACE) {
|
} else if (biometricSourceType == BiometricSourceType.FACE) {
|
||||||
|
if (!bypassController.canBypass() && !authController.isUdfpsFingerDown) {
|
||||||
|
return
|
||||||
|
}
|
||||||
faceSensorLocation?.let {
|
faceSensorLocation?.let {
|
||||||
mView.setSensorLocation(it)
|
mView.setSensorLocation(it)
|
||||||
circleReveal = CircleReveal(
|
circleReveal = CircleReveal(
|
||||||
@@ -277,6 +266,7 @@ constructor(
|
|||||||
if (biometricSourceType == BiometricSourceType.FINGERPRINT) {
|
if (biometricSourceType == BiometricSourceType.FINGERPRINT) {
|
||||||
mView.fadeDwellRipple()
|
mView.fadeDwellRipple()
|
||||||
}
|
}
|
||||||
|
showUnlockRipple(biometricSourceType)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBiometricAuthFailed(biometricSourceType: BiometricSourceType) {
|
override fun onBiometricAuthFailed(biometricSourceType: BiometricSourceType) {
|
||||||
|
|||||||
@@ -17,14 +17,14 @@
|
|||||||
package com.android.systemui.biometrics
|
package com.android.systemui.biometrics
|
||||||
|
|
||||||
import android.graphics.Point
|
import android.graphics.Point
|
||||||
import android.hardware.biometrics.BiometricSourceType.FACE
|
import android.hardware.biometrics.BiometricSourceType
|
||||||
import android.hardware.biometrics.BiometricSourceType.FINGERPRINT
|
|
||||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal
|
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal
|
||||||
import android.testing.AndroidTestingRunner
|
import android.testing.AndroidTestingRunner
|
||||||
import android.testing.TestableLooper.RunWithLooper
|
import android.testing.TestableLooper.RunWithLooper
|
||||||
import androidx.test.filters.SmallTest
|
import androidx.test.filters.SmallTest
|
||||||
import com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession
|
import com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor
|
import com.android.keyguard.KeyguardUpdateMonitor
|
||||||
|
import com.android.keyguard.KeyguardUpdateMonitorCallback
|
||||||
import com.android.keyguard.logging.KeyguardLogger
|
import com.android.keyguard.logging.KeyguardLogger
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
import com.android.systemui.dump.logcatLogBuffer
|
import com.android.systemui.dump.logcatLogBuffer
|
||||||
@@ -36,11 +36,11 @@ import com.android.systemui.statusbar.NotificationShadeWindowController
|
|||||||
import com.android.systemui.statusbar.commandline.CommandRegistry
|
import com.android.systemui.statusbar.commandline.CommandRegistry
|
||||||
import com.android.systemui.statusbar.phone.BiometricUnlockController
|
import com.android.systemui.statusbar.phone.BiometricUnlockController
|
||||||
import com.android.systemui.statusbar.phone.CentralSurfaces
|
import com.android.systemui.statusbar.phone.CentralSurfaces
|
||||||
|
import com.android.systemui.statusbar.phone.KeyguardBypassController
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController
|
import com.android.systemui.statusbar.policy.ConfigurationController
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
import com.android.systemui.util.leak.RotationUtils
|
import com.android.systemui.util.leak.RotationUtils
|
||||||
import com.android.systemui.util.mockito.any
|
import com.android.systemui.util.mockito.any
|
||||||
import javax.inject.Provider
|
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Assert.assertFalse
|
import org.junit.Assert.assertFalse
|
||||||
import org.junit.Assert.assertTrue
|
import org.junit.Assert.assertTrue
|
||||||
@@ -50,15 +50,15 @@ import org.junit.runner.RunWith
|
|||||||
import org.mockito.ArgumentCaptor
|
import org.mockito.ArgumentCaptor
|
||||||
import org.mockito.ArgumentMatchers
|
import org.mockito.ArgumentMatchers
|
||||||
import org.mockito.ArgumentMatchers.eq
|
import org.mockito.ArgumentMatchers.eq
|
||||||
import org.mockito.Captor
|
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
import org.mockito.Mockito.`when`
|
||||||
import org.mockito.Mockito.never
|
import org.mockito.Mockito.never
|
||||||
import org.mockito.Mockito.reset
|
import org.mockito.Mockito.reset
|
||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
import org.mockito.Mockito.`when`
|
|
||||||
import org.mockito.MockitoAnnotations
|
import org.mockito.MockitoAnnotations
|
||||||
import org.mockito.MockitoSession
|
import org.mockito.MockitoSession
|
||||||
import org.mockito.quality.Strictness
|
import org.mockito.quality.Strictness
|
||||||
|
import javax.inject.Provider
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@RunWith(AndroidTestingRunner::class)
|
@RunWith(AndroidTestingRunner::class)
|
||||||
@@ -75,6 +75,7 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
@Mock private lateinit var keyguardStateController: KeyguardStateController
|
@Mock private lateinit var keyguardStateController: KeyguardStateController
|
||||||
@Mock private lateinit var wakefulnessLifecycle: WakefulnessLifecycle
|
@Mock private lateinit var wakefulnessLifecycle: WakefulnessLifecycle
|
||||||
@Mock private lateinit var notificationShadeWindowController: NotificationShadeWindowController
|
@Mock private lateinit var notificationShadeWindowController: NotificationShadeWindowController
|
||||||
|
@Mock private lateinit var bypassController: KeyguardBypassController
|
||||||
@Mock private lateinit var biometricUnlockController: BiometricUnlockController
|
@Mock private lateinit var biometricUnlockController: BiometricUnlockController
|
||||||
@Mock private lateinit var udfpsControllerProvider: Provider<UdfpsController>
|
@Mock private lateinit var udfpsControllerProvider: Provider<UdfpsController>
|
||||||
@Mock private lateinit var udfpsController: UdfpsController
|
@Mock private lateinit var udfpsController: UdfpsController
|
||||||
@@ -83,15 +84,10 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
@Mock private lateinit var lightRevealScrim: LightRevealScrim
|
@Mock private lateinit var lightRevealScrim: LightRevealScrim
|
||||||
@Mock private lateinit var fpSensorProp: FingerprintSensorPropertiesInternal
|
@Mock private lateinit var fpSensorProp: FingerprintSensorPropertiesInternal
|
||||||
|
|
||||||
@Captor
|
|
||||||
private lateinit var biometricModeListener:
|
|
||||||
ArgumentCaptor<BiometricUnlockController.BiometricModeListener>
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
MockitoAnnotations.initMocks(this)
|
MockitoAnnotations.initMocks(this)
|
||||||
staticMockSession =
|
staticMockSession = mockitoSession()
|
||||||
mockitoSession()
|
|
||||||
.mockStatic(RotationUtils::class.java)
|
.mockStatic(RotationUtils::class.java)
|
||||||
.strictness(Strictness.LENIENT)
|
.strictness(Strictness.LENIENT)
|
||||||
.startMocking()
|
.startMocking()
|
||||||
@@ -100,8 +96,7 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
`when`(authController.udfpsProps).thenReturn(listOf(fpSensorProp))
|
`when`(authController.udfpsProps).thenReturn(listOf(fpSensorProp))
|
||||||
`when`(udfpsControllerProvider.get()).thenReturn(udfpsController)
|
`when`(udfpsControllerProvider.get()).thenReturn(udfpsController)
|
||||||
|
|
||||||
controller =
|
controller = AuthRippleController(
|
||||||
AuthRippleController(
|
|
||||||
mCentralSurfaces,
|
mCentralSurfaces,
|
||||||
context,
|
context,
|
||||||
authController,
|
authController,
|
||||||
@@ -111,6 +106,7 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
wakefulnessLifecycle,
|
wakefulnessLifecycle,
|
||||||
commandRegistry,
|
commandRegistry,
|
||||||
notificationShadeWindowController,
|
notificationShadeWindowController,
|
||||||
|
bypassController,
|
||||||
biometricUnlockController,
|
biometricUnlockController,
|
||||||
udfpsControllerProvider,
|
udfpsControllerProvider,
|
||||||
statusBarStateController,
|
statusBarStateController,
|
||||||
@@ -134,14 +130,16 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
`when`(authController.fingerprintSensorLocation).thenReturn(fpsLocation)
|
`when`(authController.fingerprintSensorLocation).thenReturn(fpsLocation)
|
||||||
controller.onViewAttached()
|
controller.onViewAttached()
|
||||||
`when`(keyguardStateController.isShowing).thenReturn(true)
|
`when`(keyguardStateController.isShowing).thenReturn(true)
|
||||||
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(eq(FINGERPRINT)))
|
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(
|
||||||
.thenReturn(true)
|
eq(BiometricSourceType.FINGERPRINT))).thenReturn(true)
|
||||||
`when`(biometricUnlockController.isBiometricUnlock).thenReturn(true)
|
|
||||||
`when`(biometricUnlockController.biometricType).thenReturn(FINGERPRINT)
|
|
||||||
|
|
||||||
// WHEN unlocked with fingerprint
|
// WHEN fingerprint authenticated
|
||||||
verify(biometricUnlockController).addBiometricModeListener(biometricModeListener.capture())
|
val captor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
|
||||||
biometricModeListener.value.onModeChanged(/* mode= */ 0)
|
verify(keyguardUpdateMonitor).registerCallback(captor.capture())
|
||||||
|
captor.value.onBiometricAuthenticated(
|
||||||
|
0 /* userId */,
|
||||||
|
BiometricSourceType.FINGERPRINT /* type */,
|
||||||
|
false /* isStrongBiometric */)
|
||||||
|
|
||||||
// THEN update sensor location and show ripple
|
// THEN update sensor location and show ripple
|
||||||
verify(rippleView).setFingerprintSensorLocation(fpsLocation, 0f)
|
verify(rippleView).setFingerprintSensorLocation(fpsLocation, 0f)
|
||||||
@@ -154,15 +152,17 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
val fpsLocation = Point(5, 5)
|
val fpsLocation = Point(5, 5)
|
||||||
`when`(authController.udfpsLocation).thenReturn(fpsLocation)
|
`when`(authController.udfpsLocation).thenReturn(fpsLocation)
|
||||||
controller.onViewAttached()
|
controller.onViewAttached()
|
||||||
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(eq(FINGERPRINT)))
|
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(
|
||||||
.thenReturn(true)
|
eq(BiometricSourceType.FINGERPRINT))).thenReturn(true)
|
||||||
`when`(biometricUnlockController.isBiometricUnlock).thenReturn(true)
|
|
||||||
`when`(biometricUnlockController.biometricType).thenReturn(FINGERPRINT)
|
|
||||||
|
|
||||||
// WHEN keyguard is NOT showing & fingerprint authenticated
|
// WHEN keyguard is NOT showing & fingerprint authenticated
|
||||||
`when`(keyguardStateController.isShowing).thenReturn(false)
|
`when`(keyguardStateController.isShowing).thenReturn(false)
|
||||||
verify(biometricUnlockController).addBiometricModeListener(biometricModeListener.capture())
|
val captor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
|
||||||
biometricModeListener.value.onModeChanged(/* mode= */ 0)
|
verify(keyguardUpdateMonitor).registerCallback(captor.capture())
|
||||||
|
captor.value.onBiometricAuthenticated(
|
||||||
|
0 /* userId */,
|
||||||
|
BiometricSourceType.FINGERPRINT /* type */,
|
||||||
|
false /* isStrongBiometric */)
|
||||||
|
|
||||||
// THEN no ripple
|
// THEN no ripple
|
||||||
verify(rippleView, never()).startUnlockedRipple(any())
|
verify(rippleView, never()).startUnlockedRipple(any())
|
||||||
@@ -175,14 +175,61 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
`when`(authController.udfpsLocation).thenReturn(fpsLocation)
|
`when`(authController.udfpsLocation).thenReturn(fpsLocation)
|
||||||
controller.onViewAttached()
|
controller.onViewAttached()
|
||||||
`when`(keyguardStateController.isShowing).thenReturn(true)
|
`when`(keyguardStateController.isShowing).thenReturn(true)
|
||||||
`when`(biometricUnlockController.isBiometricUnlock).thenReturn(true)
|
|
||||||
`when`(biometricUnlockController.biometricType).thenReturn(FINGERPRINT)
|
|
||||||
|
|
||||||
// WHEN unlocking with fingerprint is NOT allowed & fingerprint authenticated
|
// WHEN unlocking with fingerprint is NOT allowed & fingerprint authenticated
|
||||||
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(eq(FINGERPRINT)))
|
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(
|
||||||
.thenReturn(false)
|
eq(BiometricSourceType.FINGERPRINT))).thenReturn(false)
|
||||||
verify(biometricUnlockController).addBiometricModeListener(biometricModeListener.capture())
|
val captor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
|
||||||
biometricModeListener.value.onModeChanged(/* mode= */ 0)
|
verify(keyguardUpdateMonitor).registerCallback(captor.capture())
|
||||||
|
captor.value.onBiometricAuthenticated(
|
||||||
|
0 /* userId */,
|
||||||
|
BiometricSourceType.FINGERPRINT /* type */,
|
||||||
|
false /* isStrongBiometric */)
|
||||||
|
|
||||||
|
// THEN no ripple
|
||||||
|
verify(rippleView, never()).startUnlockedRipple(any())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testFaceTriggerBypassEnabled_Ripple() {
|
||||||
|
// GIVEN face auth sensor exists, keyguard is showing & unlocking with face is allowed
|
||||||
|
val faceLocation = Point(5, 5)
|
||||||
|
`when`(authController.faceSensorLocation).thenReturn(faceLocation)
|
||||||
|
controller.onViewAttached()
|
||||||
|
|
||||||
|
`when`(keyguardStateController.isShowing).thenReturn(true)
|
||||||
|
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(
|
||||||
|
BiometricSourceType.FACE)).thenReturn(true)
|
||||||
|
|
||||||
|
// WHEN bypass is enabled & face authenticated
|
||||||
|
`when`(bypassController.canBypass()).thenReturn(true)
|
||||||
|
val captor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
|
||||||
|
verify(keyguardUpdateMonitor).registerCallback(captor.capture())
|
||||||
|
captor.value.onBiometricAuthenticated(
|
||||||
|
0 /* userId */,
|
||||||
|
BiometricSourceType.FACE /* type */,
|
||||||
|
false /* isStrongBiometric */)
|
||||||
|
|
||||||
|
// THEN show ripple
|
||||||
|
verify(rippleView).setSensorLocation(faceLocation)
|
||||||
|
verify(rippleView).startUnlockedRipple(any())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testFaceTriggerNonBypass_NoRipple() {
|
||||||
|
// GIVEN face auth sensor exists
|
||||||
|
val faceLocation = Point(5, 5)
|
||||||
|
`when`(authController.faceSensorLocation).thenReturn(faceLocation)
|
||||||
|
controller.onViewAttached()
|
||||||
|
|
||||||
|
// WHEN bypass isn't enabled & face authenticated
|
||||||
|
`when`(bypassController.canBypass()).thenReturn(false)
|
||||||
|
val captor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
|
||||||
|
verify(keyguardUpdateMonitor).registerCallback(captor.capture())
|
||||||
|
captor.value.onBiometricAuthenticated(
|
||||||
|
0 /* userId */,
|
||||||
|
BiometricSourceType.FACE /* type */,
|
||||||
|
false /* isStrongBiometric */)
|
||||||
|
|
||||||
// THEN no ripple
|
// THEN no ripple
|
||||||
verify(rippleView, never()).startUnlockedRipple(any())
|
verify(rippleView, never()).startUnlockedRipple(any())
|
||||||
@@ -192,12 +239,14 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
fun testNullFaceSensorLocationDoesNothing() {
|
fun testNullFaceSensorLocationDoesNothing() {
|
||||||
`when`(authController.faceSensorLocation).thenReturn(null)
|
`when`(authController.faceSensorLocation).thenReturn(null)
|
||||||
controller.onViewAttached()
|
controller.onViewAttached()
|
||||||
`when`(biometricUnlockController.biometricType).thenReturn(FACE)
|
|
||||||
`when`(biometricUnlockController.isBiometricUnlock).thenReturn(true)
|
|
||||||
|
|
||||||
verify(biometricUnlockController).addBiometricModeListener(biometricModeListener.capture())
|
val captor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
|
||||||
biometricModeListener.value.onModeChanged(/* mode= */ 0)
|
verify(keyguardUpdateMonitor).registerCallback(captor.capture())
|
||||||
|
|
||||||
|
captor.value.onBiometricAuthenticated(
|
||||||
|
0 /* userId */,
|
||||||
|
BiometricSourceType.FACE /* type */,
|
||||||
|
false /* isStrongBiometric */)
|
||||||
verify(rippleView, never()).startUnlockedRipple(any())
|
verify(rippleView, never()).startUnlockedRipple(any())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,21 +254,25 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
fun testNullFingerprintSensorLocationDoesNothing() {
|
fun testNullFingerprintSensorLocationDoesNothing() {
|
||||||
`when`(authController.fingerprintSensorLocation).thenReturn(null)
|
`when`(authController.fingerprintSensorLocation).thenReturn(null)
|
||||||
controller.onViewAttached()
|
controller.onViewAttached()
|
||||||
`when`(biometricUnlockController.biometricType).thenReturn(FINGERPRINT)
|
|
||||||
`when`(biometricUnlockController.isBiometricUnlock).thenReturn(true)
|
|
||||||
|
|
||||||
verify(biometricUnlockController).addBiometricModeListener(biometricModeListener.capture())
|
val captor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
|
||||||
biometricModeListener.value.onModeChanged(/* mode= */ 0)
|
verify(keyguardUpdateMonitor).registerCallback(captor.capture())
|
||||||
|
|
||||||
|
captor.value.onBiometricAuthenticated(
|
||||||
|
0 /* userId */,
|
||||||
|
BiometricSourceType.FINGERPRINT /* type */,
|
||||||
|
false /* isStrongBiometric */)
|
||||||
verify(rippleView, never()).startUnlockedRipple(any())
|
verify(rippleView, never()).startUnlockedRipple(any())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun registersAndDeregisters() {
|
fun registersAndDeregisters() {
|
||||||
controller.onViewAttached()
|
controller.onViewAttached()
|
||||||
val captor = ArgumentCaptor.forClass(KeyguardStateController.Callback::class.java)
|
val captor = ArgumentCaptor
|
||||||
|
.forClass(KeyguardStateController.Callback::class.java)
|
||||||
verify(keyguardStateController).addCallback(captor.capture())
|
verify(keyguardStateController).addCallback(captor.capture())
|
||||||
val captor2 = ArgumentCaptor.forClass(WakefulnessLifecycle.Observer::class.java)
|
val captor2 = ArgumentCaptor
|
||||||
|
.forClass(WakefulnessLifecycle.Observer::class.java)
|
||||||
verify(wakefulnessLifecycle).addObserver(captor2.capture())
|
verify(wakefulnessLifecycle).addObserver(captor2.capture())
|
||||||
controller.onViewDetached()
|
controller.onViewDetached()
|
||||||
verify(keyguardStateController).removeCallback(any())
|
verify(keyguardStateController).removeCallback(any())
|
||||||
@@ -233,20 +286,17 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
`when`(authController.fingerprintSensorLocation).thenReturn(fpsLocation)
|
`when`(authController.fingerprintSensorLocation).thenReturn(fpsLocation)
|
||||||
controller.onViewAttached()
|
controller.onViewAttached()
|
||||||
`when`(keyguardStateController.isShowing).thenReturn(true)
|
`when`(keyguardStateController.isShowing).thenReturn(true)
|
||||||
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(FINGERPRINT)).thenReturn(true)
|
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(
|
||||||
|
BiometricSourceType.FINGERPRINT)).thenReturn(true)
|
||||||
`when`(biometricUnlockController.isWakeAndUnlock).thenReturn(true)
|
`when`(biometricUnlockController.isWakeAndUnlock).thenReturn(true)
|
||||||
|
|
||||||
controller.showUnlockRipple(FINGERPRINT)
|
controller.showUnlockRipple(BiometricSourceType.FINGERPRINT)
|
||||||
assertTrue(
|
assertTrue("reveal didn't start on keyguardFadingAway",
|
||||||
"reveal didn't start on keyguardFadingAway",
|
controller.startLightRevealScrimOnKeyguardFadingAway)
|
||||||
controller.startLightRevealScrimOnKeyguardFadingAway
|
|
||||||
)
|
|
||||||
`when`(keyguardStateController.isKeyguardFadingAway).thenReturn(true)
|
`when`(keyguardStateController.isKeyguardFadingAway).thenReturn(true)
|
||||||
controller.onKeyguardFadingAwayChanged()
|
controller.onKeyguardFadingAwayChanged()
|
||||||
assertFalse(
|
assertFalse("reveal triggers multiple times",
|
||||||
"reveal triggers multiple times",
|
controller.startLightRevealScrimOnKeyguardFadingAway)
|
||||||
controller.startLightRevealScrimOnKeyguardFadingAway
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -258,26 +308,23 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
|||||||
`when`(keyguardStateController.isShowing).thenReturn(true)
|
`when`(keyguardStateController.isShowing).thenReturn(true)
|
||||||
`when`(biometricUnlockController.isWakeAndUnlock).thenReturn(true)
|
`when`(biometricUnlockController.isWakeAndUnlock).thenReturn(true)
|
||||||
`when`(authController.isUdfpsFingerDown).thenReturn(true)
|
`when`(authController.isUdfpsFingerDown).thenReturn(true)
|
||||||
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(eq(FACE))).thenReturn(true)
|
`when`(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(
|
||||||
|
eq(BiometricSourceType.FACE))).thenReturn(true)
|
||||||
|
|
||||||
controller.showUnlockRipple(FACE)
|
controller.showUnlockRipple(BiometricSourceType.FACE)
|
||||||
assertTrue(
|
assertTrue("reveal didn't start on keyguardFadingAway",
|
||||||
"reveal didn't start on keyguardFadingAway",
|
controller.startLightRevealScrimOnKeyguardFadingAway)
|
||||||
controller.startLightRevealScrimOnKeyguardFadingAway
|
|
||||||
)
|
|
||||||
`when`(keyguardStateController.isKeyguardFadingAway).thenReturn(true)
|
`when`(keyguardStateController.isKeyguardFadingAway).thenReturn(true)
|
||||||
controller.onKeyguardFadingAwayChanged()
|
controller.onKeyguardFadingAwayChanged()
|
||||||
assertFalse(
|
assertFalse("reveal triggers multiple times",
|
||||||
"reveal triggers multiple times",
|
controller.startLightRevealScrimOnKeyguardFadingAway)
|
||||||
controller.startLightRevealScrimOnKeyguardFadingAway
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testUpdateRippleColor() {
|
fun testUpdateRippleColor() {
|
||||||
controller.onViewAttached()
|
controller.onViewAttached()
|
||||||
val captor =
|
val captor = ArgumentCaptor
|
||||||
ArgumentCaptor.forClass(ConfigurationController.ConfigurationListener::class.java)
|
.forClass(ConfigurationController.ConfigurationListener::class.java)
|
||||||
verify(configurationController).addCallback(captor.capture())
|
verify(configurationController).addCallback(captor.capture())
|
||||||
|
|
||||||
reset(rippleView)
|
reset(rippleView)
|
||||||
|
|||||||
Reference in New Issue
Block a user