Keep a strong pointer to Session in the HAL

If the client who's holding the other end of the Session goes away
prematurely, the Session will have 0 strong references and will be
destructed. That can cause a crash because the worker thread might
still be working on a task that's referencing the Session's resources.

By keeping a strong pointer to the Session in the HAL, we make sure that
even if the client disappears, the tasks can gracefully finish.

One small issue with this is that the Session's resources will not be
freed until a new session is requested. This may need to be revised if
we subscribe to client's binder death.

The VTS test no longer crashes, but fails due to another unrelated
issue.

Bug: 181184674
Test: atest VtsHalBiometricsFingerprintTargetTest
Change-Id: Ic0eafa525a7f714d26946db7c9b4ee5793f531e6
diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
index 67dc34f..8028089 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
@@ -57,12 +57,10 @@
 ndk::ScopedAStatus Fingerprint::createSession(int32_t sensorId, int32_t userId,
                                               const std::shared_ptr<ISessionCallback>& cb,
                                               std::shared_ptr<ISession>* out) {
-    auto sessionSp = mSession.lock();
-    CHECK(sessionSp == nullptr || sessionSp->isClosed()) << "Open session already exists!";
+    CHECK(mSession == nullptr || mSession->isClosed()) << "Open session already exists!";
 
-    auto session = SharedRefBase::make<Session>(sensorId, userId, cb, mEngine.get(), &mWorker);
-    mSession = session;
-    *out = session;
+    mSession = SharedRefBase::make<Session>(sensorId, userId, cb, mEngine.get(), &mWorker);
+    *out = mSession;
     return ndk::ScopedAStatus::ok();
 }