summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/system-current.txt4
-rw-r--r--api/test-current.txt4
-rw-r--r--core/java/android/hardware/camera2/CameraDevice.java82
-rw-r--r--core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java3
-rw-r--r--core/java/android/hardware/camera2/impl/CameraDeviceImpl.java38
-rw-r--r--core/java/android/hardware/camera2/impl/ICameraDeviceUserWrapper.java4
-rw-r--r--core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java8
7 files changed, 128 insertions, 15 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index 57848538d4fc..7341380e6c06 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -15613,10 +15613,14 @@ package android.hardware.camera2 {
method public abstract void createCaptureSession(java.util.List<android.view.Surface>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract void createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract void createConstrainedHighSpeedCaptureSession(java.util.List<android.view.Surface>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+ method public abstract void createCustomCaptureSession(android.hardware.camera2.params.InputConfiguration, java.util.List<android.hardware.camera2.params.OutputConfiguration>, int, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract android.hardware.camera2.CaptureRequest.Builder createReprocessCaptureRequest(android.hardware.camera2.TotalCaptureResult) throws android.hardware.camera2.CameraAccessException;
method public abstract void createReprocessableCaptureSession(android.hardware.camera2.params.InputConfiguration, java.util.List<android.view.Surface>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract void createReprocessableCaptureSessionByConfigurations(android.hardware.camera2.params.InputConfiguration, java.util.List<android.hardware.camera2.params.OutputConfiguration>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract java.lang.String getId();
+ field public static final int SESSION_OPERATION_MODE_CONSTRAINED_HIGH_SPEED = 1; // 0x1
+ field public static final int SESSION_OPERATION_MODE_NORMAL = 0; // 0x0
+ field public static final int SESSION_OPERATION_MODE_VENDOR_START = 32768; // 0x8000
field public static final int TEMPLATE_MANUAL = 6; // 0x6
field public static final int TEMPLATE_PREVIEW = 1; // 0x1
field public static final int TEMPLATE_RECORD = 3; // 0x3
diff --git a/api/test-current.txt b/api/test-current.txt
index 32312f25e0f6..46485d626597 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -14927,10 +14927,14 @@ package android.hardware.camera2 {
method public abstract void createCaptureSession(java.util.List<android.view.Surface>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract void createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract void createConstrainedHighSpeedCaptureSession(java.util.List<android.view.Surface>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+ method public abstract void createCustomCaptureSession(android.hardware.camera2.params.InputConfiguration, java.util.List<android.hardware.camera2.params.OutputConfiguration>, int, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract android.hardware.camera2.CaptureRequest.Builder createReprocessCaptureRequest(android.hardware.camera2.TotalCaptureResult) throws android.hardware.camera2.CameraAccessException;
method public abstract void createReprocessableCaptureSession(android.hardware.camera2.params.InputConfiguration, java.util.List<android.view.Surface>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract void createReprocessableCaptureSessionByConfigurations(android.hardware.camera2.params.InputConfiguration, java.util.List<android.hardware.camera2.params.OutputConfiguration>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract java.lang.String getId();
+ field public static final int SESSION_OPERATION_MODE_CONSTRAINED_HIGH_SPEED = 1; // 0x1
+ field public static final int SESSION_OPERATION_MODE_NORMAL = 0; // 0x0
+ field public static final int SESSION_OPERATION_MODE_VENDOR_START = 32768; // 0x8000
field public static final int TEMPLATE_MANUAL = 6; // 0x6
field public static final int TEMPLATE_PREVIEW = 1; // 0x1
field public static final int TEMPLATE_RECORD = 3; // 0x3
diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java
index 45cd084d5268..493ed8cda1a9 100644
--- a/core/java/android/hardware/camera2/CameraDevice.java
+++ b/core/java/android/hardware/camera2/CameraDevice.java
@@ -19,6 +19,10 @@ package android.hardware.camera2;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.IntDef;
+import android.annotation.SystemApi;
+import android.annotation.TestApi;
+import static android.hardware.camera2.ICameraDeviceUser.NORMAL_MODE;
+import static android.hardware.camera2.ICameraDeviceUser.CONSTRAINED_HIGH_SPEED_MODE;
import android.hardware.camera2.params.InputConfiguration;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.hardware.camera2.params.OutputConfiguration;
@@ -719,6 +723,84 @@ public abstract class CameraDevice implements AutoCloseable {
throws CameraAccessException;
/**
+ * Standard camera operation mode.
+ *
+ * @see #createCustomCaptureSession
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public static final int SESSION_OPERATION_MODE_NORMAL =
+ ICameraDeviceUser.NORMAL_MODE;
+
+ /**
+ * Constrained high-speed operation mode.
+ *
+ * @see #createCustomCaptureSession
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public static final int SESSION_OPERATION_MODE_CONSTRAINED_HIGH_SPEED =
+ ICameraDeviceUser.CONSTRAINED_HIGH_SPEED_MODE;
+
+ /**
+ * First vendor-specific operating mode
+ *
+ * @see #createCustomCaptureSession
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public static final int SESSION_OPERATION_MODE_VENDOR_START =
+ ICameraDeviceUser.VENDOR_MODE_START;
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(
+ {SESSION_OPERATION_MODE_NORMAL,
+ SESSION_OPERATION_MODE_CONSTRAINED_HIGH_SPEED,
+ SESSION_OPERATION_MODE_VENDOR_START})
+ public @interface SessionOperatingMode {};
+
+ /**
+ * Create a new camera capture session with a custom operating mode.
+ *
+ * @param inputConfig The configuration for the input {@link Surface} if a reprocessing session
+ * is desired, or {@code null} otherwise.
+ * @param outputs The new set of {@link OutputConfiguration OutputConfigurations} that should be
+ * made available as targets for captured image data.
+ * @param operatingMode The custom operating mode to use; a nonnegative value, either a custom
+ * vendor value or one of the SESSION_OPERATION_MODE_* values.
+ * @param callback The callback to notify about the status of the new capture session.
+ * @param handler The handler on which the callback should be invoked, or {@code null} to use
+ * the current thread's {@link android.os.Looper looper}.
+ *
+ * @throws IllegalArgumentException if the input configuration is null or not supported, the set
+ * of output Surfaces do not meet the requirements, the
+ * callback is null, or the handler is null but the current
+ * thread has no looper.
+ * @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 #createCaptureSession
+ * @see #createReprocessableCaptureSession
+ * @see CameraCaptureSession
+ * @see OutputConfiguration
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public abstract void createCustomCaptureSession(
+ InputConfiguration inputConfig,
+ @NonNull List<OutputConfiguration> outputs,
+ @SessionOperatingMode int operatingMode,
+ @NonNull CameraCaptureSession.StateCallback callback,
+ @Nullable Handler handler)
+ throws CameraAccessException;
+
+ /**
* <p>Create a {@link CaptureRequest.Builder} for new capture requests,
* initialized with template for a target use case. The settings are chosen
* to be the best options for the specific camera device, so it is not
diff --git a/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java b/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
index 891df6362d29..16ffee02b94d 100644
--- a/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
+++ b/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
@@ -19,6 +19,7 @@ import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CaptureRequest;
+import android.hardware.camera2.ICameraDeviceUser;
import android.hardware.camera2.dispatch.ArgumentReplacingDispatcher;
import android.hardware.camera2.dispatch.BroadcastDispatcher;
import android.hardware.camera2.dispatch.DuckTypingDispatcher;
@@ -742,7 +743,7 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession
try {
// begin transition to unconfigured
mDeviceImpl.configureStreamsChecked(/*inputConfig*/null, /*outputs*/null,
- /*isConstrainedHighSpeed*/false);
+ /*operatingMode*/ ICameraDeviceUser.NORMAL_MODE);
} catch (CameraAccessException e) {
// OK: do not throw checked exceptions.
Log.e(TAG, mIdString + "Exception while unconfiguring outputs: ", e);
diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
index 2364ebe0f891..8bc65af65ef1 100644
--- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
+++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
@@ -356,7 +356,7 @@ public class CameraDeviceImpl extends CameraDevice
outputConfigs.add(new OutputConfiguration(s));
}
configureStreamsChecked(/*inputConfig*/null, outputConfigs,
- /*isConstrainedHighSpeed*/false);
+ /*operatingMode*/ICameraDeviceUser.NORMAL_MODE);
}
@@ -374,13 +374,14 @@ public class CameraDeviceImpl extends CameraDevice
*
* @param inputConfig input configuration or {@code null} for no input
* @param outputs a list of one or more surfaces, or {@code null} to unconfigure
- * @param isConstrainedHighSpeed If the streams configuration is for constrained high speed output.
+ * @param operatingMode If the stream configuration is for a normal session,
+ * a constrained high speed session, or something else.
* @return whether or not the configuration was successful
*
* @throws CameraAccessException if there were any unexpected problems during configuration
*/
public boolean configureStreamsChecked(InputConfiguration inputConfig,
- List<OutputConfiguration> outputs, boolean isConstrainedHighSpeed)
+ List<OutputConfiguration> outputs, int operatingMode)
throws CameraAccessException {
// Treat a null input the same an empty list
if (outputs == null) {
@@ -456,7 +457,7 @@ public class CameraDeviceImpl extends CameraDevice
}
}
- mRemoteDevice.endConfigure(isConstrainedHighSpeed);
+ mRemoteDevice.endConfigure(operatingMode);
success = true;
} catch (IllegalArgumentException e) {
@@ -492,7 +493,7 @@ public class CameraDeviceImpl extends CameraDevice
outConfigurations.add(new OutputConfiguration(surface));
}
createCaptureSessionInternal(null, outConfigurations, callback, handler,
- /*isConstrainedHighSpeed*/false);
+ /*operatingMode*/ICameraDeviceUser.NORMAL_MODE);
}
@Override
@@ -508,7 +509,7 @@ public class CameraDeviceImpl extends CameraDevice
List<OutputConfiguration> currentOutputs = new ArrayList<>(outputConfigurations);
createCaptureSessionInternal(null, currentOutputs, callback, handler,
- /*isConstrainedHighSpeed*/false);
+ /*operatingMode*/ICameraDeviceUser.NORMAL_MODE);
}
@Override
@@ -528,7 +529,7 @@ public class CameraDeviceImpl extends CameraDevice
outConfigurations.add(new OutputConfiguration(surface));
}
createCaptureSessionInternal(inputConfig, outConfigurations, callback, handler,
- /*isConstrainedHighSpeed*/false);
+ /*operatingMode*/ICameraDeviceUser.NORMAL_MODE);
}
@Override
@@ -556,7 +557,7 @@ public class CameraDeviceImpl extends CameraDevice
currentOutputs.add(new OutputConfiguration(output));
}
createCaptureSessionInternal(inputConfig, currentOutputs,
- callback, handler, /*isConstrainedHighSpeed*/false);
+ callback, handler, /*operatingMode*/ICameraDeviceUser.NORMAL_MODE);
}
@Override
@@ -576,13 +577,26 @@ public class CameraDeviceImpl extends CameraDevice
outConfigurations.add(new OutputConfiguration(surface));
}
createCaptureSessionInternal(null, outConfigurations, callback, handler,
- /*isConstrainedHighSpeed*/true);
+ /*operatingMode*/ICameraDeviceUser.CONSTRAINED_HIGH_SPEED_MODE);
+ }
+
+ @Override
+ public void createCustomCaptureSession(InputConfiguration inputConfig,
+ List<OutputConfiguration> outputs,
+ int operatingMode,
+ android.hardware.camera2.CameraCaptureSession.StateCallback callback,
+ Handler handler) throws CameraAccessException {
+ List<OutputConfiguration> currentOutputs = new ArrayList<OutputConfiguration>();
+ for (OutputConfiguration output : outputs) {
+ currentOutputs.add(new OutputConfiguration(output));
+ }
+ createCaptureSessionInternal(inputConfig, currentOutputs, callback, handler, operatingMode);
}
private void createCaptureSessionInternal(InputConfiguration inputConfig,
List<OutputConfiguration> outputConfigurations,
CameraCaptureSession.StateCallback callback, Handler handler,
- boolean isConstrainedHighSpeed) throws CameraAccessException {
+ int operatingMode) throws CameraAccessException {
synchronized(mInterfaceLock) {
if (DEBUG) {
Log.d(TAG, "createCaptureSessionInternal");
@@ -590,6 +604,8 @@ public class CameraDeviceImpl extends CameraDevice
checkIfCameraClosedOrInError();
+ boolean isConstrainedHighSpeed =
+ (operatingMode == ICameraDeviceUser.CONSTRAINED_HIGH_SPEED_MODE);
if (isConstrainedHighSpeed && inputConfig != null) {
throw new IllegalArgumentException("Constrained high speed session doesn't support"
+ " input configuration yet.");
@@ -608,7 +624,7 @@ public class CameraDeviceImpl extends CameraDevice
try {
// configure streams and then block until IDLE
configureSuccess = configureStreamsChecked(inputConfig, outputConfigurations,
- isConstrainedHighSpeed);
+ operatingMode);
if (configureSuccess == true && inputConfig != null) {
input = mRemoteDevice.getInputSurface();
}
diff --git a/core/java/android/hardware/camera2/impl/ICameraDeviceUserWrapper.java b/core/java/android/hardware/camera2/impl/ICameraDeviceUserWrapper.java
index d9f666e54330..27087a2e4881 100644
--- a/core/java/android/hardware/camera2/impl/ICameraDeviceUserWrapper.java
+++ b/core/java/android/hardware/camera2/impl/ICameraDeviceUserWrapper.java
@@ -106,9 +106,9 @@ public class ICameraDeviceUserWrapper {
}
}
- public void endConfigure(boolean isConstrainedHighSpeed) throws CameraAccessException {
+ public void endConfigure(int operatingMode) throws CameraAccessException {
try {
- mRemoteDevice.endConfigure(isConstrainedHighSpeed);
+ mRemoteDevice.endConfigure(operatingMode);
} catch (Throwable t) {
CameraManager.throwAsPublicException(t);
throw new UnsupportedOperationException("Unexpected exception", t);
diff --git a/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java b/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java
index d8ec4df504bb..f87d8c1401c5 100644
--- a/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java
+++ b/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java
@@ -497,7 +497,7 @@ public class CameraDeviceUserShim implements ICameraDeviceUser {
}
@Override
- public void endConfigure(boolean isConstrainedHighSpeed) {
+ public void endConfigure(int operatingMode) {
if (DEBUG) {
Log.d(TAG, "endConfigure called.");
}
@@ -507,6 +507,12 @@ public class CameraDeviceUserShim implements ICameraDeviceUser {
throw new ServiceSpecificException(ICameraService.ERROR_DISCONNECTED, err);
}
+ if (operatingMode != ICameraDeviceUser.NORMAL_MODE) {
+ String err = "LEGACY devices do not support this operating mode";
+ Log.e(TAG, err);
+ throw new ServiceSpecificException(ICameraService.ERROR_ILLEGAL_ARGUMENT, err);
+ }
+
SparseArray<Surface> surfaces = null;
synchronized(mConfigureLock) {
if (!mConfiguring) {