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

Commit da701967 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Camera: Enable API for dynamic camera output surfaces"

parents 5c0a517d 03233157
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -15278,6 +15278,7 @@ package android.hardware.camera2 {
    method public abstract int setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract int setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void stopRepeating() throws android.hardware.camera2.CameraAccessException;
    method public void updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration) throws android.hardware.camera2.CameraAccessException;
  }
  public static abstract class CameraCaptureSession.CaptureCallback {
@@ -15919,9 +15920,11 @@ package android.hardware.camera2.params {
    method public void addSurface(android.view.Surface);
    method public int describeContents();
    method public void enableSurfaceSharing();
    method public static int getMaxSharedSurfaceCount();
    method public android.view.Surface getSurface();
    method public int getSurfaceGroupId();
    method public java.util.List<android.view.Surface> getSurfaces();
    method public void removeSurface(android.view.Surface);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.camera2.params.OutputConfiguration> CREATOR;
    field public static final int SURFACE_GROUP_ID_NONE = -1; // 0xffffffff
+3 −0
Original line number Diff line number Diff line
@@ -16033,6 +16033,7 @@ package android.hardware.camera2 {
    method public abstract int setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract int setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void stopRepeating() throws android.hardware.camera2.CameraAccessException;
    method public void updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration) throws android.hardware.camera2.CameraAccessException;
  }
  public static abstract class CameraCaptureSession.CaptureCallback {
@@ -16680,10 +16681,12 @@ package android.hardware.camera2.params {
    method public void addSurface(android.view.Surface);
    method public int describeContents();
    method public void enableSurfaceSharing();
    method public static int getMaxSharedSurfaceCount();
    method public int getRotation();
    method public android.view.Surface getSurface();
    method public int getSurfaceGroupId();
    method public java.util.List<android.view.Surface> getSurfaces();
    method public void removeSurface(android.view.Surface);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.camera2.params.OutputConfiguration> CREATOR;
    field public static final int ROTATION_0 = 0; // 0x0
+3 −0
Original line number Diff line number Diff line
@@ -15420,6 +15420,7 @@ package android.hardware.camera2 {
    method public abstract int setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract int setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void stopRepeating() throws android.hardware.camera2.CameraAccessException;
    method public void updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration) throws android.hardware.camera2.CameraAccessException;
  }
  public static abstract class CameraCaptureSession.CaptureCallback {
@@ -16065,9 +16066,11 @@ package android.hardware.camera2.params {
    method public void addSurface(android.view.Surface);
    method public int describeContents();
    method public void enableSurfaceSharing();
    method public static int getMaxSharedSurfaceCount();
    method public android.view.Surface getSurface();
    method public int getSurfaceGroupId();
    method public java.util.List<android.view.Surface> getSurfaces();
    method public void removeSurface(android.view.Surface);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.camera2.params.OutputConfiguration> CREATOR;
    field public static final int SURFACE_GROUP_ID_NONE = -1; // 0xffffffff
+39 −1
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ public abstract class CameraCaptureSession implements AutoCloseable {
     * <p>This function can also be called in case where multiple surfaces share the same
     * OutputConfiguration, and one of the surfaces becomes available after the {@link
     * CameraCaptureSession} is created. In that case, the application must first create the
     * OutputConfiguration with the available Surface, then enable furture surface sharing via
     * OutputConfiguration with the available Surface, then enable further surface sharing via
     * {@link OutputConfiguration#enableSurfaceSharing}, before creating the CameraCaptureSession.
     * After the CameraCaptureSession is created, and once the extra Surface becomes available, the
     * application must then call {@link OutputConfiguration#addSurface} before finalizing the
@@ -644,6 +644,44 @@ public abstract class CameraCaptureSession implements AutoCloseable {
    @Nullable
    public abstract Surface getInputSurface();

    /**
     * Update {@link OutputConfiguration} after configuration finalization see
     * {@link #finalizeOutputConfigurations}.
     *
     * <p>Any {@link OutputConfiguration} that has been modified via calls to
     * {@link OutputConfiguration#addSurface} or {@link OutputConfiguration#removeSurface} must be
     * updated. After the update call returns without throwing exceptions any newly added surfaces
     * can be referenced in subsequent capture requests.</p>
     *
     * <p>Surfaces that get removed must not be part of any active repeating or single/burst
     * request or have any pending results. Consider updating any repeating requests first via
     * {@link #setRepeatingRequest} or {@link #setRepeatingBurst} and then wait for the last frame
     * number when the sequence completes {@link CaptureCallback#onCaptureSequenceCompleted}
     * before calling updateOutputConfiguration to remove a previously active Surface.</p>
     *
     * <p>Surfaces that get added must not be part of any other registered
     * {@link OutputConfiguration}.</p>
     *
     * @param config Modified output configuration.
     *
     * @throws CameraAccessException if the camera device is no longer connected or has
     *                               encountered a fatal error.
     * @throws IllegalArgumentException if an attempt was made to add a {@link Surface} already
     *                               in use by another buffer-producing API, such as MediaCodec or
     *                               a different camera device or {@link OutputConfiguration}; or
     *                               new surfaces are not compatible (see
     *                               {@link OutputConfiguration#enableSurfaceSharing}); or a
     *                               {@link Surface} that was removed from the modified
     *                               {@link OutputConfiguration} still has pending requests.
     * @throws IllegalStateException if this session is no longer active, either because the session
     *                               was explicitly closed, a new session has been created
     *                               or the camera device has been closed.
     */
    public void updateOutputConfiguration(OutputConfiguration config)
        throws CameraAccessException {
        throw new UnsupportedOperationException("Subclasses must override this method");
    }

    /**
     * Close this capture session asynchronously.
     *
+14 −0
Original line number Diff line number Diff line
@@ -313,6 +313,20 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession
        }
    }

    @Override
    public void updateOutputConfiguration(OutputConfiguration config)
            throws CameraAccessException {
        synchronized (mDeviceImpl.mInterfaceLock) {
            checkNotClosed();

            if (DEBUG) {
                Log.v(TAG, mIdString + "updateOutputConfiguration");
            }

            mDeviceImpl.updateOutputConfiguration(config);
        }
    }

    @Override
    public boolean isReprocessable() {
        return mInput != null;
Loading