2 * Copyright (C) 2013 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package android.hardware.camera2;
19 import android.hardware.camera2.impl.CameraMetadataNative;
20 import android.hardware.camera2.CameraDevice.CaptureListener;
21 import android.os.Parcel;
22 import android.os.Parcelable;
23 import android.view.Surface;
25 import java.util.HashSet;
26 import java.util.Objects;
30 * <p>An immutable package of settings and outputs needed to capture a single
31 * image from the camera device.</p>
33 * <p>Contains the configuration for the capture hardware (sensor, lens, flash),
34 * the processing pipeline, the control algorithms, and the output buffers. Also
35 * contains the list of target Surfaces to send image data to for this
38 * <p>CaptureRequests can be created by using a {@link Builder} instance,
39 * obtained by calling {@link CameraDevice#createCaptureRequest}</p>
41 * <p>CaptureRequests are given to {@link CameraDevice#capture} or
42 * {@link CameraDevice#setRepeatingRequest} to capture images from a camera.</p>
44 * <p>Each request can specify a different subset of target Surfaces for the
45 * camera to send the captured data to. All the surfaces used in a request must
46 * be part of the surface list given to the last call to
47 * {@link CameraDevice#configureOutputs}, when the request is submitted to the
50 * <p>For example, a request meant for repeating preview might only include the
51 * Surface for the preview SurfaceView or SurfaceTexture, while a
52 * high-resolution still capture would also include a Surface from a ImageReader
53 * configured for high-resolution JPEG images.</p>
55 * @see CameraDevice#capture
56 * @see CameraDevice#setRepeatingRequest
57 * @see CameraDevice#createCaptureRequest
59 public final class CaptureRequest extends CameraMetadata implements Parcelable {
61 private final HashSet<Surface> mSurfaceSet;
62 private final CameraMetadataNative mSettings;
64 private Object mUserTag;
67 * Construct empty request.
69 * Used by Binder to unparcel this object only.
71 private CaptureRequest() {
72 mSettings = new CameraMetadataNative();
73 mSurfaceSet = new HashSet<Surface>();
77 * Clone from source capture request.
79 * Used by the Builder to create an immutable copy.
81 @SuppressWarnings("unchecked")
82 private CaptureRequest(CaptureRequest source) {
83 mSettings = new CameraMetadataNative(source.mSettings);
84 mSurfaceSet = (HashSet<Surface>) source.mSurfaceSet.clone();
85 mUserTag = source.mUserTag;
89 * Take ownership of passed-in settings.
91 * Used by the Builder to create a mutable CaptureRequest.
93 private CaptureRequest(CameraMetadataNative settings) {
95 mSurfaceSet = new HashSet<Surface>();
98 @SuppressWarnings("unchecked")
100 public <T> T get(Key<T> key) {
101 return mSettings.get(key);
105 * Retrieve the tag for this request, if any.
107 * <p>This tag is not used for anything by the camera device, but can be
108 * used by an application to easily identify a CaptureRequest when it is
110 * {@link CameraDevice.CaptureListener#onCaptureCompleted CaptureListener.onCaptureCompleted}
113 * @return the last tag Object set on this request, or {@code null} if
114 * no tag has been set.
115 * @see Builder#setTag
117 public Object getTag() {
122 * Determine whether this CaptureRequest is equal to another CaptureRequest.
124 * <p>A request is considered equal to another is if it's set of key/values is equal, it's
125 * list of output surfaces is equal, and the user tag is equal.</p>
127 * @param other Another instance of CaptureRequest.
129 * @return True if the requests are the same, false otherwise.
132 public boolean equals(Object other) {
133 return other instanceof CaptureRequest
134 && equals((CaptureRequest)other);
137 private boolean equals(CaptureRequest other) {
139 && Objects.equals(mUserTag, other.mUserTag)
140 && mSurfaceSet.equals(other.mSurfaceSet)
141 && mSettings.equals(other.mSettings);
145 public int hashCode() {
146 return mSettings.hashCode();
149 public static final Parcelable.Creator<CaptureRequest> CREATOR =
150 new Parcelable.Creator<CaptureRequest>() {
152 public CaptureRequest createFromParcel(Parcel in) {
153 CaptureRequest request = new CaptureRequest();
154 request.readFromParcel(in);
160 public CaptureRequest[] newArray(int size) {
161 return new CaptureRequest[size];
166 * Expand this object from a Parcel.
167 * Hidden since this breaks the immutability of CaptureRequest, but is
168 * needed to receive CaptureRequests with aidl.
170 * @param in The parcel from which the object should be read
173 public void readFromParcel(Parcel in) {
174 mSettings.readFromParcel(in);
178 Parcelable[] parcelableArray = in.readParcelableArray(Surface.class.getClassLoader());
180 if (parcelableArray == null) {
184 for (Parcelable p : parcelableArray) {
185 Surface s = (Surface) p;
191 public int describeContents() {
196 public void writeToParcel(Parcel dest, int flags) {
197 mSettings.writeToParcel(dest, flags);
198 dest.writeParcelableArray(mSurfaceSet.toArray(new Surface[mSurfaceSet.size()]), flags);
202 * A builder for capture requests.
204 * <p>To obtain a builder instance, use the
205 * {@link CameraDevice#createCaptureRequest} method, which initializes the
206 * request fields to one of the templates defined in {@link CameraDevice}.
208 * @see CameraDevice#createCaptureRequest
209 * @see #TEMPLATE_PREVIEW
210 * @see #TEMPLATE_RECORD
211 * @see #TEMPLATE_STILL_CAPTURE
212 * @see #TEMPLATE_VIDEO_SNAPSHOT
213 * @see #TEMPLATE_MANUAL
215 public final static class Builder {
217 private final CaptureRequest mRequest;
220 * Initialize the builder using the template; the request takes
221 * ownership of the template.
225 public Builder(CameraMetadataNative template) {
226 mRequest = new CaptureRequest(template);
230 * <p>Add a surface to the list of targets for this request</p>
232 * <p>The Surface added must be one of the surfaces included in the most
233 * recent call to {@link CameraDevice#configureOutputs}, when the
234 * request is given to the camera device.</p>
236 * <p>Adding a target more than once has no effect.</p>
238 * @param outputTarget Surface to use as an output target for this request
240 public void addTarget(Surface outputTarget) {
241 mRequest.mSurfaceSet.add(outputTarget);
245 * <p>Remove a surface from the list of targets for this request.</p>
247 * <p>Removing a target that is not currently added has no effect.</p>
249 * @param outputTarget Surface to use as an output target for this request
251 public void removeTarget(Surface outputTarget) {
252 mRequest.mSurfaceSet.remove(outputTarget);
256 * Set a capture request field to a value. The field definitions can be
257 * found in {@link CaptureRequest}.
259 * @param key The metadata field to write.
260 * @param value The value to set the field to, which must be of a matching
263 public <T> void set(Key<T> key, T value) {
264 mRequest.mSettings.set(key, value);
268 * Get a capture request field value. The field definitions can be
269 * found in {@link CaptureRequest}.
271 * @throws IllegalArgumentException if the key was not valid
273 * @param key The metadata field to read.
274 * @return The value of that key, or {@code null} if the field is not set.
276 public <T> T get(Key<T> key) {
277 return mRequest.mSettings.get(key);
281 * Set a tag for this request.
283 * <p>This tag is not used for anything by the camera device, but can be
284 * used by an application to easily identify a CaptureRequest when it is
286 * {@link CameraDevice.CaptureListener#onCaptureCompleted CaptureListener.onCaptureCompleted}
288 * @param tag an arbitrary Object to store with this request
289 * @see CaptureRequest#getTag
291 public void setTag(Object tag) {
292 mRequest.mUserTag = tag;
296 * Build a request using the current target Surfaces and settings.
298 * @return A new capture request instance, ready for submission to the
301 public CaptureRequest build() {
302 return new CaptureRequest(mRequest);
309 public boolean isEmpty() {
310 return mRequest.mSettings.isEmpty();
315 /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
316 * The key entries below this point are generated from metadata
317 * definitions in /system/media/camera/docs. Do not modify by hand or
318 * modify the comment blocks at the start or end.
319 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/
323 * When android.control.awbMode is not OFF, TRANSFORM_MATRIX
326 * @see #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX
327 * @see #COLOR_CORRECTION_MODE_FAST
328 * @see #COLOR_CORRECTION_MODE_HIGH_QUALITY
330 public static final Key<Integer> COLOR_CORRECTION_MODE =
331 new Key<Integer>("android.colorCorrection.mode", int.class);
335 * A color transform matrix to use to transform
336 * from sensor RGB color space to output linear sRGB color space
339 * This matrix is either set by HAL when the request
340 * android.colorCorrection.mode is not TRANSFORM_MATRIX, or
341 * directly by the application in the request when the
342 * android.colorCorrection.mode is TRANSFORM_MATRIX.
344 * In the latter case, the HAL may round the matrix to account
345 * for precision issues; the final rounded matrix should be
346 * reported back in this matrix result metadata.
349 public static final Key<Rational[]> COLOR_CORRECTION_TRANSFORM =
350 new Key<Rational[]>("android.colorCorrection.transform", Rational[].class);
354 * Gains applying to Bayer color channels for
358 * The 4-channel white-balance gains are defined in
359 * the order of [R G_even G_odd B], where G_even is the gain
360 * for green pixels on even rows of the output, and G_odd
361 * is the gain for greenpixels on the odd rows. if a HAL
362 * does not support a separate gain for even/odd green channels,
363 * it should use the G_even value,and write G_odd equal to
364 * G_even in the output result metadata.
366 * This array is either set by HAL when the request
367 * android.colorCorrection.mode is not TRANSFORM_MATRIX, or
368 * directly by the application in the request when the
369 * android.colorCorrection.mode is TRANSFORM_MATRIX.
371 * The ouput should be the gains actually applied by the HAL to
375 public static final Key<float[]> COLOR_CORRECTION_GAINS =
376 new Key<float[]>("android.colorCorrection.gains", float[].class);
380 * Enum for controlling
383 * @see #CONTROL_AE_ANTIBANDING_MODE_OFF
384 * @see #CONTROL_AE_ANTIBANDING_MODE_50HZ
385 * @see #CONTROL_AE_ANTIBANDING_MODE_60HZ
386 * @see #CONTROL_AE_ANTIBANDING_MODE_AUTO
388 public static final Key<Integer> CONTROL_AE_ANTIBANDING_MODE =
389 new Key<Integer>("android.control.aeAntibandingMode", int.class);
393 * Adjustment to AE target image
397 * For example, if EV step is 0.333, '6' will mean an
398 * exposure compensation of +2 EV; -3 will mean an exposure
402 public static final Key<Integer> CONTROL_AE_EXPOSURE_COMPENSATION =
403 new Key<Integer>("android.control.aeExposureCompensation", int.class);
407 * Whether AE is currently locked to its latest
411 * Note that even when AE is locked, the flash may be
412 * fired if the AE mode is ON_AUTO_FLASH / ON_ALWAYS_FLASH /
413 * ON_AUTO_FLASH_REDEYE.
416 public static final Key<Boolean> CONTROL_AE_LOCK =
417 new Key<Boolean>("android.control.aeLock", boolean.class);
421 * Whether AE is currently updating the sensor
422 * exposure and sensitivity fields
425 * Only effective if android.control.mode =
428 * @see #CONTROL_AE_MODE_OFF
429 * @see #CONTROL_AE_MODE_ON
430 * @see #CONTROL_AE_MODE_ON_AUTO_FLASH
431 * @see #CONTROL_AE_MODE_ON_ALWAYS_FLASH
432 * @see #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE
434 public static final Key<Integer> CONTROL_AE_MODE =
435 new Key<Integer>("android.control.aeMode", int.class);
439 * List of areas to use for
443 * Each area is a rectangle plus weight: xmin, ymin,
444 * xmax, ymax, weight. The rectangle is defined inclusive of the
445 * specified coordinates.
447 * The coordinate system is based on the active pixel array,
448 * with (0,0) being the top-left pixel in the active pixel array, and
449 * (android.sensor.info.activeArraySize.width - 1,
450 * android.sensor.info.activeArraySize.height - 1) being the
451 * bottom-right pixel in the active pixel array. The weight
452 * should be nonnegative.
454 * If all regions have 0 weight, then no specific metering area
455 * needs to be used by the HAL. If the metering region is
456 * outside the current android.scaler.cropRegion, the HAL
457 * should ignore the sections outside the region and output the
458 * used sections in the frame metadata
461 public static final Key<int[]> CONTROL_AE_REGIONS =
462 new Key<int[]>("android.control.aeRegions", int[].class);
466 * Range over which fps can be adjusted to
470 * Only constrains AE algorithm, not manual control
471 * of android.sensor.exposureTime
474 public static final Key<int[]> CONTROL_AE_TARGET_FPS_RANGE =
475 new Key<int[]>("android.control.aeTargetFpsRange", int[].class);
479 * Whether the HAL must trigger precapture
483 * This entry is normally set to IDLE, or is not
484 * included at all in the request settings. When included and
485 * set to START, the HAL must trigger the autoexposure
486 * precapture metering sequence.
488 * The effect of AE precapture trigger depends on the current
489 * AE mode and state; see the camera HAL device v3 header for
492 * @see #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE
493 * @see #CONTROL_AE_PRECAPTURE_TRIGGER_START
495 public static final Key<Integer> CONTROL_AE_PRECAPTURE_TRIGGER =
496 new Key<Integer>("android.control.aePrecaptureTrigger", int.class);
500 * Whether AF is currently enabled, and what
503 * @see #CONTROL_AF_MODE_OFF
504 * @see #CONTROL_AF_MODE_AUTO
505 * @see #CONTROL_AF_MODE_MACRO
506 * @see #CONTROL_AF_MODE_CONTINUOUS_VIDEO
507 * @see #CONTROL_AF_MODE_CONTINUOUS_PICTURE
508 * @see #CONTROL_AF_MODE_EDOF
510 public static final Key<Integer> CONTROL_AF_MODE =
511 new Key<Integer>("android.control.afMode", int.class);
515 * List of areas to use for focus
519 * Each area is a rectangle plus weight: xmin, ymin,
520 * xmax, ymax, weight. The rectangle is defined inclusive of the
521 * specified coordinates.
523 * The coordinate system is based on the active pixel array,
524 * with (0,0) being the top-left pixel in the active pixel array, and
525 * (android.sensor.info.activeArraySize.width - 1,
526 * android.sensor.info.activeArraySize.height - 1) being the
527 * bottom-right pixel in the active pixel array. The weight
528 * should be nonnegative.
530 * If all regions have 0 weight, then no specific focus area
531 * needs to be used by the HAL. If the focusing region is
532 * outside the current android.scaler.cropRegion, the HAL
533 * should ignore the sections outside the region and output the
534 * used sections in the frame metadata
537 public static final Key<int[]> CONTROL_AF_REGIONS =
538 new Key<int[]>("android.control.afRegions", int[].class);
542 * Whether the HAL must trigger autofocus.
545 * This entry is normally set to IDLE, or is not
546 * included at all in the request settings.
548 * When included and set to START, the HAL must trigger the
549 * autofocus algorithm. The effect of AF trigger depends on the
550 * current AF mode and state; see the camera HAL device v3
551 * header for details. When set to CANCEL, the HAL must cancel
552 * any active trigger, and return to initial AF state.
554 * @see #CONTROL_AF_TRIGGER_IDLE
555 * @see #CONTROL_AF_TRIGGER_START
556 * @see #CONTROL_AF_TRIGGER_CANCEL
558 public static final Key<Integer> CONTROL_AF_TRIGGER =
559 new Key<Integer>("android.control.afTrigger", int.class);
563 * Whether AWB is currently locked to its
564 * latest calculated values
567 * Note that AWB lock is only meaningful for AUTO
568 * mode; in other modes, AWB is already fixed to a specific
572 public static final Key<Boolean> CONTROL_AWB_LOCK =
573 new Key<Boolean>("android.control.awbLock", boolean.class);
577 * Whether AWB is currently setting the color
578 * transform fields, and what its illumination target
582 * [BC - AWB lock,AWB modes]
584 * @see #CONTROL_AWB_MODE_OFF
585 * @see #CONTROL_AWB_MODE_AUTO
586 * @see #CONTROL_AWB_MODE_INCANDESCENT
587 * @see #CONTROL_AWB_MODE_FLUORESCENT
588 * @see #CONTROL_AWB_MODE_WARM_FLUORESCENT
589 * @see #CONTROL_AWB_MODE_DAYLIGHT
590 * @see #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT
591 * @see #CONTROL_AWB_MODE_TWILIGHT
592 * @see #CONTROL_AWB_MODE_SHADE
594 public static final Key<Integer> CONTROL_AWB_MODE =
595 new Key<Integer>("android.control.awbMode", int.class);
599 * List of areas to use for illuminant
603 * Only used in AUTO mode.
605 * Each area is a rectangle plus weight: xmin, ymin,
606 * xmax, ymax, weight. The rectangle is defined inclusive of the
607 * specified coordinates.
609 * The coordinate system is based on the active pixel array,
610 * with (0,0) being the top-left pixel in the active pixel array, and
611 * (android.sensor.info.activeArraySize.width - 1,
612 * android.sensor.info.activeArraySize.height - 1) being the
613 * bottom-right pixel in the active pixel array. The weight
614 * should be nonnegative.
616 * If all regions have 0 weight, then no specific metering area
617 * needs to be used by the HAL. If the metering region is
618 * outside the current android.scaler.cropRegion, the HAL
619 * should ignore the sections outside the region and output the
620 * used sections in the frame metadata
623 public static final Key<int[]> CONTROL_AWB_REGIONS =
624 new Key<int[]>("android.control.awbRegions", int[].class);
628 * Information to 3A routines about the purpose
629 * of this capture, to help decide optimal 3A
633 * Only used if android.control.mode != OFF.
635 * @see #CONTROL_CAPTURE_INTENT_CUSTOM
636 * @see #CONTROL_CAPTURE_INTENT_PREVIEW
637 * @see #CONTROL_CAPTURE_INTENT_STILL_CAPTURE
638 * @see #CONTROL_CAPTURE_INTENT_VIDEO_RECORD
639 * @see #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT
640 * @see #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG
642 public static final Key<Integer> CONTROL_CAPTURE_INTENT =
643 new Key<Integer>("android.control.captureIntent", int.class);
647 * Whether any special color effect is in use.
648 * Only used if android.control.mode != OFF
650 * @see #CONTROL_EFFECT_MODE_OFF
651 * @see #CONTROL_EFFECT_MODE_MONO
652 * @see #CONTROL_EFFECT_MODE_NEGATIVE
653 * @see #CONTROL_EFFECT_MODE_SOLARIZE
654 * @see #CONTROL_EFFECT_MODE_SEPIA
655 * @see #CONTROL_EFFECT_MODE_POSTERIZE
656 * @see #CONTROL_EFFECT_MODE_WHITEBOARD
657 * @see #CONTROL_EFFECT_MODE_BLACKBOARD
658 * @see #CONTROL_EFFECT_MODE_AQUA
660 public static final Key<Integer> CONTROL_EFFECT_MODE =
661 new Key<Integer>("android.control.effectMode", int.class);
665 * Overall mode of 3A control
668 * @see #CONTROL_MODE_OFF
669 * @see #CONTROL_MODE_AUTO
670 * @see #CONTROL_MODE_USE_SCENE_MODE
672 public static final Key<Integer> CONTROL_MODE =
673 new Key<Integer>("android.control.mode", int.class);
677 * Which scene mode is active when
678 * android.control.mode = SCENE_MODE
680 * @see #CONTROL_SCENE_MODE_UNSUPPORTED
681 * @see #CONTROL_SCENE_MODE_FACE_PRIORITY
682 * @see #CONTROL_SCENE_MODE_ACTION
683 * @see #CONTROL_SCENE_MODE_PORTRAIT
684 * @see #CONTROL_SCENE_MODE_LANDSCAPE
685 * @see #CONTROL_SCENE_MODE_NIGHT
686 * @see #CONTROL_SCENE_MODE_NIGHT_PORTRAIT
687 * @see #CONTROL_SCENE_MODE_THEATRE
688 * @see #CONTROL_SCENE_MODE_BEACH
689 * @see #CONTROL_SCENE_MODE_SNOW
690 * @see #CONTROL_SCENE_MODE_SUNSET
691 * @see #CONTROL_SCENE_MODE_STEADYPHOTO
692 * @see #CONTROL_SCENE_MODE_FIREWORKS
693 * @see #CONTROL_SCENE_MODE_SPORTS
694 * @see #CONTROL_SCENE_MODE_PARTY
695 * @see #CONTROL_SCENE_MODE_CANDLELIGHT
696 * @see #CONTROL_SCENE_MODE_BARCODE
698 public static final Key<Integer> CONTROL_SCENE_MODE =
699 new Key<Integer>("android.control.sceneMode", int.class);
703 * Whether video stabilization is
707 * If enabled, video stabilization can modify the
708 * android.scaler.cropRegion to keep the video stream
712 public static final Key<Boolean> CONTROL_VIDEO_STABILIZATION_MODE =
713 new Key<Boolean>("android.control.videoStabilizationMode", boolean.class);
717 * Operation mode for edge
720 * @see #EDGE_MODE_OFF
721 * @see #EDGE_MODE_FAST
722 * @see #EDGE_MODE_HIGH_QUALITY
724 public static final Key<Integer> EDGE_MODE =
725 new Key<Integer>("android.edge.mode", int.class);
729 * Select flash operation mode
731 * @see #FLASH_MODE_OFF
732 * @see #FLASH_MODE_SINGLE
733 * @see #FLASH_MODE_TORCH
735 public static final Key<Integer> FLASH_MODE =
736 new Key<Integer>("android.flash.mode", int.class);
740 * GPS coordinates to include in output JPEG
744 public static final Key<double[]> JPEG_GPS_COORDINATES =
745 new Key<double[]>("android.jpeg.gpsCoordinates", double[].class);
749 * 32 characters describing GPS algorithm to
753 public static final Key<String> JPEG_GPS_PROCESSING_METHOD =
754 new Key<String>("android.jpeg.gpsProcessingMethod", String.class);
758 * Time GPS fix was made to include in
762 public static final Key<Long> JPEG_GPS_TIMESTAMP =
763 new Key<Long>("android.jpeg.gpsTimestamp", long.class);
767 * Orientation of JPEG image to
771 public static final Key<Integer> JPEG_ORIENTATION =
772 new Key<Integer>("android.jpeg.orientation", int.class);
776 * Compression quality of the final JPEG
780 * 85-95 is typical usage range
783 public static final Key<Byte> JPEG_QUALITY =
784 new Key<Byte>("android.jpeg.quality", byte.class);
788 * Compression quality of JPEG
792 public static final Key<Byte> JPEG_THUMBNAIL_QUALITY =
793 new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
797 * Resolution of embedded JPEG
801 public static final Key<android.hardware.camera2.Size> JPEG_THUMBNAIL_SIZE =
802 new Key<android.hardware.camera2.Size>("android.jpeg.thumbnailSize", android.hardware.camera2.Size.class);
806 * Size of the lens aperture
809 * Will not be supported on most devices. Can only
810 * pick from supported list
813 public static final Key<Float> LENS_APERTURE =
814 new Key<Float>("android.lens.aperture", float.class);
818 * State of lens neutral density
822 * Will not be supported on most devices. Can only
823 * pick from supported list
826 public static final Key<Float> LENS_FILTER_DENSITY =
827 new Key<Float>("android.lens.filterDensity", float.class);
831 * Lens optical zoom setting
834 * Will not be supported on most devices.
837 public static final Key<Float> LENS_FOCAL_LENGTH =
838 new Key<Float>("android.lens.focalLength", float.class);
842 * Distance to plane of sharpest focus,
843 * measured from frontmost surface of the lens
846 * 0 = infinity focus. Used value should be clamped
847 * to (0,minimum focus distance)
850 public static final Key<Float> LENS_FOCUS_DISTANCE =
851 new Key<Float>("android.lens.focusDistance", float.class);
855 * Whether optical image stabilization is
859 * Will not be supported on most devices.
861 * @see #LENS_OPTICAL_STABILIZATION_MODE_OFF
862 * @see #LENS_OPTICAL_STABILIZATION_MODE_ON
864 public static final Key<Integer> LENS_OPTICAL_STABILIZATION_MODE =
865 new Key<Integer>("android.lens.opticalStabilizationMode", int.class);
869 * Mode of operation for the noise reduction
872 * @see #NOISE_REDUCTION_MODE_OFF
873 * @see #NOISE_REDUCTION_MODE_FAST
874 * @see #NOISE_REDUCTION_MODE_HIGH_QUALITY
876 public static final Key<Integer> NOISE_REDUCTION_MODE =
877 new Key<Integer>("android.noiseReduction.mode", int.class);
881 * An application-specified ID for the current
882 * request. Must be maintained unchanged in output
888 public static final Key<Integer> REQUEST_ID =
889 new Key<Integer>("android.request.id", int.class);
893 * (x, y, width, height).
895 * A rectangle with the top-level corner of (x,y) and size
896 * (width, height). The region of the sensor that is used for
897 * output. Each stream must use this rectangle to produce its
898 * output, cropping to a smaller region if necessary to
899 * maintain the stream's aspect ratio.
901 * HAL2.x uses only (x, y, width)
904 * Any additional per-stream cropping must be done to
905 * maximize the final pixel area of the stream.
907 * For example, if the crop region is set to a 4:3 aspect
908 * ratio, then 4:3 streams should use the exact crop
909 * region. 16:9 streams should further crop vertically
912 * Conversely, if the crop region is set to a 16:9, then 4:3
913 * outputs should crop horizontally (pillarbox), and 16:9
914 * streams should match exactly. These additional crops must
915 * be centered within the crop region.
917 * The output streams must maintain square pixels at all
918 * times, no matter what the relative aspect ratios of the
919 * crop region and the stream are. Negative values for
920 * corner are allowed for raw output if full pixel array is
921 * larger than active pixel array. Width and height may be
922 * rounded to nearest larger supportable width, especially
923 * for raw output, where only a few fixed scales may be
924 * possible. The width and height of the crop region cannot
925 * be set to be smaller than floor( activeArraySize.width /
926 * android.scaler.maxDigitalZoom ) and floor(
927 * activeArraySize.height / android.scaler.maxDigitalZoom),
931 public static final Key<android.graphics.Rect> SCALER_CROP_REGION =
932 new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class);
936 * Duration each pixel is exposed to
939 * If the sensor can't expose this exact duration, it should shorten the
940 * duration exposed to the nearest possible value (rather than expose longer).
943 * 1/10000 - 30 sec range. No bulb mode
946 public static final Key<Long> SENSOR_EXPOSURE_TIME =
947 new Key<Long>("android.sensor.exposureTime", long.class);
951 * Duration from start of frame exposure to
952 * start of next frame exposure
955 * Exposure time has priority, so duration is set to
956 * max(duration, exposure time + overhead)
959 public static final Key<Long> SENSOR_FRAME_DURATION =
960 new Key<Long>("android.sensor.frameDuration", long.class);
964 * Gain applied to image data. Must be
965 * implemented through analog gain only if set to values
966 * below 'maximum analog sensitivity'.
968 * If the sensor can't apply this exact gain, it should lessen the
969 * gain to the nearest possible value (rather than gain more).
972 * ISO 12232:2006 REI method
975 public static final Key<Integer> SENSOR_SENSITIVITY =
976 new Key<Integer>("android.sensor.sensitivity", int.class);
980 * State of the face detector
984 * Whether face detection is enabled, and whether it
985 * should output just the basic fields or the full set of
986 * fields. Value must be one of the
987 * android.statistics.info.availableFaceDetectModes.
989 * @see #STATISTICS_FACE_DETECT_MODE_OFF
990 * @see #STATISTICS_FACE_DETECT_MODE_SIMPLE
991 * @see #STATISTICS_FACE_DETECT_MODE_FULL
993 public static final Key<Integer> STATISTICS_FACE_DETECT_MODE =
994 new Key<Integer>("android.statistics.faceDetectMode", int.class);
998 * Whether the HAL needs to output the lens
999 * shading map in output result metadata
1003 * android.statistics.lensShadingMap must be provided in
1004 * the output result metdata.
1006 * @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF
1007 * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON
1009 public static final Key<Integer> STATISTICS_LENS_SHADING_MAP_MODE =
1010 new Key<Integer>("android.statistics.lensShadingMapMode", int.class);
1014 * Table mapping blue input values to output
1018 * Tonemapping / contrast / gamma curve for the blue
1019 * channel, to use when android.tonemap.mode is CONTRAST_CURVE.
1021 * See android.tonemap.curveRed for more details.
1024 public static final Key<float[]> TONEMAP_CURVE_BLUE =
1025 new Key<float[]>("android.tonemap.curveBlue", float[].class);
1029 * Table mapping green input values to output
1033 * Tonemapping / contrast / gamma curve for the green
1034 * channel, to use when android.tonemap.mode is CONTRAST_CURVE.
1036 * See android.tonemap.curveRed for more details.
1039 public static final Key<float[]> TONEMAP_CURVE_GREEN =
1040 new Key<float[]>("android.tonemap.curveGreen", float[].class);
1044 * Table mapping red input values to output
1048 * Tonemapping / contrast / gamma curve for the red
1049 * channel, to use when android.tonemap.mode is CONTRAST_CURVE.
1051 * Since the input and output ranges may vary depending on
1052 * the camera pipeline, the input and output pixel values
1053 * are represented by normalized floating-point values
1054 * between 0 and 1, with 0 == black and 1 == white.
1056 * The curve should be linearly interpolated between the
1057 * defined points. The points will be listed in increasing
1058 * order of P_IN. For example, if the array is: [0.0, 0.0,
1059 * 0.3, 0.5, 1.0, 1.0], then the input->output mapping
1060 * for a few sample points would be: 0 -> 0, 0.15 ->
1061 * 0.25, 0.3 -> 0.5, 0.5 -> 0.64
1064 public static final Key<float[]> TONEMAP_CURVE_RED =
1065 new Key<float[]>("android.tonemap.curveRed", float[].class);
1068 * @see #TONEMAP_MODE_CONTRAST_CURVE
1069 * @see #TONEMAP_MODE_FAST
1070 * @see #TONEMAP_MODE_HIGH_QUALITY
1072 public static final Key<Integer> TONEMAP_MODE =
1073 new Key<Integer>("android.tonemap.mode", int.class);
1077 * This LED is nominally used to indicate to the user
1078 * that the camera is powered on and may be streaming images back to the
1079 * Application Processor. In certain rare circumstances, the OS may
1080 * disable this when video is processed locally and not transmitted to
1081 * any untrusted applications.
1083 * In particular, the LED *must* always be on when the data could be
1084 * transmitted off the device. The LED *should* always be on whenever
1085 * data is stored locally on the device.
1087 * The LED *may* be off if a trusted application is using the data that
1088 * doesn't violate the above rules.
1093 public static final Key<Boolean> LED_TRANSMIT =
1094 new Key<Boolean>("android.led.transmit", boolean.class);
1098 * Whether black-level compensation is locked
1099 * to its current values, or is free to vary
1102 * When set to ON, the values used for black-level
1103 * compensation must not change until the lock is set to
1106 * Since changes to certain capture parameters (such as
1107 * exposure time) may require resetting of black level
1108 * compensation, the HAL must report whether setting the
1109 * black level lock was successful in the output result
1112 * The black level locking must happen at the sensor, and not at the ISP.
1113 * If for some reason black level locking is no longer legal (for example,
1114 * the analog gain has changed, which forces black levels to be
1115 * recalculated), then the HAL is free to override this request (and it
1116 * must report 'OFF' when this does happen) until the next time locking
1120 public static final Key<Boolean> BLACK_LEVEL_LOCK =
1121 new Key<Boolean>("android.blackLevel.lock", boolean.class);
1123 /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
1124 * End generated code
1125 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/