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

Commit c94a8322 authored by Igor Murashkin's avatar Igor Murashkin Committed by Android Git Automerger
Browse files

am 5b65ad41: am ab98a0b1: Merge "camera2: Add more camera device states, make...

am 5b65ad41: am ab98a0b1: Merge "camera2: Add more camera device states, make #openCamera async." into klp-dev

* commit '5b65ad41':
  camera2: Add more camera device states, make #openCamera async.
parents fb339b8a 5b65ad41
Loading
Loading
Loading
Loading
+22 −16
Original line number Diff line number Diff line
@@ -10887,22 +10887,20 @@ package android.hardware.camera2 {
    ctor public CameraAccessException(int, java.lang.String, java.lang.Throwable);
    ctor public CameraAccessException(int, java.lang.Throwable);
    method public final int getReason();
    field public static final int CAMERA_DISABLED = 3; // 0x3
    field public static final int CAMERA_DISCONNECTED = 4; // 0x4
    field public static final int CAMERA_IN_USE = 1; // 0x1
    field public static final int MAX_CAMERAS_IN_USE = 2; // 0x2
    field public static final int CAMERA_DISABLED = 1; // 0x1
    field public static final int CAMERA_DISCONNECTED = 2; // 0x2
    field public static final int CAMERA_ERROR = 3; // 0x3
  }
  public abstract interface CameraDevice implements java.lang.AutoCloseable {
    method public abstract void capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void captureBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void close() throws java.lang.Exception;
    method public abstract void close();
    method public abstract void configureOutputs(java.util.List<android.view.Surface>) throws android.hardware.camera2.CameraAccessException;
    method public abstract android.hardware.camera2.CaptureRequest.Builder createCaptureRequest(int) throws android.hardware.camera2.CameraAccessException;
    method public abstract void flush() throws android.hardware.camera2.CameraAccessException;
    method public abstract java.lang.String getId();
    method public abstract android.hardware.camera2.CameraProperties getProperties() throws android.hardware.camera2.CameraAccessException;
    method public abstract void setDeviceListener(android.hardware.camera2.CameraDevice.CameraDeviceListener, android.os.Handler);
    method public abstract void setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void stopRepeating() throws android.hardware.camera2.CameraAccessException;
@@ -10913,15 +10911,6 @@ package android.hardware.camera2 {
    field public static final int TEMPLATE_VIDEO_SNAPSHOT = 4; // 0x4
  }
  public static abstract class CameraDevice.CameraDeviceListener {
    ctor public CameraDevice.CameraDeviceListener();
    method public void onCameraDisconnected(android.hardware.camera2.CameraDevice);
    method public void onCameraError(android.hardware.camera2.CameraDevice, int);
    method public void onCameraIdle(android.hardware.camera2.CameraDevice);
    field public static final int ERROR_CAMERA_DEVICE = 1; // 0x1
    field public static final int ERROR_CAMERA_SERVICE = 2; // 0x2
  }
  public static abstract class CameraDevice.CaptureListener {
    ctor public CameraDevice.CaptureListener();
    method public void onCaptureCompleted(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureResult);
@@ -10929,11 +10918,28 @@ package android.hardware.camera2 {
    method public void onCaptureStarted(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, long);
  }
  public static abstract class CameraDevice.StateListener {
    ctor public CameraDevice.StateListener();
    method public void onActive(android.hardware.camera2.CameraDevice);
    method public void onBusy(android.hardware.camera2.CameraDevice);
    method public void onClosed(android.hardware.camera2.CameraDevice);
    method public abstract void onDisconnected(android.hardware.camera2.CameraDevice);
    method public abstract void onError(android.hardware.camera2.CameraDevice, int);
    method public void onIdle(android.hardware.camera2.CameraDevice);
    method public abstract void onOpened(android.hardware.camera2.CameraDevice);
    method public void onUnconfigured(android.hardware.camera2.CameraDevice);
    field public static final int ERROR_CAMERA_DEVICE = 4; // 0x4
    field public static final int ERROR_CAMERA_DISABLED = 3; // 0x3
    field public static final int ERROR_CAMERA_IN_USE = 1; // 0x1
    field public static final int ERROR_CAMERA_SERVICE = 5; // 0x5
    field public static final int ERROR_MAX_CAMERAS_IN_USE = 2; // 0x2
  }
  public final class CameraManager {
    method public void addAvailabilityListener(android.hardware.camera2.CameraManager.AvailabilityListener, android.os.Handler);
    method public java.lang.String[] getCameraIdList() throws android.hardware.camera2.CameraAccessException;
    method public android.hardware.camera2.CameraProperties getCameraProperties(java.lang.String) throws android.hardware.camera2.CameraAccessException;
    method public android.hardware.camera2.CameraDevice openCamera(java.lang.String) throws android.hardware.camera2.CameraAccessException;
    method public void openCamera(java.lang.String, android.hardware.camera2.CameraDevice.StateListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public void removeAvailabilityListener(android.hardware.camera2.CameraManager.AvailabilityListener);
  }
+30 −10
Original line number Diff line number Diff line
@@ -29,22 +29,24 @@ import android.util.AndroidException;
public class CameraAccessException extends AndroidException {
    /**
     * The camera device is in use already
     * @hide
     */
    public static final int CAMERA_IN_USE = 1;
    public static final int CAMERA_IN_USE = 4;

    /**
     * The system-wide limit for number of open cameras has been reached,
     * and more camera devices cannot be opened until previous instances are
     * closed.
     * @hide
     */
    public static final int MAX_CAMERAS_IN_USE = 2;
    public static final int MAX_CAMERAS_IN_USE = 5;

    /**
     * The camera is disabled due to a device policy, and cannot be opened.
     *
     * @see android.app.admin.DevicePolicyManager#setCameraDisabled(android.content.ComponentName, boolean)
     */
    public static final int CAMERA_DISABLED = 3;
    public static final int CAMERA_DISABLED = 1;

    /**
     * The camera device is removable and has been disconnected from the Android
@@ -52,7 +54,23 @@ public class CameraAccessException extends AndroidException {
     * is no longer valid, or the camera service has shut down the connection due to a
     * higher-priority access request for the camera device.
     */
    public static final int CAMERA_DISCONNECTED = 4;
    public static final int CAMERA_DISCONNECTED = 2;

    /**
     * The camera device is currently in the error state.
     *
     * <p>The camera has failed to open or has failed at a later time
     * as a result of some non-user interaction. Refer to
     * {@link CameraDevice.StateListener#onError} for the exact
     * nature of the error.</p>
     *
     * <p>No further calls to the camera will succeed. Clean up
     * the camera with {@link CameraDevice#close} and try
     * handling the error in order to successfully re-open the camera.
     * </p>
     *
     */
    public static final int CAMERA_ERROR = 3;

    /**
     * A deprecated HAL version is in use.
@@ -68,10 +86,9 @@ public class CameraAccessException extends AndroidException {
    /**
     * The reason for the failure to access the camera.
     *
     * @see #CAMERA_IN_USE
     * @see #MAX_CAMERAS_IN_USE
     * @see #CAMERA_DISABLED
     * @see #CAMERA_DISCONNECTED
     * @see #CAMERA_ERROR
     */
    public final int getReason() {
        return mReason;
@@ -105,12 +122,15 @@ public class CameraAccessException extends AndroidException {
                return "The system-wide limit for number of open cameras has been reached, " +
                       "and more camera devices cannot be opened until previous instances " +
                       "are closed.";
            case CAMERA_DISCONNECTED:
                return "The camera device is removable and has been disconnected from the " +
                        "Android device, or the camera service has shut down the connection due " +
                        "to a higher-priority access request for the camera device.";
            case CAMERA_DISABLED:
                return "The camera is disabled due to a device policy, and cannot be opened.";
            case CAMERA_DISCONNECTED:
                return "The camera device is removable and has been disconnected from the Android" +
                       " device, or the camera service has shut down the connection due to a " +
                       "higher-priority access request for the camera device.";
            case CAMERA_ERROR:
                return "The camera device is currently in the error state; " +
                       "no further calls to it will succeed.";
        }
        return null;
    }