diff options
author | Yin-Chia Yeh <yinchiayeh@google.com> | 2014-09-08 15:48:47 -0700 |
---|---|---|
committer | Yin-Chia Yeh <yinchiayeh@google.com> | 2014-09-09 07:56:18 -0700 |
commit | 808150f066b53da1573e8b1fbd6b377d0fc229f8 (patch) | |
tree | 28bbd0e33575b0aeb0ad2edec7c0bddd538f1db8 /core/java/android/hardware | |
parent | a740b2bf9a492df5301336e2533651fa90e57c6b (diff) | |
download | frameworks_base-808150f066b53da1573e8b1fbd6b377d0fc229f8.zip frameworks_base-808150f066b53da1573e8b1fbd6b377d0fc229f8.tar.gz frameworks_base-808150f066b53da1573e8b1fbd6b377d0fc229f8.tar.bz2 |
camera2: make 3A regions null when not available
Bug: 17346456
Change-Id: If8e1611614622e7eef6f77e03ef55375650f1c51
Diffstat (limited to 'core/java/android/hardware')
4 files changed, 56 insertions, 10 deletions
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 6d0d505..93eb3de 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -731,6 +731,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> /** * <p>List of areas to use for * metering.</p> + * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe} is 0. + * Otherwise will always be present.</p> * <p>The coordinate system is based on the active pixel array, * with (0,0) being the top-left pixel in the active pixel array, and * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, @@ -746,7 +748,9 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata, * the camera device will ignore the sections outside the region and output the * used sections in the result metadata.</p> + * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> * + * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE * @see CaptureRequest#SCALER_CROP_REGION * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE */ @@ -820,6 +824,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> /** * <p>List of areas to use for focus * estimation.</p> + * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf} is 0. + * Otherwise will always be present.</p> * <p>The coordinate system is based on the active pixel array, * with (0,0) being the top-left pixel in the active pixel array, and * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, @@ -835,7 +841,9 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata, * the camera device will ignore the sections outside the region and output the * used sections in the result metadata.</p> + * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> * + * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF * @see CaptureRequest#SCALER_CROP_REGION * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE */ @@ -921,6 +929,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> /** * <p>List of areas to use for illuminant * estimation.</p> + * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb} is 0. + * Otherwise will always be present.</p> * <p>The coordinate system is based on the active pixel array, * with (0,0) being the top-left pixel in the active pixel array, and * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, @@ -936,7 +946,9 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata, * the camera device will ignore the sections outside the region and output the * used sections in the result metadata.</p> + * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> * + * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB * @see CaptureRequest#SCALER_CROP_REGION * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE */ diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 754d83e..01276a2 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -582,6 +582,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { /** * <p>List of areas to use for * metering.</p> + * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe} is 0. + * Otherwise will always be present.</p> * <p>The coordinate system is based on the active pixel array, * with (0,0) being the top-left pixel in the active pixel array, and * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, @@ -597,7 +599,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata, * the camera device will ignore the sections outside the region and output the * used sections in the result metadata.</p> + * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> * + * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE * @see CaptureRequest#SCALER_CROP_REGION * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE */ @@ -870,6 +874,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { /** * <p>List of areas to use for focus * estimation.</p> + * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf} is 0. + * Otherwise will always be present.</p> * <p>The coordinate system is based on the active pixel array, * with (0,0) being the top-left pixel in the active pixel array, and * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, @@ -885,7 +891,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata, * the camera device will ignore the sections outside the region and output the * used sections in the result metadata.</p> + * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> * + * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF * @see CaptureRequest#SCALER_CROP_REGION * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE */ @@ -1369,6 +1377,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { /** * <p>List of areas to use for illuminant * estimation.</p> + * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb} is 0. + * Otherwise will always be present.</p> * <p>The coordinate system is based on the active pixel array, * with (0,0) being the top-left pixel in the active pixel array, and * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, @@ -1384,7 +1394,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata, * the camera device will ignore the sections outside the region and output the * used sections in the result metadata.</p> + * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> * + * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB * @see CaptureRequest#SCALER_CROP_REGION * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE */ diff --git a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java index a8d1018..3c0e0e4 100644 --- a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java +++ b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java @@ -675,15 +675,13 @@ public class LegacyMetadataMapper { * request.availableRequestKeys */ { - CaptureRequest.Key<?> availableKeys[] = new CaptureRequest.Key<?>[] { + CaptureRequest.Key<?> defaultAvailableKeys[] = new CaptureRequest.Key<?>[] { CaptureRequest.CONTROL_AE_ANTIBANDING_MODE, CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION, CaptureRequest.CONTROL_AE_LOCK, CaptureRequest.CONTROL_AE_MODE, - CaptureRequest.CONTROL_AE_REGIONS, CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, CaptureRequest.CONTROL_AF_MODE, - CaptureRequest.CONTROL_AF_REGIONS, CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AWB_LOCK, CaptureRequest.CONTROL_AWB_MODE, @@ -704,21 +702,32 @@ public class LegacyMetadataMapper { CaptureRequest.SCALER_CROP_REGION, CaptureRequest.STATISTICS_FACE_DETECT_MODE, }; - m.set(REQUEST_AVAILABLE_REQUEST_KEYS, getTagsForKeys(availableKeys)); + ArrayList<CaptureRequest.Key<?>> availableKeys = + new ArrayList<CaptureRequest.Key<?>>(Arrays.asList(defaultAvailableKeys)); + + if (p.getMaxNumMeteringAreas() > 0) { + availableKeys.add(CaptureRequest.CONTROL_AE_REGIONS); + } + if (p.getMaxNumFocusAreas() > 0) { + availableKeys.add(CaptureRequest.CONTROL_AF_REGIONS); + } + + CaptureRequest.Key<?> availableRequestKeys[] = + new CaptureRequest.Key<?>[availableKeys.size()]; + availableKeys.toArray(availableRequestKeys); + m.set(REQUEST_AVAILABLE_REQUEST_KEYS, getTagsForKeys(availableRequestKeys)); } /* * request.availableResultKeys */ { - CaptureResult.Key<?> availableKeys[] = new CaptureResult.Key<?>[] { + CaptureResult.Key<?> defaultAvailableKeys[] = new CaptureResult.Key<?>[] { CaptureResult.CONTROL_AE_ANTIBANDING_MODE , CaptureResult.CONTROL_AE_EXPOSURE_COMPENSATION , CaptureResult.CONTROL_AE_LOCK , CaptureResult.CONTROL_AE_MODE , - CaptureResult.CONTROL_AE_REGIONS , CaptureResult.CONTROL_AF_MODE , - CaptureResult.CONTROL_AF_REGIONS , CaptureResult.CONTROL_AF_STATE , CaptureResult.CONTROL_AWB_MODE , CaptureResult.CONTROL_AWB_LOCK , @@ -737,7 +746,20 @@ public class LegacyMetadataMapper { CaptureResult.STATISTICS_FACE_DETECT_MODE , // CaptureResult.STATISTICS_FACES , }; - m.set(REQUEST_AVAILABLE_RESULT_KEYS, getTagsForKeys(availableKeys)); + List<CaptureResult.Key<?>> availableKeys = + new ArrayList<CaptureResult.Key<?>>(Arrays.asList(defaultAvailableKeys)); + + if (p.getMaxNumMeteringAreas() > 0) { + availableKeys.add(CaptureResult.CONTROL_AE_REGIONS); + } + if (p.getMaxNumFocusAreas() > 0) { + availableKeys.add(CaptureResult.CONTROL_AF_REGIONS); + } + + CaptureResult.Key<?> availableResultKeys[] = + new CaptureResult.Key<?>[availableKeys.size()]; + availableKeys.toArray(availableResultKeys); + m.set(REQUEST_AVAILABLE_RESULT_KEYS, getTagsForKeys(availableResultKeys)); } /* diff --git a/core/java/android/hardware/camera2/legacy/LegacyResultMapper.java b/core/java/android/hardware/camera2/legacy/LegacyResultMapper.java index 090a822..ddaa6ee 100644 --- a/core/java/android/hardware/camera2/legacy/LegacyResultMapper.java +++ b/core/java/android/hardware/camera2/legacy/LegacyResultMapper.java @@ -322,7 +322,7 @@ public class LegacyResultMapper { } // control.aeRegions - { + if (p.getMaxNumMeteringAreas() > 0) { if (VERBOSE) { String meteringAreas = p.get("metering-areas"); Log.v(TAG, "mapAe - parameter dump; metering-areas: " + meteringAreas); @@ -342,7 +342,7 @@ public class LegacyResultMapper { m.set(CaptureResult.CONTROL_AF_MODE, convertLegacyAfMode(p.getFocusMode())); // control.afRegions - { + if (p.getMaxNumFocusAreas() > 0) { if (VERBOSE) { String focusAreas = p.get("focus-areas"); Log.v(TAG, "mapAe - parameter dump; focus-areas: " + focusAreas); |