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

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

Camera: Send onPrepared callback to all shared surfaces

Test: Run testPrepareForSharedSurfaces
Bug: 34522408
Change-Id: I368021598a6212209c7edf00282d2a6f84629b4d
parent 6a10cba1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -118,6 +118,11 @@ public abstract class CameraCaptureSession implements AutoCloseable {
     * the Surface provided to prepare must not be used as a target of a CaptureRequest submitted
     * to this session.</p>
     *
     * <p>Note that if 2 surfaces share the same stream via {@link
     * OutputConfiguration#enableSurfaceSharing} and {@link OutputConfiguration#addSurface},
     * prepare() only needs to be called on one surface, and {link
     * StateCallback#onSurfacePrepared} will be triggered for both surfaces.</p>
     *
     * <p>{@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY}
     * devices cannot pre-allocate output buffers; for those devices,
     * {@link StateCallback#onSurfacePrepared} will be immediately called, and no preallocation is
+6 −4
Original line number Diff line number Diff line
@@ -708,7 +708,8 @@ public class CameraDeviceImpl extends CameraDevice
        synchronized(mInterfaceLock) {
            int streamId = -1;
            for (int i = 0; i < mConfiguredOutputs.size(); i++) {
                if (surface == mConfiguredOutputs.valueAt(i).getSurface()) {
                final List<Surface> surfaces = mConfiguredOutputs.valueAt(i).getSurfaces();
                if (surfaces.contains(surface)) {
                    streamId = mConfiguredOutputs.keyAt(i);
                    break;
                }
@@ -2020,10 +2021,11 @@ public class CameraDeviceImpl extends CameraDevice
                Log.w(TAG, "onPrepared invoked for unknown output Surface");
                return;
            }
            final Surface surface = output.getSurface();

            final List<Surface> surfaces = output.getSurfaces();
            for (Surface surface : surfaces) {
                sessionCallback.onSurfacePrepared(surface);
            }
        }

        @Override
        public void onRequestQueueEmpty() {