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

Commit 6b2ccdc2 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala Committed by Android Git Automerger
Browse files

am 6dee203a: am 6faa3aca: Merge "Camera2: LEGACY: Support prepare(), sort of." into mnc-dev

* commit '6dee203a':
  Camera2: LEGACY: Support prepare(), sort of.
parents cae8686c 6dee203a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -114,6 +114,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>{@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
     * done.</p>
     *
     * @param surface the output Surface for which buffers should be pre-allocated. Must be one of
     * the output Surfaces used to create this session.
     *
+12 −2
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ public class CameraDeviceUserShim implements ICameraDeviceUser {
        private static final int CAMERA_IDLE = 1;
        private static final int CAPTURE_STARTED = 2;
        private static final int RESULT_RECEIVED = 3;
        private static final int PREPARED = 4;

        private final HandlerThread mHandlerThread;
        private Handler mHandler;
@@ -253,7 +254,9 @@ public class CameraDeviceUserShim implements ICameraDeviceUser {

        @Override
        public void onPrepared(int streamId) {
            // TODO
            Message msg = getHandler().obtainMessage(PREPARED,
                    /*arg1*/ streamId, /*arg2*/ 0);
            getHandler().sendMessage(msg);
        }

        @Override
@@ -301,6 +304,11 @@ public class CameraDeviceUserShim implements ICameraDeviceUser {
                            mCallbacks.onResultReceived(result, resultExtras);
                            break;
                        }
                        case PREPARED: {
                            int streamId = msg.arg1;
                            mCallbacks.onPrepared(streamId);
                            break;
                        }
                        default:
                            throw new IllegalArgumentException(
                                "Unknown callback message " + msg.what);
@@ -631,7 +639,9 @@ public class CameraDeviceUserShim implements ICameraDeviceUser {
            return CameraBinderDecorator.ENODEV;
        }

        // TODO: Implement and fire callback
        // LEGACY doesn't support actual prepare, just signal success right away
        mCameraCallbacks.onPrepared(streamId);

        return CameraBinderDecorator.NO_ERROR;
    }