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

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

Merge "Camera: update camera audio restriction API"

parents cabf141e 6262db5a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16906,9 +16906,10 @@ package android.hardware.camera2 {
    method @NonNull public abstract android.hardware.camera2.CaptureRequest.Builder createReprocessCaptureRequest(@NonNull android.hardware.camera2.TotalCaptureResult) throws android.hardware.camera2.CameraAccessException;
    method public abstract void createReprocessableCaptureSession(@NonNull android.hardware.camera2.params.InputConfiguration, @NonNull java.util.List<android.view.Surface>, @NonNull android.hardware.camera2.CameraCaptureSession.StateCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void createReprocessableCaptureSessionByConfigurations(@NonNull android.hardware.camera2.params.InputConfiguration, @NonNull java.util.List<android.hardware.camera2.params.OutputConfiguration>, @NonNull android.hardware.camera2.CameraCaptureSession.StateCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public int getCameraAudioRestriction() throws android.hardware.camera2.CameraAccessException;
    method @NonNull public abstract String getId();
    method public boolean isSessionConfigurationSupported(@NonNull android.hardware.camera2.params.SessionConfiguration) throws android.hardware.camera2.CameraAccessException;
    method public int setCameraAudioRestriction(int) throws android.hardware.camera2.CameraAccessException;
    method public void setCameraAudioRestriction(int) throws android.hardware.camera2.CameraAccessException;
    field public static final int AUDIO_RESTRICTION_NONE = 0; // 0x0
    field public static final int AUDIO_RESTRICTION_VIBRATION = 1; // 0x1
    field public static final int AUDIO_RESTRICTION_VIBRATION_SOUND = 3; // 0x3
+9 −2
Original line number Diff line number Diff line
@@ -2169,11 +2169,18 @@ public class Camera {
    }

    /**
     * Setting camera audio restriction mode.
     * Set camera audio restriction mode.
     *
     * @hide
     */
    public native final int setAudioRestriction(int mode);
    public native final void setAudioRestriction(int mode);

    /**
     * Get currently applied camera audio restriction mode.
     *
     * @hide
     */
    public native final int getAudioRestriction();

    /**
     * Image size (width and height dimensions).
+23 −5
Original line number Diff line number Diff line
@@ -1251,24 +1251,42 @@ public abstract class CameraDevice implements AutoCloseable {
     * are setting different modes, the system will pick a the mode that's union of
     * all modes set by CameraDevice.</p>
     *
     * <p>The mute settings will be automatically removed when the CameraDevice is closed or
     * the application is disconnected from the camera.</p>
     * <p>The mute settings from this CameraDevice will be automatically removed when the
     * CameraDevice is closed or the application is disconnected from the camera.</p>
     *
     * @param mode An enumeration selecting the audio restriction mode for this camera device.
     *
     * @return The system-wide mute mode setting resulting from this call
     *
     * @throws IllegalArgumentException if the mode is not supported
     *
     * @throws CameraAccessException if the camera device is no longer connected or has
     *                               encountered a fatal error
     * @throws IllegalStateException if the camera device has been closed
     *
     * @see #getCameraAudioRestriction
     */
    public @CAMERA_AUDIO_RESTRICTION int setCameraAudioRestriction(
    public void setCameraAudioRestriction(
            @CAMERA_AUDIO_RESTRICTION int mode) throws CameraAccessException {
        throw new UnsupportedOperationException("Subclasses must override this method");
    }

    /**
     * Get currently applied global camera audio restriction mode.
     *
     * <p>Application can use this method to retrieve the system-wide camera audio restriction
     * settings described in {@link #setCameraAudioRestriction}.</p>
     *
     * @return The system-wide mute mode setting resulting from this call
     *
     * @throws CameraAccessException if the camera device is no longer connected or has
     *                               encountered a fatal error
     * @throws IllegalStateException if the camera device has been closed
     *
     * @see #setCameraAudioRestriction
     */
    public @CAMERA_AUDIO_RESTRICTION int getCameraAudioRestriction() throws CameraAccessException {
        throw new UnsupportedOperationException("Subclasses must override this method");
    }

    /**
     * To be inherited by android.hardware.camera2.* code only.
     * @hide
+10 −2
Original line number Diff line number Diff line
@@ -2570,11 +2570,19 @@ public class CameraDeviceImpl extends CameraDevice
    }

    @Override
    public @CAMERA_AUDIO_RESTRICTION int setCameraAudioRestriction(
    public void setCameraAudioRestriction(
            @CAMERA_AUDIO_RESTRICTION int mode) throws CameraAccessException {
        synchronized(mInterfaceLock) {
            checkIfCameraClosedOrInError();
            return mRemoteDevice.setCameraAudioRestriction(mode);
            mRemoteDevice.setCameraAudioRestriction(mode);
        }
    }

    @Override
    public @CAMERA_AUDIO_RESTRICTION int getCameraAudioRestriction() throws CameraAccessException {
        synchronized(mInterfaceLock) {
            checkIfCameraClosedOrInError();
            return mRemoteDevice.getGlobalAudioRestriction();
        }
    }
}
+11 −2
Original line number Diff line number Diff line
@@ -258,9 +258,18 @@ public class ICameraDeviceUserWrapper {
        }
    }

    public int setCameraAudioRestriction(int mode) throws CameraAccessException {
    public void setCameraAudioRestriction(int mode) throws CameraAccessException {
        try {
            return mRemoteDevice.setCameraAudioRestriction(mode);
            mRemoteDevice.setCameraAudioRestriction(mode);
        } catch (Throwable t) {
            CameraManager.throwAsPublicException(t);
            throw new UnsupportedOperationException("Unexpected exception", t);
        }
    }

    public int getGlobalAudioRestriction() throws CameraAccessException {
        try {
            return mRemoteDevice.getGlobalAudioRestriction();
        } catch (Throwable t) {
            CameraManager.throwAsPublicException(t);
            throw new UnsupportedOperationException("Unexpected exception", t);
Loading