From bde1397db805a03388de4936a8647a9e4f5ecd30 Mon Sep 17 00:00:00 2001
From: Shuzhen Wang
Date: Mon, 19 Mar 2018 10:30:45 -0700
Subject: [PATCH] Camera2: Use Set for physical camera IDs
Because physical camera IDs are not ordered, use Set instead.
Test: Camera CTS
Bug: 74838822
Change-Id: I2ca73ba42f4517283f4c0048f9369498b11eea66
---
api/current.txt | 2 +-
.../hardware/camera2/CameraCharacteristics.java | 21 ++++++++++-----------
.../android/hardware/camera2/CaptureRequest.java | 2 +-
.../hardware/camera2/TotalCaptureResult.java | 2 +-
4 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/api/current.txt b/api/current.txt
index 69d9a9e4c73c..bc6e768a3e07 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -15776,7 +15776,7 @@ package android.hardware.camera2 {
method public java.util.List> getAvailablePhysicalCameraRequestKeys();
method public java.util.List> getAvailableSessionKeys();
method public java.util.List> getKeys();
- method public java.util.List getPhysicalCameraIds();
+ method public java.util.Set getPhysicalCameraIds();
field public static final android.hardware.camera2.CameraCharacteristics.Key COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES;
field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_ANTIBANDING_MODES;
field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_MODES;
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 8502fc413c05..d5b052e485c4 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -28,7 +28,9 @@ import android.util.Rational;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* The properties describing a
@@ -450,23 +452,20 @@ public final class CameraCharacteristics extends CameraMetadataA camera device is a logical camera if it has
* REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA capability. If the camera device
- * doesn't have the capability, the return value will be an empty list.
+ * doesn't have the capability, the return value will be an empty set.
*
- * The list returned is not modifiable, so any attempts to modify it will throw
+ *
The set returned is not modifiable, so any attempts to modify it will throw
* a {@code UnsupportedOperationException}.
*
- * Each physical camera id is only listed once in the list. The order of the keys
- * is undefined.
- *
- * @return List of physical camera ids for this logical camera device.
+ * @return Set of physical camera ids for this logical camera device.
*/
@NonNull
- public List getPhysicalCameraIds() {
+ public Set getPhysicalCameraIds() {
int[] availableCapabilities = get(REQUEST_AVAILABLE_CAPABILITIES);
if (availableCapabilities == null) {
throw new AssertionError("android.request.availableCapabilities must be non-null "
@@ -475,7 +474,7 @@ public final class CameraCharacteristics extends CameraMetadata(Arrays.asList(physicalCameraIdArray)));
}
/*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 98901a1e6919..d7c55645e20c 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -808,7 +808,7 @@ public final class CaptureRequest extends CameraMetadata>
*
*This method can be called for logical camera devices, which are devices that have
* REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA capability and calls to
- * {@link CameraCharacteristics#getPhysicalCameraIds} return a non-empty list of
+ * {@link CameraCharacteristics#getPhysicalCameraIds} return a non-empty set of
* physical devices that are backing the logical camera. The camera Id included in the
* 'physicalCameraId' argument selects an individual physical device that will receive
* the customized capture request field.
diff --git a/core/java/android/hardware/camera2/TotalCaptureResult.java b/core/java/android/hardware/camera2/TotalCaptureResult.java
index 0be45a0c9779..4e20cb8d129e 100644
--- a/core/java/android/hardware/camera2/TotalCaptureResult.java
+++ b/core/java/android/hardware/camera2/TotalCaptureResult.java
@@ -138,7 +138,7 @@ public final class TotalCaptureResult extends CaptureResult {
*
* This function can be called for logical multi-camera devices, which are devices that have
* REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA capability and calls to {@link
- * CameraCharacteristics#getPhysicalCameraIds} return a non-empty list of physical devices that
+ * CameraCharacteristics#getPhysicalCameraIds} return a non-empty set of physical devices that
* are backing the logical camera.
*
* If one or more streams from the underlying physical cameras were requested by the
--
2.11.0