Close the session if Fingerprint servers die

by registering the death notification of the associated binder.
Bug: 273807765
Test: adb shell stop;adb shell start

Change-Id: Ifc60e68fdbf986a355f828a7fc11f2aecee4cbea
diff --git a/biometrics/fingerprint/aidl/default/include/Session.h b/biometrics/fingerprint/aidl/default/include/Session.h
index b596d9e..526d579 100644
--- a/biometrics/fingerprint/aidl/default/include/Session.h
+++ b/biometrics/fingerprint/aidl/default/include/Session.h
@@ -42,6 +42,8 @@
     RESETTING_LOCKOUT,
 };
 
+void onClientDeath(void* cookie);
+
 class Session : public BnSession {
   public:
     Session(int sensorId, int userId, std::shared_ptr<ISessionCallback> cb,
@@ -101,6 +103,8 @@
 
     ndk::ScopedAStatus setIgnoreDisplayTouches(bool shouldIgnore) override;
 
+    binder_status_t linkToDeath(AIBinder* binder);
+
     bool isClosed();
 
   private:
@@ -139,6 +143,9 @@
     // modified from both the main and the worker threads.
     std::atomic<SessionState> mScheduledState;
     std::atomic<SessionState> mCurrentState;
+
+    // Binder death handler.
+    AIBinder_DeathRecipient* mDeathRecipient;
 };
 
 }  // namespace aidl::android::hardware::biometrics::fingerprint