CaptureResult.java revision da1e6411be6d69650d7e8ae42e738f2dbb356777
1/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
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
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17package android.hardware.camera2;
18
19import android.hardware.camera2.impl.CameraMetadataNative;
20import android.hardware.camera2.impl.CaptureResultExtras;
21import android.hardware.camera2.impl.PublicKey;
22import android.hardware.camera2.impl.SyntheticKey;
23import android.hardware.camera2.utils.TypeReference;
24import android.util.Log;
25import android.util.Rational;
26
27import java.util.List;
28
29/**
30 * <p>The subset of the results of a single image capture from the image sensor.</p>
31 *
32 * <p>Contains a subset of the final configuration for the capture hardware (sensor, lens,
33 * flash), the processing pipeline, the control algorithms, and the output
34 * buffers.</p>
35 *
36 * <p>CaptureResults are produced by a {@link CameraDevice} after processing a
37 * {@link CaptureRequest}. All properties listed for capture requests can also
38 * be queried on the capture result, to determine the final values used for
39 * capture. The result also includes additional metadata about the state of the
40 * camera device during the capture.</p>
41 *
42 * <p>Not all properties returned by {@link CameraCharacteristics#getAvailableCaptureResultKeys()}
43 * are necessarily available. Some results are {@link CaptureResult partial} and will
44 * not have every key set. Only {@link TotalCaptureResult total} results are guaranteed to have
45 * every key available that was enabled by the request.</p>
46 *
47 * <p>{@link CaptureResult} objects are immutable.</p>
48 *
49 */
50public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
51
52    private static final String TAG = "CaptureResult";
53    private static final boolean VERBOSE = false;
54
55    /**
56     * A {@code Key} is used to do capture result field lookups with
57     * {@link CaptureResult#get}.
58     *
59     * <p>For example, to get the timestamp corresponding to the exposure of the first row:
60     * <code><pre>
61     * long timestamp = captureResult.get(CaptureResult.SENSOR_TIMESTAMP);
62     * </pre></code>
63     * </p>
64     *
65     * <p>To enumerate over all possible keys for {@link CaptureResult}, see
66     * {@link CameraCharacteristics#getAvailableCaptureResultKeys}.</p>
67     *
68     * @see CaptureResult#get
69     * @see CameraCharacteristics#getAvailableCaptureResultKeys
70     */
71    public final static class Key<T> {
72        private final CameraMetadataNative.Key<T> mKey;
73
74        /**
75         * Visible for testing and vendor extensions only.
76         *
77         * @hide
78         */
79        public Key(String name, Class<T> type) {
80            mKey = new CameraMetadataNative.Key<T>(name, type);
81        }
82
83        /**
84         * Visible for testing and vendor extensions only.
85         *
86         * @hide
87         */
88        public Key(String name, TypeReference<T> typeReference) {
89            mKey = new CameraMetadataNative.Key<T>(name, typeReference);
90        }
91
92        /**
93         * Return a camelCase, period separated name formatted like:
94         * {@code "root.section[.subsections].name"}.
95         *
96         * <p>Built-in keys exposed by the Android SDK are always prefixed with {@code "android."};
97         * keys that are device/platform-specific are prefixed with {@code "com."}.</p>
98         *
99         * <p>For example, {@code CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP} would
100         * have a name of {@code "android.scaler.streamConfigurationMap"}; whereas a device
101         * specific key might look like {@code "com.google.nexus.data.private"}.</p>
102         *
103         * @return String representation of the key name
104         */
105        public String getName() {
106            return mKey.getName();
107        }
108
109        /**
110         * {@inheritDoc}
111         */
112        @Override
113        public final int hashCode() {
114            return mKey.hashCode();
115        }
116
117        /**
118         * {@inheritDoc}
119         */
120        @SuppressWarnings("unchecked")
121        @Override
122        public final boolean equals(Object o) {
123            return o instanceof Key && ((Key<T>)o).mKey.equals(mKey);
124        }
125
126        /**
127         * Visible for CameraMetadataNative implementation only; do not use.
128         *
129         * TODO: Make this private or remove it altogether.
130         *
131         * @hide
132         */
133        public CameraMetadataNative.Key<T> getNativeKey() {
134            return mKey;
135        }
136
137        @SuppressWarnings({ "unchecked" })
138        /*package*/ Key(CameraMetadataNative.Key<?> nativeKey) {
139            mKey = (CameraMetadataNative.Key<T>) nativeKey;
140        }
141    }
142
143    private final CameraMetadataNative mResults;
144    private final CaptureRequest mRequest;
145    private final int mSequenceId;
146    private final long mFrameNumber;
147
148    /**
149     * Takes ownership of the passed-in properties object
150     *
151     * <p>For internal use only</p>
152     * @hide
153     */
154    public CaptureResult(CameraMetadataNative results, CaptureRequest parent,
155            CaptureResultExtras extras) {
156        if (results == null) {
157            throw new IllegalArgumentException("results was null");
158        }
159
160        if (parent == null) {
161            throw new IllegalArgumentException("parent was null");
162        }
163
164        if (extras == null) {
165            throw new IllegalArgumentException("extras was null");
166        }
167
168        mResults = CameraMetadataNative.move(results);
169        if (mResults.isEmpty()) {
170            throw new AssertionError("Results must not be empty");
171        }
172        mRequest = parent;
173        mSequenceId = extras.getRequestId();
174        mFrameNumber = extras.getFrameNumber();
175    }
176
177    /**
178     * Returns a copy of the underlying {@link CameraMetadataNative}.
179     * @hide
180     */
181    public CameraMetadataNative getNativeCopy() {
182        return new CameraMetadataNative(mResults);
183    }
184
185    /**
186     * Creates a request-less result.
187     *
188     * <p><strong>For testing only.</strong></p>
189     * @hide
190     */
191    public CaptureResult(CameraMetadataNative results, int sequenceId) {
192        if (results == null) {
193            throw new IllegalArgumentException("results was null");
194        }
195
196        mResults = CameraMetadataNative.move(results);
197        if (mResults.isEmpty()) {
198            throw new AssertionError("Results must not be empty");
199        }
200
201        mRequest = null;
202        mSequenceId = sequenceId;
203        mFrameNumber = -1;
204    }
205
206    /**
207     * Get a capture result field value.
208     *
209     * <p>The field definitions can be found in {@link CaptureResult}.</p>
210     *
211     * <p>Querying the value for the same key more than once will return a value
212     * which is equal to the previous queried value.</p>
213     *
214     * @throws IllegalArgumentException if the key was not valid
215     *
216     * @param key The result field to read.
217     * @return The value of that key, or {@code null} if the field is not set.
218     */
219    public <T> T get(Key<T> key) {
220        T value = mResults.get(key);
221        if (VERBOSE) Log.v(TAG, "#get for Key = " + key.getName() + ", returned value = " + value);
222        return value;
223    }
224
225    /**
226     * {@inheritDoc}
227     * @hide
228     */
229    @SuppressWarnings("unchecked")
230    @Override
231    protected <T> T getProtected(Key<?> key) {
232        return (T) mResults.get(key);
233    }
234
235    /**
236     * {@inheritDoc}
237     * @hide
238     */
239    @SuppressWarnings("unchecked")
240    @Override
241    protected Class<Key<?>> getKeyClass() {
242        Object thisClass = Key.class;
243        return (Class<Key<?>>)thisClass;
244    }
245
246    /**
247     * Dumps the native metadata contents to logcat.
248     *
249     * <p>Visibility for testing/debugging only. The results will not
250     * include any synthesized keys, as they are invisible to the native layer.</p>
251     *
252     * @hide
253     */
254    public void dumpToLog() {
255        mResults.dumpToLog();
256    }
257
258    /**
259     * {@inheritDoc}
260     */
261    @Override
262    public List<Key<?>> getKeys() {
263        // Force the javadoc for this function to show up on the CaptureResult page
264        return super.getKeys();
265    }
266
267    /**
268     * Get the request associated with this result.
269     *
270     * <p>Whenever a request has been fully or partially captured, with
271     * {@link CameraCaptureSession.CaptureCallback#onCaptureCompleted} or
272     * {@link CameraCaptureSession.CaptureCallback#onCaptureProgressed}, the {@code result}'s
273     * {@code getRequest()} will return that {@code request}.
274     * </p>
275     *
276     * <p>For example,
277     * <code><pre>cameraDevice.capture(someRequest, new CaptureCallback() {
278     *     {@literal @}Override
279     *     void onCaptureCompleted(CaptureRequest myRequest, CaptureResult myResult) {
280     *         assert(myResult.getRequest.equals(myRequest) == true);
281     *     }
282     * }, null);
283     * </code></pre>
284     * </p>
285     *
286     * @return The request associated with this result. Never {@code null}.
287     */
288    public CaptureRequest getRequest() {
289        return mRequest;
290    }
291
292    /**
293     * Get the frame number associated with this result.
294     *
295     * <p>Whenever a request has been processed, regardless of failure or success,
296     * it gets a unique frame number assigned to its future result/failure.</p>
297     *
298     * <p>This value monotonically increments, starting with 0,
299     * for every new result or failure; and the scope is the lifetime of the
300     * {@link CameraDevice}.</p>
301     *
302     * @return The frame number
303     */
304    public long getFrameNumber() {
305        return mFrameNumber;
306    }
307
308    /**
309     * The sequence ID for this failure that was returned by the
310     * {@link CameraCaptureSession#capture} family of functions.
311     *
312     * <p>The sequence ID is a unique monotonically increasing value starting from 0,
313     * incremented every time a new group of requests is submitted to the CameraDevice.</p>
314     *
315     * @return int The ID for the sequence of requests that this capture result is a part of
316     *
317     * @see CameraDevice.CaptureCallback#onCaptureSequenceCompleted
318     * @see CameraDevice.CaptureCallback#onCaptureSequenceAborted
319     */
320    public int getSequenceId() {
321        return mSequenceId;
322    }
323
324    /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
325     * The key entries below this point are generated from metadata
326     * definitions in /system/media/camera/docs. Do not modify by hand or
327     * modify the comment blocks at the start or end.
328     *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/
329
330    /**
331     * <p>The mode control selects how the image data is converted from the
332     * sensor's native color into linear sRGB color.</p>
333     * <p>When auto-white balance (AWB) is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this
334     * control is overridden by the AWB routine. When AWB is disabled, the
335     * application controls how the color mapping is performed.</p>
336     * <p>We define the expected processing pipeline below. For consistency
337     * across devices, this is always the case with TRANSFORM_MATRIX.</p>
338     * <p>When either FULL or HIGH_QUALITY is used, the camera device may
339     * do additional processing but {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
340     * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} will still be provided by the
341     * camera device (in the results) and be roughly correct.</p>
342     * <p>Switching to TRANSFORM_MATRIX and using the data provided from
343     * FAST or HIGH_QUALITY will yield a picture with the same white point
344     * as what was produced by the camera device in the earlier frame.</p>
345     * <p>The expected processing pipeline is as follows:</p>
346     * <p><img alt="White balance processing pipeline" src="../../../../images/camera2/metadata/android.colorCorrection.mode/processing_pipeline.png" /></p>
347     * <p>The white balance is encoded by two values, a 4-channel white-balance
348     * gain vector (applied in the Bayer domain), and a 3x3 color transform
349     * matrix (applied after demosaic).</p>
350     * <p>The 4-channel white-balance gains are defined as:</p>
351     * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} = [ R G_even G_odd B ]
352     * </code></pre>
353     * <p>where <code>G_even</code> is the gain for green pixels on even rows of the
354     * output, and <code>G_odd</code> is the gain for green pixels on the odd rows.
355     * These may be identical for a given camera device implementation; if
356     * the camera device does not support a separate gain for even/odd green
357     * channels, it will use the <code>G_even</code> value, and write <code>G_odd</code> equal to
358     * <code>G_even</code> in the output result metadata.</p>
359     * <p>The matrices for color transforms are defined as a 9-entry vector:</p>
360     * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} = [ I0 I1 I2 I3 I4 I5 I6 I7 I8 ]
361     * </code></pre>
362     * <p>which define a transform from input sensor colors, <code>P_in = [ r g b ]</code>,
363     * to output linear sRGB, <code>P_out = [ r' g' b' ]</code>,</p>
364     * <p>with colors as follows:</p>
365     * <pre><code>r' = I0r + I1g + I2b
366     * g' = I3r + I4g + I5b
367     * b' = I6r + I7g + I8b
368     * </code></pre>
369     * <p>Both the input and output value ranges must match. Overflow/underflow
370     * values are clipped to fit within the range.</p>
371     * <p><b>Possible values:</b>
372     * <ul>
373     *   <li>{@link #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX TRANSFORM_MATRIX}</li>
374     *   <li>{@link #COLOR_CORRECTION_MODE_FAST FAST}</li>
375     *   <li>{@link #COLOR_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
376     * </ul></p>
377     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
378     * <p><b>Full capability</b> -
379     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
380     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
381     *
382     * @see CaptureRequest#COLOR_CORRECTION_GAINS
383     * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
384     * @see CaptureRequest#CONTROL_AWB_MODE
385     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
386     * @see #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX
387     * @see #COLOR_CORRECTION_MODE_FAST
388     * @see #COLOR_CORRECTION_MODE_HIGH_QUALITY
389     */
390    @PublicKey
391    public static final Key<Integer> COLOR_CORRECTION_MODE =
392            new Key<Integer>("android.colorCorrection.mode", int.class);
393
394    /**
395     * <p>A color transform matrix to use to transform
396     * from sensor RGB color space to output linear sRGB color space.</p>
397     * <p>This matrix is either set by the camera device when the request
398     * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not TRANSFORM_MATRIX, or
399     * directly by the application in the request when the
400     * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is TRANSFORM_MATRIX.</p>
401     * <p>In the latter case, the camera device may round the matrix to account
402     * for precision issues; the final rounded matrix should be reported back
403     * in this matrix result metadata. The transform should keep the magnitude
404     * of the output color values within <code>[0, 1.0]</code> (assuming input color
405     * values is within the normalized range <code>[0, 1.0]</code>), or clipping may occur.</p>
406     * <p>The valid range of each matrix element varies on different devices, but
407     * values within [-1.5, 3.0] are guaranteed not to be clipped.</p>
408     * <p><b>Units</b>: Unitless scale factors</p>
409     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
410     * <p><b>Full capability</b> -
411     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
412     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
413     *
414     * @see CaptureRequest#COLOR_CORRECTION_MODE
415     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
416     */
417    @PublicKey
418    public static final Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM =
419            new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.colorCorrection.transform", android.hardware.camera2.params.ColorSpaceTransform.class);
420
421    /**
422     * <p>Gains applying to Bayer raw color channels for
423     * white-balance.</p>
424     * <p>These per-channel gains are either set by the camera device
425     * when the request {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not
426     * TRANSFORM_MATRIX, or directly by the application in the
427     * request when the {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is
428     * TRANSFORM_MATRIX.</p>
429     * <p>The gains in the result metadata are the gains actually
430     * applied by the camera device to the current frame.</p>
431     * <p>The valid range of gains varies on different devices, but gains
432     * between [1.0, 3.0] are guaranteed not to be clipped. Even if a given
433     * device allows gains below 1.0, this is usually not recommended because
434     * this can create color artifacts.</p>
435     * <p><b>Units</b>: Unitless gain factors</p>
436     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
437     * <p><b>Full capability</b> -
438     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
439     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
440     *
441     * @see CaptureRequest#COLOR_CORRECTION_MODE
442     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
443     */
444    @PublicKey
445    public static final Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS =
446            new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class);
447
448    /**
449     * <p>Mode of operation for the chromatic aberration correction algorithm.</p>
450     * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light
451     * can not focus on the same point after exiting from the lens. This metadata defines
452     * the high level control of chromatic aberration correction algorithm, which aims to
453     * minimize the chromatic artifacts that may occur along the object boundaries in an
454     * image.</p>
455     * <p>FAST/HIGH_QUALITY both mean that camera device determined aberration
456     * correction will be applied. HIGH_QUALITY mode indicates that the camera device will
457     * use the highest-quality aberration correction algorithms, even if it slows down
458     * capture rate. FAST means the camera device will not slow down capture rate when
459     * applying aberration correction.</p>
460     * <p>LEGACY devices will always be in FAST mode.</p>
461     * <p><b>Possible values:</b>
462     * <ul>
463     *   <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_OFF OFF}</li>
464     *   <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_FAST FAST}</li>
465     *   <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
466     * </ul></p>
467     * <p><b>Available values for this device:</b><br>
468     * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES android.colorCorrection.availableAberrationModes}</p>
469     * <p>This key is available on all devices.</p>
470     *
471     * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES
472     * @see #COLOR_CORRECTION_ABERRATION_MODE_OFF
473     * @see #COLOR_CORRECTION_ABERRATION_MODE_FAST
474     * @see #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY
475     */
476    @PublicKey
477    public static final Key<Integer> COLOR_CORRECTION_ABERRATION_MODE =
478            new Key<Integer>("android.colorCorrection.aberrationMode", int.class);
479
480    /**
481     * <p>The desired setting for the camera device's auto-exposure
482     * algorithm's antibanding compensation.</p>
483     * <p>Some kinds of lighting fixtures, such as some fluorescent
484     * lights, flicker at the rate of the power supply frequency
485     * (60Hz or 50Hz, depending on country). While this is
486     * typically not noticeable to a person, it can be visible to
487     * a camera device. If a camera sets its exposure time to the
488     * wrong value, the flicker may become visible in the
489     * viewfinder as flicker or in a final captured image, as a
490     * set of variable-brightness bands across the image.</p>
491     * <p>Therefore, the auto-exposure routines of camera devices
492     * include antibanding routines that ensure that the chosen
493     * exposure value will not cause such banding. The choice of
494     * exposure time depends on the rate of flicker, which the
495     * camera device can detect automatically, or the expected
496     * rate can be selected by the application using this
497     * control.</p>
498     * <p>A given camera device may not support all of the possible
499     * options for the antibanding mode. The
500     * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes} key contains
501     * the available modes for a given camera device.</p>
502     * <p>AUTO mode is the default if it is available on given
503     * camera device. When AUTO mode is not available, the
504     * default will be either 50HZ or 60HZ, and both 50HZ
505     * and 60HZ will be available.</p>
506     * <p>If manual exposure control is enabled (by setting
507     * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} to OFF),
508     * then this setting has no effect, and the application must
509     * ensure it selects exposure times that do not cause banding
510     * issues. The {@link CaptureResult#STATISTICS_SCENE_FLICKER android.statistics.sceneFlicker} key can assist
511     * the application in this.</p>
512     * <p><b>Possible values:</b>
513     * <ul>
514     *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_OFF OFF}</li>
515     *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_50HZ 50HZ}</li>
516     *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_60HZ 60HZ}</li>
517     *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_AUTO AUTO}</li>
518     * </ul></p>
519     * <p><b>Available values for this device:</b><br></p>
520     * <p>{@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes}</p>
521     * <p>This key is available on all devices.</p>
522     *
523     * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES
524     * @see CaptureRequest#CONTROL_AE_MODE
525     * @see CaptureRequest#CONTROL_MODE
526     * @see CaptureResult#STATISTICS_SCENE_FLICKER
527     * @see #CONTROL_AE_ANTIBANDING_MODE_OFF
528     * @see #CONTROL_AE_ANTIBANDING_MODE_50HZ
529     * @see #CONTROL_AE_ANTIBANDING_MODE_60HZ
530     * @see #CONTROL_AE_ANTIBANDING_MODE_AUTO
531     */
532    @PublicKey
533    public static final Key<Integer> CONTROL_AE_ANTIBANDING_MODE =
534            new Key<Integer>("android.control.aeAntibandingMode", int.class);
535
536    /**
537     * <p>Adjustment to auto-exposure (AE) target image
538     * brightness.</p>
539     * <p>The adjustment is measured as a count of steps, with the
540     * step size defined by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP android.control.aeCompensationStep} and the
541     * allowed range by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}.</p>
542     * <p>For example, if the exposure value (EV) step is 0.333, '6'
543     * will mean an exposure compensation of +2 EV; -3 will mean an
544     * exposure compensation of -1 EV. One EV represents a doubling
545     * of image brightness. Note that this control will only be
546     * effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF. This control
547     * will take effect even when {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} <code>== true</code>.</p>
548     * <p>In the event of exposure compensation value being changed, camera device
549     * may take several frames to reach the newly requested exposure target.
550     * During that time, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} field will be in the SEARCHING
551     * state. Once the new exposure target is reached, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} will
552     * change from SEARCHING to either CONVERGED, LOCKED (if AE lock is enabled), or
553     * FLASH_REQUIRED (if the scene is too dark for still capture).</p>
554     * <p><b>Units</b>: Compensation steps</p>
555     * <p><b>Range of valid values:</b><br>
556     * {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}</p>
557     * <p>This key is available on all devices.</p>
558     *
559     * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE
560     * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP
561     * @see CaptureRequest#CONTROL_AE_LOCK
562     * @see CaptureRequest#CONTROL_AE_MODE
563     * @see CaptureResult#CONTROL_AE_STATE
564     */
565    @PublicKey
566    public static final Key<Integer> CONTROL_AE_EXPOSURE_COMPENSATION =
567            new Key<Integer>("android.control.aeExposureCompensation", int.class);
568
569    /**
570     * <p>Whether auto-exposure (AE) is currently locked to its latest
571     * calculated values.</p>
572     * <p>When set to <code>true</code> (ON), the AE algorithm is locked to its latest parameters,
573     * and will not change exposure settings until the lock is set to <code>false</code> (OFF).</p>
574     * <p>Note that even when AE is locked, the flash may be fired if
575     * the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_AUTO_FLASH /
576     * ON_ALWAYS_FLASH / ON_AUTO_FLASH_REDEYE.</p>
577     * <p>When {@link CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION android.control.aeExposureCompensation} is changed, even if the AE lock
578     * is ON, the camera device will still adjust its exposure value.</p>
579     * <p>If AE precapture is triggered (see {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger})
580     * when AE is already locked, the camera device will not change the exposure time
581     * ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}) and sensitivity ({@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity})
582     * parameters. The flash may be fired if the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}
583     * is ON_AUTO_FLASH/ON_AUTO_FLASH_REDEYE and the scene is too dark. If the
584     * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_ALWAYS_FLASH, the scene may become overexposed.
585     * Similarly, AE precapture trigger CANCEL has no effect when AE is already locked.</p>
586     * <p>When an AE precapture sequence is triggered, AE unlock will not be able to unlock
587     * the AE if AE is locked by the camera device internally during precapture metering
588     * sequence In other words, submitting requests with AE unlock has no effect for an
589     * ongoing precapture metering sequence. Otherwise, the precapture metering sequence
590     * will never succeed in a sequence of preview requests where AE lock is always set
591     * to <code>false</code>.</p>
592     * <p>Since the camera device has a pipeline of in-flight requests, the settings that
593     * get locked do not necessarily correspond to the settings that were present in the
594     * latest capture result received from the camera device, since additional captures
595     * and AE updates may have occurred even before the result was sent out. If an
596     * application is switching between automatic and manual control and wishes to eliminate
597     * any flicker during the switch, the following procedure is recommended:</p>
598     * <ol>
599     * <li>Starting in auto-AE mode:</li>
600     * <li>Lock AE</li>
601     * <li>Wait for the first result to be output that has the AE locked</li>
602     * <li>Copy exposure settings from that result into a request, set the request to manual AE</li>
603     * <li>Submit the capture request, proceed to run manual AE as desired.</li>
604     * </ol>
605     * <p>See {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE lock related state transition details.</p>
606     * <p>This key is available on all devices.</p>
607     *
608     * @see CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION
609     * @see CaptureRequest#CONTROL_AE_MODE
610     * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
611     * @see CaptureResult#CONTROL_AE_STATE
612     * @see CaptureRequest#SENSOR_EXPOSURE_TIME
613     * @see CaptureRequest#SENSOR_SENSITIVITY
614     */
615    @PublicKey
616    public static final Key<Boolean> CONTROL_AE_LOCK =
617            new Key<Boolean>("android.control.aeLock", boolean.class);
618
619    /**
620     * <p>The desired mode for the camera device's
621     * auto-exposure routine.</p>
622     * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is
623     * AUTO.</p>
624     * <p>When set to any of the ON modes, the camera device's
625     * auto-exposure routine is enabled, overriding the
626     * application's selected exposure time, sensor sensitivity,
627     * and frame duration ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
628     * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and
629     * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}). If one of the FLASH modes
630     * is selected, the camera device's flash unit controls are
631     * also overridden.</p>
632     * <p>The FLASH modes are only available if the camera device
633     * has a flash unit ({@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} is <code>true</code>).</p>
634     * <p>If flash TORCH mode is desired, this field must be set to
635     * ON or OFF, and {@link CaptureRequest#FLASH_MODE android.flash.mode} set to TORCH.</p>
636     * <p>When set to any of the ON modes, the values chosen by the
637     * camera device auto-exposure routine for the overridden
638     * fields for a given capture will be available in its
639     * CaptureResult.</p>
640     * <p><b>Possible values:</b>
641     * <ul>
642     *   <li>{@link #CONTROL_AE_MODE_OFF OFF}</li>
643     *   <li>{@link #CONTROL_AE_MODE_ON ON}</li>
644     *   <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH ON_AUTO_FLASH}</li>
645     *   <li>{@link #CONTROL_AE_MODE_ON_ALWAYS_FLASH ON_ALWAYS_FLASH}</li>
646     *   <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE ON_AUTO_FLASH_REDEYE}</li>
647     * </ul></p>
648     * <p><b>Available values for this device:</b><br>
649     * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES android.control.aeAvailableModes}</p>
650     * <p>This key is available on all devices.</p>
651     *
652     * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES
653     * @see CaptureRequest#CONTROL_MODE
654     * @see CameraCharacteristics#FLASH_INFO_AVAILABLE
655     * @see CaptureRequest#FLASH_MODE
656     * @see CaptureRequest#SENSOR_EXPOSURE_TIME
657     * @see CaptureRequest#SENSOR_FRAME_DURATION
658     * @see CaptureRequest#SENSOR_SENSITIVITY
659     * @see #CONTROL_AE_MODE_OFF
660     * @see #CONTROL_AE_MODE_ON
661     * @see #CONTROL_AE_MODE_ON_AUTO_FLASH
662     * @see #CONTROL_AE_MODE_ON_ALWAYS_FLASH
663     * @see #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE
664     */
665    @PublicKey
666    public static final Key<Integer> CONTROL_AE_MODE =
667            new Key<Integer>("android.control.aeMode", int.class);
668
669    /**
670     * <p>List of metering areas to use for auto-exposure adjustment.</p>
671     * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe} is 0.
672     * Otherwise will always be present.</p>
673     * <p>The maximum number of regions supported by the device is determined by the value
674     * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe}.</p>
675     * <p>The coordinate system is based on the active pixel array,
676     * with (0,0) being the top-left pixel in the active pixel array, and
677     * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
678     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the
679     * bottom-right pixel in the active pixel array.</p>
680     * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight
681     * for every pixel in the area. This means that a large metering area
682     * with the same weight as a smaller area will have more effect in
683     * the metering result. Metering areas can partially overlap and the
684     * camera device will add the weights in the overlap region.</p>
685     * <p>The weights are relative to weights of other exposure metering regions, so if only one
686     * region is used, all non-zero weights will have the same effect. A region with 0
687     * weight is ignored.</p>
688     * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
689     * camera device.</p>
690     * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
691     * capture result metadata, the camera device will ignore the sections outside the crop
692     * region and output only the intersection rectangle as the metering region in the result
693     * metadata.  If the region is entirely outside the crop region, it will be ignored and
694     * not reported in the result metadata.</p>
695     * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}</p>
696     * <p><b>Range of valid values:</b><br>
697     * Coordinates must be between <code>[(0,0), (width, height))</code> of
698     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}</p>
699     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
700     *
701     * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE
702     * @see CaptureRequest#SCALER_CROP_REGION
703     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
704     */
705    @PublicKey
706    public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS =
707            new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.aeRegions", android.hardware.camera2.params.MeteringRectangle[].class);
708
709    /**
710     * <p>Range over which the auto-exposure routine can
711     * adjust the capture frame rate to maintain good
712     * exposure.</p>
713     * <p>Only constrains auto-exposure (AE) algorithm, not
714     * manual control of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime} and
715     * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}.</p>
716     * <p><b>Units</b>: Frames per second (FPS)</p>
717     * <p><b>Range of valid values:</b><br>
718     * Any of the entries in {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES android.control.aeAvailableTargetFpsRanges}</p>
719     * <p>This key is available on all devices.</p>
720     *
721     * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES
722     * @see CaptureRequest#SENSOR_EXPOSURE_TIME
723     * @see CaptureRequest#SENSOR_FRAME_DURATION
724     */
725    @PublicKey
726    public static final Key<android.util.Range<Integer>> CONTROL_AE_TARGET_FPS_RANGE =
727            new Key<android.util.Range<Integer>>("android.control.aeTargetFpsRange", new TypeReference<android.util.Range<Integer>>() {{ }});
728
729    /**
730     * <p>Whether the camera device will trigger a precapture
731     * metering sequence when it processes this request.</p>
732     * <p>This entry is normally set to IDLE, or is not
733     * included at all in the request settings. When included and
734     * set to START, the camera device will trigger the auto-exposure (AE)
735     * precapture metering sequence.</p>
736     * <p>When set to CANCEL, the camera device will cancel any active
737     * precapture metering trigger, and return to its initial AE state.
738     * If a precapture metering sequence is already completed, and the camera
739     * device has implicitly locked the AE for subsequent still capture, the
740     * CANCEL trigger will unlock the AE and return to its initial AE state.</p>
741     * <p>The precapture sequence should be triggered before starting a
742     * high-quality still capture for final metering decisions to
743     * be made, and for firing pre-capture flash pulses to estimate
744     * scene brightness and required final capture flash power, when
745     * the flash is enabled.</p>
746     * <p>Normally, this entry should be set to START for only a
747     * single request, and the application should wait until the
748     * sequence completes before starting a new one.</p>
749     * <p>When a precapture metering sequence is finished, the camera device
750     * may lock the auto-exposure routine internally to be able to accurately expose the
751     * subsequent still capture image (<code>{@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE</code>).
752     * For this case, the AE may not resume normal scan if no subsequent still capture is
753     * submitted. To ensure that the AE routine restarts normal scan, the application should
754     * submit a request with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == true</code>, followed by a request
755     * with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == false</code>, if the application decides not to submit a
756     * still capture request after the precapture sequence completes. Alternatively, for
757     * API level 23 or newer devices, the CANCEL can be used to unlock the camera device
758     * internally locked AE if the application doesn't submit a still capture request after
759     * the AE precapture trigger. Note that, the CANCEL was added in API level 23, and must not
760     * be used in devices that have earlier API levels.</p>
761     * <p>The exact effect of auto-exposure (AE) precapture trigger
762     * depends on the current AE mode and state; see
763     * {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture state transition
764     * details.</p>
765     * <p>On LEGACY-level devices, the precapture trigger is not supported;
766     * capturing a high-resolution JPEG image will automatically trigger a
767     * precapture sequence before the high-resolution capture, including
768     * potentially firing a pre-capture flash.</p>
769     * <p><b>Possible values:</b>
770     * <ul>
771     *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE IDLE}</li>
772     *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_START START}</li>
773     *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL CANCEL}</li>
774     * </ul></p>
775     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
776     * <p><b>Limited capability</b> -
777     * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
778     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
779     *
780     * @see CaptureRequest#CONTROL_AE_LOCK
781     * @see CaptureResult#CONTROL_AE_STATE
782     * @see CaptureRequest#CONTROL_CAPTURE_INTENT
783     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
784     * @see #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE
785     * @see #CONTROL_AE_PRECAPTURE_TRIGGER_START
786     * @see #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL
787     */
788    @PublicKey
789    public static final Key<Integer> CONTROL_AE_PRECAPTURE_TRIGGER =
790            new Key<Integer>("android.control.aePrecaptureTrigger", int.class);
791
792    /**
793     * <p>Current state of the auto-exposure (AE) algorithm.</p>
794     * <p>Switching between or enabling AE modes ({@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}) always
795     * resets the AE state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode},
796     * or {@link CaptureRequest#CONTROL_SCENE_MODE android.control.sceneMode} if <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code> resets all
797     * the algorithm states to INACTIVE.</p>
798     * <p>The camera device can do several state transitions between two results, if it is
799     * allowed by the state transition table. For example: INACTIVE may never actually be
800     * seen in a result.</p>
801     * <p>The state in the result is the state for this image (in sync with this image): if
802     * AE state becomes CONVERGED, then the image data associated with this result should
803     * be good to use.</p>
804     * <p>Below are state transition tables for different AE modes.</p>
805     * <table>
806     * <thead>
807     * <tr>
808     * <th align="center">State</th>
809     * <th align="center">Transition Cause</th>
810     * <th align="center">New State</th>
811     * <th align="center">Notes</th>
812     * </tr>
813     * </thead>
814     * <tbody>
815     * <tr>
816     * <td align="center">INACTIVE</td>
817     * <td align="center"></td>
818     * <td align="center">INACTIVE</td>
819     * <td align="center">Camera device auto exposure algorithm is disabled</td>
820     * </tr>
821     * </tbody>
822     * </table>
823     * <p>When {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is AE_MODE_ON_*:</p>
824     * <table>
825     * <thead>
826     * <tr>
827     * <th align="center">State</th>
828     * <th align="center">Transition Cause</th>
829     * <th align="center">New State</th>
830     * <th align="center">Notes</th>
831     * </tr>
832     * </thead>
833     * <tbody>
834     * <tr>
835     * <td align="center">INACTIVE</td>
836     * <td align="center">Camera device initiates AE scan</td>
837     * <td align="center">SEARCHING</td>
838     * <td align="center">Values changing</td>
839     * </tr>
840     * <tr>
841     * <td align="center">INACTIVE</td>
842     * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is ON</td>
843     * <td align="center">LOCKED</td>
844     * <td align="center">Values locked</td>
845     * </tr>
846     * <tr>
847     * <td align="center">SEARCHING</td>
848     * <td align="center">Camera device finishes AE scan</td>
849     * <td align="center">CONVERGED</td>
850     * <td align="center">Good values, not changing</td>
851     * </tr>
852     * <tr>
853     * <td align="center">SEARCHING</td>
854     * <td align="center">Camera device finishes AE scan</td>
855     * <td align="center">FLASH_REQUIRED</td>
856     * <td align="center">Converged but too dark w/o flash</td>
857     * </tr>
858     * <tr>
859     * <td align="center">SEARCHING</td>
860     * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is ON</td>
861     * <td align="center">LOCKED</td>
862     * <td align="center">Values locked</td>
863     * </tr>
864     * <tr>
865     * <td align="center">CONVERGED</td>
866     * <td align="center">Camera device initiates AE scan</td>
867     * <td align="center">SEARCHING</td>
868     * <td align="center">Values changing</td>
869     * </tr>
870     * <tr>
871     * <td align="center">CONVERGED</td>
872     * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is ON</td>
873     * <td align="center">LOCKED</td>
874     * <td align="center">Values locked</td>
875     * </tr>
876     * <tr>
877     * <td align="center">FLASH_REQUIRED</td>
878     * <td align="center">Camera device initiates AE scan</td>
879     * <td align="center">SEARCHING</td>
880     * <td align="center">Values changing</td>
881     * </tr>
882     * <tr>
883     * <td align="center">FLASH_REQUIRED</td>
884     * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is ON</td>
885     * <td align="center">LOCKED</td>
886     * <td align="center">Values locked</td>
887     * </tr>
888     * <tr>
889     * <td align="center">LOCKED</td>
890     * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is OFF</td>
891     * <td align="center">SEARCHING</td>
892     * <td align="center">Values not good after unlock</td>
893     * </tr>
894     * <tr>
895     * <td align="center">LOCKED</td>
896     * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is OFF</td>
897     * <td align="center">CONVERGED</td>
898     * <td align="center">Values good after unlock</td>
899     * </tr>
900     * <tr>
901     * <td align="center">LOCKED</td>
902     * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is OFF</td>
903     * <td align="center">FLASH_REQUIRED</td>
904     * <td align="center">Exposure good, but too dark</td>
905     * </tr>
906     * <tr>
907     * <td align="center">PRECAPTURE</td>
908     * <td align="center">Sequence done. {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is OFF</td>
909     * <td align="center">CONVERGED</td>
910     * <td align="center">Ready for high-quality capture</td>
911     * </tr>
912     * <tr>
913     * <td align="center">PRECAPTURE</td>
914     * <td align="center">Sequence done. {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is ON</td>
915     * <td align="center">LOCKED</td>
916     * <td align="center">Ready for high-quality capture</td>
917     * </tr>
918     * <tr>
919     * <td align="center">LOCKED</td>
920     * <td align="center">aeLock is ON and aePrecaptureTrigger is START</td>
921     * <td align="center">LOCKED</td>
922     * <td align="center">Precapture trigger is ignored when AE is already locked</td>
923     * </tr>
924     * <tr>
925     * <td align="center">LOCKED</td>
926     * <td align="center">aeLock is ON and aePrecaptureTrigger is CANCEL</td>
927     * <td align="center">LOCKED</td>
928     * <td align="center">Precapture trigger is ignored when AE is already locked</td>
929     * </tr>
930     * <tr>
931     * <td align="center">Any state (excluding LOCKED)</td>
932     * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is START</td>
933     * <td align="center">PRECAPTURE</td>
934     * <td align="center">Start AE precapture metering sequence</td>
935     * </tr>
936     * <tr>
937     * <td align="center">Any state (excluding LOCKED)</td>
938     * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is CANCEL</td>
939     * <td align="center">INACTIVE</td>
940     * <td align="center">Currently active precapture metering sequence is canceled</td>
941     * </tr>
942     * </tbody>
943     * </table>
944     * <p>For the above table, the camera device may skip reporting any state changes that happen
945     * without application intervention (i.e. mode switch, trigger, locking). Any state that
946     * can be skipped in that manner is called a transient state.</p>
947     * <p>For example, for above AE modes (AE_MODE_ON_*), in addition to the state transitions
948     * listed in above table, it is also legal for the camera device to skip one or more
949     * transient states between two results. See below table for examples:</p>
950     * <table>
951     * <thead>
952     * <tr>
953     * <th align="center">State</th>
954     * <th align="center">Transition Cause</th>
955     * <th align="center">New State</th>
956     * <th align="center">Notes</th>
957     * </tr>
958     * </thead>
959     * <tbody>
960     * <tr>
961     * <td align="center">INACTIVE</td>
962     * <td align="center">Camera device finished AE scan</td>
963     * <td align="center">CONVERGED</td>
964     * <td align="center">Values are already good, transient states are skipped by camera device.</td>
965     * </tr>
966     * <tr>
967     * <td align="center">Any state (excluding LOCKED)</td>
968     * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is START, sequence done</td>
969     * <td align="center">FLASH_REQUIRED</td>
970     * <td align="center">Converged but too dark w/o flash after a precapture sequence, transient states are skipped by camera device.</td>
971     * </tr>
972     * <tr>
973     * <td align="center">Any state (excluding LOCKED)</td>
974     * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is START, sequence done</td>
975     * <td align="center">CONVERGED</td>
976     * <td align="center">Converged after a precapture sequence, transient states are skipped by camera device.</td>
977     * </tr>
978     * <tr>
979     * <td align="center">Any state (excluding LOCKED)</td>
980     * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is CANCEL, converged</td>
981     * <td align="center">FLASH_REQUIRED</td>
982     * <td align="center">Converged but too dark w/o flash after a precapture sequence is canceled, transient states are skipped by camera device.</td>
983     * </tr>
984     * <tr>
985     * <td align="center">Any state (excluding LOCKED)</td>
986     * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is CANCEL, converged</td>
987     * <td align="center">CONVERGED</td>
988     * <td align="center">Converged after a precapture sequenceis canceled, transient states are skipped by camera device.</td>
989     * </tr>
990     * <tr>
991     * <td align="center">CONVERGED</td>
992     * <td align="center">Camera device finished AE scan</td>
993     * <td align="center">FLASH_REQUIRED</td>
994     * <td align="center">Converged but too dark w/o flash after a new scan, transient states are skipped by camera device.</td>
995     * </tr>
996     * <tr>
997     * <td align="center">FLASH_REQUIRED</td>
998     * <td align="center">Camera device finished AE scan</td>
999     * <td align="center">CONVERGED</td>
1000     * <td align="center">Converged after a new scan, transient states are skipped by camera device.</td>
1001     * </tr>
1002     * </tbody>
1003     * </table>
1004     * <p><b>Possible values:</b>
1005     * <ul>
1006     *   <li>{@link #CONTROL_AE_STATE_INACTIVE INACTIVE}</li>
1007     *   <li>{@link #CONTROL_AE_STATE_SEARCHING SEARCHING}</li>
1008     *   <li>{@link #CONTROL_AE_STATE_CONVERGED CONVERGED}</li>
1009     *   <li>{@link #CONTROL_AE_STATE_LOCKED LOCKED}</li>
1010     *   <li>{@link #CONTROL_AE_STATE_FLASH_REQUIRED FLASH_REQUIRED}</li>
1011     *   <li>{@link #CONTROL_AE_STATE_PRECAPTURE PRECAPTURE}</li>
1012     * </ul></p>
1013     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
1014     * <p><b>Limited capability</b> -
1015     * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
1016     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
1017     *
1018     * @see CaptureRequest#CONTROL_AE_LOCK
1019     * @see CaptureRequest#CONTROL_AE_MODE
1020     * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
1021     * @see CaptureRequest#CONTROL_MODE
1022     * @see CaptureRequest#CONTROL_SCENE_MODE
1023     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
1024     * @see #CONTROL_AE_STATE_INACTIVE
1025     * @see #CONTROL_AE_STATE_SEARCHING
1026     * @see #CONTROL_AE_STATE_CONVERGED
1027     * @see #CONTROL_AE_STATE_LOCKED
1028     * @see #CONTROL_AE_STATE_FLASH_REQUIRED
1029     * @see #CONTROL_AE_STATE_PRECAPTURE
1030     */
1031    @PublicKey
1032    public static final Key<Integer> CONTROL_AE_STATE =
1033            new Key<Integer>("android.control.aeState", int.class);
1034
1035    /**
1036     * <p>Whether auto-focus (AF) is currently enabled, and what
1037     * mode it is set to.</p>
1038     * <p>Only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} = AUTO and the lens is not fixed focus
1039     * (i.e. <code>{@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} &gt; 0</code>). Also note that
1040     * when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF, the behavior of AF is device
1041     * dependent. It is recommended to lock AF by using {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger} before
1042     * setting {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} to OFF, or set AF mode to OFF when AE is OFF.</p>
1043     * <p>If the lens is controlled by the camera device auto-focus algorithm,
1044     * the camera device will report the current AF status in {@link CaptureResult#CONTROL_AF_STATE android.control.afState}
1045     * in result metadata.</p>
1046     * <p><b>Possible values:</b>
1047     * <ul>
1048     *   <li>{@link #CONTROL_AF_MODE_OFF OFF}</li>
1049     *   <li>{@link #CONTROL_AF_MODE_AUTO AUTO}</li>
1050     *   <li>{@link #CONTROL_AF_MODE_MACRO MACRO}</li>
1051     *   <li>{@link #CONTROL_AF_MODE_CONTINUOUS_VIDEO CONTINUOUS_VIDEO}</li>
1052     *   <li>{@link #CONTROL_AF_MODE_CONTINUOUS_PICTURE CONTINUOUS_PICTURE}</li>
1053     *   <li>{@link #CONTROL_AF_MODE_EDOF EDOF}</li>
1054     * </ul></p>
1055     * <p><b>Available values for this device:</b><br>
1056     * {@link CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES android.control.afAvailableModes}</p>
1057     * <p>This key is available on all devices.</p>
1058     *
1059     * @see CaptureRequest#CONTROL_AE_MODE
1060     * @see CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES
1061     * @see CaptureResult#CONTROL_AF_STATE
1062     * @see CaptureRequest#CONTROL_AF_TRIGGER
1063     * @see CaptureRequest#CONTROL_MODE
1064     * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE
1065     * @see #CONTROL_AF_MODE_OFF
1066     * @see #CONTROL_AF_MODE_AUTO
1067     * @see #CONTROL_AF_MODE_MACRO
1068     * @see #CONTROL_AF_MODE_CONTINUOUS_VIDEO
1069     * @see #CONTROL_AF_MODE_CONTINUOUS_PICTURE
1070     * @see #CONTROL_AF_MODE_EDOF
1071     */
1072    @PublicKey
1073    public static final Key<Integer> CONTROL_AF_MODE =
1074            new Key<Integer>("android.control.afMode", int.class);
1075
1076    /**
1077     * <p>List of metering areas to use for auto-focus.</p>
1078     * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf} is 0.
1079     * Otherwise will always be present.</p>
1080     * <p>The maximum number of focus areas supported by the device is determined by the value
1081     * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf}.</p>
1082     * <p>The coordinate system is based on the active pixel array,
1083     * with (0,0) being the top-left pixel in the active pixel array, and
1084     * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1085     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the
1086     * bottom-right pixel in the active pixel array.</p>
1087     * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight
1088     * for every pixel in the area. This means that a large metering area
1089     * with the same weight as a smaller area will have more effect in
1090     * the metering result. Metering areas can partially overlap and the
1091     * camera device will add the weights in the overlap region.</p>
1092     * <p>The weights are relative to weights of other metering regions, so if only one region
1093     * is used, all non-zero weights will have the same effect. A region with 0 weight is
1094     * ignored.</p>
1095     * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
1096     * camera device.</p>
1097     * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
1098     * capture result metadata, the camera device will ignore the sections outside the crop
1099     * region and output only the intersection rectangle as the metering region in the result
1100     * metadata. If the region is entirely outside the crop region, it will be ignored and
1101     * not reported in the result metadata.</p>
1102     * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}</p>
1103     * <p><b>Range of valid values:</b><br>
1104     * Coordinates must be between <code>[(0,0), (width, height))</code> of
1105     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}</p>
1106     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
1107     *
1108     * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF
1109     * @see CaptureRequest#SCALER_CROP_REGION
1110     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
1111     */
1112    @PublicKey
1113    public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS =
1114            new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.afRegions", android.hardware.camera2.params.MeteringRectangle[].class);
1115
1116    /**
1117     * <p>Whether the camera device will trigger autofocus for this request.</p>
1118     * <p>This entry is normally set to IDLE, or is not
1119     * included at all in the request settings.</p>
1120     * <p>When included and set to START, the camera device will trigger the
1121     * autofocus algorithm. If autofocus is disabled, this trigger has no effect.</p>
1122     * <p>When set to CANCEL, the camera device will cancel any active trigger,
1123     * and return to its initial AF state.</p>
1124     * <p>Generally, applications should set this entry to START or CANCEL for only a
1125     * single capture, and then return it to IDLE (or not set at all). Specifying
1126     * START for multiple captures in a row means restarting the AF operation over
1127     * and over again.</p>
1128     * <p>See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what the trigger means for each AF mode.</p>
1129     * <p><b>Possible values:</b>
1130     * <ul>
1131     *   <li>{@link #CONTROL_AF_TRIGGER_IDLE IDLE}</li>
1132     *   <li>{@link #CONTROL_AF_TRIGGER_START START}</li>
1133     *   <li>{@link #CONTROL_AF_TRIGGER_CANCEL CANCEL}</li>
1134     * </ul></p>
1135     * <p>This key is available on all devices.</p>
1136     *
1137     * @see CaptureResult#CONTROL_AF_STATE
1138     * @see #CONTROL_AF_TRIGGER_IDLE
1139     * @see #CONTROL_AF_TRIGGER_START
1140     * @see #CONTROL_AF_TRIGGER_CANCEL
1141     */
1142    @PublicKey
1143    public static final Key<Integer> CONTROL_AF_TRIGGER =
1144            new Key<Integer>("android.control.afTrigger", int.class);
1145
1146    /**
1147     * <p>Current state of auto-focus (AF) algorithm.</p>
1148     * <p>Switching between or enabling AF modes ({@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}) always
1149     * resets the AF state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode},
1150     * or {@link CaptureRequest#CONTROL_SCENE_MODE android.control.sceneMode} if <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code> resets all
1151     * the algorithm states to INACTIVE.</p>
1152     * <p>The camera device can do several state transitions between two results, if it is
1153     * allowed by the state transition table. For example: INACTIVE may never actually be
1154     * seen in a result.</p>
1155     * <p>The state in the result is the state for this image (in sync with this image): if
1156     * AF state becomes FOCUSED, then the image data associated with this result should
1157     * be sharp.</p>
1158     * <p>Below are state transition tables for different AF modes.</p>
1159     * <p>When {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} is AF_MODE_OFF or AF_MODE_EDOF:</p>
1160     * <table>
1161     * <thead>
1162     * <tr>
1163     * <th align="center">State</th>
1164     * <th align="center">Transition Cause</th>
1165     * <th align="center">New State</th>
1166     * <th align="center">Notes</th>
1167     * </tr>
1168     * </thead>
1169     * <tbody>
1170     * <tr>
1171     * <td align="center">INACTIVE</td>
1172     * <td align="center"></td>
1173     * <td align="center">INACTIVE</td>
1174     * <td align="center">Never changes</td>
1175     * </tr>
1176     * </tbody>
1177     * </table>
1178     * <p>When {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} is AF_MODE_AUTO or AF_MODE_MACRO:</p>
1179     * <table>
1180     * <thead>
1181     * <tr>
1182     * <th align="center">State</th>
1183     * <th align="center">Transition Cause</th>
1184     * <th align="center">New State</th>
1185     * <th align="center">Notes</th>
1186     * </tr>
1187     * </thead>
1188     * <tbody>
1189     * <tr>
1190     * <td align="center">INACTIVE</td>
1191     * <td align="center">AF_TRIGGER</td>
1192     * <td align="center">ACTIVE_SCAN</td>
1193     * <td align="center">Start AF sweep, Lens now moving</td>
1194     * </tr>
1195     * <tr>
1196     * <td align="center">ACTIVE_SCAN</td>
1197     * <td align="center">AF sweep done</td>
1198     * <td align="center">FOCUSED_LOCKED</td>
1199     * <td align="center">Focused, Lens now locked</td>
1200     * </tr>
1201     * <tr>
1202     * <td align="center">ACTIVE_SCAN</td>
1203     * <td align="center">AF sweep done</td>
1204     * <td align="center">NOT_FOCUSED_LOCKED</td>
1205     * <td align="center">Not focused, Lens now locked</td>
1206     * </tr>
1207     * <tr>
1208     * <td align="center">ACTIVE_SCAN</td>
1209     * <td align="center">AF_CANCEL</td>
1210     * <td align="center">INACTIVE</td>
1211     * <td align="center">Cancel/reset AF, Lens now locked</td>
1212     * </tr>
1213     * <tr>
1214     * <td align="center">FOCUSED_LOCKED</td>
1215     * <td align="center">AF_CANCEL</td>
1216     * <td align="center">INACTIVE</td>
1217     * <td align="center">Cancel/reset AF</td>
1218     * </tr>
1219     * <tr>
1220     * <td align="center">FOCUSED_LOCKED</td>
1221     * <td align="center">AF_TRIGGER</td>
1222     * <td align="center">ACTIVE_SCAN</td>
1223     * <td align="center">Start new sweep, Lens now moving</td>
1224     * </tr>
1225     * <tr>
1226     * <td align="center">NOT_FOCUSED_LOCKED</td>
1227     * <td align="center">AF_CANCEL</td>
1228     * <td align="center">INACTIVE</td>
1229     * <td align="center">Cancel/reset AF</td>
1230     * </tr>
1231     * <tr>
1232     * <td align="center">NOT_FOCUSED_LOCKED</td>
1233     * <td align="center">AF_TRIGGER</td>
1234     * <td align="center">ACTIVE_SCAN</td>
1235     * <td align="center">Start new sweep, Lens now moving</td>
1236     * </tr>
1237     * <tr>
1238     * <td align="center">Any state</td>
1239     * <td align="center">Mode change</td>
1240     * <td align="center">INACTIVE</td>
1241     * <td align="center"></td>
1242     * </tr>
1243     * </tbody>
1244     * </table>
1245     * <p>For the above table, the camera device may skip reporting any state changes that happen
1246     * without application intervention (i.e. mode switch, trigger, locking). Any state that
1247     * can be skipped in that manner is called a transient state.</p>
1248     * <p>For example, for these AF modes (AF_MODE_AUTO and AF_MODE_MACRO), in addition to the
1249     * state transitions listed in above table, it is also legal for the camera device to skip
1250     * one or more transient states between two results. See below table for examples:</p>
1251     * <table>
1252     * <thead>
1253     * <tr>
1254     * <th align="center">State</th>
1255     * <th align="center">Transition Cause</th>
1256     * <th align="center">New State</th>
1257     * <th align="center">Notes</th>
1258     * </tr>
1259     * </thead>
1260     * <tbody>
1261     * <tr>
1262     * <td align="center">INACTIVE</td>
1263     * <td align="center">AF_TRIGGER</td>
1264     * <td align="center">FOCUSED_LOCKED</td>
1265     * <td align="center">Focus is already good or good after a scan, lens is now locked.</td>
1266     * </tr>
1267     * <tr>
1268     * <td align="center">INACTIVE</td>
1269     * <td align="center">AF_TRIGGER</td>
1270     * <td align="center">NOT_FOCUSED_LOCKED</td>
1271     * <td align="center">Focus failed after a scan, lens is now locked.</td>
1272     * </tr>
1273     * <tr>
1274     * <td align="center">FOCUSED_LOCKED</td>
1275     * <td align="center">AF_TRIGGER</td>
1276     * <td align="center">FOCUSED_LOCKED</td>
1277     * <td align="center">Focus is already good or good after a scan, lens is now locked.</td>
1278     * </tr>
1279     * <tr>
1280     * <td align="center">NOT_FOCUSED_LOCKED</td>
1281     * <td align="center">AF_TRIGGER</td>
1282     * <td align="center">FOCUSED_LOCKED</td>
1283     * <td align="center">Focus is good after a scan, lens is not locked.</td>
1284     * </tr>
1285     * </tbody>
1286     * </table>
1287     * <p>When {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} is AF_MODE_CONTINUOUS_VIDEO:</p>
1288     * <table>
1289     * <thead>
1290     * <tr>
1291     * <th align="center">State</th>
1292     * <th align="center">Transition Cause</th>
1293     * <th align="center">New State</th>
1294     * <th align="center">Notes</th>
1295     * </tr>
1296     * </thead>
1297     * <tbody>
1298     * <tr>
1299     * <td align="center">INACTIVE</td>
1300     * <td align="center">Camera device initiates new scan</td>
1301     * <td align="center">PASSIVE_SCAN</td>
1302     * <td align="center">Start AF scan, Lens now moving</td>
1303     * </tr>
1304     * <tr>
1305     * <td align="center">INACTIVE</td>
1306     * <td align="center">AF_TRIGGER</td>
1307     * <td align="center">NOT_FOCUSED_LOCKED</td>
1308     * <td align="center">AF state query, Lens now locked</td>
1309     * </tr>
1310     * <tr>
1311     * <td align="center">PASSIVE_SCAN</td>
1312     * <td align="center">Camera device completes current scan</td>
1313     * <td align="center">PASSIVE_FOCUSED</td>
1314     * <td align="center">End AF scan, Lens now locked</td>
1315     * </tr>
1316     * <tr>
1317     * <td align="center">PASSIVE_SCAN</td>
1318     * <td align="center">Camera device fails current scan</td>
1319     * <td align="center">PASSIVE_UNFOCUSED</td>
1320     * <td align="center">End AF scan, Lens now locked</td>
1321     * </tr>
1322     * <tr>
1323     * <td align="center">PASSIVE_SCAN</td>
1324     * <td align="center">AF_TRIGGER</td>
1325     * <td align="center">FOCUSED_LOCKED</td>
1326     * <td align="center">Immediate transition, if focus is good. Lens now locked</td>
1327     * </tr>
1328     * <tr>
1329     * <td align="center">PASSIVE_SCAN</td>
1330     * <td align="center">AF_TRIGGER</td>
1331     * <td align="center">NOT_FOCUSED_LOCKED</td>
1332     * <td align="center">Immediate transition, if focus is bad. Lens now locked</td>
1333     * </tr>
1334     * <tr>
1335     * <td align="center">PASSIVE_SCAN</td>
1336     * <td align="center">AF_CANCEL</td>
1337     * <td align="center">INACTIVE</td>
1338     * <td align="center">Reset lens position, Lens now locked</td>
1339     * </tr>
1340     * <tr>
1341     * <td align="center">PASSIVE_FOCUSED</td>
1342     * <td align="center">Camera device initiates new scan</td>
1343     * <td align="center">PASSIVE_SCAN</td>
1344     * <td align="center">Start AF scan, Lens now moving</td>
1345     * </tr>
1346     * <tr>
1347     * <td align="center">PASSIVE_UNFOCUSED</td>
1348     * <td align="center">Camera device initiates new scan</td>
1349     * <td align="center">PASSIVE_SCAN</td>
1350     * <td align="center">Start AF scan, Lens now moving</td>
1351     * </tr>
1352     * <tr>
1353     * <td align="center">PASSIVE_FOCUSED</td>
1354     * <td align="center">AF_TRIGGER</td>
1355     * <td align="center">FOCUSED_LOCKED</td>
1356     * <td align="center">Immediate transition, lens now locked</td>
1357     * </tr>
1358     * <tr>
1359     * <td align="center">PASSIVE_UNFOCUSED</td>
1360     * <td align="center">AF_TRIGGER</td>
1361     * <td align="center">NOT_FOCUSED_LOCKED</td>
1362     * <td align="center">Immediate transition, lens now locked</td>
1363     * </tr>
1364     * <tr>
1365     * <td align="center">FOCUSED_LOCKED</td>
1366     * <td align="center">AF_TRIGGER</td>
1367     * <td align="center">FOCUSED_LOCKED</td>
1368     * <td align="center">No effect</td>
1369     * </tr>
1370     * <tr>
1371     * <td align="center">FOCUSED_LOCKED</td>
1372     * <td align="center">AF_CANCEL</td>
1373     * <td align="center">INACTIVE</td>
1374     * <td align="center">Restart AF scan</td>
1375     * </tr>
1376     * <tr>
1377     * <td align="center">NOT_FOCUSED_LOCKED</td>
1378     * <td align="center">AF_TRIGGER</td>
1379     * <td align="center">NOT_FOCUSED_LOCKED</td>
1380     * <td align="center">No effect</td>
1381     * </tr>
1382     * <tr>
1383     * <td align="center">NOT_FOCUSED_LOCKED</td>
1384     * <td align="center">AF_CANCEL</td>
1385     * <td align="center">INACTIVE</td>
1386     * <td align="center">Restart AF scan</td>
1387     * </tr>
1388     * </tbody>
1389     * </table>
1390     * <p>When {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} is AF_MODE_CONTINUOUS_PICTURE:</p>
1391     * <table>
1392     * <thead>
1393     * <tr>
1394     * <th align="center">State</th>
1395     * <th align="center">Transition Cause</th>
1396     * <th align="center">New State</th>
1397     * <th align="center">Notes</th>
1398     * </tr>
1399     * </thead>
1400     * <tbody>
1401     * <tr>
1402     * <td align="center">INACTIVE</td>
1403     * <td align="center">Camera device initiates new scan</td>
1404     * <td align="center">PASSIVE_SCAN</td>
1405     * <td align="center">Start AF scan, Lens now moving</td>
1406     * </tr>
1407     * <tr>
1408     * <td align="center">INACTIVE</td>
1409     * <td align="center">AF_TRIGGER</td>
1410     * <td align="center">NOT_FOCUSED_LOCKED</td>
1411     * <td align="center">AF state query, Lens now locked</td>
1412     * </tr>
1413     * <tr>
1414     * <td align="center">PASSIVE_SCAN</td>
1415     * <td align="center">Camera device completes current scan</td>
1416     * <td align="center">PASSIVE_FOCUSED</td>
1417     * <td align="center">End AF scan, Lens now locked</td>
1418     * </tr>
1419     * <tr>
1420     * <td align="center">PASSIVE_SCAN</td>
1421     * <td align="center">Camera device fails current scan</td>
1422     * <td align="center">PASSIVE_UNFOCUSED</td>
1423     * <td align="center">End AF scan, Lens now locked</td>
1424     * </tr>
1425     * <tr>
1426     * <td align="center">PASSIVE_SCAN</td>
1427     * <td align="center">AF_TRIGGER</td>
1428     * <td align="center">FOCUSED_LOCKED</td>
1429     * <td align="center">Eventual transition once the focus is good. Lens now locked</td>
1430     * </tr>
1431     * <tr>
1432     * <td align="center">PASSIVE_SCAN</td>
1433     * <td align="center">AF_TRIGGER</td>
1434     * <td align="center">NOT_FOCUSED_LOCKED</td>
1435     * <td align="center">Eventual transition if cannot find focus. Lens now locked</td>
1436     * </tr>
1437     * <tr>
1438     * <td align="center">PASSIVE_SCAN</td>
1439     * <td align="center">AF_CANCEL</td>
1440     * <td align="center">INACTIVE</td>
1441     * <td align="center">Reset lens position, Lens now locked</td>
1442     * </tr>
1443     * <tr>
1444     * <td align="center">PASSIVE_FOCUSED</td>
1445     * <td align="center">Camera device initiates new scan</td>
1446     * <td align="center">PASSIVE_SCAN</td>
1447     * <td align="center">Start AF scan, Lens now moving</td>
1448     * </tr>
1449     * <tr>
1450     * <td align="center">PASSIVE_UNFOCUSED</td>
1451     * <td align="center">Camera device initiates new scan</td>
1452     * <td align="center">PASSIVE_SCAN</td>
1453     * <td align="center">Start AF scan, Lens now moving</td>
1454     * </tr>
1455     * <tr>
1456     * <td align="center">PASSIVE_FOCUSED</td>
1457     * <td align="center">AF_TRIGGER</td>
1458     * <td align="center">FOCUSED_LOCKED</td>
1459     * <td align="center">Immediate trans. Lens now locked</td>
1460     * </tr>
1461     * <tr>
1462     * <td align="center">PASSIVE_UNFOCUSED</td>
1463     * <td align="center">AF_TRIGGER</td>
1464     * <td align="center">NOT_FOCUSED_LOCKED</td>
1465     * <td align="center">Immediate trans. Lens now locked</td>
1466     * </tr>
1467     * <tr>
1468     * <td align="center">FOCUSED_LOCKED</td>
1469     * <td align="center">AF_TRIGGER</td>
1470     * <td align="center">FOCUSED_LOCKED</td>
1471     * <td align="center">No effect</td>
1472     * </tr>
1473     * <tr>
1474     * <td align="center">FOCUSED_LOCKED</td>
1475     * <td align="center">AF_CANCEL</td>
1476     * <td align="center">INACTIVE</td>
1477     * <td align="center">Restart AF scan</td>
1478     * </tr>
1479     * <tr>
1480     * <td align="center">NOT_FOCUSED_LOCKED</td>
1481     * <td align="center">AF_TRIGGER</td>
1482     * <td align="center">NOT_FOCUSED_LOCKED</td>
1483     * <td align="center">No effect</td>
1484     * </tr>
1485     * <tr>
1486     * <td align="center">NOT_FOCUSED_LOCKED</td>
1487     * <td align="center">AF_CANCEL</td>
1488     * <td align="center">INACTIVE</td>
1489     * <td align="center">Restart AF scan</td>
1490     * </tr>
1491     * </tbody>
1492     * </table>
1493     * <p>When switch between AF_MODE_CONTINUOUS_* (CAF modes) and AF_MODE_AUTO/AF_MODE_MACRO
1494     * (AUTO modes), the initial INACTIVE or PASSIVE_SCAN states may be skipped by the
1495     * camera device. When a trigger is included in a mode switch request, the trigger
1496     * will be evaluated in the context of the new mode in the request.
1497     * See below table for examples:</p>
1498     * <table>
1499     * <thead>
1500     * <tr>
1501     * <th align="center">State</th>
1502     * <th align="center">Transition Cause</th>
1503     * <th align="center">New State</th>
1504     * <th align="center">Notes</th>
1505     * </tr>
1506     * </thead>
1507     * <tbody>
1508     * <tr>
1509     * <td align="center">any state</td>
1510     * <td align="center">CAF--&gt;AUTO mode switch</td>
1511     * <td align="center">INACTIVE</td>
1512     * <td align="center">Mode switch without trigger, initial state must be INACTIVE</td>
1513     * </tr>
1514     * <tr>
1515     * <td align="center">any state</td>
1516     * <td align="center">CAF--&gt;AUTO mode switch with AF_TRIGGER</td>
1517     * <td align="center">trigger-reachable states from INACTIVE</td>
1518     * <td align="center">Mode switch with trigger, INACTIVE is skipped</td>
1519     * </tr>
1520     * <tr>
1521     * <td align="center">any state</td>
1522     * <td align="center">AUTO--&gt;CAF mode switch</td>
1523     * <td align="center">passively reachable states from INACTIVE</td>
1524     * <td align="center">Mode switch without trigger, passive transient state is skipped</td>
1525     * </tr>
1526     * </tbody>
1527     * </table>
1528     * <p><b>Possible values:</b>
1529     * <ul>
1530     *   <li>{@link #CONTROL_AF_STATE_INACTIVE INACTIVE}</li>
1531     *   <li>{@link #CONTROL_AF_STATE_PASSIVE_SCAN PASSIVE_SCAN}</li>
1532     *   <li>{@link #CONTROL_AF_STATE_PASSIVE_FOCUSED PASSIVE_FOCUSED}</li>
1533     *   <li>{@link #CONTROL_AF_STATE_ACTIVE_SCAN ACTIVE_SCAN}</li>
1534     *   <li>{@link #CONTROL_AF_STATE_FOCUSED_LOCKED FOCUSED_LOCKED}</li>
1535     *   <li>{@link #CONTROL_AF_STATE_NOT_FOCUSED_LOCKED NOT_FOCUSED_LOCKED}</li>
1536     *   <li>{@link #CONTROL_AF_STATE_PASSIVE_UNFOCUSED PASSIVE_UNFOCUSED}</li>
1537     * </ul></p>
1538     * <p>This key is available on all devices.</p>
1539     *
1540     * @see CaptureRequest#CONTROL_AF_MODE
1541     * @see CaptureRequest#CONTROL_MODE
1542     * @see CaptureRequest#CONTROL_SCENE_MODE
1543     * @see #CONTROL_AF_STATE_INACTIVE
1544     * @see #CONTROL_AF_STATE_PASSIVE_SCAN
1545     * @see #CONTROL_AF_STATE_PASSIVE_FOCUSED
1546     * @see #CONTROL_AF_STATE_ACTIVE_SCAN
1547     * @see #CONTROL_AF_STATE_FOCUSED_LOCKED
1548     * @see #CONTROL_AF_STATE_NOT_FOCUSED_LOCKED
1549     * @see #CONTROL_AF_STATE_PASSIVE_UNFOCUSED
1550     */
1551    @PublicKey
1552    public static final Key<Integer> CONTROL_AF_STATE =
1553            new Key<Integer>("android.control.afState", int.class);
1554
1555    /**
1556     * <p>Whether auto-white balance (AWB) is currently locked to its
1557     * latest calculated values.</p>
1558     * <p>When set to <code>true</code> (ON), the AWB algorithm is locked to its latest parameters,
1559     * and will not change color balance settings until the lock is set to <code>false</code> (OFF).</p>
1560     * <p>Since the camera device has a pipeline of in-flight requests, the settings that
1561     * get locked do not necessarily correspond to the settings that were present in the
1562     * latest capture result received from the camera device, since additional captures
1563     * and AWB updates may have occurred even before the result was sent out. If an
1564     * application is switching between automatic and manual control and wishes to eliminate
1565     * any flicker during the switch, the following procedure is recommended:</p>
1566     * <ol>
1567     * <li>Starting in auto-AWB mode:</li>
1568     * <li>Lock AWB</li>
1569     * <li>Wait for the first result to be output that has the AWB locked</li>
1570     * <li>Copy AWB settings from that result into a request, set the request to manual AWB</li>
1571     * <li>Submit the capture request, proceed to run manual AWB as desired.</li>
1572     * </ol>
1573     * <p>Note that AWB lock is only meaningful when
1574     * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} is in the AUTO mode; in other modes,
1575     * AWB is already fixed to a specific setting.</p>
1576     * <p>Some LEGACY devices may not support ON; the value is then overridden to OFF.</p>
1577     * <p>This key is available on all devices.</p>
1578     *
1579     * @see CaptureRequest#CONTROL_AWB_MODE
1580     */
1581    @PublicKey
1582    public static final Key<Boolean> CONTROL_AWB_LOCK =
1583            new Key<Boolean>("android.control.awbLock", boolean.class);
1584
1585    /**
1586     * <p>Whether auto-white balance (AWB) is currently setting the color
1587     * transform fields, and what its illumination target
1588     * is.</p>
1589     * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is AUTO.</p>
1590     * <p>When set to the ON mode, the camera device's auto-white balance
1591     * routine is enabled, overriding the application's selected
1592     * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
1593     * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}. Note that when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}
1594     * is OFF, the behavior of AWB is device dependent. It is recommened to
1595     * also set AWB mode to OFF or lock AWB by using {@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} before
1596     * setting AE mode to OFF.</p>
1597     * <p>When set to the OFF mode, the camera device's auto-white balance
1598     * routine is disabled. The application manually controls the white
1599     * balance by {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains}
1600     * and {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p>
1601     * <p>When set to any other modes, the camera device's auto-white
1602     * balance routine is disabled. The camera device uses each
1603     * particular illumination target for white balance
1604     * adjustment. The application's values for
1605     * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform},
1606     * {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
1607     * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} are ignored.</p>
1608     * <p><b>Possible values:</b>
1609     * <ul>
1610     *   <li>{@link #CONTROL_AWB_MODE_OFF OFF}</li>
1611     *   <li>{@link #CONTROL_AWB_MODE_AUTO AUTO}</li>
1612     *   <li>{@link #CONTROL_AWB_MODE_INCANDESCENT INCANDESCENT}</li>
1613     *   <li>{@link #CONTROL_AWB_MODE_FLUORESCENT FLUORESCENT}</li>
1614     *   <li>{@link #CONTROL_AWB_MODE_WARM_FLUORESCENT WARM_FLUORESCENT}</li>
1615     *   <li>{@link #CONTROL_AWB_MODE_DAYLIGHT DAYLIGHT}</li>
1616     *   <li>{@link #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT CLOUDY_DAYLIGHT}</li>
1617     *   <li>{@link #CONTROL_AWB_MODE_TWILIGHT TWILIGHT}</li>
1618     *   <li>{@link #CONTROL_AWB_MODE_SHADE SHADE}</li>
1619     * </ul></p>
1620     * <p><b>Available values for this device:</b><br>
1621     * {@link CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES android.control.awbAvailableModes}</p>
1622     * <p>This key is available on all devices.</p>
1623     *
1624     * @see CaptureRequest#COLOR_CORRECTION_GAINS
1625     * @see CaptureRequest#COLOR_CORRECTION_MODE
1626     * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
1627     * @see CaptureRequest#CONTROL_AE_MODE
1628     * @see CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES
1629     * @see CaptureRequest#CONTROL_AWB_LOCK
1630     * @see CaptureRequest#CONTROL_MODE
1631     * @see #CONTROL_AWB_MODE_OFF
1632     * @see #CONTROL_AWB_MODE_AUTO
1633     * @see #CONTROL_AWB_MODE_INCANDESCENT
1634     * @see #CONTROL_AWB_MODE_FLUORESCENT
1635     * @see #CONTROL_AWB_MODE_WARM_FLUORESCENT
1636     * @see #CONTROL_AWB_MODE_DAYLIGHT
1637     * @see #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT
1638     * @see #CONTROL_AWB_MODE_TWILIGHT
1639     * @see #CONTROL_AWB_MODE_SHADE
1640     */
1641    @PublicKey
1642    public static final Key<Integer> CONTROL_AWB_MODE =
1643            new Key<Integer>("android.control.awbMode", int.class);
1644
1645    /**
1646     * <p>List of metering areas to use for auto-white-balance illuminant
1647     * estimation.</p>
1648     * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb} is 0.
1649     * Otherwise will always be present.</p>
1650     * <p>The maximum number of regions supported by the device is determined by the value
1651     * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb}.</p>
1652     * <p>The coordinate system is based on the active pixel array,
1653     * with (0,0) being the top-left pixel in the active pixel array, and
1654     * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1655     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the
1656     * bottom-right pixel in the active pixel array.</p>
1657     * <p>The weight must range from 0 to 1000, and represents a weight
1658     * for every pixel in the area. This means that a large metering area
1659     * with the same weight as a smaller area will have more effect in
1660     * the metering result. Metering areas can partially overlap and the
1661     * camera device will add the weights in the overlap region.</p>
1662     * <p>The weights are relative to weights of other white balance metering regions, so if
1663     * only one region is used, all non-zero weights will have the same effect. A region with
1664     * 0 weight is ignored.</p>
1665     * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
1666     * camera device.</p>
1667     * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
1668     * capture result metadata, the camera device will ignore the sections outside the crop
1669     * region and output only the intersection rectangle as the metering region in the result
1670     * metadata.  If the region is entirely outside the crop region, it will be ignored and
1671     * not reported in the result metadata.</p>
1672     * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}</p>
1673     * <p><b>Range of valid values:</b><br>
1674     * Coordinates must be between <code>[(0,0), (width, height))</code> of
1675     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}</p>
1676     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
1677     *
1678     * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB
1679     * @see CaptureRequest#SCALER_CROP_REGION
1680     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
1681     */
1682    @PublicKey
1683    public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS =
1684            new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.awbRegions", android.hardware.camera2.params.MeteringRectangle[].class);
1685
1686    /**
1687     * <p>Information to the camera device 3A (auto-exposure,
1688     * auto-focus, auto-white balance) routines about the purpose
1689     * of this capture, to help the camera device to decide optimal 3A
1690     * strategy.</p>
1691     * <p>This control (except for MANUAL) is only effective if
1692     * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} != OFF</code> and any 3A routine is active.</p>
1693     * <p>ZERO_SHUTTER_LAG will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}
1694     * contains OPAQUE_REPROCESSING. MANUAL will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}
1695     * contains MANUAL_SENSOR. Other intent values are always supported.</p>
1696     * <p><b>Possible values:</b>
1697     * <ul>
1698     *   <li>{@link #CONTROL_CAPTURE_INTENT_CUSTOM CUSTOM}</li>
1699     *   <li>{@link #CONTROL_CAPTURE_INTENT_PREVIEW PREVIEW}</li>
1700     *   <li>{@link #CONTROL_CAPTURE_INTENT_STILL_CAPTURE STILL_CAPTURE}</li>
1701     *   <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_RECORD VIDEO_RECORD}</li>
1702     *   <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT VIDEO_SNAPSHOT}</li>
1703     *   <li>{@link #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li>
1704     *   <li>{@link #CONTROL_CAPTURE_INTENT_MANUAL MANUAL}</li>
1705     * </ul></p>
1706     * <p>This key is available on all devices.</p>
1707     *
1708     * @see CaptureRequest#CONTROL_MODE
1709     * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
1710     * @see #CONTROL_CAPTURE_INTENT_CUSTOM
1711     * @see #CONTROL_CAPTURE_INTENT_PREVIEW
1712     * @see #CONTROL_CAPTURE_INTENT_STILL_CAPTURE
1713     * @see #CONTROL_CAPTURE_INTENT_VIDEO_RECORD
1714     * @see #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT
1715     * @see #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG
1716     * @see #CONTROL_CAPTURE_INTENT_MANUAL
1717     */
1718    @PublicKey
1719    public static final Key<Integer> CONTROL_CAPTURE_INTENT =
1720            new Key<Integer>("android.control.captureIntent", int.class);
1721
1722    /**
1723     * <p>Current state of auto-white balance (AWB) algorithm.</p>
1724     * <p>Switching between or enabling AWB modes ({@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}) always
1725     * resets the AWB state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode},
1726     * or {@link CaptureRequest#CONTROL_SCENE_MODE android.control.sceneMode} if <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code> resets all
1727     * the algorithm states to INACTIVE.</p>
1728     * <p>The camera device can do several state transitions between two results, if it is
1729     * allowed by the state transition table. So INACTIVE may never actually be seen in
1730     * a result.</p>
1731     * <p>The state in the result is the state for this image (in sync with this image): if
1732     * AWB state becomes CONVERGED, then the image data associated with this result should
1733     * be good to use.</p>
1734     * <p>Below are state transition tables for different AWB modes.</p>
1735     * <p>When <code>{@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} != AWB_MODE_AUTO</code>:</p>
1736     * <table>
1737     * <thead>
1738     * <tr>
1739     * <th align="center">State</th>
1740     * <th align="center">Transition Cause</th>
1741     * <th align="center">New State</th>
1742     * <th align="center">Notes</th>
1743     * </tr>
1744     * </thead>
1745     * <tbody>
1746     * <tr>
1747     * <td align="center">INACTIVE</td>
1748     * <td align="center"></td>
1749     * <td align="center">INACTIVE</td>
1750     * <td align="center">Camera device auto white balance algorithm is disabled</td>
1751     * </tr>
1752     * </tbody>
1753     * </table>
1754     * <p>When {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} is AWB_MODE_AUTO:</p>
1755     * <table>
1756     * <thead>
1757     * <tr>
1758     * <th align="center">State</th>
1759     * <th align="center">Transition Cause</th>
1760     * <th align="center">New State</th>
1761     * <th align="center">Notes</th>
1762     * </tr>
1763     * </thead>
1764     * <tbody>
1765     * <tr>
1766     * <td align="center">INACTIVE</td>
1767     * <td align="center">Camera device initiates AWB scan</td>
1768     * <td align="center">SEARCHING</td>
1769     * <td align="center">Values changing</td>
1770     * </tr>
1771     * <tr>
1772     * <td align="center">INACTIVE</td>
1773     * <td align="center">{@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} is ON</td>
1774     * <td align="center">LOCKED</td>
1775     * <td align="center">Values locked</td>
1776     * </tr>
1777     * <tr>
1778     * <td align="center">SEARCHING</td>
1779     * <td align="center">Camera device finishes AWB scan</td>
1780     * <td align="center">CONVERGED</td>
1781     * <td align="center">Good values, not changing</td>
1782     * </tr>
1783     * <tr>
1784     * <td align="center">SEARCHING</td>
1785     * <td align="center">{@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} is ON</td>
1786     * <td align="center">LOCKED</td>
1787     * <td align="center">Values locked</td>
1788     * </tr>
1789     * <tr>
1790     * <td align="center">CONVERGED</td>
1791     * <td align="center">Camera device initiates AWB scan</td>
1792     * <td align="center">SEARCHING</td>
1793     * <td align="center">Values changing</td>
1794     * </tr>
1795     * <tr>
1796     * <td align="center">CONVERGED</td>
1797     * <td align="center">{@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} is ON</td>
1798     * <td align="center">LOCKED</td>
1799     * <td align="center">Values locked</td>
1800     * </tr>
1801     * <tr>
1802     * <td align="center">LOCKED</td>
1803     * <td align="center">{@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} is OFF</td>
1804     * <td align="center">SEARCHING</td>
1805     * <td align="center">Values not good after unlock</td>
1806     * </tr>
1807     * </tbody>
1808     * </table>
1809     * <p>For the above table, the camera device may skip reporting any state changes that happen
1810     * without application intervention (i.e. mode switch, trigger, locking). Any state that
1811     * can be skipped in that manner is called a transient state.</p>
1812     * <p>For example, for this AWB mode (AWB_MODE_AUTO), in addition to the state transitions
1813     * listed in above table, it is also legal for the camera device to skip one or more
1814     * transient states between two results. See below table for examples:</p>
1815     * <table>
1816     * <thead>
1817     * <tr>
1818     * <th align="center">State</th>
1819     * <th align="center">Transition Cause</th>
1820     * <th align="center">New State</th>
1821     * <th align="center">Notes</th>
1822     * </tr>
1823     * </thead>
1824     * <tbody>
1825     * <tr>
1826     * <td align="center">INACTIVE</td>
1827     * <td align="center">Camera device finished AWB scan</td>
1828     * <td align="center">CONVERGED</td>
1829     * <td align="center">Values are already good, transient states are skipped by camera device.</td>
1830     * </tr>
1831     * <tr>
1832     * <td align="center">LOCKED</td>
1833     * <td align="center">{@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} is OFF</td>
1834     * <td align="center">CONVERGED</td>
1835     * <td align="center">Values good after unlock, transient states are skipped by camera device.</td>
1836     * </tr>
1837     * </tbody>
1838     * </table>
1839     * <p><b>Possible values:</b>
1840     * <ul>
1841     *   <li>{@link #CONTROL_AWB_STATE_INACTIVE INACTIVE}</li>
1842     *   <li>{@link #CONTROL_AWB_STATE_SEARCHING SEARCHING}</li>
1843     *   <li>{@link #CONTROL_AWB_STATE_CONVERGED CONVERGED}</li>
1844     *   <li>{@link #CONTROL_AWB_STATE_LOCKED LOCKED}</li>
1845     * </ul></p>
1846     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
1847     * <p><b>Limited capability</b> -
1848     * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
1849     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
1850     *
1851     * @see CaptureRequest#CONTROL_AWB_LOCK
1852     * @see CaptureRequest#CONTROL_AWB_MODE
1853     * @see CaptureRequest#CONTROL_MODE
1854     * @see CaptureRequest#CONTROL_SCENE_MODE
1855     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
1856     * @see #CONTROL_AWB_STATE_INACTIVE
1857     * @see #CONTROL_AWB_STATE_SEARCHING
1858     * @see #CONTROL_AWB_STATE_CONVERGED
1859     * @see #CONTROL_AWB_STATE_LOCKED
1860     */
1861    @PublicKey
1862    public static final Key<Integer> CONTROL_AWB_STATE =
1863            new Key<Integer>("android.control.awbState", int.class);
1864
1865    /**
1866     * <p>A special color effect to apply.</p>
1867     * <p>When this mode is set, a color effect will be applied
1868     * to images produced by the camera device. The interpretation
1869     * and implementation of these color effects is left to the
1870     * implementor of the camera device, and should not be
1871     * depended on to be consistent (or present) across all
1872     * devices.</p>
1873     * <p><b>Possible values:</b>
1874     * <ul>
1875     *   <li>{@link #CONTROL_EFFECT_MODE_OFF OFF}</li>
1876     *   <li>{@link #CONTROL_EFFECT_MODE_MONO MONO}</li>
1877     *   <li>{@link #CONTROL_EFFECT_MODE_NEGATIVE NEGATIVE}</li>
1878     *   <li>{@link #CONTROL_EFFECT_MODE_SOLARIZE SOLARIZE}</li>
1879     *   <li>{@link #CONTROL_EFFECT_MODE_SEPIA SEPIA}</li>
1880     *   <li>{@link #CONTROL_EFFECT_MODE_POSTERIZE POSTERIZE}</li>
1881     *   <li>{@link #CONTROL_EFFECT_MODE_WHITEBOARD WHITEBOARD}</li>
1882     *   <li>{@link #CONTROL_EFFECT_MODE_BLACKBOARD BLACKBOARD}</li>
1883     *   <li>{@link #CONTROL_EFFECT_MODE_AQUA AQUA}</li>
1884     * </ul></p>
1885     * <p><b>Available values for this device:</b><br>
1886     * {@link CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS android.control.availableEffects}</p>
1887     * <p>This key is available on all devices.</p>
1888     *
1889     * @see CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS
1890     * @see #CONTROL_EFFECT_MODE_OFF
1891     * @see #CONTROL_EFFECT_MODE_MONO
1892     * @see #CONTROL_EFFECT_MODE_NEGATIVE
1893     * @see #CONTROL_EFFECT_MODE_SOLARIZE
1894     * @see #CONTROL_EFFECT_MODE_SEPIA
1895     * @see #CONTROL_EFFECT_MODE_POSTERIZE
1896     * @see #CONTROL_EFFECT_MODE_WHITEBOARD
1897     * @see #CONTROL_EFFECT_MODE_BLACKBOARD
1898     * @see #CONTROL_EFFECT_MODE_AQUA
1899     */
1900    @PublicKey
1901    public static final Key<Integer> CONTROL_EFFECT_MODE =
1902            new Key<Integer>("android.control.effectMode", int.class);
1903
1904    /**
1905     * <p>Overall mode of 3A (auto-exposure, auto-white-balance, auto-focus) control
1906     * routines.</p>
1907     * <p>This is a top-level 3A control switch. When set to OFF, all 3A control
1908     * by the camera device is disabled. The application must set the fields for
1909     * capture parameters itself.</p>
1910     * <p>When set to AUTO, the individual algorithm controls in
1911     * android.control.* are in effect, such as {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}.</p>
1912     * <p>When set to USE_SCENE_MODE, the individual controls in
1913     * android.control.* are mostly disabled, and the camera device implements
1914     * one of the scene mode settings (such as ACTION, SUNSET, or PARTY)
1915     * as it wishes. The camera device scene mode 3A settings are provided by
1916     * android.control.sceneModeOverrides.</p>
1917     * <p>When set to OFF_KEEP_STATE, it is similar to OFF mode, the only difference
1918     * is that this frame will not be used by camera device background 3A statistics
1919     * update, as if this frame is never captured. This mode can be used in the scenario
1920     * where the application doesn't want a 3A manual control capture to affect
1921     * the subsequent auto 3A capture results.</p>
1922     * <p><b>Possible values:</b>
1923     * <ul>
1924     *   <li>{@link #CONTROL_MODE_OFF OFF}</li>
1925     *   <li>{@link #CONTROL_MODE_AUTO AUTO}</li>
1926     *   <li>{@link #CONTROL_MODE_USE_SCENE_MODE USE_SCENE_MODE}</li>
1927     *   <li>{@link #CONTROL_MODE_OFF_KEEP_STATE OFF_KEEP_STATE}</li>
1928     * </ul></p>
1929     * <p><b>Available values for this device:</b><br>
1930     * {@link CameraCharacteristics#CONTROL_AVAILABLE_MODES android.control.availableModes}</p>
1931     * <p>This key is available on all devices.</p>
1932     *
1933     * @see CaptureRequest#CONTROL_AF_MODE
1934     * @see CameraCharacteristics#CONTROL_AVAILABLE_MODES
1935     * @see #CONTROL_MODE_OFF
1936     * @see #CONTROL_MODE_AUTO
1937     * @see #CONTROL_MODE_USE_SCENE_MODE
1938     * @see #CONTROL_MODE_OFF_KEEP_STATE
1939     */
1940    @PublicKey
1941    public static final Key<Integer> CONTROL_MODE =
1942            new Key<Integer>("android.control.mode", int.class);
1943
1944    /**
1945     * <p>Control for which scene mode is currently active.</p>
1946     * <p>Scene modes are custom camera modes optimized for a certain set of conditions and
1947     * capture settings.</p>
1948     * <p>This is the mode that that is active when
1949     * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY,
1950     * these modes will disable {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode},
1951     * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} while in use.</p>
1952     * <p>The interpretation and implementation of these scene modes is left
1953     * to the implementor of the camera device. Their behavior will not be
1954     * consistent across all devices, and any given device may only implement
1955     * a subset of these modes.</p>
1956     * <p><b>Possible values:</b>
1957     * <ul>
1958     *   <li>{@link #CONTROL_SCENE_MODE_DISABLED DISABLED}</li>
1959     *   <li>{@link #CONTROL_SCENE_MODE_FACE_PRIORITY FACE_PRIORITY}</li>
1960     *   <li>{@link #CONTROL_SCENE_MODE_ACTION ACTION}</li>
1961     *   <li>{@link #CONTROL_SCENE_MODE_PORTRAIT PORTRAIT}</li>
1962     *   <li>{@link #CONTROL_SCENE_MODE_LANDSCAPE LANDSCAPE}</li>
1963     *   <li>{@link #CONTROL_SCENE_MODE_NIGHT NIGHT}</li>
1964     *   <li>{@link #CONTROL_SCENE_MODE_NIGHT_PORTRAIT NIGHT_PORTRAIT}</li>
1965     *   <li>{@link #CONTROL_SCENE_MODE_THEATRE THEATRE}</li>
1966     *   <li>{@link #CONTROL_SCENE_MODE_BEACH BEACH}</li>
1967     *   <li>{@link #CONTROL_SCENE_MODE_SNOW SNOW}</li>
1968     *   <li>{@link #CONTROL_SCENE_MODE_SUNSET SUNSET}</li>
1969     *   <li>{@link #CONTROL_SCENE_MODE_STEADYPHOTO STEADYPHOTO}</li>
1970     *   <li>{@link #CONTROL_SCENE_MODE_FIREWORKS FIREWORKS}</li>
1971     *   <li>{@link #CONTROL_SCENE_MODE_SPORTS SPORTS}</li>
1972     *   <li>{@link #CONTROL_SCENE_MODE_PARTY PARTY}</li>
1973     *   <li>{@link #CONTROL_SCENE_MODE_CANDLELIGHT CANDLELIGHT}</li>
1974     *   <li>{@link #CONTROL_SCENE_MODE_BARCODE BARCODE}</li>
1975     *   <li>{@link #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO HIGH_SPEED_VIDEO}</li>
1976     *   <li>{@link #CONTROL_SCENE_MODE_HDR HDR}</li>
1977     * </ul></p>
1978     * <p><b>Available values for this device:</b><br>
1979     * {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes}</p>
1980     * <p>This key is available on all devices.</p>
1981     *
1982     * @see CaptureRequest#CONTROL_AE_MODE
1983     * @see CaptureRequest#CONTROL_AF_MODE
1984     * @see CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES
1985     * @see CaptureRequest#CONTROL_AWB_MODE
1986     * @see CaptureRequest#CONTROL_MODE
1987     * @see #CONTROL_SCENE_MODE_DISABLED
1988     * @see #CONTROL_SCENE_MODE_FACE_PRIORITY
1989     * @see #CONTROL_SCENE_MODE_ACTION
1990     * @see #CONTROL_SCENE_MODE_PORTRAIT
1991     * @see #CONTROL_SCENE_MODE_LANDSCAPE
1992     * @see #CONTROL_SCENE_MODE_NIGHT
1993     * @see #CONTROL_SCENE_MODE_NIGHT_PORTRAIT
1994     * @see #CONTROL_SCENE_MODE_THEATRE
1995     * @see #CONTROL_SCENE_MODE_BEACH
1996     * @see #CONTROL_SCENE_MODE_SNOW
1997     * @see #CONTROL_SCENE_MODE_SUNSET
1998     * @see #CONTROL_SCENE_MODE_STEADYPHOTO
1999     * @see #CONTROL_SCENE_MODE_FIREWORKS
2000     * @see #CONTROL_SCENE_MODE_SPORTS
2001     * @see #CONTROL_SCENE_MODE_PARTY
2002     * @see #CONTROL_SCENE_MODE_CANDLELIGHT
2003     * @see #CONTROL_SCENE_MODE_BARCODE
2004     * @see #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO
2005     * @see #CONTROL_SCENE_MODE_HDR
2006     */
2007    @PublicKey
2008    public static final Key<Integer> CONTROL_SCENE_MODE =
2009            new Key<Integer>("android.control.sceneMode", int.class);
2010
2011    /**
2012     * <p>Whether video stabilization is
2013     * active.</p>
2014     * <p>Video stabilization automatically translates and scales images from
2015     * the camera in order to stabilize motion between consecutive frames.</p>
2016     * <p>If enabled, video stabilization can modify the
2017     * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to keep the video stream stabilized.</p>
2018     * <p>Switching between different video stabilization modes may take several
2019     * frames to initialize, the camera device will report the current mode
2020     * in capture result metadata. For example, When "ON" mode is requested,
2021     * the video stabilization modes in the first several capture results may
2022     * still be "OFF", and it will become "ON" when the initialization is
2023     * done.</p>
2024     * <p>If a camera device supports both this mode and OIS
2025     * ({@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode}), turning both modes on may
2026     * produce undesirable interaction, so it is recommended not to enable
2027     * both at the same time.</p>
2028     * <p><b>Possible values:</b>
2029     * <ul>
2030     *   <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_OFF OFF}</li>
2031     *   <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_ON ON}</li>
2032     * </ul></p>
2033     * <p>This key is available on all devices.</p>
2034     *
2035     * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE
2036     * @see CaptureRequest#SCALER_CROP_REGION
2037     * @see #CONTROL_VIDEO_STABILIZATION_MODE_OFF
2038     * @see #CONTROL_VIDEO_STABILIZATION_MODE_ON
2039     */
2040    @PublicKey
2041    public static final Key<Integer> CONTROL_VIDEO_STABILIZATION_MODE =
2042            new Key<Integer>("android.control.videoStabilizationMode", int.class);
2043
2044    /**
2045     * <p>Operation mode for edge
2046     * enhancement.</p>
2047     * <p>Edge enhancement improves sharpness and details in the captured image. OFF means
2048     * no enhancement will be applied by the camera device.</p>
2049     * <p>FAST/HIGH_QUALITY both mean camera device determined enhancement
2050     * will be applied. HIGH_QUALITY mode indicates that the
2051     * camera device will use the highest-quality enhancement algorithms,
2052     * even if it slows down capture rate. FAST means the camera device will
2053     * not slow down capture rate when applying edge enhancement.</p>
2054     * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera
2055     * device will apply FAST/HIGH_QUALITY YUV-domain edge enhancement, respectively.
2056     * The camera device may adjust its internal noise reduction parameters for best
2057     * image quality based on the {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor}, if it is set.</p>
2058     * <p><b>Possible values:</b>
2059     * <ul>
2060     *   <li>{@link #EDGE_MODE_OFF OFF}</li>
2061     *   <li>{@link #EDGE_MODE_FAST FAST}</li>
2062     *   <li>{@link #EDGE_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
2063     * </ul></p>
2064     * <p><b>Available values for this device:</b><br>
2065     * {@link CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES android.edge.availableEdgeModes}</p>
2066     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2067     * <p><b>Full capability</b> -
2068     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2069     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2070     *
2071     * @see CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES
2072     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2073     * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR
2074     * @see #EDGE_MODE_OFF
2075     * @see #EDGE_MODE_FAST
2076     * @see #EDGE_MODE_HIGH_QUALITY
2077     */
2078    @PublicKey
2079    public static final Key<Integer> EDGE_MODE =
2080            new Key<Integer>("android.edge.mode", int.class);
2081
2082    /**
2083     * <p>The desired mode for for the camera device's flash control.</p>
2084     * <p>This control is only effective when flash unit is available
2085     * (<code>{@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} == true</code>).</p>
2086     * <p>When this control is used, the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} must be set to ON or OFF.
2087     * Otherwise, the camera device auto-exposure related flash control (ON_AUTO_FLASH,
2088     * ON_ALWAYS_FLASH, or ON_AUTO_FLASH_REDEYE) will override this control.</p>
2089     * <p>When set to OFF, the camera device will not fire flash for this capture.</p>
2090     * <p>When set to SINGLE, the camera device will fire flash regardless of the camera
2091     * device's auto-exposure routine's result. When used in still capture case, this
2092     * control should be used along with auto-exposure (AE) precapture metering sequence
2093     * ({@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}), otherwise, the image may be incorrectly exposed.</p>
2094     * <p>When set to TORCH, the flash will be on continuously. This mode can be used
2095     * for use cases such as preview, auto-focus assist, still capture, or video recording.</p>
2096     * <p>The flash status will be reported by {@link CaptureResult#FLASH_STATE android.flash.state} in the capture result metadata.</p>
2097     * <p><b>Possible values:</b>
2098     * <ul>
2099     *   <li>{@link #FLASH_MODE_OFF OFF}</li>
2100     *   <li>{@link #FLASH_MODE_SINGLE SINGLE}</li>
2101     *   <li>{@link #FLASH_MODE_TORCH TORCH}</li>
2102     * </ul></p>
2103     * <p>This key is available on all devices.</p>
2104     *
2105     * @see CaptureRequest#CONTROL_AE_MODE
2106     * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
2107     * @see CameraCharacteristics#FLASH_INFO_AVAILABLE
2108     * @see CaptureResult#FLASH_STATE
2109     * @see #FLASH_MODE_OFF
2110     * @see #FLASH_MODE_SINGLE
2111     * @see #FLASH_MODE_TORCH
2112     */
2113    @PublicKey
2114    public static final Key<Integer> FLASH_MODE =
2115            new Key<Integer>("android.flash.mode", int.class);
2116
2117    /**
2118     * <p>Current state of the flash
2119     * unit.</p>
2120     * <p>When the camera device doesn't have flash unit
2121     * (i.e. <code>{@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} == false</code>), this state will always be UNAVAILABLE.
2122     * Other states indicate the current flash status.</p>
2123     * <p>In certain conditions, this will be available on LEGACY devices:</p>
2124     * <ul>
2125     * <li>Flash-less cameras always return UNAVAILABLE.</li>
2126     * <li>Using {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>==</code> ON_ALWAYS_FLASH
2127     *    will always return FIRED.</li>
2128     * <li>Using {@link CaptureRequest#FLASH_MODE android.flash.mode} <code>==</code> TORCH
2129     *    will always return FIRED.</li>
2130     * </ul>
2131     * <p>In all other conditions the state will not be available on
2132     * LEGACY devices (i.e. it will be <code>null</code>).</p>
2133     * <p><b>Possible values:</b>
2134     * <ul>
2135     *   <li>{@link #FLASH_STATE_UNAVAILABLE UNAVAILABLE}</li>
2136     *   <li>{@link #FLASH_STATE_CHARGING CHARGING}</li>
2137     *   <li>{@link #FLASH_STATE_READY READY}</li>
2138     *   <li>{@link #FLASH_STATE_FIRED FIRED}</li>
2139     *   <li>{@link #FLASH_STATE_PARTIAL PARTIAL}</li>
2140     * </ul></p>
2141     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2142     * <p><b>Limited capability</b> -
2143     * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2144     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2145     *
2146     * @see CaptureRequest#CONTROL_AE_MODE
2147     * @see CameraCharacteristics#FLASH_INFO_AVAILABLE
2148     * @see CaptureRequest#FLASH_MODE
2149     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2150     * @see #FLASH_STATE_UNAVAILABLE
2151     * @see #FLASH_STATE_CHARGING
2152     * @see #FLASH_STATE_READY
2153     * @see #FLASH_STATE_FIRED
2154     * @see #FLASH_STATE_PARTIAL
2155     */
2156    @PublicKey
2157    public static final Key<Integer> FLASH_STATE =
2158            new Key<Integer>("android.flash.state", int.class);
2159
2160    /**
2161     * <p>Operational mode for hot pixel correction.</p>
2162     * <p>Hotpixel correction interpolates out, or otherwise removes, pixels
2163     * that do not accurately measure the incoming light (i.e. pixels that
2164     * are stuck at an arbitrary value or are oversensitive).</p>
2165     * <p><b>Possible values:</b>
2166     * <ul>
2167     *   <li>{@link #HOT_PIXEL_MODE_OFF OFF}</li>
2168     *   <li>{@link #HOT_PIXEL_MODE_FAST FAST}</li>
2169     *   <li>{@link #HOT_PIXEL_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
2170     * </ul></p>
2171     * <p><b>Available values for this device:</b><br>
2172     * {@link CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES android.hotPixel.availableHotPixelModes}</p>
2173     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2174     *
2175     * @see CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES
2176     * @see #HOT_PIXEL_MODE_OFF
2177     * @see #HOT_PIXEL_MODE_FAST
2178     * @see #HOT_PIXEL_MODE_HIGH_QUALITY
2179     */
2180    @PublicKey
2181    public static final Key<Integer> HOT_PIXEL_MODE =
2182            new Key<Integer>("android.hotPixel.mode", int.class);
2183
2184    /**
2185     * <p>A location object to use when generating image GPS metadata.</p>
2186     * <p>Setting a location object in a request will include the GPS coordinates of the location
2187     * into any JPEG images captured based on the request. These coordinates can then be
2188     * viewed by anyone who receives the JPEG image.</p>
2189     * <p>This key is available on all devices.</p>
2190     */
2191    @PublicKey
2192    @SyntheticKey
2193    public static final Key<android.location.Location> JPEG_GPS_LOCATION =
2194            new Key<android.location.Location>("android.jpeg.gpsLocation", android.location.Location.class);
2195
2196    /**
2197     * <p>GPS coordinates to include in output JPEG
2198     * EXIF.</p>
2199     * <p><b>Range of valid values:</b><br>
2200     * (-180 - 180], [-90,90], [-inf, inf]</p>
2201     * <p>This key is available on all devices.</p>
2202     * @hide
2203     */
2204    public static final Key<double[]> JPEG_GPS_COORDINATES =
2205            new Key<double[]>("android.jpeg.gpsCoordinates", double[].class);
2206
2207    /**
2208     * <p>32 characters describing GPS algorithm to
2209     * include in EXIF.</p>
2210     * <p><b>Units</b>: UTF-8 null-terminated string</p>
2211     * <p>This key is available on all devices.</p>
2212     * @hide
2213     */
2214    public static final Key<String> JPEG_GPS_PROCESSING_METHOD =
2215            new Key<String>("android.jpeg.gpsProcessingMethod", String.class);
2216
2217    /**
2218     * <p>Time GPS fix was made to include in
2219     * EXIF.</p>
2220     * <p><b>Units</b>: UTC in seconds since January 1, 1970</p>
2221     * <p>This key is available on all devices.</p>
2222     * @hide
2223     */
2224    public static final Key<Long> JPEG_GPS_TIMESTAMP =
2225            new Key<Long>("android.jpeg.gpsTimestamp", long.class);
2226
2227    /**
2228     * <p>The orientation for a JPEG image.</p>
2229     * <p>The clockwise rotation angle in degrees, relative to the orientation
2230     * to the camera, that the JPEG picture needs to be rotated by, to be viewed
2231     * upright.</p>
2232     * <p>Camera devices may either encode this value into the JPEG EXIF header, or
2233     * rotate the image data to match this orientation. When the image data is rotated,
2234     * the thumbnail data will also be rotated.</p>
2235     * <p>Note that this orientation is relative to the orientation of the camera sensor, given
2236     * by {@link CameraCharacteristics#SENSOR_ORIENTATION android.sensor.orientation}.</p>
2237     * <p>To translate from the device orientation given by the Android sensor APIs, the following
2238     * sample code may be used:</p>
2239     * <pre><code>private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) {
2240     *     if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0;
2241     *     int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION);
2242     *
2243     *     // Round device orientation to a multiple of 90
2244     *     deviceOrientation = (deviceOrientation + 45) / 90 * 90;
2245     *
2246     *     // Reverse device orientation for front-facing cameras
2247     *     boolean facingFront = c.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT;
2248     *     if (facingFront) deviceOrientation = -deviceOrientation;
2249     *
2250     *     // Calculate desired JPEG orientation relative to camera orientation to make
2251     *     // the image upright relative to the device orientation
2252     *     int jpegOrientation = (sensorOrientation + deviceOrientation + 360) % 360;
2253     *
2254     *     return jpegOrientation;
2255     * }
2256     * </code></pre>
2257     * <p><b>Units</b>: Degrees in multiples of 90</p>
2258     * <p><b>Range of valid values:</b><br>
2259     * 0, 90, 180, 270</p>
2260     * <p>This key is available on all devices.</p>
2261     *
2262     * @see CameraCharacteristics#SENSOR_ORIENTATION
2263     */
2264    @PublicKey
2265    public static final Key<Integer> JPEG_ORIENTATION =
2266            new Key<Integer>("android.jpeg.orientation", int.class);
2267
2268    /**
2269     * <p>Compression quality of the final JPEG
2270     * image.</p>
2271     * <p>85-95 is typical usage range.</p>
2272     * <p><b>Range of valid values:</b><br>
2273     * 1-100; larger is higher quality</p>
2274     * <p>This key is available on all devices.</p>
2275     */
2276    @PublicKey
2277    public static final Key<Byte> JPEG_QUALITY =
2278            new Key<Byte>("android.jpeg.quality", byte.class);
2279
2280    /**
2281     * <p>Compression quality of JPEG
2282     * thumbnail.</p>
2283     * <p><b>Range of valid values:</b><br>
2284     * 1-100; larger is higher quality</p>
2285     * <p>This key is available on all devices.</p>
2286     */
2287    @PublicKey
2288    public static final Key<Byte> JPEG_THUMBNAIL_QUALITY =
2289            new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
2290
2291    /**
2292     * <p>Resolution of embedded JPEG thumbnail.</p>
2293     * <p>When set to (0, 0) value, the JPEG EXIF will not contain thumbnail,
2294     * but the captured JPEG will still be a valid image.</p>
2295     * <p>For best results, when issuing a request for a JPEG image, the thumbnail size selected
2296     * should have the same aspect ratio as the main JPEG output.</p>
2297     * <p>If the thumbnail image aspect ratio differs from the JPEG primary image aspect
2298     * ratio, the camera device creates the thumbnail by cropping it from the primary image.
2299     * For example, if the primary image has 4:3 aspect ratio, the thumbnail image has
2300     * 16:9 aspect ratio, the primary image will be cropped vertically (letterbox) to
2301     * generate the thumbnail image. The thumbnail image will always have a smaller Field
2302     * Of View (FOV) than the primary image when aspect ratios differ.</p>
2303     * <p><b>Range of valid values:</b><br>
2304     * {@link CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES android.jpeg.availableThumbnailSizes}</p>
2305     * <p>This key is available on all devices.</p>
2306     *
2307     * @see CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES
2308     */
2309    @PublicKey
2310    public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE =
2311            new Key<android.util.Size>("android.jpeg.thumbnailSize", android.util.Size.class);
2312
2313    /**
2314     * <p>The desired lens aperture size, as a ratio of lens focal length to the
2315     * effective aperture diameter.</p>
2316     * <p>Setting this value is only supported on the camera devices that have a variable
2317     * aperture lens.</p>
2318     * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF,
2319     * this can be set along with {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
2320     * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}
2321     * to achieve manual exposure control.</p>
2322     * <p>The requested aperture value may take several frames to reach the
2323     * requested value; the camera device will report the current (intermediate)
2324     * aperture size in capture result metadata while the aperture is changing.
2325     * While the aperture is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p>
2326     * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is one of
2327     * the ON modes, this will be overridden by the camera device
2328     * auto-exposure algorithm, the overridden values are then provided
2329     * back to the user in the corresponding result.</p>
2330     * <p><b>Units</b>: The f-number (f/N)</p>
2331     * <p><b>Range of valid values:</b><br>
2332     * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES android.lens.info.availableApertures}</p>
2333     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2334     * <p><b>Full capability</b> -
2335     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2336     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2337     *
2338     * @see CaptureRequest#CONTROL_AE_MODE
2339     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2340     * @see CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES
2341     * @see CaptureResult#LENS_STATE
2342     * @see CaptureRequest#SENSOR_EXPOSURE_TIME
2343     * @see CaptureRequest#SENSOR_FRAME_DURATION
2344     * @see CaptureRequest#SENSOR_SENSITIVITY
2345     */
2346    @PublicKey
2347    public static final Key<Float> LENS_APERTURE =
2348            new Key<Float>("android.lens.aperture", float.class);
2349
2350    /**
2351     * <p>The desired setting for the lens neutral density filter(s).</p>
2352     * <p>This control will not be supported on most camera devices.</p>
2353     * <p>Lens filters are typically used to lower the amount of light the
2354     * sensor is exposed to (measured in steps of EV). As used here, an EV
2355     * step is the standard logarithmic representation, which are
2356     * non-negative, and inversely proportional to the amount of light
2357     * hitting the sensor.  For example, setting this to 0 would result
2358     * in no reduction of the incoming light, and setting this to 2 would
2359     * mean that the filter is set to reduce incoming light by two stops
2360     * (allowing 1/4 of the prior amount of light to the sensor).</p>
2361     * <p>It may take several frames before the lens filter density changes
2362     * to the requested value. While the filter density is still changing,
2363     * {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p>
2364     * <p><b>Units</b>: Exposure Value (EV)</p>
2365     * <p><b>Range of valid values:</b><br>
2366     * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES android.lens.info.availableFilterDensities}</p>
2367     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2368     * <p><b>Full capability</b> -
2369     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2370     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2371     *
2372     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2373     * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES
2374     * @see CaptureResult#LENS_STATE
2375     */
2376    @PublicKey
2377    public static final Key<Float> LENS_FILTER_DENSITY =
2378            new Key<Float>("android.lens.filterDensity", float.class);
2379
2380    /**
2381     * <p>The desired lens focal length; used for optical zoom.</p>
2382     * <p>This setting controls the physical focal length of the camera
2383     * device's lens. Changing the focal length changes the field of
2384     * view of the camera device, and is usually used for optical zoom.</p>
2385     * <p>Like {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} and {@link CaptureRequest#LENS_APERTURE android.lens.aperture}, this
2386     * setting won't be applied instantaneously, and it may take several
2387     * frames before the lens can change to the requested focal length.
2388     * While the focal length is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will
2389     * be set to MOVING.</p>
2390     * <p>Optical zoom will not be supported on most devices.</p>
2391     * <p><b>Units</b>: Millimeters</p>
2392     * <p><b>Range of valid values:</b><br>
2393     * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS android.lens.info.availableFocalLengths}</p>
2394     * <p>This key is available on all devices.</p>
2395     *
2396     * @see CaptureRequest#LENS_APERTURE
2397     * @see CaptureRequest#LENS_FOCUS_DISTANCE
2398     * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS
2399     * @see CaptureResult#LENS_STATE
2400     */
2401    @PublicKey
2402    public static final Key<Float> LENS_FOCAL_LENGTH =
2403            new Key<Float>("android.lens.focalLength", float.class);
2404
2405    /**
2406     * <p>Desired distance to plane of sharpest focus,
2407     * measured from frontmost surface of the lens.</p>
2408     * <p>Should be zero for fixed-focus cameras</p>
2409     * <p><b>Units</b>: See {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details</p>
2410     * <p><b>Range of valid values:</b><br>
2411     * &gt;= 0</p>
2412     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2413     * <p><b>Full capability</b> -
2414     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2415     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2416     *
2417     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2418     * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
2419     */
2420    @PublicKey
2421    public static final Key<Float> LENS_FOCUS_DISTANCE =
2422            new Key<Float>("android.lens.focusDistance", float.class);
2423
2424    /**
2425     * <p>The range of scene distances that are in
2426     * sharp focus (depth of field).</p>
2427     * <p>If variable focus not supported, can still report
2428     * fixed depth of field range</p>
2429     * <p><b>Units</b>: A pair of focus distances in diopters: (near,
2430     * far); see {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details.</p>
2431     * <p><b>Range of valid values:</b><br>
2432     * &gt;=0</p>
2433     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2434     * <p><b>Limited capability</b> -
2435     * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2436     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2437     *
2438     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2439     * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
2440     */
2441    @PublicKey
2442    public static final Key<android.util.Pair<Float,Float>> LENS_FOCUS_RANGE =
2443            new Key<android.util.Pair<Float,Float>>("android.lens.focusRange", new TypeReference<android.util.Pair<Float,Float>>() {{ }});
2444
2445    /**
2446     * <p>Sets whether the camera device uses optical image stabilization (OIS)
2447     * when capturing images.</p>
2448     * <p>OIS is used to compensate for motion blur due to small
2449     * movements of the camera during capture. Unlike digital image
2450     * stabilization ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), OIS
2451     * makes use of mechanical elements to stabilize the camera
2452     * sensor, and thus allows for longer exposure times before
2453     * camera shake becomes apparent.</p>
2454     * <p>Switching between different optical stabilization modes may take several
2455     * frames to initialize, the camera device will report the current mode in
2456     * capture result metadata. For example, When "ON" mode is requested, the
2457     * optical stabilization modes in the first several capture results may still
2458     * be "OFF", and it will become "ON" when the initialization is done.</p>
2459     * <p>If a camera device supports both OIS and digital image stabilization
2460     * ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), turning both modes on may produce undesirable
2461     * interaction, so it is recommended not to enable both at the same time.</p>
2462     * <p>Not all devices will support OIS; see
2463     * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization} for
2464     * available controls.</p>
2465     * <p><b>Possible values:</b>
2466     * <ul>
2467     *   <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_OFF OFF}</li>
2468     *   <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_ON ON}</li>
2469     * </ul></p>
2470     * <p><b>Available values for this device:</b><br>
2471     * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization}</p>
2472     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2473     * <p><b>Limited capability</b> -
2474     * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2475     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2476     *
2477     * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
2478     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2479     * @see CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION
2480     * @see #LENS_OPTICAL_STABILIZATION_MODE_OFF
2481     * @see #LENS_OPTICAL_STABILIZATION_MODE_ON
2482     */
2483    @PublicKey
2484    public static final Key<Integer> LENS_OPTICAL_STABILIZATION_MODE =
2485            new Key<Integer>("android.lens.opticalStabilizationMode", int.class);
2486
2487    /**
2488     * <p>Current lens status.</p>
2489     * <p>For lens parameters {@link CaptureRequest#LENS_FOCAL_LENGTH android.lens.focalLength}, {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance},
2490     * {@link CaptureRequest#LENS_FILTER_DENSITY android.lens.filterDensity} and {@link CaptureRequest#LENS_APERTURE android.lens.aperture}, when changes are requested,
2491     * they may take several frames to reach the requested values. This state indicates
2492     * the current status of the lens parameters.</p>
2493     * <p>When the state is STATIONARY, the lens parameters are not changing. This could be
2494     * either because the parameters are all fixed, or because the lens has had enough
2495     * time to reach the most recently-requested values.
2496     * If all these lens parameters are not changable for a camera device, as listed below:</p>
2497     * <ul>
2498     * <li>Fixed focus (<code>{@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} == 0</code>), which means
2499     * {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} parameter will always be 0.</li>
2500     * <li>Fixed focal length ({@link CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS android.lens.info.availableFocalLengths} contains single value),
2501     * which means the optical zoom is not supported.</li>
2502     * <li>No ND filter ({@link CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES android.lens.info.availableFilterDensities} contains only 0).</li>
2503     * <li>Fixed aperture ({@link CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES android.lens.info.availableApertures} contains single value).</li>
2504     * </ul>
2505     * <p>Then this state will always be STATIONARY.</p>
2506     * <p>When the state is MOVING, it indicates that at least one of the lens parameters
2507     * is changing.</p>
2508     * <p><b>Possible values:</b>
2509     * <ul>
2510     *   <li>{@link #LENS_STATE_STATIONARY STATIONARY}</li>
2511     *   <li>{@link #LENS_STATE_MOVING MOVING}</li>
2512     * </ul></p>
2513     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2514     * <p><b>Limited capability</b> -
2515     * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2516     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2517     *
2518     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2519     * @see CaptureRequest#LENS_APERTURE
2520     * @see CaptureRequest#LENS_FILTER_DENSITY
2521     * @see CaptureRequest#LENS_FOCAL_LENGTH
2522     * @see CaptureRequest#LENS_FOCUS_DISTANCE
2523     * @see CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES
2524     * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES
2525     * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS
2526     * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE
2527     * @see #LENS_STATE_STATIONARY
2528     * @see #LENS_STATE_MOVING
2529     */
2530    @PublicKey
2531    public static final Key<Integer> LENS_STATE =
2532            new Key<Integer>("android.lens.state", int.class);
2533
2534    /**
2535     * <p>The orientation of the camera relative to the sensor
2536     * coordinate system.</p>
2537     * <p>The four coefficients that describe the quarternion
2538     * rotation from the Android sensor coordinate system to a
2539     * camera-aligned coordinate system where the X-axis is
2540     * aligned with the long side of the image sensor, the Y-axis
2541     * is aligned with the short side of the image sensor, and
2542     * the Z-axis is aligned with the optical axis of the sensor.</p>
2543     * <p>To convert from the quarternion coefficients <code>(x,y,z,w)</code>
2544     * to the axis of rotation <code>(a_x, a_y, a_z)</code> and rotation
2545     * amount <code>theta</code>, the following formulas can be used:</p>
2546     * <pre><code> theta = 2 * acos(w)
2547     * a_x = x / sin(theta/2)
2548     * a_y = y / sin(theta/2)
2549     * a_z = z / sin(theta/2)
2550     * </code></pre>
2551     * <p>To create a 3x3 rotation matrix that applies the rotation
2552     * defined by this quarternion, the following matrix can be
2553     * used:</p>
2554     * <pre><code>R = [ 1 - 2y^2 - 2z^2,       2xy - 2zw,       2xz + 2yw,
2555     *            2xy + 2zw, 1 - 2x^2 - 2z^2,       2yz - 2xw,
2556     *            2xz - 2yw,       2yz + 2xw, 1 - 2x^2 - 2y^2 ]
2557     * </code></pre>
2558     * <p>This matrix can then be used to apply the rotation to a
2559     *  column vector point with</p>
2560     * <p><code>p' = Rp</code></p>
2561     * <p>where <code>p</code> is in the device sensor coordinate system, and
2562     *  <code>p'</code> is in the camera-oriented coordinate system.</p>
2563     * <p><b>Units</b>:
2564     * Quarternion coefficients</p>
2565     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2566     */
2567    @PublicKey
2568    public static final Key<float[]> LENS_POSE_ROTATION =
2569            new Key<float[]>("android.lens.poseRotation", float[].class);
2570
2571    /**
2572     * <p>Position of the camera optical center.</p>
2573     * <p>As measured in the device sensor coordinate system, the
2574     * position of the camera device's optical center, as a
2575     * three-dimensional vector <code>(x,y,z)</code>.</p>
2576     * <p>To transform a world position to a camera-device centered
2577     * coordinate system, the position must be translated by this
2578     * vector and then rotated by {@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation}.</p>
2579     * <p><b>Units</b>: Meters</p>
2580     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2581     *
2582     * @see CameraCharacteristics#LENS_POSE_ROTATION
2583     */
2584    @PublicKey
2585    public static final Key<float[]> LENS_POSE_TRANSLATION =
2586            new Key<float[]>("android.lens.poseTranslation", float[].class);
2587
2588    /**
2589     * <p>The parameters for this camera device's intrinsic
2590     * calibration.</p>
2591     * <p>The five calibration parameters that describe the
2592     * transform from camera-centric 3D coordinates to sensor
2593     * pixel coordinates:</p>
2594     * <pre><code>[f_x, f_y, c_x, c_y, s]
2595     * </code></pre>
2596     * <p>Where <code>f_x</code> and <code>f_y</code> are the horizontal and vertical
2597     * focal lengths, <code>[c_x, c_y]</code> is the position of the optical
2598     * axis, and <code>s</code> is a skew parameter for the sensor plane not
2599     * being aligned with the lens plane.</p>
2600     * <p>These are typically used within a transformation matrix K:</p>
2601     * <pre><code>K = [ f_x,   s, c_x,
2602     *        0, f_y, c_y,
2603     *        0    0,   1 ]
2604     * </code></pre>
2605     * <p>which can then be combined with the camera pose rotation
2606     * <code>R</code> and translation <code>t</code> ({@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation} and
2607     * {@link CameraCharacteristics#LENS_POSE_TRANSLATION android.lens.poseTranslation}, respective) to calculate the
2608     * complete transform from world coordinates to pixel
2609     * coordinates:</p>
2610     * <pre><code>P = [ K 0   * [ R t
2611     *      0 1 ]     0 1 ]
2612     * </code></pre>
2613     * <p>and with <code>p_w</code> being a point in the world coordinate system
2614     * and <code>p_s</code> being a point in the camera active pixel array
2615     * coordinate system, and with the mapping including the
2616     * homogeneous division by z:</p>
2617     * <pre><code> p_h = (x_h, y_h, z_h) = P p_w
2618     * p_s = p_h / z_h
2619     * </code></pre>
2620     * <p>so <code>[x_s, y_s]</code> is the pixel coordinates of the world
2621     * point, <code>z_s = 1</code>, and <code>w_s</code> is a measurement of disparity
2622     * (depth) in pixel coordinates.</p>
2623     * <p><b>Units</b>:
2624     * Pixels in the android.sensor.activeArraySize coordinate
2625     * system.</p>
2626     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2627     *
2628     * @see CameraCharacteristics#LENS_POSE_ROTATION
2629     * @see CameraCharacteristics#LENS_POSE_TRANSLATION
2630     */
2631    @PublicKey
2632    public static final Key<float[]> LENS_INTRINSIC_CALIBRATION =
2633            new Key<float[]>("android.lens.intrinsicCalibration", float[].class);
2634
2635    /**
2636     * <p>The correction coefficients to correct for this camera device's
2637     * radial lens distortion.</p>
2638     * <p>Three cofficients <code>[kappa_1, kappa_2, kappa_3]</code> that
2639     * can be used to correct the lens's radial geometric
2640     * distortion with the mapping equations:</p>
2641     * <pre><code> x_c = x_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 )
2642     * y_c = y_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 )
2643     * </code></pre>
2644     * <p>where <code>[x_i, y_i]</code> are normalized coordinates with <code>(0,0)</code>
2645     * at the lens optical center, and <code>[-1, 1]</code> are the edges of
2646     * the active pixel array; and where <code>[x_c, y_c]</code> are the
2647     * corrected normalized coordinates with radial distortion
2648     * removed; and <code>r^2 = x_i^2 + y_i^2</code>.</p>
2649     * <p><b>Units</b>:
2650     * Coefficients for a 6th-degree even radial polynomial.</p>
2651     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2652     */
2653    @PublicKey
2654    public static final Key<float[]> LENS_RADIAL_DISTORTION =
2655            new Key<float[]>("android.lens.radialDistortion", float[].class);
2656
2657    /**
2658     * <p>Mode of operation for the noise reduction algorithm.</p>
2659     * <p>The noise reduction algorithm attempts to improve image quality by removing
2660     * excessive noise added by the capture process, especially in dark conditions.</p>
2661     * <p>OFF means no noise reduction will be applied by the camera device, for both raw and
2662     * YUV domain.</p>
2663     * <p>MINIMAL means that only sensor raw domain basic noise reduction is enabled ,to remove
2664     * demosaicing or other processing artifacts. For YUV_REPROCESSING, MINIMAL is same as OFF.
2665     * This mode is optional, may not be support by all devices. The application should check
2666     * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes} before using it.</p>
2667     * <p>FAST/HIGH_QUALITY both mean camera device determined noise filtering
2668     * will be applied. HIGH_QUALITY mode indicates that the camera device
2669     * will use the highest-quality noise filtering algorithms,
2670     * even if it slows down capture rate. FAST means the camera device will not
2671     * slow down capture rate when applying noise filtering.</p>
2672     * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera device
2673     * will apply FAST/HIGH_QUALITY YUV domain noise reduction, respectively. The camera device
2674     * may adjust the noise reduction parameters for best image quality based on the
2675     * {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor} if it is set.</p>
2676     * <p><b>Possible values:</b>
2677     * <ul>
2678     *   <li>{@link #NOISE_REDUCTION_MODE_OFF OFF}</li>
2679     *   <li>{@link #NOISE_REDUCTION_MODE_FAST FAST}</li>
2680     *   <li>{@link #NOISE_REDUCTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
2681     *   <li>{@link #NOISE_REDUCTION_MODE_MINIMAL MINIMAL}</li>
2682     * </ul></p>
2683     * <p><b>Available values for this device:</b><br>
2684     * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}</p>
2685     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2686     * <p><b>Full capability</b> -
2687     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2688     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2689     *
2690     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2691     * @see CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES
2692     * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR
2693     * @see #NOISE_REDUCTION_MODE_OFF
2694     * @see #NOISE_REDUCTION_MODE_FAST
2695     * @see #NOISE_REDUCTION_MODE_HIGH_QUALITY
2696     * @see #NOISE_REDUCTION_MODE_MINIMAL
2697     */
2698    @PublicKey
2699    public static final Key<Integer> NOISE_REDUCTION_MODE =
2700            new Key<Integer>("android.noiseReduction.mode", int.class);
2701
2702    /**
2703     * <p>Whether a result given to the framework is the
2704     * final one for the capture, or only a partial that contains a
2705     * subset of the full set of dynamic metadata
2706     * values.</p>
2707     * <p>The entries in the result metadata buffers for a
2708     * single capture may not overlap, except for this entry. The
2709     * FINAL buffers must retain FIFO ordering relative to the
2710     * requests that generate them, so the FINAL buffer for frame 3 must
2711     * always be sent to the framework after the FINAL buffer for frame 2, and
2712     * before the FINAL buffer for frame 4. PARTIAL buffers may be returned
2713     * in any order relative to other frames, but all PARTIAL buffers for a given
2714     * capture must arrive before the FINAL buffer for that capture. This entry may
2715     * only be used by the camera device if quirks.usePartialResult is set to 1.</p>
2716     * <p><b>Range of valid values:</b><br>
2717     * Optional. Default value is FINAL.</p>
2718     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2719     * @deprecated
2720     * @hide
2721     */
2722    @Deprecated
2723    public static final Key<Boolean> QUIRKS_PARTIAL_RESULT =
2724            new Key<Boolean>("android.quirks.partialResult", boolean.class);
2725
2726    /**
2727     * <p>A frame counter set by the framework. This value monotonically
2728     * increases with every new result (that is, each new result has a unique
2729     * frameCount value).</p>
2730     * <p>Reset on release()</p>
2731     * <p><b>Units</b>: count of frames</p>
2732     * <p><b>Range of valid values:</b><br>
2733     * &gt; 0</p>
2734     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2735     * @deprecated
2736     * @hide
2737     */
2738    @Deprecated
2739    public static final Key<Integer> REQUEST_FRAME_COUNT =
2740            new Key<Integer>("android.request.frameCount", int.class);
2741
2742    /**
2743     * <p>An application-specified ID for the current
2744     * request. Must be maintained unchanged in output
2745     * frame</p>
2746     * <p><b>Units</b>: arbitrary integer assigned by application</p>
2747     * <p><b>Range of valid values:</b><br>
2748     * Any int</p>
2749     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2750     * @hide
2751     */
2752    public static final Key<Integer> REQUEST_ID =
2753            new Key<Integer>("android.request.id", int.class);
2754
2755    /**
2756     * <p>Specifies the number of pipeline stages the frame went
2757     * through from when it was exposed to when the final completed result
2758     * was available to the framework.</p>
2759     * <p>Depending on what settings are used in the request, and
2760     * what streams are configured, the data may undergo less processing,
2761     * and some pipeline stages skipped.</p>
2762     * <p>See {@link CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH android.request.pipelineMaxDepth} for more details.</p>
2763     * <p><b>Range of valid values:</b><br>
2764     * &lt;= {@link CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH android.request.pipelineMaxDepth}</p>
2765     * <p>This key is available on all devices.</p>
2766     *
2767     * @see CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH
2768     */
2769    @PublicKey
2770    public static final Key<Byte> REQUEST_PIPELINE_DEPTH =
2771            new Key<Byte>("android.request.pipelineDepth", byte.class);
2772
2773    /**
2774     * <p>The desired region of the sensor to read out for this capture.</p>
2775     * <p>This control can be used to implement digital zoom.</p>
2776     * <p>The crop region coordinate system is based off
2777     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being the
2778     * top-left corner of the sensor active array.</p>
2779     * <p>Output streams use this rectangle to produce their output,
2780     * cropping to a smaller region if necessary to maintain the
2781     * stream's aspect ratio, then scaling the sensor input to
2782     * match the output's configured resolution.</p>
2783     * <p>The crop region is applied after the RAW to other color
2784     * space (e.g. YUV) conversion. Since raw streams
2785     * (e.g. RAW16) don't have the conversion stage, they are not
2786     * croppable. The crop region will be ignored by raw streams.</p>
2787     * <p>For non-raw streams, any additional per-stream cropping will
2788     * be done to maximize the final pixel area of the stream.</p>
2789     * <p>For example, if the crop region is set to a 4:3 aspect
2790     * ratio, then 4:3 streams will use the exact crop
2791     * region. 16:9 streams will further crop vertically
2792     * (letterbox).</p>
2793     * <p>Conversely, if the crop region is set to a 16:9, then 4:3
2794     * outputs will crop horizontally (pillarbox), and 16:9
2795     * streams will match exactly. These additional crops will
2796     * be centered within the crop region.</p>
2797     * <p>The width and height of the crop region cannot
2798     * be set to be smaller than
2799     * <code>floor( activeArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> and
2800     * <code>floor( activeArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, respectively.</p>
2801     * <p>The camera device may adjust the crop region to account
2802     * for rounding and other hardware requirements; the final
2803     * crop region used will be included in the output capture
2804     * result.</p>
2805     * <p><b>Units</b>: Pixel coordinates relative to
2806     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}</p>
2807     * <p>This key is available on all devices.</p>
2808     *
2809     * @see CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM
2810     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
2811     */
2812    @PublicKey
2813    public static final Key<android.graphics.Rect> SCALER_CROP_REGION =
2814            new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class);
2815
2816    /**
2817     * <p>Duration each pixel is exposed to
2818     * light.</p>
2819     * <p>If the sensor can't expose this exact duration, it will shorten the
2820     * duration exposed to the nearest possible value (rather than expose longer).
2821     * The final exposure time used will be available in the output capture result.</p>
2822     * <p>This control is only effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} is set to
2823     * OFF; otherwise the auto-exposure algorithm will override this value.</p>
2824     * <p><b>Units</b>: Nanoseconds</p>
2825     * <p><b>Range of valid values:</b><br>
2826     * {@link CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE android.sensor.info.exposureTimeRange}</p>
2827     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2828     * <p><b>Full capability</b> -
2829     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2830     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2831     *
2832     * @see CaptureRequest#CONTROL_AE_MODE
2833     * @see CaptureRequest#CONTROL_MODE
2834     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2835     * @see CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE
2836     */
2837    @PublicKey
2838    public static final Key<Long> SENSOR_EXPOSURE_TIME =
2839            new Key<Long>("android.sensor.exposureTime", long.class);
2840
2841    /**
2842     * <p>Duration from start of frame exposure to
2843     * start of next frame exposure.</p>
2844     * <p>The maximum frame rate that can be supported by a camera subsystem is
2845     * a function of many factors:</p>
2846     * <ul>
2847     * <li>Requested resolutions of output image streams</li>
2848     * <li>Availability of binning / skipping modes on the imager</li>
2849     * <li>The bandwidth of the imager interface</li>
2850     * <li>The bandwidth of the various ISP processing blocks</li>
2851     * </ul>
2852     * <p>Since these factors can vary greatly between different ISPs and
2853     * sensors, the camera abstraction tries to represent the bandwidth
2854     * restrictions with as simple a model as possible.</p>
2855     * <p>The model presented has the following characteristics:</p>
2856     * <ul>
2857     * <li>The image sensor is always configured to output the smallest
2858     * resolution possible given the application's requested output stream
2859     * sizes.  The smallest resolution is defined as being at least as large
2860     * as the largest requested output stream size; the camera pipeline must
2861     * never digitally upsample sensor data when the crop region covers the
2862     * whole sensor. In general, this means that if only small output stream
2863     * resolutions are configured, the sensor can provide a higher frame
2864     * rate.</li>
2865     * <li>Since any request may use any or all the currently configured
2866     * output streams, the sensor and ISP must be configured to support
2867     * scaling a single capture to all the streams at the same time.  This
2868     * means the camera pipeline must be ready to produce the largest
2869     * requested output size without any delay.  Therefore, the overall
2870     * frame rate of a given configured stream set is governed only by the
2871     * largest requested stream resolution.</li>
2872     * <li>Using more than one output stream in a request does not affect the
2873     * frame duration.</li>
2874     * <li>Certain format-streams may need to do additional background processing
2875     * before data is consumed/produced by that stream. These processors
2876     * can run concurrently to the rest of the camera pipeline, but
2877     * cannot process more than 1 capture at a time.</li>
2878     * </ul>
2879     * <p>The necessary information for the application, given the model above,
2880     * is provided via the {@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP android.scaler.streamConfigurationMap} field
2881     * using StreamConfigurationMap#getOutputMinFrameDuration(int, Size).
2882     * These are used to determine the maximum frame rate / minimum frame
2883     * duration that is possible for a given stream configuration.</p>
2884     * <p>Specifically, the application can use the following rules to
2885     * determine the minimum frame duration it can request from the camera
2886     * device:</p>
2887     * <ol>
2888     * <li>Let the set of currently configured input/output streams
2889     * be called <code>S</code>.</li>
2890     * <li>Find the minimum frame durations for each stream in <code>S</code>, by
2891     * looking it up in {@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP android.scaler.streamConfigurationMap} using
2892     * StreamConfigurationMap#getOutputMinFrameDuration(int, Size) (with
2893     * its respective size/format). Let this set of frame durations be called
2894     * <code>F</code>.</li>
2895     * <li>For any given request <code>R</code>, the minimum frame duration allowed
2896     * for <code>R</code> is the maximum out of all values in <code>F</code>. Let the streams
2897     * used in <code>R</code> be called <code>S_r</code>.</li>
2898     * </ol>
2899     * <p>If none of the streams in <code>S_r</code> have a stall time (listed in
2900     * StreamConfigurationMap#getOutputStallDuration(int,Size) using its
2901     * respective size/format), then the frame duration in
2902     * <code>F</code> determines the steady state frame rate that the application will
2903     * get if it uses <code>R</code> as a repeating request. Let this special kind
2904     * of request be called <code>Rsimple</code>.</p>
2905     * <p>A repeating request <code>Rsimple</code> can be <em>occasionally</em> interleaved
2906     * by a single capture of a new request <code>Rstall</code> (which has at least
2907     * one in-use stream with a non-0 stall time) and if <code>Rstall</code> has the
2908     * same minimum frame duration this will not cause a frame rate loss
2909     * if all buffers from the previous <code>Rstall</code> have already been
2910     * delivered.</p>
2911     * <p>For more details about stalling, see
2912     * StreamConfigurationMap#getOutputStallDuration(int,Size).</p>
2913     * <p>This control is only effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} is set to
2914     * OFF; otherwise the auto-exposure algorithm will override this value.</p>
2915     * <p><b>Units</b>: Nanoseconds</p>
2916     * <p><b>Range of valid values:</b><br>
2917     * See {@link CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION android.sensor.info.maxFrameDuration},
2918     * {@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP android.scaler.streamConfigurationMap}. The duration
2919     * is capped to <code>max(duration, exposureTime + overhead)</code>.</p>
2920     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2921     * <p><b>Full capability</b> -
2922     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2923     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2924     *
2925     * @see CaptureRequest#CONTROL_AE_MODE
2926     * @see CaptureRequest#CONTROL_MODE
2927     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2928     * @see CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP
2929     * @see CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION
2930     */
2931    @PublicKey
2932    public static final Key<Long> SENSOR_FRAME_DURATION =
2933            new Key<Long>("android.sensor.frameDuration", long.class);
2934
2935    /**
2936     * <p>The amount of gain applied to sensor data
2937     * before processing.</p>
2938     * <p>The sensitivity is the standard ISO sensitivity value,
2939     * as defined in ISO 12232:2006.</p>
2940     * <p>The sensitivity must be within {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}, and
2941     * if if it less than {@link CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY android.sensor.maxAnalogSensitivity}, the camera device
2942     * is guaranteed to use only analog amplification for applying the gain.</p>
2943     * <p>If the camera device cannot apply the exact sensitivity
2944     * requested, it will reduce the gain to the nearest supported
2945     * value. The final sensitivity used will be available in the
2946     * output capture result.</p>
2947     * <p><b>Units</b>: ISO arithmetic units</p>
2948     * <p><b>Range of valid values:</b><br>
2949     * {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}</p>
2950     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
2951     * <p><b>Full capability</b> -
2952     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2953     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2954     *
2955     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2956     * @see CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE
2957     * @see CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY
2958     */
2959    @PublicKey
2960    public static final Key<Integer> SENSOR_SENSITIVITY =
2961            new Key<Integer>("android.sensor.sensitivity", int.class);
2962
2963    /**
2964     * <p>Time at start of exposure of first
2965     * row of the image sensor active array, in nanoseconds.</p>
2966     * <p>The timestamps are also included in all image
2967     * buffers produced for the same capture, and will be identical
2968     * on all the outputs.</p>
2969     * <p>When {@link CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE android.sensor.info.timestampSource} <code>==</code> UNKNOWN,
2970     * the timestamps measure time since an unspecified starting point,
2971     * and are monotonically increasing. They can be compared with the
2972     * timestamps for other captures from the same camera device, but are
2973     * not guaranteed to be comparable to any other time source.</p>
2974     * <p>When {@link CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE android.sensor.info.timestampSource} <code>==</code> REALTIME,
2975     * the timestamps measure time in the same timebase as
2976     * android.os.SystemClock#elapsedRealtimeNanos(), and they can be
2977     * compared to other timestamps from other subsystems that are using
2978     * that base.</p>
2979     * <p><b>Units</b>: Nanoseconds</p>
2980     * <p><b>Range of valid values:</b><br>
2981     * &gt; 0</p>
2982     * <p>This key is available on all devices.</p>
2983     *
2984     * @see CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE
2985     */
2986    @PublicKey
2987    public static final Key<Long> SENSOR_TIMESTAMP =
2988            new Key<Long>("android.sensor.timestamp", long.class);
2989
2990    /**
2991     * <p>The estimated camera neutral color in the native sensor colorspace at
2992     * the time of capture.</p>
2993     * <p>This value gives the neutral color point encoded as an RGB value in the
2994     * native sensor color space.  The neutral color point indicates the
2995     * currently estimated white point of the scene illumination.  It can be
2996     * used to interpolate between the provided color transforms when
2997     * processing raw sensor data.</p>
2998     * <p>The order of the values is R, G, B; where R is in the lowest index.</p>
2999     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3000     */
3001    @PublicKey
3002    public static final Key<Rational[]> SENSOR_NEUTRAL_COLOR_POINT =
3003            new Key<Rational[]>("android.sensor.neutralColorPoint", Rational[].class);
3004
3005    /**
3006     * <p>Noise model coefficients for each CFA mosaic channel.</p>
3007     * <p>This key contains two noise model coefficients for each CFA channel
3008     * corresponding to the sensor amplification (S) and sensor readout
3009     * noise (O).  These are given as pairs of coefficients for each channel
3010     * in the same order as channels listed for the CFA layout key
3011     * (see {@link CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT android.sensor.info.colorFilterArrangement}).  This is
3012     * represented as an array of Pair&lt;Double, Double&gt;, where
3013     * the first member of the Pair at index n is the S coefficient and the
3014     * second member is the O coefficient for the nth color channel in the CFA.</p>
3015     * <p>These coefficients are used in a two parameter noise model to describe
3016     * the amount of noise present in the image for each CFA channel.  The
3017     * noise model used here is:</p>
3018     * <p>N(x) = sqrt(Sx + O)</p>
3019     * <p>Where x represents the recorded signal of a CFA channel normalized to
3020     * the range [0, 1], and S and O are the noise model coeffiecients for
3021     * that channel.</p>
3022     * <p>A more detailed description of the noise model can be found in the
3023     * Adobe DNG specification for the NoiseProfile tag.</p>
3024     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3025     *
3026     * @see CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
3027     */
3028    @PublicKey
3029    public static final Key<android.util.Pair<Double,Double>[]> SENSOR_NOISE_PROFILE =
3030            new Key<android.util.Pair<Double,Double>[]>("android.sensor.noiseProfile", new TypeReference<android.util.Pair<Double,Double>[]>() {{ }});
3031
3032    /**
3033     * <p>The worst-case divergence between Bayer green channels.</p>
3034     * <p>This value is an estimate of the worst case split between the
3035     * Bayer green channels in the red and blue rows in the sensor color
3036     * filter array.</p>
3037     * <p>The green split is calculated as follows:</p>
3038     * <ol>
3039     * <li>A 5x5 pixel (or larger) window W within the active sensor array is
3040     * chosen. The term 'pixel' here is taken to mean a group of 4 Bayer
3041     * mosaic channels (R, Gr, Gb, B).  The location and size of the window
3042     * chosen is implementation defined, and should be chosen to provide a
3043     * green split estimate that is both representative of the entire image
3044     * for this camera sensor, and can be calculated quickly.</li>
3045     * <li>The arithmetic mean of the green channels from the red
3046     * rows (mean_Gr) within W is computed.</li>
3047     * <li>The arithmetic mean of the green channels from the blue
3048     * rows (mean_Gb) within W is computed.</li>
3049     * <li>The maximum ratio R of the two means is computed as follows:
3050     * <code>R = max((mean_Gr + 1)/(mean_Gb + 1), (mean_Gb + 1)/(mean_Gr + 1))</code></li>
3051     * </ol>
3052     * <p>The ratio R is the green split divergence reported for this property,
3053     * which represents how much the green channels differ in the mosaic
3054     * pattern.  This value is typically used to determine the treatment of
3055     * the green mosaic channels when demosaicing.</p>
3056     * <p>The green split value can be roughly interpreted as follows:</p>
3057     * <ul>
3058     * <li>R &lt; 1.03 is a negligible split (&lt;3% divergence).</li>
3059     * <li>1.20 &lt;= R &gt;= 1.03 will require some software
3060     * correction to avoid demosaic errors (3-20% divergence).</li>
3061     * <li>R &gt; 1.20 will require strong software correction to produce
3062     * a usuable image (&gt;20% divergence).</li>
3063     * </ul>
3064     * <p><b>Range of valid values:</b><br></p>
3065     * <p>&gt;= 0</p>
3066     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3067     */
3068    @PublicKey
3069    public static final Key<Float> SENSOR_GREEN_SPLIT =
3070            new Key<Float>("android.sensor.greenSplit", float.class);
3071
3072    /**
3073     * <p>A pixel <code>[R, G_even, G_odd, B]</code> that supplies the test pattern
3074     * when {@link CaptureRequest#SENSOR_TEST_PATTERN_MODE android.sensor.testPatternMode} is SOLID_COLOR.</p>
3075     * <p>Each color channel is treated as an unsigned 32-bit integer.
3076     * The camera device then uses the most significant X bits
3077     * that correspond to how many bits are in its Bayer raw sensor
3078     * output.</p>
3079     * <p>For example, a sensor with RAW10 Bayer output would use the
3080     * 10 most significant bits from each color channel.</p>
3081     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3082     *
3083     * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE
3084     */
3085    @PublicKey
3086    public static final Key<int[]> SENSOR_TEST_PATTERN_DATA =
3087            new Key<int[]>("android.sensor.testPatternData", int[].class);
3088
3089    /**
3090     * <p>When enabled, the sensor sends a test pattern instead of
3091     * doing a real exposure from the camera.</p>
3092     * <p>When a test pattern is enabled, all manual sensor controls specified
3093     * by android.sensor.* will be ignored. All other controls should
3094     * work as normal.</p>
3095     * <p>For example, if manual flash is enabled, flash firing should still
3096     * occur (and that the test pattern remain unmodified, since the flash
3097     * would not actually affect it).</p>
3098     * <p>Defaults to OFF.</p>
3099     * <p><b>Possible values:</b>
3100     * <ul>
3101     *   <li>{@link #SENSOR_TEST_PATTERN_MODE_OFF OFF}</li>
3102     *   <li>{@link #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR SOLID_COLOR}</li>
3103     *   <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS COLOR_BARS}</li>
3104     *   <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY COLOR_BARS_FADE_TO_GRAY}</li>
3105     *   <li>{@link #SENSOR_TEST_PATTERN_MODE_PN9 PN9}</li>
3106     *   <li>{@link #SENSOR_TEST_PATTERN_MODE_CUSTOM1 CUSTOM1}</li>
3107     * </ul></p>
3108     * <p><b>Available values for this device:</b><br>
3109     * {@link CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES android.sensor.availableTestPatternModes}</p>
3110     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3111     *
3112     * @see CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES
3113     * @see #SENSOR_TEST_PATTERN_MODE_OFF
3114     * @see #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR
3115     * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS
3116     * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY
3117     * @see #SENSOR_TEST_PATTERN_MODE_PN9
3118     * @see #SENSOR_TEST_PATTERN_MODE_CUSTOM1
3119     */
3120    @PublicKey
3121    public static final Key<Integer> SENSOR_TEST_PATTERN_MODE =
3122            new Key<Integer>("android.sensor.testPatternMode", int.class);
3123
3124    /**
3125     * <p>Duration between the start of first row exposure
3126     * and the start of last row exposure.</p>
3127     * <p>This is the exposure time skew between the first and last
3128     * row exposure start times. The first row and the last row are
3129     * the first and last rows inside of the
3130     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p>
3131     * <p>For typical camera sensors that use rolling shutters, this is also equivalent
3132     * to the frame readout time.</p>
3133     * <p><b>Units</b>: Nanoseconds</p>
3134     * <p><b>Range of valid values:</b><br>
3135     * &gt;= 0 and &lt;
3136     * StreamConfigurationMap#getOutputMinFrameDuration(int, Size).</p>
3137     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3138     * <p><b>Limited capability</b> -
3139     * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
3140     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3141     *
3142     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3143     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
3144     */
3145    @PublicKey
3146    public static final Key<Long> SENSOR_ROLLING_SHUTTER_SKEW =
3147            new Key<Long>("android.sensor.rollingShutterSkew", long.class);
3148
3149    /**
3150     * <p>Quality of lens shading correction applied
3151     * to the image data.</p>
3152     * <p>When set to OFF mode, no lens shading correction will be applied by the
3153     * camera device, and an identity lens shading map data will be provided
3154     * if <code>{@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} == ON</code>. For example, for lens
3155     * shading map with size of <code>[ 4, 3 ]</code>,
3156     * the output {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap} for this case will be an identity
3157     * map shown below:</p>
3158     * <pre><code>[ 1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
3159     *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
3160     *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
3161     *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
3162     *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
3163     *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0 ]
3164     * </code></pre>
3165     * <p>When set to other modes, lens shading correction will be applied by the camera
3166     * device. Applications can request lens shading map data by setting
3167     * {@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} to ON, and then the camera device will provide lens
3168     * shading map data in {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap}; the returned shading map
3169     * data will be the one applied by the camera device for this capture request.</p>
3170     * <p>The shading map data may depend on the auto-exposure (AE) and AWB statistics, therefore
3171     * the reliability of the map data may be affected by the AE and AWB algorithms. When AE and
3172     * AWB are in AUTO modes({@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF and {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} <code>!=</code>
3173     * OFF), to get best results, it is recommended that the applications wait for the AE and AWB
3174     * to be converged before using the returned shading map data.</p>
3175     * <p><b>Possible values:</b>
3176     * <ul>
3177     *   <li>{@link #SHADING_MODE_OFF OFF}</li>
3178     *   <li>{@link #SHADING_MODE_FAST FAST}</li>
3179     *   <li>{@link #SHADING_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
3180     * </ul></p>
3181     * <p><b>Available values for this device:</b><br>
3182     * {@link CameraCharacteristics#SHADING_AVAILABLE_MODES android.shading.availableModes}</p>
3183     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3184     * <p><b>Full capability</b> -
3185     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3186     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3187     *
3188     * @see CaptureRequest#CONTROL_AE_MODE
3189     * @see CaptureRequest#CONTROL_AWB_MODE
3190     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3191     * @see CameraCharacteristics#SHADING_AVAILABLE_MODES
3192     * @see CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP
3193     * @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE
3194     * @see #SHADING_MODE_OFF
3195     * @see #SHADING_MODE_FAST
3196     * @see #SHADING_MODE_HIGH_QUALITY
3197     */
3198    @PublicKey
3199    public static final Key<Integer> SHADING_MODE =
3200            new Key<Integer>("android.shading.mode", int.class);
3201
3202    /**
3203     * <p>Operating mode for the face detector
3204     * unit.</p>
3205     * <p>Whether face detection is enabled, and whether it
3206     * should output just the basic fields or the full set of
3207     * fields.</p>
3208     * <p><b>Possible values:</b>
3209     * <ul>
3210     *   <li>{@link #STATISTICS_FACE_DETECT_MODE_OFF OFF}</li>
3211     *   <li>{@link #STATISTICS_FACE_DETECT_MODE_SIMPLE SIMPLE}</li>
3212     *   <li>{@link #STATISTICS_FACE_DETECT_MODE_FULL FULL}</li>
3213     * </ul></p>
3214     * <p><b>Available values for this device:</b><br>
3215     * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES android.statistics.info.availableFaceDetectModes}</p>
3216     * <p>This key is available on all devices.</p>
3217     *
3218     * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES
3219     * @see #STATISTICS_FACE_DETECT_MODE_OFF
3220     * @see #STATISTICS_FACE_DETECT_MODE_SIMPLE
3221     * @see #STATISTICS_FACE_DETECT_MODE_FULL
3222     */
3223    @PublicKey
3224    public static final Key<Integer> STATISTICS_FACE_DETECT_MODE =
3225            new Key<Integer>("android.statistics.faceDetectMode", int.class);
3226
3227    /**
3228     * <p>List of unique IDs for detected faces.</p>
3229     * <p>Each detected face is given a unique ID that is valid for as long as the face is visible
3230     * to the camera device.  A face that leaves the field of view and later returns may be
3231     * assigned a new ID.</p>
3232     * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} == FULL
3233     * This key is available on all devices.</p>
3234     *
3235     * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
3236     * @hide
3237     */
3238    public static final Key<int[]> STATISTICS_FACE_IDS =
3239            new Key<int[]>("android.statistics.faceIds", int[].class);
3240
3241    /**
3242     * <p>List of landmarks for detected
3243     * faces.</p>
3244     * <p>The coordinate system is that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
3245     * <code>(0, 0)</code> being the top-left pixel of the active array.</p>
3246     * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} == FULL
3247     * This key is available on all devices.</p>
3248     *
3249     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
3250     * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
3251     * @hide
3252     */
3253    public static final Key<int[]> STATISTICS_FACE_LANDMARKS =
3254            new Key<int[]>("android.statistics.faceLandmarks", int[].class);
3255
3256    /**
3257     * <p>List of the bounding rectangles for detected
3258     * faces.</p>
3259     * <p>The coordinate system is that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
3260     * <code>(0, 0)</code> being the top-left pixel of the active array.</p>
3261     * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} != OFF
3262     * This key is available on all devices.</p>
3263     *
3264     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
3265     * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
3266     * @hide
3267     */
3268    public static final Key<android.graphics.Rect[]> STATISTICS_FACE_RECTANGLES =
3269            new Key<android.graphics.Rect[]>("android.statistics.faceRectangles", android.graphics.Rect[].class);
3270
3271    /**
3272     * <p>List of the face confidence scores for
3273     * detected faces</p>
3274     * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} != OFF.</p>
3275     * <p><b>Range of valid values:</b><br>
3276     * 1-100</p>
3277     * <p>This key is available on all devices.</p>
3278     *
3279     * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
3280     * @hide
3281     */
3282    public static final Key<byte[]> STATISTICS_FACE_SCORES =
3283            new Key<byte[]>("android.statistics.faceScores", byte[].class);
3284
3285    /**
3286     * <p>List of the faces detected through camera face detection
3287     * in this capture.</p>
3288     * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} <code>!=</code> OFF.</p>
3289     * <p>This key is available on all devices.</p>
3290     *
3291     * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
3292     */
3293    @PublicKey
3294    @SyntheticKey
3295    public static final Key<android.hardware.camera2.params.Face[]> STATISTICS_FACES =
3296            new Key<android.hardware.camera2.params.Face[]>("android.statistics.faces", android.hardware.camera2.params.Face[].class);
3297
3298    /**
3299     * <p>The shading map is a low-resolution floating-point map
3300     * that lists the coefficients used to correct for vignetting, for each
3301     * Bayer color channel.</p>
3302     * <p>The least shaded section of the image should have a gain factor
3303     * of 1; all other sections should have gains above 1.</p>
3304     * <p>When {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} = TRANSFORM_MATRIX, the map
3305     * must take into account the colorCorrection settings.</p>
3306     * <p>The shading map is for the entire active pixel array, and is not
3307     * affected by the crop region specified in the request. Each shading map
3308     * entry is the value of the shading compensation map over a specific
3309     * pixel on the sensor.  Specifically, with a (N x M) resolution shading
3310     * map, and an active pixel array size (W x H), shading map entry
3311     * (x,y) ϵ (0 ... N-1, 0 ... M-1) is the value of the shading map at
3312     * pixel ( ((W-1)/(N-1)) * x, ((H-1)/(M-1)) * y) for the four color channels.
3313     * The map is assumed to be bilinearly interpolated between the sample points.</p>
3314     * <p>The channel order is [R, Geven, Godd, B], where Geven is the green
3315     * channel for the even rows of a Bayer pattern, and Godd is the odd rows.
3316     * The shading map is stored in a fully interleaved format.</p>
3317     * <p>The shading map should have on the order of 30-40 rows and columns,
3318     * and must be smaller than 64x64.</p>
3319     * <p>As an example, given a very small map defined as:</p>
3320     * <pre><code>width,height = [ 4, 3 ]
3321     * values =
3322     * [ 1.3, 1.2, 1.15, 1.2,  1.2, 1.2, 1.15, 1.2,
3323     *     1.1, 1.2, 1.2, 1.2,  1.3, 1.2, 1.3, 1.3,
3324     *   1.2, 1.2, 1.25, 1.1,  1.1, 1.1, 1.1, 1.0,
3325     *     1.0, 1.0, 1.0, 1.0,  1.2, 1.3, 1.25, 1.2,
3326     *   1.3, 1.2, 1.2, 1.3,   1.2, 1.15, 1.1, 1.2,
3327     *     1.2, 1.1, 1.0, 1.2,  1.3, 1.15, 1.2, 1.3 ]
3328     * </code></pre>
3329     * <p>The low-resolution scaling map images for each channel are
3330     * (displayed using nearest-neighbor interpolation):</p>
3331     * <p><img alt="Red lens shading map" src="../../../../images/camera2/metadata/android.statistics.lensShadingMap/red_shading.png" />
3332     * <img alt="Green (even rows) lens shading map" src="../../../../images/camera2/metadata/android.statistics.lensShadingMap/green_e_shading.png" />
3333     * <img alt="Green (odd rows) lens shading map" src="../../../../images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png" />
3334     * <img alt="Blue lens shading map" src="../../../../images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png" /></p>
3335     * <p>As a visualization only, inverting the full-color map to recover an
3336     * image of a gray wall (using bicubic interpolation for visual quality) as captured by the sensor gives:</p>
3337     * <p><img alt="Image of a uniform white wall (inverse shading map)" src="../../../../images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png" /></p>
3338     * <p><b>Range of valid values:</b><br>
3339     * Each gain factor is &gt;= 1</p>
3340     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3341     * <p><b>Full capability</b> -
3342     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3343     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3344     *
3345     * @see CaptureRequest#COLOR_CORRECTION_MODE
3346     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3347     */
3348    @PublicKey
3349    public static final Key<android.hardware.camera2.params.LensShadingMap> STATISTICS_LENS_SHADING_CORRECTION_MAP =
3350            new Key<android.hardware.camera2.params.LensShadingMap>("android.statistics.lensShadingCorrectionMap", android.hardware.camera2.params.LensShadingMap.class);
3351
3352    /**
3353     * <p>The shading map is a low-resolution floating-point map
3354     * that lists the coefficients used to correct for vignetting, for each
3355     * Bayer color channel of RAW image data.</p>
3356     * <p>The least shaded section of the image should have a gain factor
3357     * of 1; all other sections should have gains above 1.</p>
3358     * <p>When {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} = TRANSFORM_MATRIX, the map
3359     * must take into account the colorCorrection settings.</p>
3360     * <p>The shading map is for the entire active pixel array, and is not
3361     * affected by the crop region specified in the request. Each shading map
3362     * entry is the value of the shading compensation map over a specific
3363     * pixel on the sensor.  Specifically, with a (N x M) resolution shading
3364     * map, and an active pixel array size (W x H), shading map entry
3365     * (x,y) ϵ (0 ... N-1, 0 ... M-1) is the value of the shading map at
3366     * pixel ( ((W-1)/(N-1)) * x, ((H-1)/(M-1)) * y) for the four color channels.
3367     * The map is assumed to be bilinearly interpolated between the sample points.</p>
3368     * <p>The channel order is [R, Geven, Godd, B], where Geven is the green
3369     * channel for the even rows of a Bayer pattern, and Godd is the odd rows.
3370     * The shading map is stored in a fully interleaved format, and its size
3371     * is provided in the camera static metadata by android.lens.info.shadingMapSize.</p>
3372     * <p>The shading map should have on the order of 30-40 rows and columns,
3373     * and must be smaller than 64x64.</p>
3374     * <p>As an example, given a very small map defined as:</p>
3375     * <pre><code>android.lens.info.shadingMapSize = [ 4, 3 ]
3376     * android.statistics.lensShadingMap =
3377     * [ 1.3, 1.2, 1.15, 1.2,  1.2, 1.2, 1.15, 1.2,
3378     *     1.1, 1.2, 1.2, 1.2,  1.3, 1.2, 1.3, 1.3,
3379     *   1.2, 1.2, 1.25, 1.1,  1.1, 1.1, 1.1, 1.0,
3380     *     1.0, 1.0, 1.0, 1.0,  1.2, 1.3, 1.25, 1.2,
3381     *   1.3, 1.2, 1.2, 1.3,   1.2, 1.15, 1.1, 1.2,
3382     *     1.2, 1.1, 1.0, 1.2,  1.3, 1.15, 1.2, 1.3 ]
3383     * </code></pre>
3384     * <p>The low-resolution scaling map images for each channel are
3385     * (displayed using nearest-neighbor interpolation):</p>
3386     * <p><img alt="Red lens shading map" src="../../../../images/camera2/metadata/android.statistics.lensShadingMap/red_shading.png" />
3387     * <img alt="Green (even rows) lens shading map" src="../../../../images/camera2/metadata/android.statistics.lensShadingMap/green_e_shading.png" />
3388     * <img alt="Green (odd rows) lens shading map" src="../../../../images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png" />
3389     * <img alt="Blue lens shading map" src="../../../../images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png" /></p>
3390     * <p>As a visualization only, inverting the full-color map to recover an
3391     * image of a gray wall (using bicubic interpolation for visual quality)
3392     * as captured by the sensor gives:</p>
3393     * <p><img alt="Image of a uniform white wall (inverse shading map)" src="../../../../images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png" /></p>
3394     * <p>Note that the RAW image data might be subject to lens shading
3395     * correction not reported on this map. Query
3396     * {@link CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED android.sensor.info.lensShadingApplied} to see if RAW image data has subject
3397     * to lens shading correction. If {@link CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED android.sensor.info.lensShadingApplied}
3398     * is TRUE, the RAW image data is subject to partial or full lens shading
3399     * correction. In the case full lens shading correction is applied to RAW
3400     * images, the gain factor map reported in this key will contain all 1.0 gains.
3401     * In other words, the map reported in this key is the remaining lens shading
3402     * that needs to be applied on the RAW image to get images without lens shading
3403     * artifacts. See {@link CameraCharacteristics#REQUEST_MAX_NUM_OUTPUT_RAW android.request.maxNumOutputRaw} for a list of RAW image
3404     * formats.</p>
3405     * <p><b>Range of valid values:</b><br>
3406     * Each gain factor is &gt;= 1</p>
3407     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3408     * <p><b>Full capability</b> -
3409     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3410     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3411     *
3412     * @see CaptureRequest#COLOR_CORRECTION_MODE
3413     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3414     * @see CameraCharacteristics#REQUEST_MAX_NUM_OUTPUT_RAW
3415     * @see CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED
3416     * @hide
3417     */
3418    public static final Key<float[]> STATISTICS_LENS_SHADING_MAP =
3419            new Key<float[]>("android.statistics.lensShadingMap", float[].class);
3420
3421    /**
3422     * <p>The best-fit color channel gains calculated
3423     * by the camera device's statistics units for the current output frame.</p>
3424     * <p>This may be different than the gains used for this frame,
3425     * since statistics processing on data from a new frame
3426     * typically completes after the transform has already been
3427     * applied to that frame.</p>
3428     * <p>The 4 channel gains are defined in Bayer domain,
3429     * see {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} for details.</p>
3430     * <p>This value should always be calculated by the auto-white balance (AWB) block,
3431     * regardless of the android.control.* current values.</p>
3432     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3433     *
3434     * @see CaptureRequest#COLOR_CORRECTION_GAINS
3435     * @deprecated
3436     * @hide
3437     */
3438    @Deprecated
3439    public static final Key<float[]> STATISTICS_PREDICTED_COLOR_GAINS =
3440            new Key<float[]>("android.statistics.predictedColorGains", float[].class);
3441
3442    /**
3443     * <p>The best-fit color transform matrix estimate
3444     * calculated by the camera device's statistics units for the current
3445     * output frame.</p>
3446     * <p>The camera device will provide the estimate from its
3447     * statistics unit on the white balance transforms to use
3448     * for the next frame. These are the values the camera device believes
3449     * are the best fit for the current output frame. This may
3450     * be different than the transform used for this frame, since
3451     * statistics processing on data from a new frame typically
3452     * completes after the transform has already been applied to
3453     * that frame.</p>
3454     * <p>These estimates must be provided for all frames, even if
3455     * capture settings and color transforms are set by the application.</p>
3456     * <p>This value should always be calculated by the auto-white balance (AWB) block,
3457     * regardless of the android.control.* current values.</p>
3458     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3459     * @deprecated
3460     * @hide
3461     */
3462    @Deprecated
3463    public static final Key<Rational[]> STATISTICS_PREDICTED_COLOR_TRANSFORM =
3464            new Key<Rational[]>("android.statistics.predictedColorTransform", Rational[].class);
3465
3466    /**
3467     * <p>The camera device estimated scene illumination lighting
3468     * frequency.</p>
3469     * <p>Many light sources, such as most fluorescent lights, flicker at a rate
3470     * that depends on the local utility power standards. This flicker must be
3471     * accounted for by auto-exposure routines to avoid artifacts in captured images.
3472     * The camera device uses this entry to tell the application what the scene
3473     * illuminant frequency is.</p>
3474     * <p>When manual exposure control is enabled
3475     * (<code>{@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} == OFF</code> or <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} ==
3476     * OFF</code>), the {@link CaptureRequest#CONTROL_AE_ANTIBANDING_MODE android.control.aeAntibandingMode} doesn't perform
3477     * antibanding, and the application can ensure it selects
3478     * exposure times that do not cause banding issues by looking
3479     * into this metadata field. See
3480     * {@link CaptureRequest#CONTROL_AE_ANTIBANDING_MODE android.control.aeAntibandingMode} for more details.</p>
3481     * <p>Reports NONE if there doesn't appear to be flickering illumination.</p>
3482     * <p><b>Possible values:</b>
3483     * <ul>
3484     *   <li>{@link #STATISTICS_SCENE_FLICKER_NONE NONE}</li>
3485     *   <li>{@link #STATISTICS_SCENE_FLICKER_50HZ 50HZ}</li>
3486     *   <li>{@link #STATISTICS_SCENE_FLICKER_60HZ 60HZ}</li>
3487     * </ul></p>
3488     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3489     * <p><b>Full capability</b> -
3490     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3491     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3492     *
3493     * @see CaptureRequest#CONTROL_AE_ANTIBANDING_MODE
3494     * @see CaptureRequest#CONTROL_AE_MODE
3495     * @see CaptureRequest#CONTROL_MODE
3496     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3497     * @see #STATISTICS_SCENE_FLICKER_NONE
3498     * @see #STATISTICS_SCENE_FLICKER_50HZ
3499     * @see #STATISTICS_SCENE_FLICKER_60HZ
3500     */
3501    @PublicKey
3502    public static final Key<Integer> STATISTICS_SCENE_FLICKER =
3503            new Key<Integer>("android.statistics.sceneFlicker", int.class);
3504
3505    /**
3506     * <p>Operating mode for hot pixel map generation.</p>
3507     * <p>If set to <code>true</code>, a hot pixel map is returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.
3508     * If set to <code>false</code>, no hot pixel map will be returned.</p>
3509     * <p><b>Range of valid values:</b><br>
3510     * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}</p>
3511     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3512     *
3513     * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
3514     * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES
3515     */
3516    @PublicKey
3517    public static final Key<Boolean> STATISTICS_HOT_PIXEL_MAP_MODE =
3518            new Key<Boolean>("android.statistics.hotPixelMapMode", boolean.class);
3519
3520    /**
3521     * <p>List of <code>(x, y)</code> coordinates of hot/defective pixels on the sensor.</p>
3522     * <p>A coordinate <code>(x, y)</code> must lie between <code>(0, 0)</code>, and
3523     * <code>(width - 1, height - 1)</code> (inclusive), which are the top-left and
3524     * bottom-right of the pixel array, respectively. The width and
3525     * height dimensions are given in {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}.
3526     * This may include hot pixels that lie outside of the active array
3527     * bounds given by {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p>
3528     * <p><b>Range of valid values:</b><br></p>
3529     * <p>n &lt;= number of pixels on the sensor.
3530     * The <code>(x, y)</code> coordinates must be bounded by
3531     * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}.</p>
3532     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3533     *
3534     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
3535     * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE
3536     */
3537    @PublicKey
3538    public static final Key<android.graphics.Point[]> STATISTICS_HOT_PIXEL_MAP =
3539            new Key<android.graphics.Point[]>("android.statistics.hotPixelMap", android.graphics.Point[].class);
3540
3541    /**
3542     * <p>Whether the camera device will output the lens
3543     * shading map in output result metadata.</p>
3544     * <p>When set to ON,
3545     * android.statistics.lensShadingMap will be provided in
3546     * the output result metadata.</p>
3547     * <p>ON is always supported on devices with the RAW capability.</p>
3548     * <p><b>Possible values:</b>
3549     * <ul>
3550     *   <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_OFF OFF}</li>
3551     *   <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_ON ON}</li>
3552     * </ul></p>
3553     * <p><b>Available values for this device:</b><br>
3554     * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES android.statistics.info.availableLensShadingMapModes}</p>
3555     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3556     * <p><b>Full capability</b> -
3557     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3558     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3559     *
3560     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3561     * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES
3562     * @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF
3563     * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON
3564     */
3565    @PublicKey
3566    public static final Key<Integer> STATISTICS_LENS_SHADING_MAP_MODE =
3567            new Key<Integer>("android.statistics.lensShadingMapMode", int.class);
3568
3569    /**
3570     * <p>Tonemapping / contrast / gamma curve for the blue
3571     * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3572     * CONTRAST_CURVE.</p>
3573     * <p>See android.tonemap.curveRed for more details.</p>
3574     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3575     * <p><b>Full capability</b> -
3576     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3577     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3578     *
3579     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3580     * @see CaptureRequest#TONEMAP_MODE
3581     * @hide
3582     */
3583    public static final Key<float[]> TONEMAP_CURVE_BLUE =
3584            new Key<float[]>("android.tonemap.curveBlue", float[].class);
3585
3586    /**
3587     * <p>Tonemapping / contrast / gamma curve for the green
3588     * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3589     * CONTRAST_CURVE.</p>
3590     * <p>See android.tonemap.curveRed for more details.</p>
3591     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3592     * <p><b>Full capability</b> -
3593     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3594     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3595     *
3596     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3597     * @see CaptureRequest#TONEMAP_MODE
3598     * @hide
3599     */
3600    public static final Key<float[]> TONEMAP_CURVE_GREEN =
3601            new Key<float[]>("android.tonemap.curveGreen", float[].class);
3602
3603    /**
3604     * <p>Tonemapping / contrast / gamma curve for the red
3605     * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3606     * CONTRAST_CURVE.</p>
3607     * <p>Each channel's curve is defined by an array of control points:</p>
3608     * <pre><code>android.tonemap.curveRed =
3609     *   [ P0in, P0out, P1in, P1out, P2in, P2out, P3in, P3out, ..., PNin, PNout ]
3610     * 2 &lt;= N &lt;= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
3611     * <p>These are sorted in order of increasing <code>Pin</code>; it is
3612     * required that input values 0.0 and 1.0 are included in the list to
3613     * define a complete mapping. For input values between control points,
3614     * the camera device must linearly interpolate between the control
3615     * points.</p>
3616     * <p>Each curve can have an independent number of points, and the number
3617     * of points can be less than max (that is, the request doesn't have to
3618     * always provide a curve with number of points equivalent to
3619     * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p>
3620     * <p>A few examples, and their corresponding graphical mappings; these
3621     * only specify the red channel and the precision is limited to 4
3622     * digits, for conciseness.</p>
3623     * <p>Linear mapping:</p>
3624     * <pre><code>android.tonemap.curveRed = [ 0, 0, 1.0, 1.0 ]
3625     * </code></pre>
3626     * <p><img alt="Linear mapping curve" src="../../../../images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p>
3627     * <p>Invert mapping:</p>
3628     * <pre><code>android.tonemap.curveRed = [ 0, 1.0, 1.0, 0 ]
3629     * </code></pre>
3630     * <p><img alt="Inverting mapping curve" src="../../../../images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p>
3631     * <p>Gamma 1/2.2 mapping, with 16 control points:</p>
3632     * <pre><code>android.tonemap.curveRed = [
3633     *   0.0000, 0.0000, 0.0667, 0.2920, 0.1333, 0.4002, 0.2000, 0.4812,
3634     *   0.2667, 0.5484, 0.3333, 0.6069, 0.4000, 0.6594, 0.4667, 0.7072,
3635     *   0.5333, 0.7515, 0.6000, 0.7928, 0.6667, 0.8317, 0.7333, 0.8685,
3636     *   0.8000, 0.9035, 0.8667, 0.9370, 0.9333, 0.9691, 1.0000, 1.0000 ]
3637     * </code></pre>
3638     * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="../../../../images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p>
3639     * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p>
3640     * <pre><code>android.tonemap.curveRed = [
3641     *   0.0000, 0.0000, 0.0667, 0.2864, 0.1333, 0.4007, 0.2000, 0.4845,
3642     *   0.2667, 0.5532, 0.3333, 0.6125, 0.4000, 0.6652, 0.4667, 0.7130,
3643     *   0.5333, 0.7569, 0.6000, 0.7977, 0.6667, 0.8360, 0.7333, 0.8721,
3644     *   0.8000, 0.9063, 0.8667, 0.9389, 0.9333, 0.9701, 1.0000, 1.0000 ]
3645     * </code></pre>
3646     * <p><img alt="sRGB tonemapping curve" src="../../../../images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
3647     * <p><b>Range of valid values:</b><br>
3648     * 0-1 on both input and output coordinates, normalized
3649     * as a floating-point value such that 0 == black and 1 == white.</p>
3650     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3651     * <p><b>Full capability</b> -
3652     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3653     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3654     *
3655     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3656     * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS
3657     * @see CaptureRequest#TONEMAP_MODE
3658     * @hide
3659     */
3660    public static final Key<float[]> TONEMAP_CURVE_RED =
3661            new Key<float[]>("android.tonemap.curveRed", float[].class);
3662
3663    /**
3664     * <p>Tonemapping / contrast / gamma curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode}
3665     * is CONTRAST_CURVE.</p>
3666     * <p>The tonemapCurve consist of three curves for each of red, green, and blue
3667     * channels respectively. The following example uses the red channel as an
3668     * example. The same logic applies to green and blue channel.
3669     * Each channel's curve is defined by an array of control points:</p>
3670     * <pre><code>curveRed =
3671     *   [ P0(in, out), P1(in, out), P2(in, out), P3(in, out), ..., PN(in, out) ]
3672     * 2 &lt;= N &lt;= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
3673     * <p>These are sorted in order of increasing <code>Pin</code>; it is always
3674     * guaranteed that input values 0.0 and 1.0 are included in the list to
3675     * define a complete mapping. For input values between control points,
3676     * the camera device must linearly interpolate between the control
3677     * points.</p>
3678     * <p>Each curve can have an independent number of points, and the number
3679     * of points can be less than max (that is, the request doesn't have to
3680     * always provide a curve with number of points equivalent to
3681     * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p>
3682     * <p>A few examples, and their corresponding graphical mappings; these
3683     * only specify the red channel and the precision is limited to 4
3684     * digits, for conciseness.</p>
3685     * <p>Linear mapping:</p>
3686     * <pre><code>curveRed = [ (0, 0), (1.0, 1.0) ]
3687     * </code></pre>
3688     * <p><img alt="Linear mapping curve" src="../../../../images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p>
3689     * <p>Invert mapping:</p>
3690     * <pre><code>curveRed = [ (0, 1.0), (1.0, 0) ]
3691     * </code></pre>
3692     * <p><img alt="Inverting mapping curve" src="../../../../images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p>
3693     * <p>Gamma 1/2.2 mapping, with 16 control points:</p>
3694     * <pre><code>curveRed = [
3695     *   (0.0000, 0.0000), (0.0667, 0.2920), (0.1333, 0.4002), (0.2000, 0.4812),
3696     *   (0.2667, 0.5484), (0.3333, 0.6069), (0.4000, 0.6594), (0.4667, 0.7072),
3697     *   (0.5333, 0.7515), (0.6000, 0.7928), (0.6667, 0.8317), (0.7333, 0.8685),
3698     *   (0.8000, 0.9035), (0.8667, 0.9370), (0.9333, 0.9691), (1.0000, 1.0000) ]
3699     * </code></pre>
3700     * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="../../../../images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p>
3701     * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p>
3702     * <pre><code>curveRed = [
3703     *   (0.0000, 0.0000), (0.0667, 0.2864), (0.1333, 0.4007), (0.2000, 0.4845),
3704     *   (0.2667, 0.5532), (0.3333, 0.6125), (0.4000, 0.6652), (0.4667, 0.7130),
3705     *   (0.5333, 0.7569), (0.6000, 0.7977), (0.6667, 0.8360), (0.7333, 0.8721),
3706     *   (0.8000, 0.9063), (0.8667, 0.9389), (0.9333, 0.9701), (1.0000, 1.0000) ]
3707     * </code></pre>
3708     * <p><img alt="sRGB tonemapping curve" src="../../../../images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
3709     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3710     * <p><b>Full capability</b> -
3711     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3712     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3713     *
3714     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3715     * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS
3716     * @see CaptureRequest#TONEMAP_MODE
3717     */
3718    @PublicKey
3719    @SyntheticKey
3720    public static final Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE =
3721            new Key<android.hardware.camera2.params.TonemapCurve>("android.tonemap.curve", android.hardware.camera2.params.TonemapCurve.class);
3722
3723    /**
3724     * <p>High-level global contrast/gamma/tonemapping control.</p>
3725     * <p>When switching to an application-defined contrast curve by setting
3726     * {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} to CONTRAST_CURVE, the curve is defined
3727     * per-channel with a set of <code>(in, out)</code> points that specify the
3728     * mapping from input high-bit-depth pixel value to the output
3729     * low-bit-depth value.  Since the actual pixel ranges of both input
3730     * and output may change depending on the camera pipeline, the values
3731     * are specified by normalized floating-point numbers.</p>
3732     * <p>More-complex color mapping operations such as 3D color look-up
3733     * tables, selective chroma enhancement, or other non-linear color
3734     * transforms will be disabled when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3735     * CONTRAST_CURVE.</p>
3736     * <p>When using either FAST or HIGH_QUALITY, the camera device will
3737     * emit its own tonemap curve in {@link CaptureRequest#TONEMAP_CURVE android.tonemap.curve}.
3738     * These values are always available, and as close as possible to the
3739     * actually used nonlinear/nonglobal transforms.</p>
3740     * <p>If a request is sent with CONTRAST_CURVE with the camera device's
3741     * provided curve in FAST or HIGH_QUALITY, the image's tonemap will be
3742     * roughly the same.</p>
3743     * <p><b>Possible values:</b>
3744     * <ul>
3745     *   <li>{@link #TONEMAP_MODE_CONTRAST_CURVE CONTRAST_CURVE}</li>
3746     *   <li>{@link #TONEMAP_MODE_FAST FAST}</li>
3747     *   <li>{@link #TONEMAP_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
3748     *   <li>{@link #TONEMAP_MODE_GAMMA_VALUE GAMMA_VALUE}</li>
3749     *   <li>{@link #TONEMAP_MODE_PRESET_CURVE PRESET_CURVE}</li>
3750     * </ul></p>
3751     * <p><b>Available values for this device:</b><br>
3752     * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}</p>
3753     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3754     * <p><b>Full capability</b> -
3755     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3756     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3757     *
3758     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3759     * @see CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES
3760     * @see CaptureRequest#TONEMAP_CURVE
3761     * @see CaptureRequest#TONEMAP_MODE
3762     * @see #TONEMAP_MODE_CONTRAST_CURVE
3763     * @see #TONEMAP_MODE_FAST
3764     * @see #TONEMAP_MODE_HIGH_QUALITY
3765     * @see #TONEMAP_MODE_GAMMA_VALUE
3766     * @see #TONEMAP_MODE_PRESET_CURVE
3767     */
3768    @PublicKey
3769    public static final Key<Integer> TONEMAP_MODE =
3770            new Key<Integer>("android.tonemap.mode", int.class);
3771
3772    /**
3773     * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3774     * GAMMA_VALUE</p>
3775     * <p>The tonemap curve will be defined the following formula:
3776     * * OUT = pow(IN, 1.0 / gamma)
3777     * where IN and OUT is the input pixel value scaled to range [0.0, 1.0],
3778     * pow is the power function and gamma is the gamma value specified by this
3779     * key.</p>
3780     * <p>The same curve will be applied to all color channels. The camera device
3781     * may clip the input gamma value to its supported range. The actual applied
3782     * value will be returned in capture result.</p>
3783     * <p>The valid range of gamma value varies on different devices, but values
3784     * within [1.0, 5.0] are guaranteed not to be clipped.</p>
3785     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3786     *
3787     * @see CaptureRequest#TONEMAP_MODE
3788     */
3789    @PublicKey
3790    public static final Key<Float> TONEMAP_GAMMA =
3791            new Key<Float>("android.tonemap.gamma", float.class);
3792
3793    /**
3794     * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3795     * PRESET_CURVE</p>
3796     * <p>The tonemap curve will be defined by specified standard.</p>
3797     * <p>sRGB (approximated by 16 control points):</p>
3798     * <p><img alt="sRGB tonemapping curve" src="../../../../images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
3799     * <p>Rec. 709 (approximated by 16 control points):</p>
3800     * <p><img alt="Rec. 709 tonemapping curve" src="../../../../images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png" /></p>
3801     * <p>Note that above figures show a 16 control points approximation of preset
3802     * curves. Camera devices may apply a different approximation to the curve.</p>
3803     * <p><b>Possible values:</b>
3804     * <ul>
3805     *   <li>{@link #TONEMAP_PRESET_CURVE_SRGB SRGB}</li>
3806     *   <li>{@link #TONEMAP_PRESET_CURVE_REC709 REC709}</li>
3807     * </ul></p>
3808     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3809     *
3810     * @see CaptureRequest#TONEMAP_MODE
3811     * @see #TONEMAP_PRESET_CURVE_SRGB
3812     * @see #TONEMAP_PRESET_CURVE_REC709
3813     */
3814    @PublicKey
3815    public static final Key<Integer> TONEMAP_PRESET_CURVE =
3816            new Key<Integer>("android.tonemap.presetCurve", int.class);
3817
3818    /**
3819     * <p>This LED is nominally used to indicate to the user
3820     * that the camera is powered on and may be streaming images back to the
3821     * Application Processor. In certain rare circumstances, the OS may
3822     * disable this when video is processed locally and not transmitted to
3823     * any untrusted applications.</p>
3824     * <p>In particular, the LED <em>must</em> always be on when the data could be
3825     * transmitted off the device. The LED <em>should</em> always be on whenever
3826     * data is stored locally on the device.</p>
3827     * <p>The LED <em>may</em> be off if a trusted application is using the data that
3828     * doesn't violate the above rules.</p>
3829     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3830     * @hide
3831     */
3832    public static final Key<Boolean> LED_TRANSMIT =
3833            new Key<Boolean>("android.led.transmit", boolean.class);
3834
3835    /**
3836     * <p>Whether black-level compensation is locked
3837     * to its current values, or is free to vary.</p>
3838     * <p>Whether the black level offset was locked for this frame.  Should be
3839     * ON if {@link CaptureRequest#BLACK_LEVEL_LOCK android.blackLevel.lock} was ON in the capture request, unless
3840     * a change in other capture settings forced the camera device to
3841     * perform a black level reset.</p>
3842     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3843     * <p><b>Full capability</b> -
3844     * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3845     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3846     *
3847     * @see CaptureRequest#BLACK_LEVEL_LOCK
3848     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3849     */
3850    @PublicKey
3851    public static final Key<Boolean> BLACK_LEVEL_LOCK =
3852            new Key<Boolean>("android.blackLevel.lock", boolean.class);
3853
3854    /**
3855     * <p>The frame number corresponding to the last request
3856     * with which the output result (metadata + buffers) has been fully
3857     * synchronized.</p>
3858     * <p>When a request is submitted to the camera device, there is usually a
3859     * delay of several frames before the controls get applied. A camera
3860     * device may either choose to account for this delay by implementing a
3861     * pipeline and carefully submit well-timed atomic control updates, or
3862     * it may start streaming control changes that span over several frame
3863     * boundaries.</p>
3864     * <p>In the latter case, whenever a request's settings change relative to
3865     * the previous submitted request, the full set of changes may take
3866     * multiple frame durations to fully take effect. Some settings may
3867     * take effect sooner (in less frame durations) than others.</p>
3868     * <p>While a set of control changes are being propagated, this value
3869     * will be CONVERGING.</p>
3870     * <p>Once it is fully known that a set of control changes have been
3871     * finished propagating, and the resulting updated control settings
3872     * have been read back by the camera device, this value will be set
3873     * to a non-negative frame number (corresponding to the request to
3874     * which the results have synchronized to).</p>
3875     * <p>Older camera device implementations may not have a way to detect
3876     * when all camera controls have been applied, and will always set this
3877     * value to UNKNOWN.</p>
3878     * <p>FULL capability devices will always have this value set to the
3879     * frame number of the request corresponding to this result.</p>
3880     * <p><em>Further details</em>:</p>
3881     * <ul>
3882     * <li>Whenever a request differs from the last request, any future
3883     * results not yet returned may have this value set to CONVERGING (this
3884     * could include any in-progress captures not yet returned by the camera
3885     * device, for more details see pipeline considerations below).</li>
3886     * <li>Submitting a series of multiple requests that differ from the
3887     * previous request (e.g. r1, r2, r3 s.t. r1 != r2 != r3)
3888     * moves the new synchronization frame to the last non-repeating
3889     * request (using the smallest frame number from the contiguous list of
3890     * repeating requests).</li>
3891     * <li>Submitting the same request repeatedly will not change this value
3892     * to CONVERGING, if it was already a non-negative value.</li>
3893     * <li>When this value changes to non-negative, that means that all of the
3894     * metadata controls from the request have been applied, all of the
3895     * metadata controls from the camera device have been read to the
3896     * updated values (into the result), and all of the graphics buffers
3897     * corresponding to this result are also synchronized to the request.</li>
3898     * </ul>
3899     * <p><em>Pipeline considerations</em>:</p>
3900     * <p>Submitting a request with updated controls relative to the previously
3901     * submitted requests may also invalidate the synchronization state
3902     * of all the results corresponding to currently in-flight requests.</p>
3903     * <p>In other words, results for this current request and up to
3904     * {@link CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH android.request.pipelineMaxDepth} prior requests may have their
3905     * android.sync.frameNumber change to CONVERGING.</p>
3906     * <p><b>Possible values:</b>
3907     * <ul>
3908     *   <li>{@link #SYNC_FRAME_NUMBER_CONVERGING CONVERGING}</li>
3909     *   <li>{@link #SYNC_FRAME_NUMBER_UNKNOWN UNKNOWN}</li>
3910     * </ul></p>
3911     * <p><b>Available values for this device:</b><br>
3912     * Either a non-negative value corresponding to a
3913     * <code>frame_number</code>, or one of the two enums (CONVERGING / UNKNOWN).</p>
3914     * <p>This key is available on all devices.</p>
3915     *
3916     * @see CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH
3917     * @see #SYNC_FRAME_NUMBER_CONVERGING
3918     * @see #SYNC_FRAME_NUMBER_UNKNOWN
3919     * @hide
3920     */
3921    public static final Key<Long> SYNC_FRAME_NUMBER =
3922            new Key<Long>("android.sync.frameNumber", long.class);
3923
3924    /**
3925     * <p>The amount of exposure time increase factor applied to the original output
3926     * frame by the application processing before sending for reprocessing.</p>
3927     * <p>This is optional, and will be supported if the camera device supports YUV_REPROCESSING
3928     * capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains YUV_REPROCESSING).</p>
3929     * <p>For some YUV reprocessing use cases, the application may choose to filter the original
3930     * output frames to effectively reduce the noise to the same level as a frame that was
3931     * captured with longer exposure time. To be more specific, assuming the original captured
3932     * images were captured with a sensitivity of S and an exposure time of T, the model in
3933     * the camera device is that the amount of noise in the image would be approximately what
3934     * would be expected if the original capture parameters had been a sensitivity of
3935     * S/effectiveExposureFactor and an exposure time of T*effectiveExposureFactor, rather
3936     * than S and T respectively. If the captured images were processed by the application
3937     * before being sent for reprocessing, then the application may have used image processing
3938     * algorithms and/or multi-frame image fusion to reduce the noise in the
3939     * application-processed images (input images). By using the effectiveExposureFactor
3940     * control, the application can communicate to the camera device the actual noise level
3941     * improvement in the application-processed image. With this information, the camera
3942     * device can select appropriate noise reduction and edge enhancement parameters to avoid
3943     * excessive noise reduction ({@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode}) and insufficient edge
3944     * enhancement ({@link CaptureRequest#EDGE_MODE android.edge.mode}) being applied to the reprocessed frames.</p>
3945     * <p>For example, for multi-frame image fusion use case, the application may fuse
3946     * multiple output frames together to a final frame for reprocessing. When N image are
3947     * fused into 1 image for reprocessing, the exposure time increase factor could be up to
3948     * square root of N (based on a simple photon shot noise model). The camera device will
3949     * adjust the reprocessing noise reduction and edge enhancement parameters accordingly to
3950     * produce the best quality images.</p>
3951     * <p>This is relative factor, 1.0 indicates the application hasn't processed the input
3952     * buffer in a way that affects its effective exposure time.</p>
3953     * <p>This control is only effective for YUV reprocessing capture request. For noise
3954     * reduction reprocessing, it is only effective when <code>{@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode} != OFF</code>.
3955     * Similarly, for edge enhancement reprocessing, it is only effective when
3956     * <code>{@link CaptureRequest#EDGE_MODE android.edge.mode} != OFF</code>.</p>
3957     * <p><b>Units</b>: Relative exposure time increase factor.</p>
3958     * <p><b>Range of valid values:</b><br>
3959     * &gt;= 1.0</p>
3960     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
3961     *
3962     * @see CaptureRequest#EDGE_MODE
3963     * @see CaptureRequest#NOISE_REDUCTION_MODE
3964     * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
3965     */
3966    @PublicKey
3967    public static final Key<Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR =
3968            new Key<Float>("android.reprocess.effectiveExposureFactor", float.class);
3969
3970    /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
3971     * End generated code
3972     *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/
3973
3974
3975
3976}
3977