summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Eino-Ville Talvala <etalvala@google.com> 2013-08-08 16:56:28 -0700
committer Eino-Ville Talvala <etalvala@google.com> 2013-08-16 11:10:21 -0700
commit4068388beea728bbf9f321b0b5b5c52ce4ab3d06 (patch)
tree892f8846c5a23375a571844c890e62717caa8375
parent0a94b9ce277ef2ec79902e3c576a50ab438dca97 (diff)
Camera2: Add user tag to CaptureRequest
Bug: 10360518 Change-Id: I781341b4c598c28ee5dd7551b8e05ab19b8fff0d
-rw-r--r--api/current.txt2
-rw-r--r--core/java/android/hardware/camera2/CaptureRequest.java37
2 files changed, 39 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index 2f0d64c71c96..faf88e520aa7 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -10925,7 +10925,9 @@ package android.hardware.camera2 {
public final class CaptureRequest extends android.hardware.camera2.CameraMetadata implements android.os.Parcelable {
method public void addTarget(android.view.Surface);
+ method public java.lang.Object getTag();
method public void removeTarget(android.view.Surface);
+ method public void setTag(java.lang.Object);
field public static final android.hardware.camera2.CameraMetadata.Key BLACK_LEVEL_LOCK;
field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_GAINS;
field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_MODE;
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 1a10bdd9f295..63d61349fd41 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -53,6 +53,7 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable {
private final Object mLock = new Object();
private final HashSet<Surface> mSurfaceSet = new HashSet<Surface>();
+ private Object mUserTag;
/**
* @hide
@@ -89,6 +90,42 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable {
}
}
+ /**
+ * Set a tag for this request.
+ *
+ * <p>This tag is not used for anything by the camera device, but can be
+ * used by an application to easily identify a CaptureRequest when it is
+ * returned by
+ * {@link CameraDevice.CaptureListener#onCaptureComplete CaptureListener.onCaptureComplete}
+ *
+ * @param tag an arbitrary Object to store with this request
+ * @see #getTag
+ */
+ public void setTag(Object tag) {
+ synchronized (mLock) {
+ mUserTag = tag;
+ }
+ }
+
+ /**
+ * Retrieve the tag for this request, if any.
+ *
+ * <p>This tag is not used for anything by the camera device, but can be
+ * used by an application to easily identify a CaptureRequest when it is
+ * returned by
+ * {@link CameraDevice.CaptureListener#onCaptureComplete CaptureListener.onCaptureComplete}
+ * </p>
+ *
+ * @return the last tag Object set on this request, or {@code null} if
+ * no tag has been set.
+ * @see #setTag
+ */
+ public Object getTag() {
+ synchronized (mLock) {
+ return mUserTag;
+ }
+ }
+
public static final Parcelable.Creator<CaptureRequest> CREATOR =
new Parcelable.Creator<CaptureRequest>() {
@Override