diff --git a/api/current.txt b/api/current.txt
index 7d4e2dbe8c2ea..2b667c0963481 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -12098,12 +12098,12 @@ package android.hardware.camera2 {
public static abstract class CameraCaptureSession.CaptureListener {
ctor public CameraCaptureSession.CaptureListener();
- method public void onCaptureCompleted(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, android.hardware.camera2.TotalCaptureResult);
- method public void onCaptureFailed(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureFailure);
- method public void onCaptureProgressed(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureResult);
- method public void onCaptureSequenceAborted(android.hardware.camera2.CameraDevice, int);
- method public void onCaptureSequenceCompleted(android.hardware.camera2.CameraDevice, int, long);
- method public void onCaptureStarted(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, long);
+ method public void onCaptureCompleted(android.hardware.camera2.CameraCaptureSession, android.hardware.camera2.CaptureRequest, android.hardware.camera2.TotalCaptureResult);
+ method public void onCaptureFailed(android.hardware.camera2.CameraCaptureSession, android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureFailure);
+ method public void onCaptureProgressed(android.hardware.camera2.CameraCaptureSession, android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureResult);
+ method public void onCaptureSequenceAborted(android.hardware.camera2.CameraCaptureSession, int);
+ method public void onCaptureSequenceCompleted(android.hardware.camera2.CameraCaptureSession, int, long);
+ method public void onCaptureStarted(android.hardware.camera2.CameraCaptureSession, android.hardware.camera2.CaptureRequest, long);
}
public static abstract class CameraCaptureSession.StateListener {
@@ -12190,7 +12190,7 @@ package android.hardware.camera2 {
method public final int hashCode();
}
- public abstract interface CameraDevice implements java.lang.AutoCloseable {
+ public abstract class CameraDevice implements java.lang.AutoCloseable {
method public abstract deprecated int capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method public abstract deprecated int captureBurst(java.util.List If the camera device configuration fails, then {@link #onConfigureFailed} will
* be invoked instead of this callback.
Otherwise, this callback will be invoked any time the session finishes processing * all of its active capture requests, and no repeating request or burst is set up.
* + * @param session the session returned by {@link CameraDevice#createCaptureSession} + * */ public void onReady(CameraCaptureSession session) { // default empty implementation @@ -410,6 +415,8 @@ public abstract class CameraCaptureSession implements AutoCloseable { * *If the session runs out of capture requests to process and calls {@link #onReady}, * then this callback will be invoked again once new requests are submitted for capture.
+ * + * @param session the session returned by {@link CameraDevice#createCaptureSession} */ public void onActive(CameraCaptureSession session) { // default empty implementation @@ -426,6 +433,8 @@ public abstract class CameraCaptureSession implements AutoCloseable { * any repeating requests or bursts are stopped (as if {@link #stopRepeating()} was called). * However, any in-progress capture requests submitted to the session will be completed * as normal. + * + * @param session the session returned by {@link CameraDevice#createCaptureSession} */ public void onClosed(CameraCaptureSession session) { // default empty implementation @@ -478,13 +487,13 @@ public abstract class CameraCaptureSession implements AutoCloseable { * *The default implementation of this method does nothing.
* - * @param camera the CameraDevice sending the callback + * @param session the session returned by {@link CameraDevice#createCaptureSession} * @param request the request for the capture that just begun * @param timestamp the timestamp at start of capture, in nanoseconds. * * @see android.media.MediaActionSound */ - public void onCaptureStarted(CameraDevice camera, + public void onCaptureStarted(CameraCaptureSession session, CaptureRequest request, long timestamp) { // default empty implementation } @@ -502,7 +511,7 @@ public abstract class CameraCaptureSession implements AutoCloseable { * *The default implementation of this method does nothing.
* - * @param camera The CameraDevice sending the callback. + * @param session the session returned by {@link CameraDevice#createCaptureSession} * @param request The request that was given to the CameraDevice * @param result The partial output metadata from the capture, which * includes a subset of the CaptureResult fields. @@ -514,7 +523,7 @@ public abstract class CameraCaptureSession implements AutoCloseable { * * @hide */ - public void onCapturePartial(CameraDevice camera, + public void onCapturePartial(CameraCaptureSession session, CaptureRequest request, CaptureResult result) { // default empty implementation } @@ -545,7 +554,7 @@ public abstract class CameraCaptureSession implements AutoCloseable { * *The default implementation of this method does nothing.
* - * @param camera The CameraDevice sending the callback. + * @param session the session returned by {@link CameraDevice#createCaptureSession} * @param request The request that was given to the CameraDevice * @param partialResult The partial output metadata from the capture, which * includes a subset of the {@link TotalCaptureResult} fields. @@ -555,7 +564,7 @@ public abstract class CameraCaptureSession implements AutoCloseable { * @see #setRepeatingRequest * @see #setRepeatingBurst */ - public void onCaptureProgressed(CameraDevice camera, + public void onCaptureProgressed(CameraCaptureSession session, CaptureRequest request, CaptureResult partialResult) { // default empty implementation } @@ -573,7 +582,7 @@ public abstract class CameraCaptureSession implements AutoCloseable { * *The default implementation of this method does nothing.
* - * @param camera The CameraDevice sending the callback. + * @param session the session returned by {@link CameraDevice#createCaptureSession} * @param request The request that was given to the CameraDevice * @param result The total output metadata from the capture, including the * final capture parameters and the state of the camera system during @@ -584,7 +593,7 @@ public abstract class CameraCaptureSession implements AutoCloseable { * @see #setRepeatingRequest * @see #setRepeatingBurst */ - public void onCaptureCompleted(CameraDevice camera, + public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) { // default empty implementation } @@ -600,8 +609,8 @@ public abstract class CameraCaptureSession implements AutoCloseable { * *The default implementation of this method does nothing.
* - * @param camera - * The CameraDevice sending the callback. + * @param session + * The session returned by {@link CameraDevice#createCaptureSession} * @param request * The request that was given to the CameraDevice * @param failure @@ -613,7 +622,7 @@ public abstract class CameraCaptureSession implements AutoCloseable { * @see #setRepeatingRequest * @see #setRepeatingBurst */ - public void onCaptureFailed(CameraDevice camera, + public void onCaptureFailed(CameraCaptureSession session, CaptureRequest request, CaptureFailure failure) { // default empty implementation } @@ -629,8 +638,8 @@ public abstract class CameraCaptureSession implements AutoCloseable { * *The default implementation does nothing.
* - * @param camera - * The CameraDevice sending the callback. + * @param session + * The session returned by {@link CameraDevice#createCaptureSession} * @param sequenceId * A sequence ID returned by the {@link #capture} family of functions. * @param frameNumber @@ -643,7 +652,7 @@ public abstract class CameraCaptureSession implements AutoCloseable { * @see CaptureFailure#getSequenceId() * @see #onCaptureSequenceAborted */ - public void onCaptureSequenceCompleted(CameraDevice camera, + public void onCaptureSequenceCompleted(CameraCaptureSession session, int sequenceId, long frameNumber) { // default empty implementation } @@ -661,8 +670,8 @@ public abstract class CameraCaptureSession implements AutoCloseable { * *The default implementation does nothing.
* - * @param camera - * The CameraDevice sending the callback. + * @param session + * The session returned by {@link CameraDevice#createCaptureSession} * @param sequenceId * A sequence ID returned by the {@link #capture} family of functions. * @@ -672,7 +681,7 @@ public abstract class CameraCaptureSession implements AutoCloseable { * @see CaptureFailure#getSequenceId() * @see #onCaptureSequenceCompleted */ - public void onCaptureSequenceAborted(CameraDevice camera, + public void onCaptureSequenceAborted(CameraCaptureSession session, int sequenceId) { // default empty implementation } diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java index f9f617a0b6937..e9213c5b8cb84 100644 --- a/core/java/android/hardware/camera2/CameraDevice.java +++ b/core/java/android/hardware/camera2/CameraDevice.java @@ -24,7 +24,7 @@ import android.view.Surface; import java.util.List; /** - *The CameraDevice class is an interface to a single camera connected to an + *
The CameraDevice class is a representation of a single camera connected to an * Android device, allowing for fine-grain control of image capture and * post-processing at high frame rates.
* @@ -46,7 +46,7 @@ import java.util.List; * @see CameraManager#openCamera * @see android.Manifest.permission#CAMERA */ -public interface CameraDevice extends AutoCloseable { +public abstract class CameraDevice implements AutoCloseable { /** * Create a request suitable for a camera preview window. Specifically, this @@ -127,7 +127,7 @@ public interface CameraDevice extends AutoCloseable { * @see CameraManager#getCameraCharacteristics * @see CameraManager#getCameraIdList */ - public String getId(); + public abstract String getId(); /** *Set up a new output set of Surfaces for the camera device.
@@ -245,7 +245,7 @@ public interface CameraDevice extends AutoCloseable { * @deprecated Use {@link #createCaptureSession} instead */ @Deprecated - public void configureOutputs(ListCreate a new camera capture session by providing the target output set of Surfaces to the
@@ -358,7 +358,7 @@ public interface CameraDevice extends AutoCloseable {
* @see StreamConfigurationMap#getOutputSizes(int)
* @see StreamConfigurationMap#getOutputSizes(Class)
*/
- public void createCaptureSession(List A listener for tracking the progress of a {@link CaptureRequest}
@@ -1230,4 +1230,10 @@ public interface CameraDevice extends AutoCloseable {
*/
public abstract void onError(CameraDevice camera, int error); // Must implement
}
+
+ /**
+ * To be inherited by android.hardware.camera2.* code only.
+ * @hide
+ */
+ public CameraDevice() {}
}
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
index 4a89fe72e3623..781301e02854e 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -227,8 +227,8 @@ public final class CameraManager {
ICameraDeviceUser cameraUser;
- android.hardware.camera2.impl.CameraDevice deviceImpl =
- new android.hardware.camera2.impl.CameraDevice(
+ android.hardware.camera2.impl.CameraDeviceImpl deviceImpl =
+ new android.hardware.camera2.impl.CameraDeviceImpl(
cameraId,
listener,
handler,
diff --git a/core/java/android/hardware/camera2/dispatch/ArgumentReplacingDispatcher.java b/core/java/android/hardware/camera2/dispatch/ArgumentReplacingDispatcher.java
new file mode 100644
index 0000000000000..866f370f5d5de
--- /dev/null
+++ b/core/java/android/hardware/camera2/dispatch/ArgumentReplacingDispatcher.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.camera2.dispatch;
+
+import java.lang.reflect.Method;
+
+import static com.android.internal.util.Preconditions.*;
+
+/**
+ * A dispatcher that replaces one argument with another; replaces any argument at an index
+ * with another argument.
+ *
+ * For example, we can override an {@code void onSomething(int x)} calls to have {@code x} always
+ * equal to 1. Or, if using this with a duck typing dispatcher, we could even overwrite {@code x} to
+ * be something
+ * that's not an {@code int}. For example, if a method {@code onAction(T1 a, Integer b, T2 c)} is invoked, and we wanted
+ * to replace all occurrences of {@code b} with {@code 0xDEADBEEF}, we would set
+ * {@code argumentIndex = 1} and {@code replaceWith = 0xDEADBEEF}. If a method dispatched has less arguments than {@code argumentIndex}, it is
+ * passed through with the arguments unchanged.