diff options
author | Jim Miller <jaggies@google.com> | 2015-07-21 16:58:46 -0700 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2015-07-22 04:07:29 +0000 |
commit | 091f0e5c6c7f9e72a6e661c4849a2e232823075b (patch) | |
tree | 9e37177a9c84e973bf9d5184f43c9babdba74e87 | |
parent | bdb7d936512a39b6c06411d11a26824b82e5727f (diff) | |
download | frameworks_base-091f0e5c6c7f9e72a6e661c4849a2e232823075b.zip frameworks_base-091f0e5c6c7f9e72a6e661c4849a2e232823075b.tar.gz frameworks_base-091f0e5c6c7f9e72a6e661c4849a2e232823075b.tar.bz2 |
Make FingerprintService more tolerant of fingerprintd crashes.
- attempt to restart fingerprintd on the next request
- inform clients that the hardware isn't available and cancel
listeners.
Fixes bug 22492148
Change-Id: Ib27eaf7f197c6a4e6ed9b085602882904d6b794d
-rw-r--r-- | services/core/java/com/android/server/fingerprint/FingerprintService.java | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java index f34fff7..c705fbf 100644 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java @@ -123,20 +123,29 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe public void binderDied() { Slog.v(TAG, "fingerprintd died"); mDaemon = null; + dispatchError(mHalDeviceId, FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE); } public IFingerprintDaemon getFingerprintDaemon() { if (mDaemon == null) { mDaemon = IFingerprintDaemon.Stub.asInterface(ServiceManager.getService(FINGERPRINTD)); - if (mDaemon == null) { - Slog.w(TAG, "fingerprind service not available"); - } else { + if (mDaemon != null) { try { mDaemon.asBinder().linkToDeath(this, 0); - } catch (RemoteException e) { - Slog.w(TAG, "caught remote exception in linkToDeath: ", e); - mDaemon = null; // try again! + mDaemon.init(mDaemonCallback); + mHalDeviceId = mDaemon.openHal(); + if (mHalDeviceId != 0) { + updateActiveGroup(ActivityManager.getCurrentUser()); + } else { + Slog.w(TAG, "Failed to open Fingerprint HAL!"); + mDaemon = null; + } + } catch (RemoteException e) { + Slog.e(TAG, "Failed to open fingeprintd HAL", e); + mDaemon = null; // try again later! } + } else { + Slog.w(TAG, "fingerprint service not available"); } } return mDaemon; @@ -155,7 +164,6 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe protected void dispatchRemoved(long deviceId, int fingerId, int groupId) { final ClientMonitor client = mRemoveClient; if (fingerId != 0) { - ContentResolver res = mContext.getContentResolver(); removeTemplateForUser(mRemoveClient, fingerId); } if (client != null && client.sendRemoved(fingerId, groupId)) { @@ -813,15 +821,6 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe public void onStart() { publishBinderService(Context.FINGERPRINT_SERVICE, new FingerprintServiceWrapper()); IFingerprintDaemon daemon = getFingerprintDaemon(); - if (daemon != null) { - try { - daemon.init(mDaemonCallback); - mHalDeviceId = daemon.openHal(); - updateActiveGroup(ActivityManager.getCurrentUser()); - } catch (RemoteException e) { - Slog.e(TAG, "Failed to open fingeprintd HAL", e); - } - } if (DEBUG) Slog.v(TAG, "Fingerprint HAL id: " + mHalDeviceId); listenForUserSwitches(); } |