Camera: Always release the extension session after configuration

Since both the session 'onConfigured' callback and the
initialization session callback run within the same Handler
thread, it is possible for the 'onSuccess' callback to fail
to execute if there is another thread the releases the
extension session and quits the thread.
Ensure that the extension session is released also when we
have a valid capture session.

Bug: 270276341
Test: atest -c -d
cts/tests/camera/src/android/hardware/camera2/cts/CameraExtensionSessionTest.java

Change-Id: I03fd9b2859ae8919ca89c823fed973853030bc5f
This commit is contained in:
Emilian Peev
2023-03-15 10:56:32 -07:00
parent 370fbcc548
commit d8983d671e
2 changed files with 2 additions and 2 deletions

View File

@@ -542,7 +542,7 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
if (mExtensionClientId >= 0) {
CameraExtensionCharacteristics.unregisterClient(mExtensionClientId);
if (mInitialized) {
if (mInitialized || (mCaptureSession != null)) {
notifyClose = true;
CameraExtensionCharacteristics.releaseSession();
}

View File

@@ -840,7 +840,7 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession {
if (mExtensionClientId >= 0) {
CameraExtensionCharacteristics.unregisterClient(mExtensionClientId);
if (mInitialized) {
if (mInitialized || (mCaptureSession != null)) {
notifyClose = true;
CameraExtensionCharacteristics.releaseSession();
}