Biometric HAL death should invoke handleError on the handler

All client lifecycle is modified on the handler. When the HAL dies,
serviceDied comes in on the main thread and will race with the rest of
client lifecycle manipulation. We need to guarantee this is in order,
otherwise it's possible for BiometricService to receive the following
order of events
1) BiometricService requests auth
2) Face/FingerprintService is ready to start auth
3) HAL dies in the middle of 2), and sends onError to BiometricService
4) onReadyForAuthentication is sent to BiometricService, causing NPE

With this change, it will guarantee that 3) occurs after 4), which will
avoid A) BiometricService receiving events out of order, and more
importantly B) allow BiometricPrompt to show the HW_UNAVAILABLE error
instead of crashing system server.

Fixes: 137800315

Test: Authentication with BiometricPromptDemo while killing the HAL
Change-Id: Iae2d5b39dd494123f274b47edcc44c3afc1fff8c
1 file changed