Release wakelock when binder died or exception occurs

Fixes: 73862644

Test: manual, fp lockout still behaves as expected
Test: manually extend wakelock timeout, kill sysui (adb shell pkill systemui)
      while wakelock is held; binderDied() log shows
Change-Id: Id8abe4ac5b45170cee0f108a274604b89b954505
This commit is contained in:
Kevin Chyn
2018-02-28 18:12:03 -08:00
parent 3f8237f356
commit 71d04218a7

View File

@@ -941,9 +941,7 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
@Override
public void sendResult(Bundle data) throws RemoteException {
if (mWakeLock.isHeld()) {
mWakeLock.release();
}
releaseWakelock();
}
});
} catch (DeadObjectException e) {
@@ -951,6 +949,7 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
mHandler.post(mRemoveCallbackRunnable);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to invoke onLockoutReset: ", e);
releaseWakelock();
}
}
}
@@ -958,9 +957,7 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
private final Runnable mRemoveCallbackRunnable = new Runnable() {
@Override
public void run() {
if (mWakeLock.isHeld()) {
mWakeLock.release();
}
releaseWakelock();
removeLockoutResetCallback(FingerprintServiceLockoutResetMonitor.this);
}
};
@@ -970,6 +967,12 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
Slog.e(TAG, "Lockout reset callback binder died");
mHandler.post(mRemoveCallbackRunnable);
}
private void releaseWakelock() {
if (mWakeLock.isHeld()) {
mWakeLock.release();
}
}
}
private IBiometricsFingerprintClientCallback mDaemonCallback =