Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de95aafa authored by Shuzhen Wang's avatar Shuzhen Wang
Browse files

Camera: legecy: disconnect JPEG surface at exit

Test: Camera CTS on Pixel 1 with HAL1 enabled on nyc-mr2
Bug: 128600230
Change-Id: Ide5acf3117c178029c187ed4ad9d270878c220be
parent 91498b70
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -333,6 +333,16 @@ public class RequestThreadManager {
        startPreview();
    }

    private void disconnectCallbackSurfaces() {
        for (Surface s : mCallbackOutputs) {
            try {
                LegacyCameraDevice.disconnectSurface(s);
            } catch (LegacyExceptionUtils.BufferQueueAbandonedException e) {
                Log.d(TAG, "Surface abandoned, skipping...", e);
            }
        }
    }

    private void configureOutputs(Collection<Pair<Surface, Size>> outputs) {
        if (DEBUG) {
            String outputsStr = outputs == null ? "null" : (outputs.size() + " surfaces");
@@ -370,14 +380,8 @@ public class RequestThreadManager {
            mGLThreadManager.waitUntilIdle();
        }
        resetJpegSurfaceFormats(mCallbackOutputs);
        disconnectCallbackSurfaces();

        for (Surface s : mCallbackOutputs) {
            try {
                LegacyCameraDevice.disconnectSurface(s);
            } catch (LegacyExceptionUtils.BufferQueueAbandonedException e) {
                Log.w(TAG, "Surface abandoned, skipping...", e);
            }
        }
        mPreviewOutputs.clear();
        mCallbackOutputs.clear();
        mJpegSurfaceIds.clear();
@@ -972,11 +976,11 @@ public class RequestThreadManager {
                        mGLThreadManager.quit();
                        mGLThreadManager = null;
                    }
                    disconnectCallbackSurfaces();
                    if (mCamera != null) {
                        mCamera.release();
                        mCamera = null;
                    }
                    resetJpegSurfaceFormats(mCallbackOutputs);
                    break;
                case RequestHandlerThread.MSG_POKE_IDLE_HANDLER:
                    // OK: Ignore message.