Camera2: implement Key.toString()
Implement toString() for CameraCharacteristics.Key,
CaptureResult.Key, and CaptureRequest.Key.
Bug: 22279124
Change-Id: Ib1076e3f6d7bcbffbb148a7a01f72133daccebb8
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 835daab..6c74a9f 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -116,6 +116,20 @@
}
/**
+ * Return this {@link Key} as a string representation.
+ *
+ * <p>{@code "CameraCharacteristics.Key(%s)"}, where {@code %s} represents
+ * the name of this key as returned by {@link #getName}.</p>
+ *
+ * @return string representation of {@link Key}
+ */
+ @NonNull
+ @Override
+ public String toString() {
+ return String.format("CameraCharacteristics.Key(%s)", mKey.getName());
+ }
+
+ /**
* Visible for CameraMetadataNative implementation only; do not use.
*
* TODO: Make this private or remove it altogether.
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 33cc962..5d7da79 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -150,6 +150,20 @@
}
/**
+ * Return this {@link Key} as a string representation.
+ *
+ * <p>{@code "CaptureRequest.Key(%s)"}, where {@code %s} represents
+ * the name of this key as returned by {@link #getName}.</p>
+ *
+ * @return string representation of {@link Key}
+ */
+ @NonNull
+ @Override
+ public String toString() {
+ return String.format("CaptureRequest.Key(%s)", mKey.getName());
+ }
+
+ /**
* Visible for CameraMetadataNative implementation only; do not use.
*
* TODO: Make this private or remove it altogether.
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 9dee045..e071409 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -127,6 +127,20 @@
}
/**
+ * Return this {@link Key} as a string representation.
+ *
+ * <p>{@code "CaptureResult.Key(%s)"}, where {@code %s} represents
+ * the name of this key as returned by {@link #getName}.</p>
+ *
+ * @return string representation of {@link Key}
+ */
+ @NonNull
+ @Override
+ public String toString() {
+ return String.format("CaptureResult.Key(%s)", mKey.getName());
+ }
+
+ /**
* Visible for CameraMetadataNative implementation only; do not use.
*
* TODO: Make this private or remove it altogether.