Camera: Fix offline session close locking

The HIDL/AIDL session close is expected to trigger processCaptureResult
callbacks. Currently both methods will try to acquire the same
'mLock' which can result in a potential deadlock.
Revert back to the previous locking scheme where session close and
release are synchronized via 'mInterfaceLock' and 'mLock'
respectively.
Additionally handle failing offline client registration by
ensuring that the client is initialized before it gets released.
This will allow CameraHals to return/fail any pending offline
requests.

Bug: 267723307
Test: Camera CTS

Change-Id: Ib55d654bfa213ec2df0fc4590017f77c4492b28e
diff --git a/services/camera/libcameraservice/device3/Camera3OfflineSession.h b/services/camera/libcameraservice/device3/Camera3OfflineSession.h
index 5ee6ca5..e780043 100644
--- a/services/camera/libcameraservice/device3/Camera3OfflineSession.h
+++ b/services/camera/libcameraservice/device3/Camera3OfflineSession.h
@@ -274,7 +274,12 @@
     void setErrorStateLockedV(const char *fmt, va_list args);
 
     status_t disconnectImpl();
-    virtual void disconnectSession() = 0;
+
+    // Clients need to ensure that 'mInterfaceLock' is acquired before calling this method
+    virtual void closeSessionLocked() = 0;
+
+    // Clients need to ensure that 'mLock' is acquired before calling this method
+    virtual void releaseSessionLocked() = 0;
 
 }; // class Camera3OfflineSession