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/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
index 7808a13..f00a49d 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
@@ -103,6 +103,8 @@
mSession = SharedRefBase::make<Session>(sensorId, userId, cb, mEngine.get(), &mWorker);
*out = mSession;
+ mSession->linkToDeath(cb->asBinder().get());
+
LOG(INFO) << "createSession: sensorId:" << sensorId << " userId:" << userId;
return ndk::ScopedAStatus::ok();
}