Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71d04218 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

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
parent 3f8237f3
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -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 =