From 827afdab0eb620ed139c4ab519ac837cb718296b Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Fri, 21 Aug 2015 18:45:15 -0700 Subject: [PATCH] Handle driver errors from remove, enroll and auth. FingerprintService expects callbacks from the HAL to happen over the provided notify() method. However, there are some circumstances when errors can't be propagated (i.e. the driver cannot be loaded). In this case, the call to the method (remove(), enroll(), authenticate()) fails and we get a return status != 0. When this happens, FingerprintService now sends an error response to the client. In general, this will mean the driver is unavailable, so we send FINGERPRINT_ERROR_HW_UNAVAILABLE. Fixes bug 23183484 Change-Id: Ifb40ba6fb1d960810043749fd8478ba37c968405 --- .../com/android/server/fingerprint/FingerprintService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java index befa3116bc8c9..7807416d408fa 100644 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java @@ -298,6 +298,7 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe final int result = daemon.enroll(cryptoToken, groupId, timeout); if (result != 0) { Slog.w(TAG, "startEnroll failed, result=" + result); + dispatchError(mHalDeviceId, FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE); } } catch (RemoteException e) { Slog.e(TAG, "startEnroll failed", e); @@ -391,6 +392,7 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe final int result = daemon.authenticate(opId, groupId); if (result != 0) { Slog.w(TAG, "startAuthentication failed, result=" + result); + dispatchError(mHalDeviceId, FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE); } } catch (RemoteException e) { Slog.e(TAG, "startAuthentication failed", e); @@ -433,12 +435,14 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe return; } + stopPendingOperations(true); mRemoveClient = new ClientMonitor(token, receiver, userId, restricted); // The fingerprint template ids will be removed when we get confirmation from the HAL try { final int result = daemon.remove(fingerId, userId); if (result != 0) { Slog.w(TAG, "startRemove with id = " + fingerId + " failed, result=" + result); + dispatchError(mHalDeviceId, FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE); } } catch (RemoteException e) { Slog.e(TAG, "startRemove failed", e);