Biometrics stubbing¶
Goal¶
Allow tests and agents to trigger biometric success/failure/cancel on emulators (API 29/35) and provide a path for app-under-test integration when emulator support is not sufficient.
Proposed MCP tool¶
biometricAuth({
action: "match" | "fail" | "cancel",
modality: "any" | "fingerprint" | "face",
fingerprintId?: number
})
Behavior:
modality: anyprefers fingerprint on emulator (highest support).action: matchshould succeed if enrollment exists.action: failshould simulate a non-matching biometric.
Emulator implementation (API 29/35)¶
Primary mechanism (fingerprint):
- Enroll a fingerprint in Settings (one-time per emulator snapshot).
- Trigger match:
adb -s <device> emu finger touch <id> - Release sensor:
adb -s <device> emu finger remove <id>
Failure simulation:
- Use a non-enrolled
<id>to generate a mismatch when the prompt is active. - If emulator does not differentiate ids, treat
failascanceland returnsupported: partialwith a reason.
Capability probing:
adb -s <device> shell getprop ro.kernel.qemu(1 indicates emulator)adb -s <device> emu helpto confirmfingercommands are available
ADB validation (API 35)¶
Status:
- API 29 not validated yet (no local AVD available).
Enrollment + auth steps (confirmed):
- Set a device PIN (required for enrollment).
adb -s <device> shell locksettings set-pin 1234- Launch fingerprint enrollment.
adb -s <device> shell am start -a android.settings.FINGERPRINT_ENROLL- Enter PIN to continue.
adb -s <device> shell input text 1234adb -s <device> shell input keyevent 66- Accept the consent screen (“I AGREE”) via UI automation.
adb -s <device> shell uiautomator dump /sdcard/fp_enroll.xmladb -s <device> shell input tap <x> <y>- At “Touch the sensor”, simulate enrollment.
adb -s <device> emu finger touch 1adb -s <device> emu finger remove 1- repeat until the UI shows “Fingerprint added”
- Verify enrollment.
adb -s <device> shell dumpsys fingerprintadb -s <device> shell cmd fingerprint sync- Validate unlock behavior on the lock screen.
adb -s <device> shell input keyevent 26adb -s <device> shell input keyevent 26adb -s <device> emu finger touch 1adb -s <device> emu finger remove 1adb -s <device> shell dumpsys window | rg -n "isKeyguardShowing"adb -s <device> shell input keyevent 26adb -s <device> shell input keyevent 26adb -s <device> emu finger touch 2adb -s <device> emu finger remove 2adb -s <device> shell dumpsys window | rg -n "isKeyguardShowing"
Observed results:
- Enrollment completes after repeated touch/remove cycles and UI shows “Fingerprint added.”
dumpsys fingerprintreports one enrolled print:prints:[{"id":0,"count":1,...}].touch 1unlocks the lock screen (isKeyguardShowing=false).touch 2does not unlock (isKeyguardShowing=true) when only print 1 is enrolled.
Notes:
adb shell cmd biometrichas no shell implementation on API 35.adb shell cmd fingerprintexposes sync/fingerdown/notification only; enrollment still requires the Settings UI.
App-under-test integration (AutoMobile SDK)¶
When emulator-only support is not enough, add a debug-only SDK hook to bypass or simulate biometric callbacks within the app-under-test.
Suggested SDK entrypoint:
AutoMobileBiometrics.overrideResult(
result = SUCCESS | FAILURE | CANCEL,
ttlMs = 5000
)
Notes:
- This is a build-time opt-in for apps we can modify.
- It can bypass the system prompt to make tests deterministic.
Plan¶
- Implement emulator fingerprint support via
adb emu finger. - Add capability detection and clear error messages for unsupported devices.
- Add optional SDK hook for deterministic app-under-test flows.
Risks¶
- Emulator support is primarily fingerprint; face/iris is not consistent.
- Physical devices may not allow simulation without device-owner privileges.