Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit bed96eb1 authored by Grace Cheng's avatar Grace Cheng
Browse files

[flexiglass] Implement fp success and error haptics

Implements fingerprint success and error haptics across all biometric
auth-related scenes: lockscreen, bouncer, quick settings, and shade, and
adds tests for the new haptics implementation.

Haptics was previously handled in KeyguardRootViewBinder, which was
bound in KeyguardViewConfigurator and played the haptics with
vibratorHelper.performHapticFeedback(view = KeyguardRootView,
feedbackConstant = HapticFeedbackConstants.BIOMETRIC_CONFIRM /
HapticFeedbackConstants.BIOMETRIC_REJECT).

The new flexiglass implementation doesn’t use KeyguardViewConfigurator,
and since haptics is applicable across multiple scenes, we migrate it to
SceneContainerStartable, which runs coroutine jobs that outlive the
scene transitions. Since it no longer has a view reference, we use
vibratorHelper.vibrateAuthSuccess and vibrationHelper.vibrateAuthError
to play the haptics.

vibrateAuthSuccess uses BIOMETRIC_SUCCESS_VIBRATION_EFFECT, which maps
to VibrationEffect.EFFECT_CLICK, the same effect
HapticFeedbackVibrationProvider uses for
HapticFeedbackConstants.BIOMETRIC_CONFIRM. vibrateAuthError uses
BIOMETRIC_ERROR_VIBRATION_EFFECT, which maps to
VibrationEffect.EFFECT_DOUBLE_CLICK, the same effect
HapticFeedbackVibrationProvider uses for
HapticFeedbackConstants.BIOMETRIC_REJECT.

Also updates VibrationHelperKosmos, which was using a FakeVibratorHelper
type in previous use cases. We need to mock VibrationHelper in test to
ensure the expected haptics methods are called, so we create a new
Kosmos.fakeVibratorHelper that is the default value for
Kosmos.vibratorHelper for previous use cases, and override it to a
VibratorHelper mock in this test.

Flag: com.android.systemui.scene_container
Fixes: 352764632
Fixes: 352766437
Fixes: 352765379
Fixes: 352762251
Test: manually verified success and error haptics on SFPS, UDFPS, RFPS devices on lock screen, primary bouncer, alternate bouncer
Test: atest SceneContainerStartableTest
Test: atest QSLongPressEffectTest
Test: atest SliderHapticFeedbackProviderTest
Change-Id: Ic04ae3db137f6413515cb72da22a8d11db6a9a7e
parent 5f1c1da0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment