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 
17 package android.hardware.camera2;
18 
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.compat.annotation.UnsupportedAppUsage;
22 import android.hardware.camera2.impl.CameraMetadataNative;
23 import android.hardware.camera2.impl.CaptureResultExtras;
24 import android.hardware.camera2.impl.PublicKey;
25 import android.hardware.camera2.impl.SyntheticKey;
26 import android.hardware.camera2.utils.TypeReference;
27 import android.util.Log;
28 import android.util.Rational;
29 
30 import java.util.List;
31 
32 /**
33  * <p>The subset of the results of a single image capture from the image sensor.</p>
34  *
35  * <p>Contains a subset of the final configuration for the capture hardware (sensor, lens,
36  * flash), the processing pipeline, the control algorithms, and the output
37  * buffers.</p>
38  *
39  * <p>CaptureResults are produced by a {@link CameraDevice} after processing a
40  * {@link CaptureRequest}. All properties listed for capture requests can also
41  * be queried on the capture result, to determine the final values used for
42  * capture. The result also includes additional metadata about the state of the
43  * camera device during the capture.</p>
44  *
45  * <p>Not all properties returned by {@link CameraCharacteristics#getAvailableCaptureResultKeys()}
46  * are necessarily available. Some results are {@link CaptureResult partial} and will
47  * not have every key set. Only {@link TotalCaptureResult total} results are guaranteed to have
48  * every key available that was enabled by the request.</p>
49  *
50  * <p>{@link CaptureResult} objects are immutable.</p>
51  *
52  */
53 public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
54 
55     private static final String TAG = "CaptureResult";
56     private static final boolean VERBOSE = false;
57 
58     /**
59      * A {@code Key} is used to do capture result field lookups with
60      * {@link CaptureResult#get}.
61      *
62      * <p>For example, to get the timestamp corresponding to the exposure of the first row:
63      * <code><pre>
64      * long timestamp = captureResult.get(CaptureResult.SENSOR_TIMESTAMP);
65      * </pre></code>
66      * </p>
67      *
68      * <p>To enumerate over all possible keys for {@link CaptureResult}, see
69      * {@link CameraCharacteristics#getAvailableCaptureResultKeys}.</p>
70      *
71      * @see CaptureResult#get
72      * @see CameraCharacteristics#getAvailableCaptureResultKeys
73      */
74     public final static class Key<T> {
75         private final CameraMetadataNative.Key<T> mKey;
76 
77         /**
78          * Visible for testing and vendor extensions only.
79          *
80          * @hide
81          */
82         @UnsupportedAppUsage
Key(String name, Class<T> type, long vendorId)83         public Key(String name, Class<T> type, long vendorId) {
84             mKey = new CameraMetadataNative.Key<T>(name, type, vendorId);
85         }
86 
87         /**
88          * Visible for testing and vendor extensions only.
89          *
90          * @hide
91          */
Key(String name, String fallbackName, Class<T> type)92         public Key(String name, String fallbackName, Class<T> type) {
93             mKey = new CameraMetadataNative.Key<T>(name, fallbackName, type);
94         }
95 
96        /**
97          * Construct a new Key with a given name and type.
98          *
99          * <p>Normally, applications should use the existing Key definitions in
100          * {@link CaptureResult}, and not need to construct their own Key objects. However, they may
101          * be useful for testing purposes and for defining custom capture result fields.</p>
102          */
Key(@onNull String name, @NonNull Class<T> type)103         public Key(@NonNull String name, @NonNull Class<T> type) {
104             mKey = new CameraMetadataNative.Key<T>(name, type);
105         }
106 
107         /**
108          * Visible for testing and vendor extensions only.
109          *
110          * @hide
111          */
112         @UnsupportedAppUsage
Key(String name, TypeReference<T> typeReference)113         public Key(String name, TypeReference<T> typeReference) {
114             mKey = new CameraMetadataNative.Key<T>(name, typeReference);
115         }
116 
117         /**
118          * Return a camelCase, period separated name formatted like:
119          * {@code "root.section[.subsections].name"}.
120          *
121          * <p>Built-in keys exposed by the Android SDK are always prefixed with {@code "android."};
122          * keys that are device/platform-specific are prefixed with {@code "com."}.</p>
123          *
124          * <p>For example, {@code CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP} would
125          * have a name of {@code "android.scaler.streamConfigurationMap"}; whereas a device
126          * specific key might look like {@code "com.google.nexus.data.private"}.</p>
127          *
128          * @return String representation of the key name
129          */
130         @NonNull
getName()131         public String getName() {
132             return mKey.getName();
133         }
134 
135         /**
136          * Return vendor tag id.
137          *
138          * @hide
139          */
getVendorId()140         public long getVendorId() {
141             return mKey.getVendorId();
142         }
143 
144         /**
145          * {@inheritDoc}
146          */
147         @Override
hashCode()148         public final int hashCode() {
149             return mKey.hashCode();
150         }
151 
152         /**
153          * {@inheritDoc}
154          */
155         @SuppressWarnings("unchecked")
156         @Override
equals(Object o)157         public final boolean equals(Object o) {
158             return o instanceof Key && ((Key<T>)o).mKey.equals(mKey);
159         }
160 
161         /**
162          * Return this {@link Key} as a string representation.
163          *
164          * <p>{@code "CaptureResult.Key(%s)"}, where {@code %s} represents
165          * the name of this key as returned by {@link #getName}.</p>
166          *
167          * @return string representation of {@link Key}
168          */
169         @NonNull
170         @Override
toString()171         public String toString() {
172             return String.format("CaptureResult.Key(%s)", mKey.getName());
173         }
174 
175         /**
176          * Visible for CameraMetadataNative implementation only; do not use.
177          *
178          * TODO: Make this private or remove it altogether.
179          *
180          * @hide
181          */
182         @UnsupportedAppUsage
getNativeKey()183         public CameraMetadataNative.Key<T> getNativeKey() {
184             return mKey;
185         }
186 
187         @SuppressWarnings({ "unchecked" })
Key(CameraMetadataNative.Key<?> nativeKey)188         /*package*/ Key(CameraMetadataNative.Key<?> nativeKey) {
189             mKey = (CameraMetadataNative.Key<T>) nativeKey;
190         }
191     }
192 
193     @UnsupportedAppUsage
194     private final CameraMetadataNative mResults;
195     private final CaptureRequest mRequest;
196     private final int mSequenceId;
197     private final long mFrameNumber;
198 
199     /**
200      * Takes ownership of the passed-in properties object
201      *
202      * <p>For internal use only</p>
203      * @hide
204      */
CaptureResult(CameraMetadataNative results, CaptureRequest parent, CaptureResultExtras extras)205     public CaptureResult(CameraMetadataNative results, CaptureRequest parent,
206             CaptureResultExtras extras) {
207         if (results == null) {
208             throw new IllegalArgumentException("results was null");
209         }
210 
211         if (parent == null) {
212             throw new IllegalArgumentException("parent was null");
213         }
214 
215         if (extras == null) {
216             throw new IllegalArgumentException("extras was null");
217         }
218 
219         mResults = CameraMetadataNative.move(results);
220         if (mResults.isEmpty()) {
221             throw new AssertionError("Results must not be empty");
222         }
223         setNativeInstance(mResults);
224         mRequest = parent;
225         mSequenceId = extras.getRequestId();
226         mFrameNumber = extras.getFrameNumber();
227     }
228 
229     /**
230      * Returns a copy of the underlying {@link CameraMetadataNative}.
231      * @hide
232      */
getNativeCopy()233     public CameraMetadataNative getNativeCopy() {
234         return new CameraMetadataNative(mResults);
235     }
236 
237     /**
238      * Creates a request-less result.
239      *
240      * <p><strong>For testing only.</strong></p>
241      * @hide
242      */
CaptureResult(CameraMetadataNative results, int sequenceId)243     public CaptureResult(CameraMetadataNative results, int sequenceId) {
244         if (results == null) {
245             throw new IllegalArgumentException("results was null");
246         }
247 
248         mResults = CameraMetadataNative.move(results);
249         if (mResults.isEmpty()) {
250             throw new AssertionError("Results must not be empty");
251         }
252 
253         setNativeInstance(mResults);
254         mRequest = null;
255         mSequenceId = sequenceId;
256         mFrameNumber = -1;
257     }
258 
259     /**
260      * Get a capture result field value.
261      *
262      * <p>The field definitions can be found in {@link CaptureResult}.</p>
263      *
264      * <p>Querying the value for the same key more than once will return a value
265      * which is equal to the previous queried value.</p>
266      *
267      * @throws IllegalArgumentException if the key was not valid
268      *
269      * @param key The result field to read.
270      * @return The value of that key, or {@code null} if the field is not set.
271      */
272     @Nullable
get(Key<T> key)273     public <T> T get(Key<T> key) {
274         T value = mResults.get(key);
275         if (VERBOSE) Log.v(TAG, "#get for Key = " + key.getName() + ", returned value = " + value);
276         return value;
277     }
278 
279     /**
280      * {@inheritDoc}
281      * @hide
282      */
283     @SuppressWarnings("unchecked")
284     @Override
getProtected(Key<?> key)285     protected <T> T getProtected(Key<?> key) {
286         return (T) mResults.get(key);
287     }
288 
289     /**
290      * {@inheritDoc}
291      * @hide
292      */
293     @SuppressWarnings("unchecked")
294     @Override
getKeyClass()295     protected Class<Key<?>> getKeyClass() {
296         Object thisClass = Key.class;
297         return (Class<Key<?>>)thisClass;
298     }
299 
300     /**
301      * Dumps the native metadata contents to logcat.
302      *
303      * <p>Visibility for testing/debugging only. The results will not
304      * include any synthesized keys, as they are invisible to the native layer.</p>
305      *
306      * @hide
307      */
dumpToLog()308     public void dumpToLog() {
309         mResults.dumpToLog();
310     }
311 
312     /**
313      * {@inheritDoc}
314      */
315     @Override
316     @NonNull
getKeys()317     public List<Key<?>> getKeys() {
318         // Force the javadoc for this function to show up on the CaptureResult page
319         return super.getKeys();
320     }
321 
322     /**
323      * Get the request associated with this result.
324      *
325      * <p>Whenever a request has been fully or partially captured, with
326      * {@link CameraCaptureSession.CaptureCallback#onCaptureCompleted} or
327      * {@link CameraCaptureSession.CaptureCallback#onCaptureProgressed}, the {@code result}'s
328      * {@code getRequest()} will return that {@code request}.
329      * </p>
330      *
331      * <p>For example,
332      * <code><pre>cameraDevice.capture(someRequest, new CaptureCallback() {
333      *     {@literal @}Override
334      *     void onCaptureCompleted(CaptureRequest myRequest, CaptureResult myResult) {
335      *         assert(myResult.getRequest.equals(myRequest) == true);
336      *     }
337      * }, null);
338      * </code></pre>
339      * </p>
340      *
341      * @return The request associated with this result. Never {@code null}.
342      */
343     @NonNull
getRequest()344     public CaptureRequest getRequest() {
345         return mRequest;
346     }
347 
348     /**
349      * Get the frame number associated with this result.
350      *
351      * <p>Whenever a request has been processed, regardless of failure or success,
352      * it gets a unique frame number assigned to its future result/failure.</p>
353      *
354      * <p>For the same type of request (capturing from the camera device or reprocessing), this
355      * value monotonically increments, starting with 0, for every new result or failure and the
356      * scope is the lifetime of the {@link CameraDevice}. Between different types of requests,
357      * the frame number may not monotonically increment. For example, the frame number of a newer
358      * reprocess result may be smaller than the frame number of an older result of capturing new
359      * images from the camera device, but the frame number of a newer reprocess result will never be
360      * smaller than the frame number of an older reprocess result.</p>
361      *
362      * @return The frame number
363      *
364      * @see CameraDevice#createCaptureRequest
365      * @see CameraDevice#createReprocessCaptureRequest
366      */
getFrameNumber()367     public long getFrameNumber() {
368         return mFrameNumber;
369     }
370 
371     /**
372      * The sequence ID for this failure that was returned by the
373      * {@link CameraCaptureSession#capture} family of functions.
374      *
375      * <p>The sequence ID is a unique monotonically increasing value starting from 0,
376      * incremented every time a new group of requests is submitted to the CameraDevice.</p>
377      *
378      * @return int The ID for the sequence of requests that this capture result is a part of
379      *
380      * @see CameraCaptureSession.CaptureCallback#onCaptureSequenceCompleted
381      * @see CameraCaptureSession.CaptureCallback#onCaptureSequenceAborted
382      */
getSequenceId()383     public int getSequenceId() {
384         return mSequenceId;
385     }
386 
387     /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
388      * The key entries below this point are generated from metadata
389      * definitions in /system/media/camera/docs. Do not modify by hand or
390      * modify the comment blocks at the start or end.
391      *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/
392 
393     /**
394      * <p>The mode control selects how the image data is converted from the
395      * sensor's native color into linear sRGB color.</p>
396      * <p>When auto-white balance (AWB) is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this
397      * control is overridden by the AWB routine. When AWB is disabled, the
398      * application controls how the color mapping is performed.</p>
399      * <p>We define the expected processing pipeline below. For consistency
400      * across devices, this is always the case with TRANSFORM_MATRIX.</p>
401      * <p>When either FAST or HIGH_QUALITY is used, the camera device may
402      * do additional processing but {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
403      * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} will still be provided by the
404      * camera device (in the results) and be roughly correct.</p>
405      * <p>Switching to TRANSFORM_MATRIX and using the data provided from
406      * FAST or HIGH_QUALITY will yield a picture with the same white point
407      * as what was produced by the camera device in the earlier frame.</p>
408      * <p>The expected processing pipeline is as follows:</p>
409      * <p><img alt="White balance processing pipeline" src="/reference/images/camera2/metadata/android.colorCorrection.mode/processing_pipeline.png" /></p>
410      * <p>The white balance is encoded by two values, a 4-channel white-balance
411      * gain vector (applied in the Bayer domain), and a 3x3 color transform
412      * matrix (applied after demosaic).</p>
413      * <p>The 4-channel white-balance gains are defined as:</p>
414      * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} = [ R G_even G_odd B ]
415      * </code></pre>
416      * <p>where <code>G_even</code> is the gain for green pixels on even rows of the
417      * output, and <code>G_odd</code> is the gain for green pixels on the odd rows.
418      * These may be identical for a given camera device implementation; if
419      * the camera device does not support a separate gain for even/odd green
420      * channels, it will use the <code>G_even</code> value, and write <code>G_odd</code> equal to
421      * <code>G_even</code> in the output result metadata.</p>
422      * <p>The matrices for color transforms are defined as a 9-entry vector:</p>
423      * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} = [ I0 I1 I2 I3 I4 I5 I6 I7 I8 ]
424      * </code></pre>
425      * <p>which define a transform from input sensor colors, <code>P_in = [ r g b ]</code>,
426      * to output linear sRGB, <code>P_out = [ r' g' b' ]</code>,</p>
427      * <p>with colors as follows:</p>
428      * <pre><code>r' = I0r + I1g + I2b
429      * g' = I3r + I4g + I5b
430      * b' = I6r + I7g + I8b
431      * </code></pre>
432      * <p>Both the input and output value ranges must match. Overflow/underflow
433      * values are clipped to fit within the range.</p>
434      * <p><b>Possible values:</b>
435      * <ul>
436      *   <li>{@link #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX TRANSFORM_MATRIX}</li>
437      *   <li>{@link #COLOR_CORRECTION_MODE_FAST FAST}</li>
438      *   <li>{@link #COLOR_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
439      * </ul></p>
440      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
441      * <p><b>Full capability</b> -
442      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
443      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
444      *
445      * @see CaptureRequest#COLOR_CORRECTION_GAINS
446      * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
447      * @see CaptureRequest#CONTROL_AWB_MODE
448      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
449      * @see #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX
450      * @see #COLOR_CORRECTION_MODE_FAST
451      * @see #COLOR_CORRECTION_MODE_HIGH_QUALITY
452      */
453     @PublicKey
454     @NonNull
455     public static final Key<Integer> COLOR_CORRECTION_MODE =
456             new Key<Integer>("android.colorCorrection.mode", int.class);
457 
458     /**
459      * <p>A color transform matrix to use to transform
460      * from sensor RGB color space to output linear sRGB color space.</p>
461      * <p>This matrix is either set by the camera device when the request
462      * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not TRANSFORM_MATRIX, or
463      * directly by the application in the request when the
464      * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is TRANSFORM_MATRIX.</p>
465      * <p>In the latter case, the camera device may round the matrix to account
466      * for precision issues; the final rounded matrix should be reported back
467      * in this matrix result metadata. The transform should keep the magnitude
468      * of the output color values within <code>[0, 1.0]</code> (assuming input color
469      * values is within the normalized range <code>[0, 1.0]</code>), or clipping may occur.</p>
470      * <p>The valid range of each matrix element varies on different devices, but
471      * values within [-1.5, 3.0] are guaranteed not to be clipped.</p>
472      * <p><b>Units</b>: Unitless scale factors</p>
473      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
474      * <p><b>Full capability</b> -
475      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
476      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
477      *
478      * @see CaptureRequest#COLOR_CORRECTION_MODE
479      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
480      */
481     @PublicKey
482     @NonNull
483     public static final Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM =
484             new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.colorCorrection.transform", android.hardware.camera2.params.ColorSpaceTransform.class);
485 
486     /**
487      * <p>Gains applying to Bayer raw color channels for
488      * white-balance.</p>
489      * <p>These per-channel gains are either set by the camera device
490      * when the request {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not
491      * TRANSFORM_MATRIX, or directly by the application in the
492      * request when the {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is
493      * TRANSFORM_MATRIX.</p>
494      * <p>The gains in the result metadata are the gains actually
495      * applied by the camera device to the current frame.</p>
496      * <p>The valid range of gains varies on different devices, but gains
497      * between [1.0, 3.0] are guaranteed not to be clipped. Even if a given
498      * device allows gains below 1.0, this is usually not recommended because
499      * this can create color artifacts.</p>
500      * <p><b>Units</b>: Unitless gain factors</p>
501      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
502      * <p><b>Full capability</b> -
503      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
504      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
505      *
506      * @see CaptureRequest#COLOR_CORRECTION_MODE
507      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
508      */
509     @PublicKey
510     @NonNull
511     public static final Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS =
512             new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class);
513 
514     /**
515      * <p>Mode of operation for the chromatic aberration correction algorithm.</p>
516      * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light
517      * can not focus on the same point after exiting from the lens. This metadata defines
518      * the high level control of chromatic aberration correction algorithm, which aims to
519      * minimize the chromatic artifacts that may occur along the object boundaries in an
520      * image.</p>
521      * <p>FAST/HIGH_QUALITY both mean that camera device determined aberration
522      * correction will be applied. HIGH_QUALITY mode indicates that the camera device will
523      * use the highest-quality aberration correction algorithms, even if it slows down
524      * capture rate. FAST means the camera device will not slow down capture rate when
525      * applying aberration correction.</p>
526      * <p>LEGACY devices will always be in FAST mode.</p>
527      * <p><b>Possible values:</b>
528      * <ul>
529      *   <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_OFF OFF}</li>
530      *   <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_FAST FAST}</li>
531      *   <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
532      * </ul></p>
533      * <p><b>Available values for this device:</b><br>
534      * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES android.colorCorrection.availableAberrationModes}</p>
535      * <p>This key is available on all devices.</p>
536      *
537      * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES
538      * @see #COLOR_CORRECTION_ABERRATION_MODE_OFF
539      * @see #COLOR_CORRECTION_ABERRATION_MODE_FAST
540      * @see #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY
541      */
542     @PublicKey
543     @NonNull
544     public static final Key<Integer> COLOR_CORRECTION_ABERRATION_MODE =
545             new Key<Integer>("android.colorCorrection.aberrationMode", int.class);
546 
547     /**
548      * <p>The desired setting for the camera device's auto-exposure
549      * algorithm's antibanding compensation.</p>
550      * <p>Some kinds of lighting fixtures, such as some fluorescent
551      * lights, flicker at the rate of the power supply frequency
552      * (60Hz or 50Hz, depending on country). While this is
553      * typically not noticeable to a person, it can be visible to
554      * a camera device. If a camera sets its exposure time to the
555      * wrong value, the flicker may become visible in the
556      * viewfinder as flicker or in a final captured image, as a
557      * set of variable-brightness bands across the image.</p>
558      * <p>Therefore, the auto-exposure routines of camera devices
559      * include antibanding routines that ensure that the chosen
560      * exposure value will not cause such banding. The choice of
561      * exposure time depends on the rate of flicker, which the
562      * camera device can detect automatically, or the expected
563      * rate can be selected by the application using this
564      * control.</p>
565      * <p>A given camera device may not support all of the possible
566      * options for the antibanding mode. The
567      * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes} key contains
568      * the available modes for a given camera device.</p>
569      * <p>AUTO mode is the default if it is available on given
570      * camera device. When AUTO mode is not available, the
571      * default will be either 50HZ or 60HZ, and both 50HZ
572      * and 60HZ will be available.</p>
573      * <p>If manual exposure control is enabled (by setting
574      * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} to OFF),
575      * then this setting has no effect, and the application must
576      * ensure it selects exposure times that do not cause banding
577      * issues. The {@link CaptureResult#STATISTICS_SCENE_FLICKER android.statistics.sceneFlicker} key can assist
578      * the application in this.</p>
579      * <p><b>Possible values:</b>
580      * <ul>
581      *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_OFF OFF}</li>
582      *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_50HZ 50HZ}</li>
583      *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_60HZ 60HZ}</li>
584      *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_AUTO AUTO}</li>
585      * </ul></p>
586      * <p><b>Available values for this device:</b><br></p>
587      * <p>{@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes}</p>
588      * <p>This key is available on all devices.</p>
589      *
590      * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES
591      * @see CaptureRequest#CONTROL_AE_MODE
592      * @see CaptureRequest#CONTROL_MODE
593      * @see CaptureResult#STATISTICS_SCENE_FLICKER
594      * @see #CONTROL_AE_ANTIBANDING_MODE_OFF
595      * @see #CONTROL_AE_ANTIBANDING_MODE_50HZ
596      * @see #CONTROL_AE_ANTIBANDING_MODE_60HZ
597      * @see #CONTROL_AE_ANTIBANDING_MODE_AUTO
598      */
599     @PublicKey
600     @NonNull
601     public static final Key<Integer> CONTROL_AE_ANTIBANDING_MODE =
602             new Key<Integer>("android.control.aeAntibandingMode", int.class);
603 
604     /**
605      * <p>Adjustment to auto-exposure (AE) target image
606      * brightness.</p>
607      * <p>The adjustment is measured as a count of steps, with the
608      * step size defined by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP android.control.aeCompensationStep} and the
609      * allowed range by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}.</p>
610      * <p>For example, if the exposure value (EV) step is 0.333, '6'
611      * will mean an exposure compensation of +2 EV; -3 will mean an
612      * exposure compensation of -1 EV. One EV represents a doubling
613      * of image brightness. Note that this control will only be
614      * effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF. This control
615      * will take effect even when {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} <code>== true</code>.</p>
616      * <p>In the event of exposure compensation value being changed, camera device
617      * may take several frames to reach the newly requested exposure target.
618      * During that time, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} field will be in the SEARCHING
619      * state. Once the new exposure target is reached, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} will
620      * change from SEARCHING to either CONVERGED, LOCKED (if AE lock is enabled), or
621      * FLASH_REQUIRED (if the scene is too dark for still capture).</p>
622      * <p><b>Units</b>: Compensation steps</p>
623      * <p><b>Range of valid values:</b><br>
624      * {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}</p>
625      * <p>This key is available on all devices.</p>
626      *
627      * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE
628      * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP
629      * @see CaptureRequest#CONTROL_AE_LOCK
630      * @see CaptureRequest#CONTROL_AE_MODE
631      * @see CaptureResult#CONTROL_AE_STATE
632      */
633     @PublicKey
634     @NonNull
635     public static final Key<Integer> CONTROL_AE_EXPOSURE_COMPENSATION =
636             new Key<Integer>("android.control.aeExposureCompensation", int.class);
637 
638     /**
639      * <p>Whether auto-exposure (AE) is currently locked to its latest
640      * calculated values.</p>
641      * <p>When set to <code>true</code> (ON), the AE algorithm is locked to its latest parameters,
642      * and will not change exposure settings until the lock is set to <code>false</code> (OFF).</p>
643      * <p>Note that even when AE is locked, the flash may be fired if
644      * the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_AUTO_FLASH /
645      * ON_ALWAYS_FLASH / ON_AUTO_FLASH_REDEYE.</p>
646      * <p>When {@link CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION android.control.aeExposureCompensation} is changed, even if the AE lock
647      * is ON, the camera device will still adjust its exposure value.</p>
648      * <p>If AE precapture is triggered (see {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger})
649      * when AE is already locked, the camera device will not change the exposure time
650      * ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}) and sensitivity ({@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity})
651      * parameters. The flash may be fired if the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}
652      * is ON_AUTO_FLASH/ON_AUTO_FLASH_REDEYE and the scene is too dark. If the
653      * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_ALWAYS_FLASH, the scene may become overexposed.
654      * Similarly, AE precapture trigger CANCEL has no effect when AE is already locked.</p>
655      * <p>When an AE precapture sequence is triggered, AE unlock will not be able to unlock
656      * the AE if AE is locked by the camera device internally during precapture metering
657      * sequence In other words, submitting requests with AE unlock has no effect for an
658      * ongoing precapture metering sequence. Otherwise, the precapture metering sequence
659      * will never succeed in a sequence of preview requests where AE lock is always set
660      * to <code>false</code>.</p>
661      * <p>Since the camera device has a pipeline of in-flight requests, the settings that
662      * get locked do not necessarily correspond to the settings that were present in the
663      * latest capture result received from the camera device, since additional captures
664      * and AE updates may have occurred even before the result was sent out. If an
665      * application is switching between automatic and manual control and wishes to eliminate
666      * any flicker during the switch, the following procedure is recommended:</p>
667      * <ol>
668      * <li>Starting in auto-AE mode:</li>
669      * <li>Lock AE</li>
670      * <li>Wait for the first result to be output that has the AE locked</li>
671      * <li>Copy exposure settings from that result into a request, set the request to manual AE</li>
672      * <li>Submit the capture request, proceed to run manual AE as desired.</li>
673      * </ol>
674      * <p>See {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE lock related state transition details.</p>
675      * <p>This key is available on all devices.</p>
676      *
677      * @see CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION
678      * @see CaptureRequest#CONTROL_AE_MODE
679      * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
680      * @see CaptureResult#CONTROL_AE_STATE
681      * @see CaptureRequest#SENSOR_EXPOSURE_TIME
682      * @see CaptureRequest#SENSOR_SENSITIVITY
683      */
684     @PublicKey
685     @NonNull
686     public static final Key<Boolean> CONTROL_AE_LOCK =
687             new Key<Boolean>("android.control.aeLock", boolean.class);
688 
689     /**
690      * <p>The desired mode for the camera device's
691      * auto-exposure routine.</p>
692      * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is
693      * AUTO.</p>
694      * <p>When set to any of the ON modes, the camera device's
695      * auto-exposure routine is enabled, overriding the
696      * application's selected exposure time, sensor sensitivity,
697      * and frame duration ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
698      * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and
699      * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}). If one of the FLASH modes
700      * is selected, the camera device's flash unit controls are
701      * also overridden.</p>
702      * <p>The FLASH modes are only available if the camera device
703      * has a flash unit ({@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} is <code>true</code>).</p>
704      * <p>If flash TORCH mode is desired, this field must be set to
705      * ON or OFF, and {@link CaptureRequest#FLASH_MODE android.flash.mode} set to TORCH.</p>
706      * <p>When set to any of the ON modes, the values chosen by the
707      * camera device auto-exposure routine for the overridden
708      * fields for a given capture will be available in its
709      * CaptureResult.</p>
710      * <p><b>Possible values:</b>
711      * <ul>
712      *   <li>{@link #CONTROL_AE_MODE_OFF OFF}</li>
713      *   <li>{@link #CONTROL_AE_MODE_ON ON}</li>
714      *   <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH ON_AUTO_FLASH}</li>
715      *   <li>{@link #CONTROL_AE_MODE_ON_ALWAYS_FLASH ON_ALWAYS_FLASH}</li>
716      *   <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE ON_AUTO_FLASH_REDEYE}</li>
717      *   <li>{@link #CONTROL_AE_MODE_ON_EXTERNAL_FLASH ON_EXTERNAL_FLASH}</li>
718      * </ul></p>
719      * <p><b>Available values for this device:</b><br>
720      * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES android.control.aeAvailableModes}</p>
721      * <p>This key is available on all devices.</p>
722      *
723      * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES
724      * @see CaptureRequest#CONTROL_MODE
725      * @see CameraCharacteristics#FLASH_INFO_AVAILABLE
726      * @see CaptureRequest#FLASH_MODE
727      * @see CaptureRequest#SENSOR_EXPOSURE_TIME
728      * @see CaptureRequest#SENSOR_FRAME_DURATION
729      * @see CaptureRequest#SENSOR_SENSITIVITY
730      * @see #CONTROL_AE_MODE_OFF
731      * @see #CONTROL_AE_MODE_ON
732      * @see #CONTROL_AE_MODE_ON_AUTO_FLASH
733      * @see #CONTROL_AE_MODE_ON_ALWAYS_FLASH
734      * @see #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE
735      * @see #CONTROL_AE_MODE_ON_EXTERNAL_FLASH
736      */
737     @PublicKey
738     @NonNull
739     public static final Key<Integer> CONTROL_AE_MODE =
740             new Key<Integer>("android.control.aeMode", int.class);
741 
742     /**
743      * <p>List of metering areas to use for auto-exposure adjustment.</p>
744      * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe} is 0.
745      * Otherwise will always be present.</p>
746      * <p>The maximum number of regions supported by the device is determined by the value
747      * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe}.</p>
748      * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
749      * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being
750      * the top-left pixel in the active pixel array, and
751      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
752      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
753      * active pixel array.</p>
754      * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
755      * system depends on the mode being set.
756      * When the distortion correction mode is OFF, the coordinate system follows
757      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
758      * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and
759      * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1,
760      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right
761      * pixel in the pre-correction active pixel array.
762      * When the distortion correction mode is not OFF, the coordinate system follows
763      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
764      * <code>(0, 0)</code> being the top-left pixel of the active array, and
765      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
766      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
767      * active pixel array.</p>
768      * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight
769      * for every pixel in the area. This means that a large metering area
770      * with the same weight as a smaller area will have more effect in
771      * the metering result. Metering areas can partially overlap and the
772      * camera device will add the weights in the overlap region.</p>
773      * <p>The weights are relative to weights of other exposure metering regions, so if only one
774      * region is used, all non-zero weights will have the same effect. A region with 0
775      * weight is ignored.</p>
776      * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
777      * camera device.</p>
778      * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
779      * capture result metadata, the camera device will ignore the sections outside the crop
780      * region and output only the intersection rectangle as the metering region in the result
781      * metadata.  If the region is entirely outside the crop region, it will be ignored and
782      * not reported in the result metadata.</p>
783      * <p>Starting from API level 30, the coordinate system of activeArraySize or
784      * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
785      * pre-zoom field of view. This means that the same aeRegions values at different
786      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The aeRegions
787      * coordinates are relative to the activeArray/preCorrectionActiveArray representing the
788      * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same
789      * aeRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of the
790      * scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use
791      * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
792      * mode.</p>
793      * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
794      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on
795      * distortion correction capability and mode</p>
796      * <p><b>Range of valid values:</b><br>
797      * Coordinates must be between <code>[(0,0), (width, height))</code> of
798      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
799      * depending on distortion correction capability and mode</p>
800      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
801      *
802      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE
803      * @see CaptureRequest#CONTROL_ZOOM_RATIO
804      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
805      * @see CaptureRequest#SCALER_CROP_REGION
806      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
807      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
808      */
809     @PublicKey
810     @NonNull
811     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS =
812             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.aeRegions", android.hardware.camera2.params.MeteringRectangle[].class);
813 
814     /**
815      * <p>Range over which the auto-exposure routine can
816      * adjust the capture frame rate to maintain good
817      * exposure.</p>
818      * <p>Only constrains auto-exposure (AE) algorithm, not
819      * manual control of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime} and
820      * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}.</p>
821      * <p><b>Units</b>: Frames per second (FPS)</p>
822      * <p><b>Range of valid values:</b><br>
823      * Any of the entries in {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES android.control.aeAvailableTargetFpsRanges}</p>
824      * <p>This key is available on all devices.</p>
825      *
826      * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES
827      * @see CaptureRequest#SENSOR_EXPOSURE_TIME
828      * @see CaptureRequest#SENSOR_FRAME_DURATION
829      */
830     @PublicKey
831     @NonNull
832     public static final Key<android.util.Range<Integer>> CONTROL_AE_TARGET_FPS_RANGE =
833             new Key<android.util.Range<Integer>>("android.control.aeTargetFpsRange", new TypeReference<android.util.Range<Integer>>() {{ }});
834 
835     /**
836      * <p>Whether the camera device will trigger a precapture
837      * metering sequence when it processes this request.</p>
838      * <p>This entry is normally set to IDLE, or is not
839      * included at all in the request settings. When included and
840      * set to START, the camera device will trigger the auto-exposure (AE)
841      * precapture metering sequence.</p>
842      * <p>When set to CANCEL, the camera device will cancel any active
843      * precapture metering trigger, and return to its initial AE state.
844      * If a precapture metering sequence is already completed, and the camera
845      * device has implicitly locked the AE for subsequent still capture, the
846      * CANCEL trigger will unlock the AE and return to its initial AE state.</p>
847      * <p>The precapture sequence should be triggered before starting a
848      * high-quality still capture for final metering decisions to
849      * be made, and for firing pre-capture flash pulses to estimate
850      * scene brightness and required final capture flash power, when
851      * the flash is enabled.</p>
852      * <p>Normally, this entry should be set to START for only a
853      * single request, and the application should wait until the
854      * sequence completes before starting a new one.</p>
855      * <p>When a precapture metering sequence is finished, the camera device
856      * may lock the auto-exposure routine internally to be able to accurately expose the
857      * subsequent still capture image (<code>{@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE</code>).
858      * For this case, the AE may not resume normal scan if no subsequent still capture is
859      * submitted. To ensure that the AE routine restarts normal scan, the application should
860      * submit a request with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == true</code>, followed by a request
861      * with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == false</code>, if the application decides not to submit a
862      * still capture request after the precapture sequence completes. Alternatively, for
863      * API level 23 or newer devices, the CANCEL can be used to unlock the camera device
864      * internally locked AE if the application doesn't submit a still capture request after
865      * the AE precapture trigger. Note that, the CANCEL was added in API level 23, and must not
866      * be used in devices that have earlier API levels.</p>
867      * <p>The exact effect of auto-exposure (AE) precapture trigger
868      * depends on the current AE mode and state; see
869      * {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture state transition
870      * details.</p>
871      * <p>On LEGACY-level devices, the precapture trigger is not supported;
872      * capturing a high-resolution JPEG image will automatically trigger a
873      * precapture sequence before the high-resolution capture, including
874      * potentially firing a pre-capture flash.</p>
875      * <p>Using the precapture trigger and the auto-focus trigger {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger}
876      * simultaneously is allowed. However, since these triggers often require cooperation between
877      * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a
878      * focus sweep), the camera device may delay acting on a later trigger until the previous
879      * trigger has been fully handled. This may lead to longer intervals between the trigger and
880      * changes to {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} indicating the start of the precapture sequence, for
881      * example.</p>
882      * <p>If both the precapture and the auto-focus trigger are activated on the same request, then
883      * the camera device will complete them in the optimal order for that device.</p>
884      * <p><b>Possible values:</b>
885      * <ul>
886      *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE IDLE}</li>
887      *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_START START}</li>
888      *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL CANCEL}</li>
889      * </ul></p>
890      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
891      * <p><b>Limited capability</b> -
892      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
893      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
894      *
895      * @see CaptureRequest#CONTROL_AE_LOCK
896      * @see CaptureResult#CONTROL_AE_STATE
897      * @see CaptureRequest#CONTROL_AF_TRIGGER
898      * @see CaptureRequest#CONTROL_CAPTURE_INTENT
899      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
900      * @see #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE
901      * @see #CONTROL_AE_PRECAPTURE_TRIGGER_START
902      * @see #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL
903      */
904     @PublicKey
905     @NonNull
906     public static final Key<Integer> CONTROL_AE_PRECAPTURE_TRIGGER =
907             new Key<Integer>("android.control.aePrecaptureTrigger", int.class);
908 
909     /**
910      * <p>Current state of the auto-exposure (AE) algorithm.</p>
911      * <p>Switching between or enabling AE modes ({@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}) always
912      * resets the AE state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode},
913      * or {@link CaptureRequest#CONTROL_SCENE_MODE android.control.sceneMode} if <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code> resets all
914      * the algorithm states to INACTIVE.</p>
915      * <p>The camera device can do several state transitions between two results, if it is
916      * allowed by the state transition table. For example: INACTIVE may never actually be
917      * seen in a result.</p>
918      * <p>The state in the result is the state for this image (in sync with this image): if
919      * AE state becomes CONVERGED, then the image data associated with this result should
920      * be good to use.</p>
921      * <p>Below are state transition tables for different AE modes.</p>
922      * <table>
923      * <thead>
924      * <tr>
925      * <th align="center">State</th>
926      * <th align="center">Transition Cause</th>
927      * <th align="center">New State</th>
928      * <th align="center">Notes</th>
929      * </tr>
930      * </thead>
931      * <tbody>
932      * <tr>
933      * <td align="center">INACTIVE</td>
934      * <td align="center"></td>
935      * <td align="center">INACTIVE</td>
936      * <td align="center">Camera device auto exposure algorithm is disabled</td>
937      * </tr>
938      * </tbody>
939      * </table>
940      * <p>When {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is AE_MODE_ON*:</p>
941      * <table>
942      * <thead>
943      * <tr>
944      * <th align="center">State</th>
945      * <th align="center">Transition Cause</th>
946      * <th align="center">New State</th>
947      * <th align="center">Notes</th>
948      * </tr>
949      * </thead>
950      * <tbody>
951      * <tr>
952      * <td align="center">INACTIVE</td>
953      * <td align="center">Camera device initiates AE scan</td>
954      * <td align="center">SEARCHING</td>
955      * <td align="center">Values changing</td>
956      * </tr>
957      * <tr>
958      * <td align="center">INACTIVE</td>
959      * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is ON</td>
960      * <td align="center">LOCKED</td>
961      * <td align="center">Values locked</td>
962      * </tr>
963      * <tr>
964      * <td align="center">SEARCHING</td>
965      * <td align="center">Camera device finishes AE scan</td>
966      * <td align="center">CONVERGED</td>
967      * <td align="center">Good values, not changing</td>
968      * </tr>
969      * <tr>
970      * <td align="center">SEARCHING</td>
971      * <td align="center">Camera device finishes AE scan</td>
972      * <td align="center">FLASH_REQUIRED</td>
973      * <td align="center">Converged but too dark w/o flash</td>
974      * </tr>
975      * <tr>
976      * <td align="center">SEARCHING</td>
977      * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is ON</td>
978      * <td align="center">LOCKED</td>
979      * <td align="center">Values locked</td>
980      * </tr>
981      * <tr>
982      * <td align="center">CONVERGED</td>
983      * <td align="center">Camera device initiates AE scan</td>
984      * <td align="center">SEARCHING</td>
985      * <td align="center">Values changing</td>
986      * </tr>
987      * <tr>
988      * <td align="center">CONVERGED</td>
989      * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is ON</td>
990      * <td align="center">LOCKED</td>
991      * <td align="center">Values locked</td>
992      * </tr>
993      * <tr>
994      * <td align="center">FLASH_REQUIRED</td>
995      * <td align="center">Camera device initiates AE scan</td>
996      * <td align="center">SEARCHING</td>
997      * <td align="center">Values changing</td>
998      * </tr>
999      * <tr>
1000      * <td align="center">FLASH_REQUIRED</td>
1001      * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is ON</td>
1002      * <td align="center">LOCKED</td>
1003      * <td align="center">Values locked</td>
1004      * </tr>
1005      * <tr>
1006      * <td align="center">LOCKED</td>
1007      * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is OFF</td>
1008      * <td align="center">SEARCHING</td>
1009      * <td align="center">Values not good after unlock</td>
1010      * </tr>
1011      * <tr>
1012      * <td align="center">LOCKED</td>
1013      * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is OFF</td>
1014      * <td align="center">CONVERGED</td>
1015      * <td align="center">Values good after unlock</td>
1016      * </tr>
1017      * <tr>
1018      * <td align="center">LOCKED</td>
1019      * <td align="center">{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is OFF</td>
1020      * <td align="center">FLASH_REQUIRED</td>
1021      * <td align="center">Exposure good, but too dark</td>
1022      * </tr>
1023      * <tr>
1024      * <td align="center">PRECAPTURE</td>
1025      * <td align="center">Sequence done. {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is OFF</td>
1026      * <td align="center">CONVERGED</td>
1027      * <td align="center">Ready for high-quality capture</td>
1028      * </tr>
1029      * <tr>
1030      * <td align="center">PRECAPTURE</td>
1031      * <td align="center">Sequence done. {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} is ON</td>
1032      * <td align="center">LOCKED</td>
1033      * <td align="center">Ready for high-quality capture</td>
1034      * </tr>
1035      * <tr>
1036      * <td align="center">LOCKED</td>
1037      * <td align="center">aeLock is ON and aePrecaptureTrigger is START</td>
1038      * <td align="center">LOCKED</td>
1039      * <td align="center">Precapture trigger is ignored when AE is already locked</td>
1040      * </tr>
1041      * <tr>
1042      * <td align="center">LOCKED</td>
1043      * <td align="center">aeLock is ON and aePrecaptureTrigger is CANCEL</td>
1044      * <td align="center">LOCKED</td>
1045      * <td align="center">Precapture trigger is ignored when AE is already locked</td>
1046      * </tr>
1047      * <tr>
1048      * <td align="center">Any state (excluding LOCKED)</td>
1049      * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is START</td>
1050      * <td align="center">PRECAPTURE</td>
1051      * <td align="center">Start AE precapture metering sequence</td>
1052      * </tr>
1053      * <tr>
1054      * <td align="center">Any state (excluding LOCKED)</td>
1055      * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is CANCEL</td>
1056      * <td align="center">INACTIVE</td>
1057      * <td align="center">Currently active precapture metering sequence is canceled</td>
1058      * </tr>
1059      * </tbody>
1060      * </table>
1061      * <p>If the camera device supports AE external flash mode (ON_EXTERNAL_FLASH is included in
1062      * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES android.control.aeAvailableModes}), {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} must be FLASH_REQUIRED after
1063      * the camera device finishes AE scan and it's too dark without flash.</p>
1064      * <p>For the above table, the camera device may skip reporting any state changes that happen
1065      * without application intervention (i.e. mode switch, trigger, locking). Any state that
1066      * can be skipped in that manner is called a transient state.</p>
1067      * <p>For example, for above AE modes (AE_MODE_ON*), in addition to the state transitions
1068      * listed in above table, it is also legal for the camera device to skip one or more
1069      * transient states between two results. See below table for examples:</p>
1070      * <table>
1071      * <thead>
1072      * <tr>
1073      * <th align="center">State</th>
1074      * <th align="center">Transition Cause</th>
1075      * <th align="center">New State</th>
1076      * <th align="center">Notes</th>
1077      * </tr>
1078      * </thead>
1079      * <tbody>
1080      * <tr>
1081      * <td align="center">INACTIVE</td>
1082      * <td align="center">Camera device finished AE scan</td>
1083      * <td align="center">CONVERGED</td>
1084      * <td align="center">Values are already good, transient states are skipped by camera device.</td>
1085      * </tr>
1086      * <tr>
1087      * <td align="center">Any state (excluding LOCKED)</td>
1088      * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is START, sequence done</td>
1089      * <td align="center">FLASH_REQUIRED</td>
1090      * <td align="center">Converged but too dark w/o flash after a precapture sequence, transient states are skipped by camera device.</td>
1091      * </tr>
1092      * <tr>
1093      * <td align="center">Any state (excluding LOCKED)</td>
1094      * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is START, sequence done</td>
1095      * <td align="center">CONVERGED</td>
1096      * <td align="center">Converged after a precapture sequence, transient states are skipped by camera device.</td>
1097      * </tr>
1098      * <tr>
1099      * <td align="center">Any state (excluding LOCKED)</td>
1100      * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is CANCEL, converged</td>
1101      * <td align="center">FLASH_REQUIRED</td>
1102      * <td align="center">Converged but too dark w/o flash after a precapture sequence is canceled, transient states are skipped by camera device.</td>
1103      * </tr>
1104      * <tr>
1105      * <td align="center">Any state (excluding LOCKED)</td>
1106      * <td align="center">{@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} is CANCEL, converged</td>
1107      * <td align="center">CONVERGED</td>
1108      * <td align="center">Converged after a precapture sequenceis canceled, transient states are skipped by camera device.</td>
1109      * </tr>
1110      * <tr>
1111      * <td align="center">CONVERGED</td>
1112      * <td align="center">Camera device finished AE scan</td>
1113      * <td align="center">FLASH_REQUIRED</td>
1114      * <td align="center">Converged but too dark w/o flash after a new scan, transient states are skipped by camera device.</td>
1115      * </tr>
1116      * <tr>
1117      * <td align="center">FLASH_REQUIRED</td>
1118      * <td align="center">Camera device finished AE scan</td>
1119      * <td align="center">CONVERGED</td>
1120      * <td align="center">Converged after a new scan, transient states are skipped by camera device.</td>
1121      * </tr>
1122      * </tbody>
1123      * </table>
1124      * <p><b>Possible values:</b>
1125      * <ul>
1126      *   <li>{@link #CONTROL_AE_STATE_INACTIVE INACTIVE}</li>
1127      *   <li>{@link #CONTROL_AE_STATE_SEARCHING SEARCHING}</li>
1128      *   <li>{@link #CONTROL_AE_STATE_CONVERGED CONVERGED}</li>
1129      *   <li>{@link #CONTROL_AE_STATE_LOCKED LOCKED}</li>
1130      *   <li>{@link #CONTROL_AE_STATE_FLASH_REQUIRED FLASH_REQUIRED}</li>
1131      *   <li>{@link #CONTROL_AE_STATE_PRECAPTURE PRECAPTURE}</li>
1132      * </ul></p>
1133      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
1134      * <p><b>Limited capability</b> -
1135      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
1136      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
1137      *
1138      * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES
1139      * @see CaptureRequest#CONTROL_AE_LOCK
1140      * @see CaptureRequest#CONTROL_AE_MODE
1141      * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
1142      * @see CaptureResult#CONTROL_AE_STATE
1143      * @see CaptureRequest#CONTROL_MODE
1144      * @see CaptureRequest#CONTROL_SCENE_MODE
1145      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
1146      * @see #CONTROL_AE_STATE_INACTIVE
1147      * @see #CONTROL_AE_STATE_SEARCHING
1148      * @see #CONTROL_AE_STATE_CONVERGED
1149      * @see #CONTROL_AE_STATE_LOCKED
1150      * @see #CONTROL_AE_STATE_FLASH_REQUIRED
1151      * @see #CONTROL_AE_STATE_PRECAPTURE
1152      */
1153     @PublicKey
1154     @NonNull
1155     public static final Key<Integer> CONTROL_AE_STATE =
1156             new Key<Integer>("android.control.aeState", int.class);
1157 
1158     /**
1159      * <p>Whether auto-focus (AF) is currently enabled, and what
1160      * mode it is set to.</p>
1161      * <p>Only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} = AUTO and the lens is not fixed focus
1162      * (i.e. <code>{@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} &gt; 0</code>). Also note that
1163      * when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF, the behavior of AF is device
1164      * dependent. It is recommended to lock AF by using {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger} before
1165      * setting {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} to OFF, or set AF mode to OFF when AE is OFF.</p>
1166      * <p>If the lens is controlled by the camera device auto-focus algorithm,
1167      * the camera device will report the current AF status in {@link CaptureResult#CONTROL_AF_STATE android.control.afState}
1168      * in result metadata.</p>
1169      * <p><b>Possible values:</b>
1170      * <ul>
1171      *   <li>{@link #CONTROL_AF_MODE_OFF OFF}</li>
1172      *   <li>{@link #CONTROL_AF_MODE_AUTO AUTO}</li>
1173      *   <li>{@link #CONTROL_AF_MODE_MACRO MACRO}</li>
1174      *   <li>{@link #CONTROL_AF_MODE_CONTINUOUS_VIDEO CONTINUOUS_VIDEO}</li>
1175      *   <li>{@link #CONTROL_AF_MODE_CONTINUOUS_PICTURE CONTINUOUS_PICTURE}</li>
1176      *   <li>{@link #CONTROL_AF_MODE_EDOF EDOF}</li>
1177      * </ul></p>
1178      * <p><b>Available values for this device:</b><br>
1179      * {@link CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES android.control.afAvailableModes}</p>
1180      * <p>This key is available on all devices.</p>
1181      *
1182      * @see CaptureRequest#CONTROL_AE_MODE
1183      * @see CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES
1184      * @see CaptureResult#CONTROL_AF_STATE
1185      * @see CaptureRequest#CONTROL_AF_TRIGGER
1186      * @see CaptureRequest#CONTROL_MODE
1187      * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE
1188      * @see #CONTROL_AF_MODE_OFF
1189      * @see #CONTROL_AF_MODE_AUTO
1190      * @see #CONTROL_AF_MODE_MACRO
1191      * @see #CONTROL_AF_MODE_CONTINUOUS_VIDEO
1192      * @see #CONTROL_AF_MODE_CONTINUOUS_PICTURE
1193      * @see #CONTROL_AF_MODE_EDOF
1194      */
1195     @PublicKey
1196     @NonNull
1197     public static final Key<Integer> CONTROL_AF_MODE =
1198             new Key<Integer>("android.control.afMode", int.class);
1199 
1200     /**
1201      * <p>List of metering areas to use for auto-focus.</p>
1202      * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf} is 0.
1203      * Otherwise will always be present.</p>
1204      * <p>The maximum number of focus areas supported by the device is determined by the value
1205      * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf}.</p>
1206      * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1207      * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being
1208      * the top-left pixel in the active pixel array, and
1209      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1210      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1211      * active pixel array.</p>
1212      * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1213      * system depends on the mode being set.
1214      * When the distortion correction mode is OFF, the coordinate system follows
1215      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
1216      * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and
1217      * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1,
1218      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right
1219      * pixel in the pre-correction active pixel array.
1220      * When the distortion correction mode is not OFF, the coordinate system follows
1221      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
1222      * <code>(0, 0)</code> being the top-left pixel of the active array, and
1223      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1224      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1225      * active pixel array.</p>
1226      * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight
1227      * for every pixel in the area. This means that a large metering area
1228      * with the same weight as a smaller area will have more effect in
1229      * the metering result. Metering areas can partially overlap and the
1230      * camera device will add the weights in the overlap region.</p>
1231      * <p>The weights are relative to weights of other metering regions, so if only one region
1232      * is used, all non-zero weights will have the same effect. A region with 0 weight is
1233      * ignored.</p>
1234      * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
1235      * camera device. The capture result will either be a zero weight region as well, or
1236      * the region selected by the camera device as the focus area of interest.</p>
1237      * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
1238      * capture result metadata, the camera device will ignore the sections outside the crop
1239      * region and output only the intersection rectangle as the metering region in the result
1240      * metadata. If the region is entirely outside the crop region, it will be ignored and
1241      * not reported in the result metadata.</p>
1242      * <p>Starting from API level 30, the coordinate system of activeArraySize or
1243      * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
1244      * pre-zoom field of view. This means that the same afRegions values at different
1245      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The afRegions
1246      * coordinates are relative to the activeArray/preCorrectionActiveArray representing the
1247      * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same
1248      * afRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of the
1249      * scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use
1250      * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
1251      * mode.</p>
1252      * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
1253      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on
1254      * distortion correction capability and mode</p>
1255      * <p><b>Range of valid values:</b><br>
1256      * Coordinates must be between <code>[(0,0), (width, height))</code> of
1257      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
1258      * depending on distortion correction capability and mode</p>
1259      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
1260      *
1261      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF
1262      * @see CaptureRequest#CONTROL_ZOOM_RATIO
1263      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
1264      * @see CaptureRequest#SCALER_CROP_REGION
1265      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
1266      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
1267      */
1268     @PublicKey
1269     @NonNull
1270     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS =
1271             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.afRegions", android.hardware.camera2.params.MeteringRectangle[].class);
1272 
1273     /**
1274      * <p>Whether the camera device will trigger autofocus for this request.</p>
1275      * <p>This entry is normally set to IDLE, or is not
1276      * included at all in the request settings.</p>
1277      * <p>When included and set to START, the camera device will trigger the
1278      * autofocus algorithm. If autofocus is disabled, this trigger has no effect.</p>
1279      * <p>When set to CANCEL, the camera device will cancel any active trigger,
1280      * and return to its initial AF state.</p>
1281      * <p>Generally, applications should set this entry to START or CANCEL for only a
1282      * single capture, and then return it to IDLE (or not set at all). Specifying
1283      * START for multiple captures in a row means restarting the AF operation over
1284      * and over again.</p>
1285      * <p>See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what the trigger means for each AF mode.</p>
1286      * <p>Using the autofocus trigger and the precapture trigger {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}
1287      * simultaneously is allowed. However, since these triggers often require cooperation between
1288      * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a
1289      * focus sweep), the camera device may delay acting on a later trigger until the previous
1290      * trigger has been fully handled. This may lead to longer intervals between the trigger and
1291      * changes to {@link CaptureResult#CONTROL_AF_STATE android.control.afState}, for example.</p>
1292      * <p><b>Possible values:</b>
1293      * <ul>
1294      *   <li>{@link #CONTROL_AF_TRIGGER_IDLE IDLE}</li>
1295      *   <li>{@link #CONTROL_AF_TRIGGER_START START}</li>
1296      *   <li>{@link #CONTROL_AF_TRIGGER_CANCEL CANCEL}</li>
1297      * </ul></p>
1298      * <p>This key is available on all devices.</p>
1299      *
1300      * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
1301      * @see CaptureResult#CONTROL_AF_STATE
1302      * @see #CONTROL_AF_TRIGGER_IDLE
1303      * @see #CONTROL_AF_TRIGGER_START
1304      * @see #CONTROL_AF_TRIGGER_CANCEL
1305      */
1306     @PublicKey
1307     @NonNull
1308     public static final Key<Integer> CONTROL_AF_TRIGGER =
1309             new Key<Integer>("android.control.afTrigger", int.class);
1310 
1311     /**
1312      * <p>Current state of auto-focus (AF) algorithm.</p>
1313      * <p>Switching between or enabling AF modes ({@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}) always
1314      * resets the AF state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode},
1315      * or {@link CaptureRequest#CONTROL_SCENE_MODE android.control.sceneMode} if <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code> resets all
1316      * the algorithm states to INACTIVE.</p>
1317      * <p>The camera device can do several state transitions between two results, if it is
1318      * allowed by the state transition table. For example: INACTIVE may never actually be
1319      * seen in a result.</p>
1320      * <p>The state in the result is the state for this image (in sync with this image): if
1321      * AF state becomes FOCUSED, then the image data associated with this result should
1322      * be sharp.</p>
1323      * <p>Below are state transition tables for different AF modes.</p>
1324      * <p>When {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} is AF_MODE_OFF or AF_MODE_EDOF:</p>
1325      * <table>
1326      * <thead>
1327      * <tr>
1328      * <th align="center">State</th>
1329      * <th align="center">Transition Cause</th>
1330      * <th align="center">New State</th>
1331      * <th align="center">Notes</th>
1332      * </tr>
1333      * </thead>
1334      * <tbody>
1335      * <tr>
1336      * <td align="center">INACTIVE</td>
1337      * <td align="center"></td>
1338      * <td align="center">INACTIVE</td>
1339      * <td align="center">Never changes</td>
1340      * </tr>
1341      * </tbody>
1342      * </table>
1343      * <p>When {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} is AF_MODE_AUTO or AF_MODE_MACRO:</p>
1344      * <table>
1345      * <thead>
1346      * <tr>
1347      * <th align="center">State</th>
1348      * <th align="center">Transition Cause</th>
1349      * <th align="center">New State</th>
1350      * <th align="center">Notes</th>
1351      * </tr>
1352      * </thead>
1353      * <tbody>
1354      * <tr>
1355      * <td align="center">INACTIVE</td>
1356      * <td align="center">AF_TRIGGER</td>
1357      * <td align="center">ACTIVE_SCAN</td>
1358      * <td align="center">Start AF sweep, Lens now moving</td>
1359      * </tr>
1360      * <tr>
1361      * <td align="center">ACTIVE_SCAN</td>
1362      * <td align="center">AF sweep done</td>
1363      * <td align="center">FOCUSED_LOCKED</td>
1364      * <td align="center">Focused, Lens now locked</td>
1365      * </tr>
1366      * <tr>
1367      * <td align="center">ACTIVE_SCAN</td>
1368      * <td align="center">AF sweep done</td>
1369      * <td align="center">NOT_FOCUSED_LOCKED</td>
1370      * <td align="center">Not focused, Lens now locked</td>
1371      * </tr>
1372      * <tr>
1373      * <td align="center">ACTIVE_SCAN</td>
1374      * <td align="center">AF_CANCEL</td>
1375      * <td align="center">INACTIVE</td>
1376      * <td align="center">Cancel/reset AF, Lens now locked</td>
1377      * </tr>
1378      * <tr>
1379      * <td align="center">FOCUSED_LOCKED</td>
1380      * <td align="center">AF_CANCEL</td>
1381      * <td align="center">INACTIVE</td>
1382      * <td align="center">Cancel/reset AF</td>
1383      * </tr>
1384      * <tr>
1385      * <td align="center">FOCUSED_LOCKED</td>
1386      * <td align="center">AF_TRIGGER</td>
1387      * <td align="center">ACTIVE_SCAN</td>
1388      * <td align="center">Start new sweep, Lens now moving</td>
1389      * </tr>
1390      * <tr>
1391      * <td align="center">NOT_FOCUSED_LOCKED</td>
1392      * <td align="center">AF_CANCEL</td>
1393      * <td align="center">INACTIVE</td>
1394      * <td align="center">Cancel/reset AF</td>
1395      * </tr>
1396      * <tr>
1397      * <td align="center">NOT_FOCUSED_LOCKED</td>
1398      * <td align="center">AF_TRIGGER</td>
1399      * <td align="center">ACTIVE_SCAN</td>
1400      * <td align="center">Start new sweep, Lens now moving</td>
1401      * </tr>
1402      * <tr>
1403      * <td align="center">Any state</td>
1404      * <td align="center">Mode change</td>
1405      * <td align="center">INACTIVE</td>
1406      * <td align="center"></td>
1407      * </tr>
1408      * </tbody>
1409      * </table>
1410      * <p>For the above table, the camera device may skip reporting any state changes that happen
1411      * without application intervention (i.e. mode switch, trigger, locking). Any state that
1412      * can be skipped in that manner is called a transient state.</p>
1413      * <p>For example, for these AF modes (AF_MODE_AUTO and AF_MODE_MACRO), in addition to the
1414      * state transitions listed in above table, it is also legal for the camera device to skip
1415      * one or more transient states between two results. See below table for examples:</p>
1416      * <table>
1417      * <thead>
1418      * <tr>
1419      * <th align="center">State</th>
1420      * <th align="center">Transition Cause</th>
1421      * <th align="center">New State</th>
1422      * <th align="center">Notes</th>
1423      * </tr>
1424      * </thead>
1425      * <tbody>
1426      * <tr>
1427      * <td align="center">INACTIVE</td>
1428      * <td align="center">AF_TRIGGER</td>
1429      * <td align="center">FOCUSED_LOCKED</td>
1430      * <td align="center">Focus is already good or good after a scan, lens is now locked.</td>
1431      * </tr>
1432      * <tr>
1433      * <td align="center">INACTIVE</td>
1434      * <td align="center">AF_TRIGGER</td>
1435      * <td align="center">NOT_FOCUSED_LOCKED</td>
1436      * <td align="center">Focus failed after a scan, lens is now locked.</td>
1437      * </tr>
1438      * <tr>
1439      * <td align="center">FOCUSED_LOCKED</td>
1440      * <td align="center">AF_TRIGGER</td>
1441      * <td align="center">FOCUSED_LOCKED</td>
1442      * <td align="center">Focus is already good or good after a scan, lens is now locked.</td>
1443      * </tr>
1444      * <tr>
1445      * <td align="center">NOT_FOCUSED_LOCKED</td>
1446      * <td align="center">AF_TRIGGER</td>
1447      * <td align="center">FOCUSED_LOCKED</td>
1448      * <td align="center">Focus is good after a scan, lens is not locked.</td>
1449      * </tr>
1450      * </tbody>
1451      * </table>
1452      * <p>When {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} is AF_MODE_CONTINUOUS_VIDEO:</p>
1453      * <table>
1454      * <thead>
1455      * <tr>
1456      * <th align="center">State</th>
1457      * <th align="center">Transition Cause</th>
1458      * <th align="center">New State</th>
1459      * <th align="center">Notes</th>
1460      * </tr>
1461      * </thead>
1462      * <tbody>
1463      * <tr>
1464      * <td align="center">INACTIVE</td>
1465      * <td align="center">Camera device initiates new scan</td>
1466      * <td align="center">PASSIVE_SCAN</td>
1467      * <td align="center">Start AF scan, Lens now moving</td>
1468      * </tr>
1469      * <tr>
1470      * <td align="center">INACTIVE</td>
1471      * <td align="center">AF_TRIGGER</td>
1472      * <td align="center">NOT_FOCUSED_LOCKED</td>
1473      * <td align="center">AF state query, Lens now locked</td>
1474      * </tr>
1475      * <tr>
1476      * <td align="center">PASSIVE_SCAN</td>
1477      * <td align="center">Camera device completes current scan</td>
1478      * <td align="center">PASSIVE_FOCUSED</td>
1479      * <td align="center">End AF scan, Lens now locked</td>
1480      * </tr>
1481      * <tr>
1482      * <td align="center">PASSIVE_SCAN</td>
1483      * <td align="center">Camera device fails current scan</td>
1484      * <td align="center">PASSIVE_UNFOCUSED</td>
1485      * <td align="center">End AF scan, Lens now locked</td>
1486      * </tr>
1487      * <tr>
1488      * <td align="center">PASSIVE_SCAN</td>
1489      * <td align="center">AF_TRIGGER</td>
1490      * <td align="center">FOCUSED_LOCKED</td>
1491      * <td align="center">Immediate transition, if focus is good. Lens now locked</td>
1492      * </tr>
1493      * <tr>
1494      * <td align="center">PASSIVE_SCAN</td>
1495      * <td align="center">AF_TRIGGER</td>
1496      * <td align="center">NOT_FOCUSED_LOCKED</td>
1497      * <td align="center">Immediate transition, if focus is bad. Lens now locked</td>
1498      * </tr>
1499      * <tr>
1500      * <td align="center">PASSIVE_SCAN</td>
1501      * <td align="center">AF_CANCEL</td>
1502      * <td align="center">INACTIVE</td>
1503      * <td align="center">Reset lens position, Lens now locked</td>
1504      * </tr>
1505      * <tr>
1506      * <td align="center">PASSIVE_FOCUSED</td>
1507      * <td align="center">Camera device initiates new scan</td>
1508      * <td align="center">PASSIVE_SCAN</td>
1509      * <td align="center">Start AF scan, Lens now moving</td>
1510      * </tr>
1511      * <tr>
1512      * <td align="center">PASSIVE_UNFOCUSED</td>
1513      * <td align="center">Camera device initiates new scan</td>
1514      * <td align="center">PASSIVE_SCAN</td>
1515      * <td align="center">Start AF scan, Lens now moving</td>
1516      * </tr>
1517      * <tr>
1518      * <td align="center">PASSIVE_FOCUSED</td>
1519      * <td align="center">AF_TRIGGER</td>
1520      * <td align="center">FOCUSED_LOCKED</td>
1521      * <td align="center">Immediate transition, lens now locked</td>
1522      * </tr>
1523      * <tr>
1524      * <td align="center">PASSIVE_UNFOCUSED</td>
1525      * <td align="center">AF_TRIGGER</td>
1526      * <td align="center">NOT_FOCUSED_LOCKED</td>
1527      * <td align="center">Immediate transition, lens now locked</td>
1528      * </tr>
1529      * <tr>
1530      * <td align="center">FOCUSED_LOCKED</td>
1531      * <td align="center">AF_TRIGGER</td>
1532      * <td align="center">FOCUSED_LOCKED</td>
1533      * <td align="center">No effect</td>
1534      * </tr>
1535      * <tr>
1536      * <td align="center">FOCUSED_LOCKED</td>
1537      * <td align="center">AF_CANCEL</td>
1538      * <td align="center">INACTIVE</td>
1539      * <td align="center">Restart AF scan</td>
1540      * </tr>
1541      * <tr>
1542      * <td align="center">NOT_FOCUSED_LOCKED</td>
1543      * <td align="center">AF_TRIGGER</td>
1544      * <td align="center">NOT_FOCUSED_LOCKED</td>
1545      * <td align="center">No effect</td>
1546      * </tr>
1547      * <tr>
1548      * <td align="center">NOT_FOCUSED_LOCKED</td>
1549      * <td align="center">AF_CANCEL</td>
1550      * <td align="center">INACTIVE</td>
1551      * <td align="center">Restart AF scan</td>
1552      * </tr>
1553      * </tbody>
1554      * </table>
1555      * <p>When {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} is AF_MODE_CONTINUOUS_PICTURE:</p>
1556      * <table>
1557      * <thead>
1558      * <tr>
1559      * <th align="center">State</th>
1560      * <th align="center">Transition Cause</th>
1561      * <th align="center">New State</th>
1562      * <th align="center">Notes</th>
1563      * </tr>
1564      * </thead>
1565      * <tbody>
1566      * <tr>
1567      * <td align="center">INACTIVE</td>
1568      * <td align="center">Camera device initiates new scan</td>
1569      * <td align="center">PASSIVE_SCAN</td>
1570      * <td align="center">Start AF scan, Lens now moving</td>
1571      * </tr>
1572      * <tr>
1573      * <td align="center">INACTIVE</td>
1574      * <td align="center">AF_TRIGGER</td>
1575      * <td align="center">NOT_FOCUSED_LOCKED</td>
1576      * <td align="center">AF state query, Lens now locked</td>
1577      * </tr>
1578      * <tr>
1579      * <td align="center">PASSIVE_SCAN</td>
1580      * <td align="center">Camera device completes current scan</td>
1581      * <td align="center">PASSIVE_FOCUSED</td>
1582      * <td align="center">End AF scan, Lens now locked</td>
1583      * </tr>
1584      * <tr>
1585      * <td align="center">PASSIVE_SCAN</td>
1586      * <td align="center">Camera device fails current scan</td>
1587      * <td align="center">PASSIVE_UNFOCUSED</td>
1588      * <td align="center">End AF scan, Lens now locked</td>
1589      * </tr>
1590      * <tr>
1591      * <td align="center">PASSIVE_SCAN</td>
1592      * <td align="center">AF_TRIGGER</td>
1593      * <td align="center">FOCUSED_LOCKED</td>
1594      * <td align="center">Eventual transition once the focus is good. Lens now locked</td>
1595      * </tr>
1596      * <tr>
1597      * <td align="center">PASSIVE_SCAN</td>
1598      * <td align="center">AF_TRIGGER</td>
1599      * <td align="center">NOT_FOCUSED_LOCKED</td>
1600      * <td align="center">Eventual transition if cannot find focus. Lens now locked</td>
1601      * </tr>
1602      * <tr>
1603      * <td align="center">PASSIVE_SCAN</td>
1604      * <td align="center">AF_CANCEL</td>
1605      * <td align="center">INACTIVE</td>
1606      * <td align="center">Reset lens position, Lens now locked</td>
1607      * </tr>
1608      * <tr>
1609      * <td align="center">PASSIVE_FOCUSED</td>
1610      * <td align="center">Camera device initiates new scan</td>
1611      * <td align="center">PASSIVE_SCAN</td>
1612      * <td align="center">Start AF scan, Lens now moving</td>
1613      * </tr>
1614      * <tr>
1615      * <td align="center">PASSIVE_UNFOCUSED</td>
1616      * <td align="center">Camera device initiates new scan</td>
1617      * <td align="center">PASSIVE_SCAN</td>
1618      * <td align="center">Start AF scan, Lens now moving</td>
1619      * </tr>
1620      * <tr>
1621      * <td align="center">PASSIVE_FOCUSED</td>
1622      * <td align="center">AF_TRIGGER</td>
1623      * <td align="center">FOCUSED_LOCKED</td>
1624      * <td align="center">Immediate trans. Lens now locked</td>
1625      * </tr>
1626      * <tr>
1627      * <td align="center">PASSIVE_UNFOCUSED</td>
1628      * <td align="center">AF_TRIGGER</td>
1629      * <td align="center">NOT_FOCUSED_LOCKED</td>
1630      * <td align="center">Immediate trans. Lens now locked</td>
1631      * </tr>
1632      * <tr>
1633      * <td align="center">FOCUSED_LOCKED</td>
1634      * <td align="center">AF_TRIGGER</td>
1635      * <td align="center">FOCUSED_LOCKED</td>
1636      * <td align="center">No effect</td>
1637      * </tr>
1638      * <tr>
1639      * <td align="center">FOCUSED_LOCKED</td>
1640      * <td align="center">AF_CANCEL</td>
1641      * <td align="center">INACTIVE</td>
1642      * <td align="center">Restart AF scan</td>
1643      * </tr>
1644      * <tr>
1645      * <td align="center">NOT_FOCUSED_LOCKED</td>
1646      * <td align="center">AF_TRIGGER</td>
1647      * <td align="center">NOT_FOCUSED_LOCKED</td>
1648      * <td align="center">No effect</td>
1649      * </tr>
1650      * <tr>
1651      * <td align="center">NOT_FOCUSED_LOCKED</td>
1652      * <td align="center">AF_CANCEL</td>
1653      * <td align="center">INACTIVE</td>
1654      * <td align="center">Restart AF scan</td>
1655      * </tr>
1656      * </tbody>
1657      * </table>
1658      * <p>When switch between AF_MODE_CONTINUOUS_* (CAF modes) and AF_MODE_AUTO/AF_MODE_MACRO
1659      * (AUTO modes), the initial INACTIVE or PASSIVE_SCAN states may be skipped by the
1660      * camera device. When a trigger is included in a mode switch request, the trigger
1661      * will be evaluated in the context of the new mode in the request.
1662      * See below table for examples:</p>
1663      * <table>
1664      * <thead>
1665      * <tr>
1666      * <th align="center">State</th>
1667      * <th align="center">Transition Cause</th>
1668      * <th align="center">New State</th>
1669      * <th align="center">Notes</th>
1670      * </tr>
1671      * </thead>
1672      * <tbody>
1673      * <tr>
1674      * <td align="center">any state</td>
1675      * <td align="center">CAF--&gt;AUTO mode switch</td>
1676      * <td align="center">INACTIVE</td>
1677      * <td align="center">Mode switch without trigger, initial state must be INACTIVE</td>
1678      * </tr>
1679      * <tr>
1680      * <td align="center">any state</td>
1681      * <td align="center">CAF--&gt;AUTO mode switch with AF_TRIGGER</td>
1682      * <td align="center">trigger-reachable states from INACTIVE</td>
1683      * <td align="center">Mode switch with trigger, INACTIVE is skipped</td>
1684      * </tr>
1685      * <tr>
1686      * <td align="center">any state</td>
1687      * <td align="center">AUTO--&gt;CAF mode switch</td>
1688      * <td align="center">passively reachable states from INACTIVE</td>
1689      * <td align="center">Mode switch without trigger, passive transient state is skipped</td>
1690      * </tr>
1691      * </tbody>
1692      * </table>
1693      * <p><b>Possible values:</b>
1694      * <ul>
1695      *   <li>{@link #CONTROL_AF_STATE_INACTIVE INACTIVE}</li>
1696      *   <li>{@link #CONTROL_AF_STATE_PASSIVE_SCAN PASSIVE_SCAN}</li>
1697      *   <li>{@link #CONTROL_AF_STATE_PASSIVE_FOCUSED PASSIVE_FOCUSED}</li>
1698      *   <li>{@link #CONTROL_AF_STATE_ACTIVE_SCAN ACTIVE_SCAN}</li>
1699      *   <li>{@link #CONTROL_AF_STATE_FOCUSED_LOCKED FOCUSED_LOCKED}</li>
1700      *   <li>{@link #CONTROL_AF_STATE_NOT_FOCUSED_LOCKED NOT_FOCUSED_LOCKED}</li>
1701      *   <li>{@link #CONTROL_AF_STATE_PASSIVE_UNFOCUSED PASSIVE_UNFOCUSED}</li>
1702      * </ul></p>
1703      * <p>This key is available on all devices.</p>
1704      *
1705      * @see CaptureRequest#CONTROL_AF_MODE
1706      * @see CaptureRequest#CONTROL_MODE
1707      * @see CaptureRequest#CONTROL_SCENE_MODE
1708      * @see #CONTROL_AF_STATE_INACTIVE
1709      * @see #CONTROL_AF_STATE_PASSIVE_SCAN
1710      * @see #CONTROL_AF_STATE_PASSIVE_FOCUSED
1711      * @see #CONTROL_AF_STATE_ACTIVE_SCAN
1712      * @see #CONTROL_AF_STATE_FOCUSED_LOCKED
1713      * @see #CONTROL_AF_STATE_NOT_FOCUSED_LOCKED
1714      * @see #CONTROL_AF_STATE_PASSIVE_UNFOCUSED
1715      */
1716     @PublicKey
1717     @NonNull
1718     public static final Key<Integer> CONTROL_AF_STATE =
1719             new Key<Integer>("android.control.afState", int.class);
1720 
1721     /**
1722      * <p>Whether auto-white balance (AWB) is currently locked to its
1723      * latest calculated values.</p>
1724      * <p>When set to <code>true</code> (ON), the AWB algorithm is locked to its latest parameters,
1725      * and will not change color balance settings until the lock is set to <code>false</code> (OFF).</p>
1726      * <p>Since the camera device has a pipeline of in-flight requests, the settings that
1727      * get locked do not necessarily correspond to the settings that were present in the
1728      * latest capture result received from the camera device, since additional captures
1729      * and AWB updates may have occurred even before the result was sent out. If an
1730      * application is switching between automatic and manual control and wishes to eliminate
1731      * any flicker during the switch, the following procedure is recommended:</p>
1732      * <ol>
1733      * <li>Starting in auto-AWB mode:</li>
1734      * <li>Lock AWB</li>
1735      * <li>Wait for the first result to be output that has the AWB locked</li>
1736      * <li>Copy AWB settings from that result into a request, set the request to manual AWB</li>
1737      * <li>Submit the capture request, proceed to run manual AWB as desired.</li>
1738      * </ol>
1739      * <p>Note that AWB lock is only meaningful when
1740      * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} is in the AUTO mode; in other modes,
1741      * AWB is already fixed to a specific setting.</p>
1742      * <p>Some LEGACY devices may not support ON; the value is then overridden to OFF.</p>
1743      * <p>This key is available on all devices.</p>
1744      *
1745      * @see CaptureRequest#CONTROL_AWB_MODE
1746      */
1747     @PublicKey
1748     @NonNull
1749     public static final Key<Boolean> CONTROL_AWB_LOCK =
1750             new Key<Boolean>("android.control.awbLock", boolean.class);
1751 
1752     /**
1753      * <p>Whether auto-white balance (AWB) is currently setting the color
1754      * transform fields, and what its illumination target
1755      * is.</p>
1756      * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is AUTO.</p>
1757      * <p>When set to the ON mode, the camera device's auto-white balance
1758      * routine is enabled, overriding the application's selected
1759      * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
1760      * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}. Note that when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}
1761      * is OFF, the behavior of AWB is device dependent. It is recommened to
1762      * also set AWB mode to OFF or lock AWB by using {@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} before
1763      * setting AE mode to OFF.</p>
1764      * <p>When set to the OFF mode, the camera device's auto-white balance
1765      * routine is disabled. The application manually controls the white
1766      * balance by {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains}
1767      * and {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p>
1768      * <p>When set to any other modes, the camera device's auto-white
1769      * balance routine is disabled. The camera device uses each
1770      * particular illumination target for white balance
1771      * adjustment. The application's values for
1772      * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform},
1773      * {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
1774      * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} are ignored.</p>
1775      * <p><b>Possible values:</b>
1776      * <ul>
1777      *   <li>{@link #CONTROL_AWB_MODE_OFF OFF}</li>
1778      *   <li>{@link #CONTROL_AWB_MODE_AUTO AUTO}</li>
1779      *   <li>{@link #CONTROL_AWB_MODE_INCANDESCENT INCANDESCENT}</li>
1780      *   <li>{@link #CONTROL_AWB_MODE_FLUORESCENT FLUORESCENT}</li>
1781      *   <li>{@link #CONTROL_AWB_MODE_WARM_FLUORESCENT WARM_FLUORESCENT}</li>
1782      *   <li>{@link #CONTROL_AWB_MODE_DAYLIGHT DAYLIGHT}</li>
1783      *   <li>{@link #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT CLOUDY_DAYLIGHT}</li>
1784      *   <li>{@link #CONTROL_AWB_MODE_TWILIGHT TWILIGHT}</li>
1785      *   <li>{@link #CONTROL_AWB_MODE_SHADE SHADE}</li>
1786      * </ul></p>
1787      * <p><b>Available values for this device:</b><br>
1788      * {@link CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES android.control.awbAvailableModes}</p>
1789      * <p>This key is available on all devices.</p>
1790      *
1791      * @see CaptureRequest#COLOR_CORRECTION_GAINS
1792      * @see CaptureRequest#COLOR_CORRECTION_MODE
1793      * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
1794      * @see CaptureRequest#CONTROL_AE_MODE
1795      * @see CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES
1796      * @see CaptureRequest#CONTROL_AWB_LOCK
1797      * @see CaptureRequest#CONTROL_MODE
1798      * @see #CONTROL_AWB_MODE_OFF
1799      * @see #CONTROL_AWB_MODE_AUTO
1800      * @see #CONTROL_AWB_MODE_INCANDESCENT
1801      * @see #CONTROL_AWB_MODE_FLUORESCENT
1802      * @see #CONTROL_AWB_MODE_WARM_FLUORESCENT
1803      * @see #CONTROL_AWB_MODE_DAYLIGHT
1804      * @see #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT
1805      * @see #CONTROL_AWB_MODE_TWILIGHT
1806      * @see #CONTROL_AWB_MODE_SHADE
1807      */
1808     @PublicKey
1809     @NonNull
1810     public static final Key<Integer> CONTROL_AWB_MODE =
1811             new Key<Integer>("android.control.awbMode", int.class);
1812 
1813     /**
1814      * <p>List of metering areas to use for auto-white-balance illuminant
1815      * estimation.</p>
1816      * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb} is 0.
1817      * Otherwise will always be present.</p>
1818      * <p>The maximum number of regions supported by the device is determined by the value
1819      * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb}.</p>
1820      * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1821      * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being
1822      * the top-left pixel in the active pixel array, and
1823      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1824      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1825      * active pixel array.</p>
1826      * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1827      * system depends on the mode being set.
1828      * When the distortion correction mode is OFF, the coordinate system follows
1829      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
1830      * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and
1831      * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1,
1832      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right
1833      * pixel in the pre-correction active pixel array.
1834      * When the distortion correction mode is not OFF, the coordinate system follows
1835      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
1836      * <code>(0, 0)</code> being the top-left pixel of the active array, and
1837      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1838      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1839      * active pixel array.</p>
1840      * <p>The weight must range from 0 to 1000, and represents a weight
1841      * for every pixel in the area. This means that a large metering area
1842      * with the same weight as a smaller area will have more effect in
1843      * the metering result. Metering areas can partially overlap and the
1844      * camera device will add the weights in the overlap region.</p>
1845      * <p>The weights are relative to weights of other white balance metering regions, so if
1846      * only one region is used, all non-zero weights will have the same effect. A region with
1847      * 0 weight is ignored.</p>
1848      * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
1849      * camera device.</p>
1850      * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
1851      * capture result metadata, the camera device will ignore the sections outside the crop
1852      * region and output only the intersection rectangle as the metering region in the result
1853      * metadata.  If the region is entirely outside the crop region, it will be ignored and
1854      * not reported in the result metadata.</p>
1855      * <p>Starting from API level 30, the coordinate system of activeArraySize or
1856      * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
1857      * pre-zoom field of view. This means that the same awbRegions values at different
1858      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The awbRegions
1859      * coordinates are relative to the activeArray/preCorrectionActiveArray representing the
1860      * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same
1861      * awbRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of
1862      * the scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use
1863      * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
1864      * mode.</p>
1865      * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
1866      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on
1867      * distortion correction capability and mode</p>
1868      * <p><b>Range of valid values:</b><br>
1869      * Coordinates must be between <code>[(0,0), (width, height))</code> of
1870      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
1871      * depending on distortion correction capability and mode</p>
1872      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
1873      *
1874      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB
1875      * @see CaptureRequest#CONTROL_ZOOM_RATIO
1876      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
1877      * @see CaptureRequest#SCALER_CROP_REGION
1878      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
1879      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
1880      */
1881     @PublicKey
1882     @NonNull
1883     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS =
1884             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.awbRegions", android.hardware.camera2.params.MeteringRectangle[].class);
1885 
1886     /**
1887      * <p>Information to the camera device 3A (auto-exposure,
1888      * auto-focus, auto-white balance) routines about the purpose
1889      * of this capture, to help the camera device to decide optimal 3A
1890      * strategy.</p>
1891      * <p>This control (except for MANUAL) is only effective if
1892      * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} != OFF</code> and any 3A routine is active.</p>
1893      * <p>All intents are supported by all devices, except that:
1894      *   * ZERO_SHUTTER_LAG will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains
1895      * PRIVATE_REPROCESSING or YUV_REPROCESSING.
1896      *   * MANUAL will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains
1897      * MANUAL_SENSOR.
1898      *   * MOTION_TRACKING will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains
1899      * MOTION_TRACKING.</p>
1900      * <p><b>Possible values:</b>
1901      * <ul>
1902      *   <li>{@link #CONTROL_CAPTURE_INTENT_CUSTOM CUSTOM}</li>
1903      *   <li>{@link #CONTROL_CAPTURE_INTENT_PREVIEW PREVIEW}</li>
1904      *   <li>{@link #CONTROL_CAPTURE_INTENT_STILL_CAPTURE STILL_CAPTURE}</li>
1905      *   <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_RECORD VIDEO_RECORD}</li>
1906      *   <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT VIDEO_SNAPSHOT}</li>
1907      *   <li>{@link #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li>
1908      *   <li>{@link #CONTROL_CAPTURE_INTENT_MANUAL MANUAL}</li>
1909      *   <li>{@link #CONTROL_CAPTURE_INTENT_MOTION_TRACKING MOTION_TRACKING}</li>
1910      * </ul></p>
1911      * <p>This key is available on all devices.</p>
1912      *
1913      * @see CaptureRequest#CONTROL_MODE
1914      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
1915      * @see #CONTROL_CAPTURE_INTENT_CUSTOM
1916      * @see #CONTROL_CAPTURE_INTENT_PREVIEW
1917      * @see #CONTROL_CAPTURE_INTENT_STILL_CAPTURE
1918      * @see #CONTROL_CAPTURE_INTENT_VIDEO_RECORD
1919      * @see #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT
1920      * @see #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG
1921      * @see #CONTROL_CAPTURE_INTENT_MANUAL
1922      * @see #CONTROL_CAPTURE_INTENT_MOTION_TRACKING
1923      */
1924     @PublicKey
1925     @NonNull
1926     public static final Key<Integer> CONTROL_CAPTURE_INTENT =
1927             new Key<Integer>("android.control.captureIntent", int.class);
1928 
1929     /**
1930      * <p>Current state of auto-white balance (AWB) algorithm.</p>
1931      * <p>Switching between or enabling AWB modes ({@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}) always
1932      * resets the AWB state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode},
1933      * or {@link CaptureRequest#CONTROL_SCENE_MODE android.control.sceneMode} if <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code> resets all
1934      * the algorithm states to INACTIVE.</p>
1935      * <p>The camera device can do several state transitions between two results, if it is
1936      * allowed by the state transition table. So INACTIVE may never actually be seen in
1937      * a result.</p>
1938      * <p>The state in the result is the state for this image (in sync with this image): if
1939      * AWB state becomes CONVERGED, then the image data associated with this result should
1940      * be good to use.</p>
1941      * <p>Below are state transition tables for different AWB modes.</p>
1942      * <p>When <code>{@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} != AWB_MODE_AUTO</code>:</p>
1943      * <table>
1944      * <thead>
1945      * <tr>
1946      * <th align="center">State</th>
1947      * <th align="center">Transition Cause</th>
1948      * <th align="center">New State</th>
1949      * <th align="center">Notes</th>
1950      * </tr>
1951      * </thead>
1952      * <tbody>
1953      * <tr>
1954      * <td align="center">INACTIVE</td>
1955      * <td align="center"></td>
1956      * <td align="center">INACTIVE</td>
1957      * <td align="center">Camera device auto white balance algorithm is disabled</td>
1958      * </tr>
1959      * </tbody>
1960      * </table>
1961      * <p>When {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} is AWB_MODE_AUTO:</p>
1962      * <table>
1963      * <thead>
1964      * <tr>
1965      * <th align="center">State</th>
1966      * <th align="center">Transition Cause</th>
1967      * <th align="center">New State</th>
1968      * <th align="center">Notes</th>
1969      * </tr>
1970      * </thead>
1971      * <tbody>
1972      * <tr>
1973      * <td align="center">INACTIVE</td>
1974      * <td align="center">Camera device initiates AWB scan</td>
1975      * <td align="center">SEARCHING</td>
1976      * <td align="center">Values changing</td>
1977      * </tr>
1978      * <tr>
1979      * <td align="center">INACTIVE</td>
1980      * <td align="center">{@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} is ON</td>
1981      * <td align="center">LOCKED</td>
1982      * <td align="center">Values locked</td>
1983      * </tr>
1984      * <tr>
1985      * <td align="center">SEARCHING</td>
1986      * <td align="center">Camera device finishes AWB scan</td>
1987      * <td align="center">CONVERGED</td>
1988      * <td align="center">Good values, not changing</td>
1989      * </tr>
1990      * <tr>
1991      * <td align="center">SEARCHING</td>
1992      * <td align="center">{@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} is ON</td>
1993      * <td align="center">LOCKED</td>
1994      * <td align="center">Values locked</td>
1995      * </tr>
1996      * <tr>
1997      * <td align="center">CONVERGED</td>
1998      * <td align="center">Camera device initiates AWB scan</td>
1999      * <td align="center">SEARCHING</td>
2000      * <td align="center">Values changing</td>
2001      * </tr>
2002      * <tr>
2003      * <td align="center">CONVERGED</td>
2004      * <td align="center">{@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} is ON</td>
2005      * <td align="center">LOCKED</td>
2006      * <td align="center">Values locked</td>
2007      * </tr>
2008      * <tr>
2009      * <td align="center">LOCKED</td>
2010      * <td align="center">{@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} is OFF</td>
2011      * <td align="center">SEARCHING</td>
2012      * <td align="center">Values not good after unlock</td>
2013      * </tr>
2014      * </tbody>
2015      * </table>
2016      * <p>For the above table, the camera device may skip reporting any state changes that happen
2017      * without application intervention (i.e. mode switch, trigger, locking). Any state that
2018      * can be skipped in that manner is called a transient state.</p>
2019      * <p>For example, for this AWB mode (AWB_MODE_AUTO), in addition to the state transitions
2020      * listed in above table, it is also legal for the camera device to skip one or more
2021      * transient states between two results. See below table for examples:</p>
2022      * <table>
2023      * <thead>
2024      * <tr>
2025      * <th align="center">State</th>
2026      * <th align="center">Transition Cause</th>
2027      * <th align="center">New State</th>
2028      * <th align="center">Notes</th>
2029      * </tr>
2030      * </thead>
2031      * <tbody>
2032      * <tr>
2033      * <td align="center">INACTIVE</td>
2034      * <td align="center">Camera device finished AWB scan</td>
2035      * <td align="center">CONVERGED</td>
2036      * <td align="center">Values are already good, transient states are skipped by camera device.</td>
2037      * </tr>
2038      * <tr>
2039      * <td align="center">LOCKED</td>
2040      * <td align="center">{@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} is OFF</td>
2041      * <td align="center">CONVERGED</td>
2042      * <td align="center">Values good after unlock, transient states are skipped by camera device.</td>
2043      * </tr>
2044      * </tbody>
2045      * </table>
2046      * <p><b>Possible values:</b>
2047      * <ul>
2048      *   <li>{@link #CONTROL_AWB_STATE_INACTIVE INACTIVE}</li>
2049      *   <li>{@link #CONTROL_AWB_STATE_SEARCHING SEARCHING}</li>
2050      *   <li>{@link #CONTROL_AWB_STATE_CONVERGED CONVERGED}</li>
2051      *   <li>{@link #CONTROL_AWB_STATE_LOCKED LOCKED}</li>
2052      * </ul></p>
2053      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2054      * <p><b>Limited capability</b> -
2055      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2056      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2057      *
2058      * @see CaptureRequest#CONTROL_AWB_LOCK
2059      * @see CaptureRequest#CONTROL_AWB_MODE
2060      * @see CaptureRequest#CONTROL_MODE
2061      * @see CaptureRequest#CONTROL_SCENE_MODE
2062      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2063      * @see #CONTROL_AWB_STATE_INACTIVE
2064      * @see #CONTROL_AWB_STATE_SEARCHING
2065      * @see #CONTROL_AWB_STATE_CONVERGED
2066      * @see #CONTROL_AWB_STATE_LOCKED
2067      */
2068     @PublicKey
2069     @NonNull
2070     public static final Key<Integer> CONTROL_AWB_STATE =
2071             new Key<Integer>("android.control.awbState", int.class);
2072 
2073     /**
2074      * <p>A special color effect to apply.</p>
2075      * <p>When this mode is set, a color effect will be applied
2076      * to images produced by the camera device. The interpretation
2077      * and implementation of these color effects is left to the
2078      * implementor of the camera device, and should not be
2079      * depended on to be consistent (or present) across all
2080      * devices.</p>
2081      * <p><b>Possible values:</b>
2082      * <ul>
2083      *   <li>{@link #CONTROL_EFFECT_MODE_OFF OFF}</li>
2084      *   <li>{@link #CONTROL_EFFECT_MODE_MONO MONO}</li>
2085      *   <li>{@link #CONTROL_EFFECT_MODE_NEGATIVE NEGATIVE}</li>
2086      *   <li>{@link #CONTROL_EFFECT_MODE_SOLARIZE SOLARIZE}</li>
2087      *   <li>{@link #CONTROL_EFFECT_MODE_SEPIA SEPIA}</li>
2088      *   <li>{@link #CONTROL_EFFECT_MODE_POSTERIZE POSTERIZE}</li>
2089      *   <li>{@link #CONTROL_EFFECT_MODE_WHITEBOARD WHITEBOARD}</li>
2090      *   <li>{@link #CONTROL_EFFECT_MODE_BLACKBOARD BLACKBOARD}</li>
2091      *   <li>{@link #CONTROL_EFFECT_MODE_AQUA AQUA}</li>
2092      * </ul></p>
2093      * <p><b>Available values for this device:</b><br>
2094      * {@link CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS android.control.availableEffects}</p>
2095      * <p>This key is available on all devices.</p>
2096      *
2097      * @see CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS
2098      * @see #CONTROL_EFFECT_MODE_OFF
2099      * @see #CONTROL_EFFECT_MODE_MONO
2100      * @see #CONTROL_EFFECT_MODE_NEGATIVE
2101      * @see #CONTROL_EFFECT_MODE_SOLARIZE
2102      * @see #CONTROL_EFFECT_MODE_SEPIA
2103      * @see #CONTROL_EFFECT_MODE_POSTERIZE
2104      * @see #CONTROL_EFFECT_MODE_WHITEBOARD
2105      * @see #CONTROL_EFFECT_MODE_BLACKBOARD
2106      * @see #CONTROL_EFFECT_MODE_AQUA
2107      */
2108     @PublicKey
2109     @NonNull
2110     public static final Key<Integer> CONTROL_EFFECT_MODE =
2111             new Key<Integer>("android.control.effectMode", int.class);
2112 
2113     /**
2114      * <p>Overall mode of 3A (auto-exposure, auto-white-balance, auto-focus) control
2115      * routines.</p>
2116      * <p>This is a top-level 3A control switch. When set to OFF, all 3A control
2117      * by the camera device is disabled. The application must set the fields for
2118      * capture parameters itself.</p>
2119      * <p>When set to AUTO, the individual algorithm controls in
2120      * android.control.* are in effect, such as {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}.</p>
2121      * <p>When set to USE_SCENE_MODE or USE_EXTENDED_SCENE_MODE, the individual controls in
2122      * android.control.* are mostly disabled, and the camera device
2123      * implements one of the scene mode or extended scene mode settings (such as ACTION,
2124      * SUNSET, PARTY, or BOKEH) as it wishes. The camera device scene mode
2125      * 3A settings are provided by {@link android.hardware.camera2.CaptureResult capture results}.</p>
2126      * <p>When set to OFF_KEEP_STATE, it is similar to OFF mode, the only difference
2127      * is that this frame will not be used by camera device background 3A statistics
2128      * update, as if this frame is never captured. This mode can be used in the scenario
2129      * where the application doesn't want a 3A manual control capture to affect
2130      * the subsequent auto 3A capture results.</p>
2131      * <p><b>Possible values:</b>
2132      * <ul>
2133      *   <li>{@link #CONTROL_MODE_OFF OFF}</li>
2134      *   <li>{@link #CONTROL_MODE_AUTO AUTO}</li>
2135      *   <li>{@link #CONTROL_MODE_USE_SCENE_MODE USE_SCENE_MODE}</li>
2136      *   <li>{@link #CONTROL_MODE_OFF_KEEP_STATE OFF_KEEP_STATE}</li>
2137      *   <li>{@link #CONTROL_MODE_USE_EXTENDED_SCENE_MODE USE_EXTENDED_SCENE_MODE}</li>
2138      * </ul></p>
2139      * <p><b>Available values for this device:</b><br>
2140      * {@link CameraCharacteristics#CONTROL_AVAILABLE_MODES android.control.availableModes}</p>
2141      * <p>This key is available on all devices.</p>
2142      *
2143      * @see CaptureRequest#CONTROL_AF_MODE
2144      * @see CameraCharacteristics#CONTROL_AVAILABLE_MODES
2145      * @see #CONTROL_MODE_OFF
2146      * @see #CONTROL_MODE_AUTO
2147      * @see #CONTROL_MODE_USE_SCENE_MODE
2148      * @see #CONTROL_MODE_OFF_KEEP_STATE
2149      * @see #CONTROL_MODE_USE_EXTENDED_SCENE_MODE
2150      */
2151     @PublicKey
2152     @NonNull
2153     public static final Key<Integer> CONTROL_MODE =
2154             new Key<Integer>("android.control.mode", int.class);
2155 
2156     /**
2157      * <p>Control for which scene mode is currently active.</p>
2158      * <p>Scene modes are custom camera modes optimized for a certain set of conditions and
2159      * capture settings.</p>
2160      * <p>This is the mode that that is active when
2161      * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY, these modes will
2162      * disable {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}, {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}
2163      * while in use.</p>
2164      * <p>The interpretation and implementation of these scene modes is left
2165      * to the implementor of the camera device. Their behavior will not be
2166      * consistent across all devices, and any given device may only implement
2167      * a subset of these modes.</p>
2168      * <p><b>Possible values:</b>
2169      * <ul>
2170      *   <li>{@link #CONTROL_SCENE_MODE_DISABLED DISABLED}</li>
2171      *   <li>{@link #CONTROL_SCENE_MODE_FACE_PRIORITY FACE_PRIORITY}</li>
2172      *   <li>{@link #CONTROL_SCENE_MODE_ACTION ACTION}</li>
2173      *   <li>{@link #CONTROL_SCENE_MODE_PORTRAIT PORTRAIT}</li>
2174      *   <li>{@link #CONTROL_SCENE_MODE_LANDSCAPE LANDSCAPE}</li>
2175      *   <li>{@link #CONTROL_SCENE_MODE_NIGHT NIGHT}</li>
2176      *   <li>{@link #CONTROL_SCENE_MODE_NIGHT_PORTRAIT NIGHT_PORTRAIT}</li>
2177      *   <li>{@link #CONTROL_SCENE_MODE_THEATRE THEATRE}</li>
2178      *   <li>{@link #CONTROL_SCENE_MODE_BEACH BEACH}</li>
2179      *   <li>{@link #CONTROL_SCENE_MODE_SNOW SNOW}</li>
2180      *   <li>{@link #CONTROL_SCENE_MODE_SUNSET SUNSET}</li>
2181      *   <li>{@link #CONTROL_SCENE_MODE_STEADYPHOTO STEADYPHOTO}</li>
2182      *   <li>{@link #CONTROL_SCENE_MODE_FIREWORKS FIREWORKS}</li>
2183      *   <li>{@link #CONTROL_SCENE_MODE_SPORTS SPORTS}</li>
2184      *   <li>{@link #CONTROL_SCENE_MODE_PARTY PARTY}</li>
2185      *   <li>{@link #CONTROL_SCENE_MODE_CANDLELIGHT CANDLELIGHT}</li>
2186      *   <li>{@link #CONTROL_SCENE_MODE_BARCODE BARCODE}</li>
2187      *   <li>{@link #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO HIGH_SPEED_VIDEO}</li>
2188      *   <li>{@link #CONTROL_SCENE_MODE_HDR HDR}</li>
2189      * </ul></p>
2190      * <p><b>Available values for this device:</b><br>
2191      * {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes}</p>
2192      * <p>This key is available on all devices.</p>
2193      *
2194      * @see CaptureRequest#CONTROL_AE_MODE
2195      * @see CaptureRequest#CONTROL_AF_MODE
2196      * @see CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES
2197      * @see CaptureRequest#CONTROL_AWB_MODE
2198      * @see CaptureRequest#CONTROL_MODE
2199      * @see #CONTROL_SCENE_MODE_DISABLED
2200      * @see #CONTROL_SCENE_MODE_FACE_PRIORITY
2201      * @see #CONTROL_SCENE_MODE_ACTION
2202      * @see #CONTROL_SCENE_MODE_PORTRAIT
2203      * @see #CONTROL_SCENE_MODE_LANDSCAPE
2204      * @see #CONTROL_SCENE_MODE_NIGHT
2205      * @see #CONTROL_SCENE_MODE_NIGHT_PORTRAIT
2206      * @see #CONTROL_SCENE_MODE_THEATRE
2207      * @see #CONTROL_SCENE_MODE_BEACH
2208      * @see #CONTROL_SCENE_MODE_SNOW
2209      * @see #CONTROL_SCENE_MODE_SUNSET
2210      * @see #CONTROL_SCENE_MODE_STEADYPHOTO
2211      * @see #CONTROL_SCENE_MODE_FIREWORKS
2212      * @see #CONTROL_SCENE_MODE_SPORTS
2213      * @see #CONTROL_SCENE_MODE_PARTY
2214      * @see #CONTROL_SCENE_MODE_CANDLELIGHT
2215      * @see #CONTROL_SCENE_MODE_BARCODE
2216      * @see #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO
2217      * @see #CONTROL_SCENE_MODE_HDR
2218      */
2219     @PublicKey
2220     @NonNull
2221     public static final Key<Integer> CONTROL_SCENE_MODE =
2222             new Key<Integer>("android.control.sceneMode", int.class);
2223 
2224     /**
2225      * <p>Whether video stabilization is
2226      * active.</p>
2227      * <p>Video stabilization automatically warps images from
2228      * the camera in order to stabilize motion between consecutive frames.</p>
2229      * <p>If enabled, video stabilization can modify the
2230      * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to keep the video stream stabilized.</p>
2231      * <p>Switching between different video stabilization modes may take several
2232      * frames to initialize, the camera device will report the current mode
2233      * in capture result metadata. For example, When "ON" mode is requested,
2234      * the video stabilization modes in the first several capture results may
2235      * still be "OFF", and it will become "ON" when the initialization is
2236      * done.</p>
2237      * <p>In addition, not all recording sizes or frame rates may be supported for
2238      * stabilization by a device that reports stabilization support. It is guaranteed
2239      * that an output targeting a MediaRecorder or MediaCodec will be stabilized if
2240      * the recording resolution is less than or equal to 1920 x 1080 (width less than
2241      * or equal to 1920, height less than or equal to 1080), and the recording
2242      * frame rate is less than or equal to 30fps.  At other sizes, the CaptureResult
2243      * {@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode} field will return
2244      * OFF if the recording output is not stabilized, or if there are no output
2245      * Surface types that can be stabilized.</p>
2246      * <p>If a camera device supports both this mode and OIS
2247      * ({@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode}), turning both modes on may
2248      * produce undesirable interaction, so it is recommended not to enable
2249      * both at the same time.</p>
2250      * <p><b>Possible values:</b>
2251      * <ul>
2252      *   <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_OFF OFF}</li>
2253      *   <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_ON ON}</li>
2254      * </ul></p>
2255      * <p>This key is available on all devices.</p>
2256      *
2257      * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
2258      * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE
2259      * @see CaptureRequest#SCALER_CROP_REGION
2260      * @see #CONTROL_VIDEO_STABILIZATION_MODE_OFF
2261      * @see #CONTROL_VIDEO_STABILIZATION_MODE_ON
2262      */
2263     @PublicKey
2264     @NonNull
2265     public static final Key<Integer> CONTROL_VIDEO_STABILIZATION_MODE =
2266             new Key<Integer>("android.control.videoStabilizationMode", int.class);
2267 
2268     /**
2269      * <p>The amount of additional sensitivity boost applied to output images
2270      * after RAW sensor data is captured.</p>
2271      * <p>Some camera devices support additional digital sensitivity boosting in the
2272      * camera processing pipeline after sensor RAW image is captured.
2273      * Such a boost will be applied to YUV/JPEG format output images but will not
2274      * have effect on RAW output formats like RAW_SENSOR, RAW10, RAW12 or RAW_OPAQUE.</p>
2275      * <p>This key will be <code>null</code> for devices that do not support any RAW format
2276      * outputs. For devices that do support RAW format outputs, this key will always
2277      * present, and if a device does not support post RAW sensitivity boost, it will
2278      * list <code>100</code> in this key.</p>
2279      * <p>If the camera device cannot apply the exact boost requested, it will reduce the
2280      * boost to the nearest supported value.
2281      * The final boost value used will be available in the output capture result.</p>
2282      * <p>For devices that support post RAW sensitivity boost, the YUV/JPEG output images
2283      * of such device will have the total sensitivity of
2284      * <code>{@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} * {@link CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST android.control.postRawSensitivityBoost} / 100</code>
2285      * The sensitivity of RAW format images will always be <code>{@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</code></p>
2286      * <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
2287      * OFF; otherwise the auto-exposure algorithm will override this value.</p>
2288      * <p><b>Units</b>: ISO arithmetic units, the same as {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</p>
2289      * <p><b>Range of valid values:</b><br>
2290      * {@link CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE android.control.postRawSensitivityBoostRange}</p>
2291      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2292      *
2293      * @see CaptureRequest#CONTROL_AE_MODE
2294      * @see CaptureRequest#CONTROL_MODE
2295      * @see CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST
2296      * @see CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE
2297      * @see CaptureRequest#SENSOR_SENSITIVITY
2298      */
2299     @PublicKey
2300     @NonNull
2301     public static final Key<Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST =
2302             new Key<Integer>("android.control.postRawSensitivityBoost", int.class);
2303 
2304     /**
2305      * <p>Allow camera device to enable zero-shutter-lag mode for requests with
2306      * {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE.</p>
2307      * <p>If enableZsl is <code>true</code>, the camera device may enable zero-shutter-lag mode for requests with
2308      * STILL_CAPTURE capture intent. The camera device may use images captured in the past to
2309      * produce output images for a zero-shutter-lag request. The result metadata including the
2310      * {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp} reflects the source frames used to produce output images.
2311      * Therefore, the contents of the output images and the result metadata may be out of order
2312      * compared to previous regular requests. enableZsl does not affect requests with other
2313      * capture intents.</p>
2314      * <p>For example, when requests are submitted in the following order:
2315      *   Request A: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is PREVIEW
2316      *   Request B: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is STILL_CAPTURE</p>
2317      * <p>The output images for request B may have contents captured before the output images for
2318      * request A, and the result metadata for request B may be older than the result metadata for
2319      * request A.</p>
2320      * <p>Note that when enableZsl is <code>true</code>, it is not guaranteed to get output images captured in
2321      * the past for requests with STILL_CAPTURE capture intent.</p>
2322      * <p>For applications targeting SDK versions O and newer, the value of enableZsl in
2323      * TEMPLATE_STILL_CAPTURE template may be <code>true</code>. The value in other templates is always
2324      * <code>false</code> if present.</p>
2325      * <p>For applications targeting SDK versions older than O, the value of enableZsl in all
2326      * capture templates is always <code>false</code> if present.</p>
2327      * <p>For application-operated ZSL, use CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG template.</p>
2328      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2329      *
2330      * @see CaptureRequest#CONTROL_CAPTURE_INTENT
2331      * @see CaptureResult#SENSOR_TIMESTAMP
2332      */
2333     @PublicKey
2334     @NonNull
2335     public static final Key<Boolean> CONTROL_ENABLE_ZSL =
2336             new Key<Boolean>("android.control.enableZsl", boolean.class);
2337 
2338     /**
2339      * <p>Whether a significant scene change is detected within the currently-set AF
2340      * region(s).</p>
2341      * <p>When the camera focus routine detects a change in the scene it is looking at,
2342      * such as a large shift in camera viewpoint, significant motion in the scene, or a
2343      * significant illumination change, this value will be set to DETECTED for a single capture
2344      * result. Otherwise the value will be NOT_DETECTED. The threshold for detection is similar
2345      * to what would trigger a new passive focus scan to begin in CONTINUOUS autofocus modes.</p>
2346      * <p>This key will be available if the camera device advertises this key via {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureResultKeys }.</p>
2347      * <p><b>Possible values:</b>
2348      * <ul>
2349      *   <li>{@link #CONTROL_AF_SCENE_CHANGE_NOT_DETECTED NOT_DETECTED}</li>
2350      *   <li>{@link #CONTROL_AF_SCENE_CHANGE_DETECTED DETECTED}</li>
2351      * </ul></p>
2352      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2353      * @see #CONTROL_AF_SCENE_CHANGE_NOT_DETECTED
2354      * @see #CONTROL_AF_SCENE_CHANGE_DETECTED
2355      */
2356     @PublicKey
2357     @NonNull
2358     public static final Key<Integer> CONTROL_AF_SCENE_CHANGE =
2359             new Key<Integer>("android.control.afSceneChange", int.class);
2360 
2361     /**
2362      * <p>Whether extended scene mode is enabled for a particular capture request.</p>
2363      * <p>With bokeh mode, the camera device may blur out the parts of scene that are not in
2364      * focus, creating a bokeh (or shallow depth of field) effect for people or objects.</p>
2365      * <p>When set to BOKEH_STILL_CAPTURE mode with STILL_CAPTURE capture intent, due to the extra
2366      * processing needed for high quality bokeh effect, the stall may be longer than when
2367      * capture intent is not STILL_CAPTURE.</p>
2368      * <p>When set to BOKEH_STILL_CAPTURE mode with PREVIEW capture intent,</p>
2369      * <ul>
2370      * <li>If the camera device has BURST_CAPTURE capability, the frame rate requirement of
2371      * BURST_CAPTURE must still be met.</li>
2372      * <li>All streams not larger than the maximum streaming dimension for BOKEH_STILL_CAPTURE mode
2373      * (queried via {@link android.hardware.camera2.CameraCharacteristics#CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_CAPABILITIES })
2374      * will have preview bokeh effect applied.</li>
2375      * </ul>
2376      * <p>When set to BOKEH_CONTINUOUS mode, configured streams dimension should not exceed this mode's
2377      * maximum streaming dimension in order to have bokeh effect applied. Bokeh effect may not
2378      * be available for streams larger than the maximum streaming dimension.</p>
2379      * <p>Switching between different extended scene modes may involve reconfiguration of the camera
2380      * pipeline, resulting in long latency. The application should check this key against the
2381      * available session keys queried via
2382      * {@link android.hardware.camera2.CameraCharacteristics#getAvailableSessionKeys }.</p>
2383      * <p>For a logical multi-camera, bokeh may be implemented by stereo vision from sub-cameras
2384      * with different field of view. As a result, when bokeh mode is enabled, the camera device
2385      * may override {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, and the field of
2386      * view may be smaller than when bokeh mode is off.</p>
2387      * <p><b>Possible values:</b>
2388      * <ul>
2389      *   <li>{@link #CONTROL_EXTENDED_SCENE_MODE_DISABLED DISABLED}</li>
2390      *   <li>{@link #CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE BOKEH_STILL_CAPTURE}</li>
2391      *   <li>{@link #CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS BOKEH_CONTINUOUS}</li>
2392      * </ul></p>
2393      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2394      *
2395      * @see CaptureRequest#CONTROL_ZOOM_RATIO
2396      * @see CaptureRequest#SCALER_CROP_REGION
2397      * @see #CONTROL_EXTENDED_SCENE_MODE_DISABLED
2398      * @see #CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE
2399      * @see #CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS
2400      */
2401     @PublicKey
2402     @NonNull
2403     public static final Key<Integer> CONTROL_EXTENDED_SCENE_MODE =
2404             new Key<Integer>("android.control.extendedSceneMode", int.class);
2405 
2406     /**
2407      * <p>The desired zoom ratio</p>
2408      * <p>Instead of using {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} with dual purposes of crop and zoom, the
2409      * application can now choose to use this tag to specify the desired zoom level. The
2410      * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} can still be used to specify the horizontal or vertical
2411      * crop to achieve aspect ratios different than the native camera sensor.</p>
2412      * <p>By using this control, the application gains a simpler way to control zoom, which can
2413      * be a combination of optical and digital zoom. For example, a multi-camera system may
2414      * contain more than one lens with different focal lengths, and the user can use optical
2415      * zoom by switching between lenses. Using zoomRatio has benefits in the scenarios below:</p>
2416      * <ul>
2417      * <li>Zooming in from a wide-angle lens to a telephoto lens: A floating-point ratio provides
2418      *   better precision compared to an integer value of {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}.</li>
2419      * <li>Zooming out from a wide lens to an ultrawide lens: zoomRatio supports zoom-out whereas
2420      *   {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} doesn't.</li>
2421      * </ul>
2422      * <p>To illustrate, here are several scenarios of different zoom ratios, crop regions,
2423      * and output streams, for a hypothetical camera device with an active array of size
2424      * <code>(2000,1500)</code>.</p>
2425      * <ul>
2426      * <li>Camera Configuration:<ul>
2427      * <li>Active array size: <code>2000x1500</code> (3 MP, 4:3 aspect ratio)</li>
2428      * <li>Output stream #1: <code>640x480</code> (VGA, 4:3 aspect ratio)</li>
2429      * <li>Output stream #2: <code>1280x720</code> (720p, 16:9 aspect ratio)</li>
2430      * </ul>
2431      * </li>
2432      * <li>Case #1: 4:3 crop region with 2.0x zoom ratio<ul>
2433      * <li>Zoomed field of view: 1/4 of original field of view</li>
2434      * <li>Crop region: <code>Rect(0, 0, 2000, 1500) // (left, top, right, bottom)</code> (post zoom)</li>
2435      * </ul>
2436      * </li>
2437      * <li><img alt="4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-2-crop-43.png" /><ul>
2438      * <li><code>640x480</code> stream source area: <code>(0, 0, 2000, 1500)</code> (equal to crop region)</li>
2439      * <li><code>1280x720</code> stream source area: <code>(0, 187, 2000, 1312)</code> (letterboxed)</li>
2440      * </ul>
2441      * </li>
2442      * <li>Case #2: 16:9 crop region with 2.0x zoom.<ul>
2443      * <li>Zoomed field of view: 1/4 of original field of view</li>
2444      * <li>Crop region: <code>Rect(0, 187, 2000, 1312)</code></li>
2445      * <li><img alt="16:9 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-2-crop-169.png" /></li>
2446      * <li><code>640x480</code> stream source area: <code>(250, 187, 1750, 1312)</code> (pillarboxed)</li>
2447      * <li><code>1280x720</code> stream source area: <code>(0, 187, 2000, 1312)</code> (equal to crop region)</li>
2448      * </ul>
2449      * </li>
2450      * <li>Case #3: 1:1 crop region with 0.5x zoom out to ultrawide lens.<ul>
2451      * <li>Zoomed field of view: 4x of original field of view (switched from wide lens to ultrawide lens)</li>
2452      * <li>Crop region: <code>Rect(250, 0, 1750, 1500)</code></li>
2453      * <li><img alt="1:1 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-0.5-crop-11.png" /></li>
2454      * <li><code>640x480</code> stream source area: <code>(250, 187, 1750, 1312)</code> (letterboxed)</li>
2455      * <li><code>1280x720</code> stream source area: <code>(250, 328, 1750, 1172)</code> (letterboxed)</li>
2456      * </ul>
2457      * </li>
2458      * </ul>
2459      * <p>As seen from the graphs above, the coordinate system of cropRegion now changes to the
2460      * effective after-zoom field-of-view, and is represented by the rectangle of (0, 0,
2461      * activeArrayWith, activeArrayHeight). The same applies to AE/AWB/AF regions, and faces.
2462      * This coordinate system change isn't applicable to RAW capture and its related
2463      * metadata such as intrinsicCalibration and lensShadingMap.</p>
2464      * <p>Using the same hypothetical example above, and assuming output stream #1 (640x480) is
2465      * the viewfinder stream, the application can achieve 2.0x zoom in one of two ways:</p>
2466      * <ul>
2467      * <li>zoomRatio = 2.0, scaler.cropRegion = (0, 0, 2000, 1500)</li>
2468      * <li>zoomRatio = 1.0 (default), scaler.cropRegion = (500, 375, 1500, 1125)</li>
2469      * </ul>
2470      * <p>If the application intends to set aeRegions to be top-left quarter of the viewfinder
2471      * field-of-view, the {@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions} should be set to (0, 0, 1000, 750) with
2472      * zoomRatio set to 2.0. Alternatively, the application can set aeRegions to the equivalent
2473      * region of (500, 375, 1000, 750) for zoomRatio of 1.0. If the application doesn't
2474      * explicitly set {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, its value defaults to 1.0.</p>
2475      * <p>One limitation of controlling zoom using zoomRatio is that the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}
2476      * must only be used for letterboxing or pillarboxing of the sensor active array, and no
2477      * FREEFORM cropping can be used with {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} other than 1.0.</p>
2478      * <p><b>Range of valid values:</b><br>
2479      * {@link CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE android.control.zoomRatioRange}</p>
2480      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2481      * <p><b>Limited capability</b> -
2482      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2483      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2484      *
2485      * @see CaptureRequest#CONTROL_AE_REGIONS
2486      * @see CaptureRequest#CONTROL_ZOOM_RATIO
2487      * @see CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE
2488      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2489      * @see CaptureRequest#SCALER_CROP_REGION
2490      */
2491     @PublicKey
2492     @NonNull
2493     public static final Key<Float> CONTROL_ZOOM_RATIO =
2494             new Key<Float>("android.control.zoomRatio", float.class);
2495 
2496     /**
2497      * <p>Operation mode for edge
2498      * enhancement.</p>
2499      * <p>Edge enhancement improves sharpness and details in the captured image. OFF means
2500      * no enhancement will be applied by the camera device.</p>
2501      * <p>FAST/HIGH_QUALITY both mean camera device determined enhancement
2502      * will be applied. HIGH_QUALITY mode indicates that the
2503      * camera device will use the highest-quality enhancement algorithms,
2504      * even if it slows down capture rate. FAST means the camera device will
2505      * not slow down capture rate when applying edge enhancement. FAST may be the same as OFF if
2506      * edge enhancement will slow down capture rate. Every output stream will have a similar
2507      * amount of enhancement applied.</p>
2508      * <p>ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular
2509      * buffer of high-resolution images during preview and reprocess image(s) from that buffer
2510      * into a final capture when triggered by the user. In this mode, the camera device applies
2511      * edge enhancement to low-resolution streams (below maximum recording resolution) to
2512      * maximize preview quality, but does not apply edge enhancement to high-resolution streams,
2513      * since those will be reprocessed later if necessary.</p>
2514      * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera
2515      * device will apply FAST/HIGH_QUALITY YUV-domain edge enhancement, respectively.
2516      * The camera device may adjust its internal edge enhancement parameters for best
2517      * image quality based on the {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor}, if it is set.</p>
2518      * <p><b>Possible values:</b>
2519      * <ul>
2520      *   <li>{@link #EDGE_MODE_OFF OFF}</li>
2521      *   <li>{@link #EDGE_MODE_FAST FAST}</li>
2522      *   <li>{@link #EDGE_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
2523      *   <li>{@link #EDGE_MODE_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li>
2524      * </ul></p>
2525      * <p><b>Available values for this device:</b><br>
2526      * {@link CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES android.edge.availableEdgeModes}</p>
2527      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2528      * <p><b>Full capability</b> -
2529      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2530      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2531      *
2532      * @see CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES
2533      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2534      * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR
2535      * @see #EDGE_MODE_OFF
2536      * @see #EDGE_MODE_FAST
2537      * @see #EDGE_MODE_HIGH_QUALITY
2538      * @see #EDGE_MODE_ZERO_SHUTTER_LAG
2539      */
2540     @PublicKey
2541     @NonNull
2542     public static final Key<Integer> EDGE_MODE =
2543             new Key<Integer>("android.edge.mode", int.class);
2544 
2545     /**
2546      * <p>The desired mode for for the camera device's flash control.</p>
2547      * <p>This control is only effective when flash unit is available
2548      * (<code>{@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} == true</code>).</p>
2549      * <p>When this control is used, the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} must be set to ON or OFF.
2550      * Otherwise, the camera device auto-exposure related flash control (ON_AUTO_FLASH,
2551      * ON_ALWAYS_FLASH, or ON_AUTO_FLASH_REDEYE) will override this control.</p>
2552      * <p>When set to OFF, the camera device will not fire flash for this capture.</p>
2553      * <p>When set to SINGLE, the camera device will fire flash regardless of the camera
2554      * device's auto-exposure routine's result. When used in still capture case, this
2555      * control should be used along with auto-exposure (AE) precapture metering sequence
2556      * ({@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}), otherwise, the image may be incorrectly exposed.</p>
2557      * <p>When set to TORCH, the flash will be on continuously. This mode can be used
2558      * for use cases such as preview, auto-focus assist, still capture, or video recording.</p>
2559      * <p>The flash status will be reported by {@link CaptureResult#FLASH_STATE android.flash.state} in the capture result metadata.</p>
2560      * <p><b>Possible values:</b>
2561      * <ul>
2562      *   <li>{@link #FLASH_MODE_OFF OFF}</li>
2563      *   <li>{@link #FLASH_MODE_SINGLE SINGLE}</li>
2564      *   <li>{@link #FLASH_MODE_TORCH TORCH}</li>
2565      * </ul></p>
2566      * <p>This key is available on all devices.</p>
2567      *
2568      * @see CaptureRequest#CONTROL_AE_MODE
2569      * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
2570      * @see CameraCharacteristics#FLASH_INFO_AVAILABLE
2571      * @see CaptureResult#FLASH_STATE
2572      * @see #FLASH_MODE_OFF
2573      * @see #FLASH_MODE_SINGLE
2574      * @see #FLASH_MODE_TORCH
2575      */
2576     @PublicKey
2577     @NonNull
2578     public static final Key<Integer> FLASH_MODE =
2579             new Key<Integer>("android.flash.mode", int.class);
2580 
2581     /**
2582      * <p>Current state of the flash
2583      * unit.</p>
2584      * <p>When the camera device doesn't have flash unit
2585      * (i.e. <code>{@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} == false</code>), this state will always be UNAVAILABLE.
2586      * Other states indicate the current flash status.</p>
2587      * <p>In certain conditions, this will be available on LEGACY devices:</p>
2588      * <ul>
2589      * <li>Flash-less cameras always return UNAVAILABLE.</li>
2590      * <li>Using {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>==</code> ON_ALWAYS_FLASH
2591      *    will always return FIRED.</li>
2592      * <li>Using {@link CaptureRequest#FLASH_MODE android.flash.mode} <code>==</code> TORCH
2593      *    will always return FIRED.</li>
2594      * </ul>
2595      * <p>In all other conditions the state will not be available on
2596      * LEGACY devices (i.e. it will be <code>null</code>).</p>
2597      * <p><b>Possible values:</b>
2598      * <ul>
2599      *   <li>{@link #FLASH_STATE_UNAVAILABLE UNAVAILABLE}</li>
2600      *   <li>{@link #FLASH_STATE_CHARGING CHARGING}</li>
2601      *   <li>{@link #FLASH_STATE_READY READY}</li>
2602      *   <li>{@link #FLASH_STATE_FIRED FIRED}</li>
2603      *   <li>{@link #FLASH_STATE_PARTIAL PARTIAL}</li>
2604      * </ul></p>
2605      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2606      * <p><b>Limited capability</b> -
2607      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2608      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2609      *
2610      * @see CaptureRequest#CONTROL_AE_MODE
2611      * @see CameraCharacteristics#FLASH_INFO_AVAILABLE
2612      * @see CaptureRequest#FLASH_MODE
2613      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2614      * @see #FLASH_STATE_UNAVAILABLE
2615      * @see #FLASH_STATE_CHARGING
2616      * @see #FLASH_STATE_READY
2617      * @see #FLASH_STATE_FIRED
2618      * @see #FLASH_STATE_PARTIAL
2619      */
2620     @PublicKey
2621     @NonNull
2622     public static final Key<Integer> FLASH_STATE =
2623             new Key<Integer>("android.flash.state", int.class);
2624 
2625     /**
2626      * <p>Operational mode for hot pixel correction.</p>
2627      * <p>Hotpixel correction interpolates out, or otherwise removes, pixels
2628      * that do not accurately measure the incoming light (i.e. pixels that
2629      * are stuck at an arbitrary value or are oversensitive).</p>
2630      * <p><b>Possible values:</b>
2631      * <ul>
2632      *   <li>{@link #HOT_PIXEL_MODE_OFF OFF}</li>
2633      *   <li>{@link #HOT_PIXEL_MODE_FAST FAST}</li>
2634      *   <li>{@link #HOT_PIXEL_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
2635      * </ul></p>
2636      * <p><b>Available values for this device:</b><br>
2637      * {@link CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES android.hotPixel.availableHotPixelModes}</p>
2638      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2639      *
2640      * @see CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES
2641      * @see #HOT_PIXEL_MODE_OFF
2642      * @see #HOT_PIXEL_MODE_FAST
2643      * @see #HOT_PIXEL_MODE_HIGH_QUALITY
2644      */
2645     @PublicKey
2646     @NonNull
2647     public static final Key<Integer> HOT_PIXEL_MODE =
2648             new Key<Integer>("android.hotPixel.mode", int.class);
2649 
2650     /**
2651      * <p>A location object to use when generating image GPS metadata.</p>
2652      * <p>Setting a location object in a request will include the GPS coordinates of the location
2653      * into any JPEG images captured based on the request. These coordinates can then be
2654      * viewed by anyone who receives the JPEG image.</p>
2655      * <p>This tag is also used for HEIC image capture.</p>
2656      * <p>This key is available on all devices.</p>
2657      */
2658     @PublicKey
2659     @NonNull
2660     @SyntheticKey
2661     public static final Key<android.location.Location> JPEG_GPS_LOCATION =
2662             new Key<android.location.Location>("android.jpeg.gpsLocation", android.location.Location.class);
2663 
2664     /**
2665      * <p>GPS coordinates to include in output JPEG
2666      * EXIF.</p>
2667      * <p>This tag is also used for HEIC image capture.</p>
2668      * <p><b>Range of valid values:</b><br>
2669      * (-180 - 180], [-90,90], [-inf, inf]</p>
2670      * <p>This key is available on all devices.</p>
2671      * @hide
2672      */
2673     public static final Key<double[]> JPEG_GPS_COORDINATES =
2674             new Key<double[]>("android.jpeg.gpsCoordinates", double[].class);
2675 
2676     /**
2677      * <p>32 characters describing GPS algorithm to
2678      * include in EXIF.</p>
2679      * <p>This tag is also used for HEIC image capture.</p>
2680      * <p>This key is available on all devices.</p>
2681      * @hide
2682      */
2683     public static final Key<String> JPEG_GPS_PROCESSING_METHOD =
2684             new Key<String>("android.jpeg.gpsProcessingMethod", String.class);
2685 
2686     /**
2687      * <p>Time GPS fix was made to include in
2688      * EXIF.</p>
2689      * <p>This tag is also used for HEIC image capture.</p>
2690      * <p><b>Units</b>: UTC in seconds since January 1, 1970</p>
2691      * <p>This key is available on all devices.</p>
2692      * @hide
2693      */
2694     public static final Key<Long> JPEG_GPS_TIMESTAMP =
2695             new Key<Long>("android.jpeg.gpsTimestamp", long.class);
2696 
2697     /**
2698      * <p>The orientation for a JPEG image.</p>
2699      * <p>The clockwise rotation angle in degrees, relative to the orientation
2700      * to the camera, that the JPEG picture needs to be rotated by, to be viewed
2701      * upright.</p>
2702      * <p>Camera devices may either encode this value into the JPEG EXIF header, or
2703      * rotate the image data to match this orientation. When the image data is rotated,
2704      * the thumbnail data will also be rotated.</p>
2705      * <p>Note that this orientation is relative to the orientation of the camera sensor, given
2706      * by {@link CameraCharacteristics#SENSOR_ORIENTATION android.sensor.orientation}.</p>
2707      * <p>To translate from the device orientation given by the Android sensor APIs for camera
2708      * sensors which are not EXTERNAL, the following sample code may be used:</p>
2709      * <pre><code>private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) {
2710      *     if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0;
2711      *     int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION);
2712      *
2713      *     // Round device orientation to a multiple of 90
2714      *     deviceOrientation = (deviceOrientation + 45) / 90 * 90;
2715      *
2716      *     // Reverse device orientation for front-facing cameras
2717      *     boolean facingFront = c.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT;
2718      *     if (facingFront) deviceOrientation = -deviceOrientation;
2719      *
2720      *     // Calculate desired JPEG orientation relative to camera orientation to make
2721      *     // the image upright relative to the device orientation
2722      *     int jpegOrientation = (sensorOrientation + deviceOrientation + 360) % 360;
2723      *
2724      *     return jpegOrientation;
2725      * }
2726      * </code></pre>
2727      * <p>For EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will
2728      * also be set to EXTERNAL. The above code is not relevant in such case.</p>
2729      * <p>This tag is also used to describe the orientation of the HEIC image capture, in which
2730      * case the rotation is reflected by
2731      * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by
2732      * rotating the image data itself.</p>
2733      * <p><b>Units</b>: Degrees in multiples of 90</p>
2734      * <p><b>Range of valid values:</b><br>
2735      * 0, 90, 180, 270</p>
2736      * <p>This key is available on all devices.</p>
2737      *
2738      * @see CameraCharacteristics#SENSOR_ORIENTATION
2739      */
2740     @PublicKey
2741     @NonNull
2742     public static final Key<Integer> JPEG_ORIENTATION =
2743             new Key<Integer>("android.jpeg.orientation", int.class);
2744 
2745     /**
2746      * <p>Compression quality of the final JPEG
2747      * image.</p>
2748      * <p>85-95 is typical usage range. This tag is also used to describe the quality
2749      * of the HEIC image capture.</p>
2750      * <p><b>Range of valid values:</b><br>
2751      * 1-100; larger is higher quality</p>
2752      * <p>This key is available on all devices.</p>
2753      */
2754     @PublicKey
2755     @NonNull
2756     public static final Key<Byte> JPEG_QUALITY =
2757             new Key<Byte>("android.jpeg.quality", byte.class);
2758 
2759     /**
2760      * <p>Compression quality of JPEG
2761      * thumbnail.</p>
2762      * <p>This tag is also used to describe the quality of the HEIC image capture.</p>
2763      * <p><b>Range of valid values:</b><br>
2764      * 1-100; larger is higher quality</p>
2765      * <p>This key is available on all devices.</p>
2766      */
2767     @PublicKey
2768     @NonNull
2769     public static final Key<Byte> JPEG_THUMBNAIL_QUALITY =
2770             new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
2771 
2772     /**
2773      * <p>Resolution of embedded JPEG thumbnail.</p>
2774      * <p>When set to (0, 0) value, the JPEG EXIF will not contain thumbnail,
2775      * but the captured JPEG will still be a valid image.</p>
2776      * <p>For best results, when issuing a request for a JPEG image, the thumbnail size selected
2777      * should have the same aspect ratio as the main JPEG output.</p>
2778      * <p>If the thumbnail image aspect ratio differs from the JPEG primary image aspect
2779      * ratio, the camera device creates the thumbnail by cropping it from the primary image.
2780      * For example, if the primary image has 4:3 aspect ratio, the thumbnail image has
2781      * 16:9 aspect ratio, the primary image will be cropped vertically (letterbox) to
2782      * generate the thumbnail image. The thumbnail image will always have a smaller Field
2783      * Of View (FOV) than the primary image when aspect ratios differ.</p>
2784      * <p>When an {@link CaptureRequest#JPEG_ORIENTATION android.jpeg.orientation} of non-zero degree is requested,
2785      * the camera device will handle thumbnail rotation in one of the following ways:</p>
2786      * <ul>
2787      * <li>Set the {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}
2788      *   and keep jpeg and thumbnail image data unrotated.</li>
2789      * <li>Rotate the jpeg and thumbnail image data and not set
2790      *   {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}. In this
2791      *   case, LIMITED or FULL hardware level devices will report rotated thumnail size in
2792      *   capture result, so the width and height will be interchanged if 90 or 270 degree
2793      *   orientation is requested. LEGACY device will always report unrotated thumbnail
2794      *   size.</li>
2795      * </ul>
2796      * <p>The tag is also used as thumbnail size for HEIC image format capture, in which case the
2797      * the thumbnail rotation is reflected by
2798      * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by
2799      * rotating the thumbnail data itself.</p>
2800      * <p><b>Range of valid values:</b><br>
2801      * {@link CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES android.jpeg.availableThumbnailSizes}</p>
2802      * <p>This key is available on all devices.</p>
2803      *
2804      * @see CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES
2805      * @see CaptureRequest#JPEG_ORIENTATION
2806      */
2807     @PublicKey
2808     @NonNull
2809     public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE =
2810             new Key<android.util.Size>("android.jpeg.thumbnailSize", android.util.Size.class);
2811 
2812     /**
2813      * <p>The desired lens aperture size, as a ratio of lens focal length to the
2814      * effective aperture diameter.</p>
2815      * <p>Setting this value is only supported on the camera devices that have a variable
2816      * aperture lens.</p>
2817      * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF,
2818      * this can be set along with {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
2819      * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}
2820      * to achieve manual exposure control.</p>
2821      * <p>The requested aperture value may take several frames to reach the
2822      * requested value; the camera device will report the current (intermediate)
2823      * aperture size in capture result metadata while the aperture is changing.
2824      * While the aperture is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p>
2825      * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is one of
2826      * the ON modes, this will be overridden by the camera device
2827      * auto-exposure algorithm, the overridden values are then provided
2828      * back to the user in the corresponding result.</p>
2829      * <p><b>Units</b>: The f-number (f/N)</p>
2830      * <p><b>Range of valid values:</b><br>
2831      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES android.lens.info.availableApertures}</p>
2832      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2833      * <p><b>Full capability</b> -
2834      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2835      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2836      *
2837      * @see CaptureRequest#CONTROL_AE_MODE
2838      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2839      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES
2840      * @see CaptureResult#LENS_STATE
2841      * @see CaptureRequest#SENSOR_EXPOSURE_TIME
2842      * @see CaptureRequest#SENSOR_FRAME_DURATION
2843      * @see CaptureRequest#SENSOR_SENSITIVITY
2844      */
2845     @PublicKey
2846     @NonNull
2847     public static final Key<Float> LENS_APERTURE =
2848             new Key<Float>("android.lens.aperture", float.class);
2849 
2850     /**
2851      * <p>The desired setting for the lens neutral density filter(s).</p>
2852      * <p>This control will not be supported on most camera devices.</p>
2853      * <p>Lens filters are typically used to lower the amount of light the
2854      * sensor is exposed to (measured in steps of EV). As used here, an EV
2855      * step is the standard logarithmic representation, which are
2856      * non-negative, and inversely proportional to the amount of light
2857      * hitting the sensor.  For example, setting this to 0 would result
2858      * in no reduction of the incoming light, and setting this to 2 would
2859      * mean that the filter is set to reduce incoming light by two stops
2860      * (allowing 1/4 of the prior amount of light to the sensor).</p>
2861      * <p>It may take several frames before the lens filter density changes
2862      * to the requested value. While the filter density is still changing,
2863      * {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p>
2864      * <p><b>Units</b>: Exposure Value (EV)</p>
2865      * <p><b>Range of valid values:</b><br>
2866      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES android.lens.info.availableFilterDensities}</p>
2867      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2868      * <p><b>Full capability</b> -
2869      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2870      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2871      *
2872      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2873      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES
2874      * @see CaptureResult#LENS_STATE
2875      */
2876     @PublicKey
2877     @NonNull
2878     public static final Key<Float> LENS_FILTER_DENSITY =
2879             new Key<Float>("android.lens.filterDensity", float.class);
2880 
2881     /**
2882      * <p>The desired lens focal length; used for optical zoom.</p>
2883      * <p>This setting controls the physical focal length of the camera
2884      * device's lens. Changing the focal length changes the field of
2885      * view of the camera device, and is usually used for optical zoom.</p>
2886      * <p>Like {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} and {@link CaptureRequest#LENS_APERTURE android.lens.aperture}, this
2887      * setting won't be applied instantaneously, and it may take several
2888      * frames before the lens can change to the requested focal length.
2889      * While the focal length is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will
2890      * be set to MOVING.</p>
2891      * <p>Optical zoom via this control will not be supported on most devices. Starting from API
2892      * level 30, the camera device may combine optical and digital zoom through the
2893      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} control.</p>
2894      * <p><b>Units</b>: Millimeters</p>
2895      * <p><b>Range of valid values:</b><br>
2896      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS android.lens.info.availableFocalLengths}</p>
2897      * <p>This key is available on all devices.</p>
2898      *
2899      * @see CaptureRequest#CONTROL_ZOOM_RATIO
2900      * @see CaptureRequest#LENS_APERTURE
2901      * @see CaptureRequest#LENS_FOCUS_DISTANCE
2902      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS
2903      * @see CaptureResult#LENS_STATE
2904      */
2905     @PublicKey
2906     @NonNull
2907     public static final Key<Float> LENS_FOCAL_LENGTH =
2908             new Key<Float>("android.lens.focalLength", float.class);
2909 
2910     /**
2911      * <p>Desired distance to plane of sharpest focus,
2912      * measured from frontmost surface of the lens.</p>
2913      * <p>Should be zero for fixed-focus cameras</p>
2914      * <p><b>Units</b>: See {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details</p>
2915      * <p><b>Range of valid values:</b><br>
2916      * &gt;= 0</p>
2917      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2918      * <p><b>Full capability</b> -
2919      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2920      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2921      *
2922      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2923      * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
2924      */
2925     @PublicKey
2926     @NonNull
2927     public static final Key<Float> LENS_FOCUS_DISTANCE =
2928             new Key<Float>("android.lens.focusDistance", float.class);
2929 
2930     /**
2931      * <p>The range of scene distances that are in
2932      * sharp focus (depth of field).</p>
2933      * <p>If variable focus not supported, can still report
2934      * fixed depth of field range</p>
2935      * <p><b>Units</b>: A pair of focus distances in diopters: (near,
2936      * far); see {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details.</p>
2937      * <p><b>Range of valid values:</b><br>
2938      * &gt;=0</p>
2939      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2940      * <p><b>Limited capability</b> -
2941      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2942      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2943      *
2944      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2945      * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
2946      */
2947     @PublicKey
2948     @NonNull
2949     public static final Key<android.util.Pair<Float,Float>> LENS_FOCUS_RANGE =
2950             new Key<android.util.Pair<Float,Float>>("android.lens.focusRange", new TypeReference<android.util.Pair<Float,Float>>() {{ }});
2951 
2952     /**
2953      * <p>Sets whether the camera device uses optical image stabilization (OIS)
2954      * when capturing images.</p>
2955      * <p>OIS is used to compensate for motion blur due to small
2956      * movements of the camera during capture. Unlike digital image
2957      * stabilization ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), OIS
2958      * makes use of mechanical elements to stabilize the camera
2959      * sensor, and thus allows for longer exposure times before
2960      * camera shake becomes apparent.</p>
2961      * <p>Switching between different optical stabilization modes may take several
2962      * frames to initialize, the camera device will report the current mode in
2963      * capture result metadata. For example, When "ON" mode is requested, the
2964      * optical stabilization modes in the first several capture results may still
2965      * be "OFF", and it will become "ON" when the initialization is done.</p>
2966      * <p>If a camera device supports both OIS and digital image stabilization
2967      * ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), turning both modes on may produce undesirable
2968      * interaction, so it is recommended not to enable both at the same time.</p>
2969      * <p>Not all devices will support OIS; see
2970      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization} for
2971      * available controls.</p>
2972      * <p><b>Possible values:</b>
2973      * <ul>
2974      *   <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_OFF OFF}</li>
2975      *   <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_ON ON}</li>
2976      * </ul></p>
2977      * <p><b>Available values for this device:</b><br>
2978      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization}</p>
2979      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2980      * <p><b>Limited capability</b> -
2981      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2982      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2983      *
2984      * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
2985      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2986      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION
2987      * @see #LENS_OPTICAL_STABILIZATION_MODE_OFF
2988      * @see #LENS_OPTICAL_STABILIZATION_MODE_ON
2989      */
2990     @PublicKey
2991     @NonNull
2992     public static final Key<Integer> LENS_OPTICAL_STABILIZATION_MODE =
2993             new Key<Integer>("android.lens.opticalStabilizationMode", int.class);
2994 
2995     /**
2996      * <p>Current lens status.</p>
2997      * <p>For lens parameters {@link CaptureRequest#LENS_FOCAL_LENGTH android.lens.focalLength}, {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance},
2998      * {@link CaptureRequest#LENS_FILTER_DENSITY android.lens.filterDensity} and {@link CaptureRequest#LENS_APERTURE android.lens.aperture}, when changes are requested,
2999      * they may take several frames to reach the requested values. This state indicates
3000      * the current status of the lens parameters.</p>
3001      * <p>When the state is STATIONARY, the lens parameters are not changing. This could be
3002      * either because the parameters are all fixed, or because the lens has had enough
3003      * time to reach the most recently-requested values.
3004      * If all these lens parameters are not changable for a camera device, as listed below:</p>
3005      * <ul>
3006      * <li>Fixed focus (<code>{@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} == 0</code>), which means
3007      * {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} parameter will always be 0.</li>
3008      * <li>Fixed focal length ({@link CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS android.lens.info.availableFocalLengths} contains single value),
3009      * which means the optical zoom is not supported.</li>
3010      * <li>No ND filter ({@link CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES android.lens.info.availableFilterDensities} contains only 0).</li>
3011      * <li>Fixed aperture ({@link CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES android.lens.info.availableApertures} contains single value).</li>
3012      * </ul>
3013      * <p>Then this state will always be STATIONARY.</p>
3014      * <p>When the state is MOVING, it indicates that at least one of the lens parameters
3015      * is changing.</p>
3016      * <p><b>Possible values:</b>
3017      * <ul>
3018      *   <li>{@link #LENS_STATE_STATIONARY STATIONARY}</li>
3019      *   <li>{@link #LENS_STATE_MOVING MOVING}</li>
3020      * </ul></p>
3021      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3022      * <p><b>Limited capability</b> -
3023      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
3024      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3025      *
3026      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3027      * @see CaptureRequest#LENS_APERTURE
3028      * @see CaptureRequest#LENS_FILTER_DENSITY
3029      * @see CaptureRequest#LENS_FOCAL_LENGTH
3030      * @see CaptureRequest#LENS_FOCUS_DISTANCE
3031      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES
3032      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES
3033      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS
3034      * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE
3035      * @see #LENS_STATE_STATIONARY
3036      * @see #LENS_STATE_MOVING
3037      */
3038     @PublicKey
3039     @NonNull
3040     public static final Key<Integer> LENS_STATE =
3041             new Key<Integer>("android.lens.state", int.class);
3042 
3043     /**
3044      * <p>The orientation of the camera relative to the sensor
3045      * coordinate system.</p>
3046      * <p>The four coefficients that describe the quaternion
3047      * rotation from the Android sensor coordinate system to a
3048      * camera-aligned coordinate system where the X-axis is
3049      * aligned with the long side of the image sensor, the Y-axis
3050      * is aligned with the short side of the image sensor, and
3051      * the Z-axis is aligned with the optical axis of the sensor.</p>
3052      * <p>To convert from the quaternion coefficients <code>(x,y,z,w)</code>
3053      * to the axis of rotation <code>(a_x, a_y, a_z)</code> and rotation
3054      * amount <code>theta</code>, the following formulas can be used:</p>
3055      * <pre><code> theta = 2 * acos(w)
3056      * a_x = x / sin(theta/2)
3057      * a_y = y / sin(theta/2)
3058      * a_z = z / sin(theta/2)
3059      * </code></pre>
3060      * <p>To create a 3x3 rotation matrix that applies the rotation
3061      * defined by this quaternion, the following matrix can be
3062      * used:</p>
3063      * <pre><code>R = [ 1 - 2y^2 - 2z^2,       2xy - 2zw,       2xz + 2yw,
3064      *            2xy + 2zw, 1 - 2x^2 - 2z^2,       2yz - 2xw,
3065      *            2xz - 2yw,       2yz + 2xw, 1 - 2x^2 - 2y^2 ]
3066      * </code></pre>
3067      * <p>This matrix can then be used to apply the rotation to a
3068      *  column vector point with</p>
3069      * <p><code>p' = Rp</code></p>
3070      * <p>where <code>p</code> is in the device sensor coordinate system, and
3071      *  <code>p'</code> is in the camera-oriented coordinate system.</p>
3072      * <p>If {@link CameraCharacteristics#LENS_POSE_REFERENCE android.lens.poseReference} is UNDEFINED, the quaternion rotation cannot
3073      *  be accurately represented by the camera device, and will be represented by
3074      *  default values matching its default facing.</p>
3075      * <p><b>Units</b>:
3076      * Quaternion coefficients</p>
3077      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3078      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
3079      *
3080      * @see CameraCharacteristics#LENS_POSE_REFERENCE
3081      */
3082     @PublicKey
3083     @NonNull
3084     public static final Key<float[]> LENS_POSE_ROTATION =
3085             new Key<float[]>("android.lens.poseRotation", float[].class);
3086 
3087     /**
3088      * <p>Position of the camera optical center.</p>
3089      * <p>The position of the camera device's lens optical center,
3090      * as a three-dimensional vector <code>(x,y,z)</code>.</p>
3091      * <p>Prior to Android P, or when {@link CameraCharacteristics#LENS_POSE_REFERENCE android.lens.poseReference} is PRIMARY_CAMERA, this position
3092      * is relative to the optical center of the largest camera device facing in the same
3093      * direction as this camera, in the {@link android.hardware.SensorEvent Android sensor
3094      * coordinate axes}. Note that only the axis definitions are shared with the sensor
3095      * coordinate system, but not the origin.</p>
3096      * <p>If this device is the largest or only camera device with a given facing, then this
3097      * position will be <code>(0, 0, 0)</code>; a camera device with a lens optical center located 3 cm
3098      * from the main sensor along the +X axis (to the right from the user's perspective) will
3099      * report <code>(0.03, 0, 0)</code>.  Note that this means that, for many computer vision
3100      * applications, the position needs to be negated to convert it to a translation from the
3101      * camera to the origin.</p>
3102      * <p>To transform a pixel coordinates between two cameras facing the same direction, first
3103      * the source camera {@link CameraCharacteristics#LENS_DISTORTION android.lens.distortion} must be corrected for.  Then the source
3104      * camera {@link CameraCharacteristics#LENS_INTRINSIC_CALIBRATION android.lens.intrinsicCalibration} needs to be applied, followed by the
3105      * {@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation} of the source camera, the translation of the source camera
3106      * relative to the destination camera, the {@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation} of the destination
3107      * camera, and finally the inverse of {@link CameraCharacteristics#LENS_INTRINSIC_CALIBRATION android.lens.intrinsicCalibration} of the destination
3108      * camera. This obtains a radial-distortion-free coordinate in the destination camera pixel
3109      * coordinates.</p>
3110      * <p>To compare this against a real image from the destination camera, the destination camera
3111      * image then needs to be corrected for radial distortion before comparison or sampling.</p>
3112      * <p>When {@link CameraCharacteristics#LENS_POSE_REFERENCE android.lens.poseReference} is GYROSCOPE, then this position is relative to
3113      * the center of the primary gyroscope on the device. The axis definitions are the same as
3114      * with PRIMARY_CAMERA.</p>
3115      * <p>When {@link CameraCharacteristics#LENS_POSE_REFERENCE android.lens.poseReference} is UNDEFINED, this position cannot be accurately
3116      * represented by the camera device, and will be represented as <code>(0, 0, 0)</code>.</p>
3117      * <p><b>Units</b>: Meters</p>
3118      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3119      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
3120      *
3121      * @see CameraCharacteristics#LENS_DISTORTION
3122      * @see CameraCharacteristics#LENS_INTRINSIC_CALIBRATION
3123      * @see CameraCharacteristics#LENS_POSE_REFERENCE
3124      * @see CameraCharacteristics#LENS_POSE_ROTATION
3125      */
3126     @PublicKey
3127     @NonNull
3128     public static final Key<float[]> LENS_POSE_TRANSLATION =
3129             new Key<float[]>("android.lens.poseTranslation", float[].class);
3130 
3131     /**
3132      * <p>The parameters for this camera device's intrinsic
3133      * calibration.</p>
3134      * <p>The five calibration parameters that describe the
3135      * transform from camera-centric 3D coordinates to sensor
3136      * pixel coordinates:</p>
3137      * <pre><code>[f_x, f_y, c_x, c_y, s]
3138      * </code></pre>
3139      * <p>Where <code>f_x</code> and <code>f_y</code> are the horizontal and vertical
3140      * focal lengths, <code>[c_x, c_y]</code> is the position of the optical
3141      * axis, and <code>s</code> is a skew parameter for the sensor plane not
3142      * being aligned with the lens plane.</p>
3143      * <p>These are typically used within a transformation matrix K:</p>
3144      * <pre><code>K = [ f_x,   s, c_x,
3145      *        0, f_y, c_y,
3146      *        0    0,   1 ]
3147      * </code></pre>
3148      * <p>which can then be combined with the camera pose rotation
3149      * <code>R</code> and translation <code>t</code> ({@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation} and
3150      * {@link CameraCharacteristics#LENS_POSE_TRANSLATION android.lens.poseTranslation}, respectively) to calculate the
3151      * complete transform from world coordinates to pixel
3152      * coordinates:</p>
3153      * <pre><code>P = [ K 0   * [ R -Rt
3154      *      0 1 ]      0 1 ]
3155      * </code></pre>
3156      * <p>(Note the negation of poseTranslation when mapping from camera
3157      * to world coordinates, and multiplication by the rotation).</p>
3158      * <p>With <code>p_w</code> being a point in the world coordinate system
3159      * and <code>p_s</code> being a point in the camera active pixel array
3160      * coordinate system, and with the mapping including the
3161      * homogeneous division by z:</p>
3162      * <pre><code> p_h = (x_h, y_h, z_h) = P p_w
3163      * p_s = p_h / z_h
3164      * </code></pre>
3165      * <p>so <code>[x_s, y_s]</code> is the pixel coordinates of the world
3166      * point, <code>z_s = 1</code>, and <code>w_s</code> is a measurement of disparity
3167      * (depth) in pixel coordinates.</p>
3168      * <p>Note that the coordinate system for this transform is the
3169      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} system,
3170      * where <code>(0,0)</code> is the top-left of the
3171      * preCorrectionActiveArraySize rectangle. Once the pose and
3172      * intrinsic calibration transforms have been applied to a
3173      * world point, then the {@link CameraCharacteristics#LENS_DISTORTION android.lens.distortion}
3174      * transform needs to be applied, and the result adjusted to
3175      * be in the {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} coordinate
3176      * system (where <code>(0, 0)</code> is the top-left of the
3177      * activeArraySize rectangle), to determine the final pixel
3178      * coordinate of the world point for processed (non-RAW)
3179      * output buffers.</p>
3180      * <p>For camera devices, the center of pixel <code>(x,y)</code> is located at
3181      * coordinate <code>(x + 0.5, y + 0.5)</code>.  So on a device with a
3182      * precorrection active array of size <code>(10,10)</code>, the valid pixel
3183      * indices go from <code>(0,0)-(9,9)</code>, and an perfectly-built camera would
3184      * have an optical center at the exact center of the pixel grid, at
3185      * coordinates <code>(5.0, 5.0)</code>, which is the top-left corner of pixel
3186      * <code>(5,5)</code>.</p>
3187      * <p><b>Units</b>:
3188      * Pixels in the
3189      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
3190      * coordinate system.</p>
3191      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3192      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
3193      *
3194      * @see CameraCharacteristics#LENS_DISTORTION
3195      * @see CameraCharacteristics#LENS_POSE_ROTATION
3196      * @see CameraCharacteristics#LENS_POSE_TRANSLATION
3197      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
3198      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
3199      */
3200     @PublicKey
3201     @NonNull
3202     public static final Key<float[]> LENS_INTRINSIC_CALIBRATION =
3203             new Key<float[]>("android.lens.intrinsicCalibration", float[].class);
3204 
3205     /**
3206      * <p>The correction coefficients to correct for this camera device's
3207      * radial and tangential lens distortion.</p>
3208      * <p>Four radial distortion coefficients <code>[kappa_0, kappa_1, kappa_2,
3209      * kappa_3]</code> and two tangential distortion coefficients
3210      * <code>[kappa_4, kappa_5]</code> that can be used to correct the
3211      * lens's geometric distortion with the mapping equations:</p>
3212      * <pre><code> x_c = x_i * ( kappa_0 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
3213      *        kappa_4 * (2 * x_i * y_i) + kappa_5 * ( r^2 + 2 * x_i^2 )
3214      *  y_c = y_i * ( kappa_0 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
3215      *        kappa_5 * (2 * x_i * y_i) + kappa_4 * ( r^2 + 2 * y_i^2 )
3216      * </code></pre>
3217      * <p>Here, <code>[x_c, y_c]</code> are the coordinates to sample in the
3218      * input image that correspond to the pixel values in the
3219      * corrected image at the coordinate <code>[x_i, y_i]</code>:</p>
3220      * <pre><code> correctedImage(x_i, y_i) = sample_at(x_c, y_c, inputImage)
3221      * </code></pre>
3222      * <p>The pixel coordinates are defined in a normalized
3223      * coordinate system related to the
3224      * {@link CameraCharacteristics#LENS_INTRINSIC_CALIBRATION android.lens.intrinsicCalibration} calibration fields.
3225      * Both <code>[x_i, y_i]</code> and <code>[x_c, y_c]</code> have <code>(0,0)</code> at the
3226      * lens optical center <code>[c_x, c_y]</code>. The maximum magnitudes
3227      * of both x and y coordinates are normalized to be 1 at the
3228      * edge further from the optical center, so the range
3229      * for both dimensions is <code>-1 &lt;= x &lt;= 1</code>.</p>
3230      * <p>Finally, <code>r</code> represents the radial distance from the
3231      * optical center, <code>r^2 = x_i^2 + y_i^2</code>, and its magnitude
3232      * is therefore no larger than <code>|r| &lt;= sqrt(2)</code>.</p>
3233      * <p>The distortion model used is the Brown-Conrady model.</p>
3234      * <p><b>Units</b>:
3235      * Unitless coefficients.</p>
3236      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3237      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
3238      *
3239      * @see CameraCharacteristics#LENS_INTRINSIC_CALIBRATION
3240      * @deprecated
3241      * <p>This field was inconsistently defined in terms of its
3242      * normalization. Use {@link CameraCharacteristics#LENS_DISTORTION android.lens.distortion} instead.</p>
3243      *
3244      * @see CameraCharacteristics#LENS_DISTORTION
3245 
3246      */
3247     @Deprecated
3248     @PublicKey
3249     @NonNull
3250     public static final Key<float[]> LENS_RADIAL_DISTORTION =
3251             new Key<float[]>("android.lens.radialDistortion", float[].class);
3252 
3253     /**
3254      * <p>The correction coefficients to correct for this camera device's
3255      * radial and tangential lens distortion.</p>
3256      * <p>Replaces the deprecated {@link CameraCharacteristics#LENS_RADIAL_DISTORTION android.lens.radialDistortion} field, which was
3257      * inconsistently defined.</p>
3258      * <p>Three radial distortion coefficients <code>[kappa_1, kappa_2,
3259      * kappa_3]</code> and two tangential distortion coefficients
3260      * <code>[kappa_4, kappa_5]</code> that can be used to correct the
3261      * lens's geometric distortion with the mapping equations:</p>
3262      * <pre><code> x_c = x_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
3263      *        kappa_4 * (2 * x_i * y_i) + kappa_5 * ( r^2 + 2 * x_i^2 )
3264      *  y_c = y_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
3265      *        kappa_5 * (2 * x_i * y_i) + kappa_4 * ( r^2 + 2 * y_i^2 )
3266      * </code></pre>
3267      * <p>Here, <code>[x_c, y_c]</code> are the coordinates to sample in the
3268      * input image that correspond to the pixel values in the
3269      * corrected image at the coordinate <code>[x_i, y_i]</code>:</p>
3270      * <pre><code> correctedImage(x_i, y_i) = sample_at(x_c, y_c, inputImage)
3271      * </code></pre>
3272      * <p>The pixel coordinates are defined in a coordinate system
3273      * related to the {@link CameraCharacteristics#LENS_INTRINSIC_CALIBRATION android.lens.intrinsicCalibration}
3274      * calibration fields; see that entry for details of the mapping stages.
3275      * Both <code>[x_i, y_i]</code> and <code>[x_c, y_c]</code>
3276      * have <code>(0,0)</code> at the lens optical center <code>[c_x, c_y]</code>, and
3277      * the range of the coordinates depends on the focal length
3278      * terms of the intrinsic calibration.</p>
3279      * <p>Finally, <code>r</code> represents the radial distance from the
3280      * optical center, <code>r^2 = x_i^2 + y_i^2</code>.</p>
3281      * <p>The distortion model used is the Brown-Conrady model.</p>
3282      * <p><b>Units</b>:
3283      * Unitless coefficients.</p>
3284      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3285      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
3286      *
3287      * @see CameraCharacteristics#LENS_INTRINSIC_CALIBRATION
3288      * @see CameraCharacteristics#LENS_RADIAL_DISTORTION
3289      */
3290     @PublicKey
3291     @NonNull
3292     public static final Key<float[]> LENS_DISTORTION =
3293             new Key<float[]>("android.lens.distortion", float[].class);
3294 
3295     /**
3296      * <p>Mode of operation for the noise reduction algorithm.</p>
3297      * <p>The noise reduction algorithm attempts to improve image quality by removing
3298      * excessive noise added by the capture process, especially in dark conditions.</p>
3299      * <p>OFF means no noise reduction will be applied by the camera device, for both raw and
3300      * YUV domain.</p>
3301      * <p>MINIMAL means that only sensor raw domain basic noise reduction is enabled ,to remove
3302      * demosaicing or other processing artifacts. For YUV_REPROCESSING, MINIMAL is same as OFF.
3303      * This mode is optional, may not be support by all devices. The application should check
3304      * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes} before using it.</p>
3305      * <p>FAST/HIGH_QUALITY both mean camera device determined noise filtering
3306      * will be applied. HIGH_QUALITY mode indicates that the camera device
3307      * will use the highest-quality noise filtering algorithms,
3308      * even if it slows down capture rate. FAST means the camera device will not
3309      * slow down capture rate when applying noise filtering. FAST may be the same as MINIMAL if
3310      * MINIMAL is listed, or the same as OFF if any noise filtering will slow down capture rate.
3311      * Every output stream will have a similar amount of enhancement applied.</p>
3312      * <p>ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular
3313      * buffer of high-resolution images during preview and reprocess image(s) from that buffer
3314      * into a final capture when triggered by the user. In this mode, the camera device applies
3315      * noise reduction to low-resolution streams (below maximum recording resolution) to maximize
3316      * preview quality, but does not apply noise reduction to high-resolution streams, since
3317      * those will be reprocessed later if necessary.</p>
3318      * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera device
3319      * will apply FAST/HIGH_QUALITY YUV domain noise reduction, respectively. The camera device
3320      * may adjust the noise reduction parameters for best image quality based on the
3321      * {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor} if it is set.</p>
3322      * <p><b>Possible values:</b>
3323      * <ul>
3324      *   <li>{@link #NOISE_REDUCTION_MODE_OFF OFF}</li>
3325      *   <li>{@link #NOISE_REDUCTION_MODE_FAST FAST}</li>
3326      *   <li>{@link #NOISE_REDUCTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
3327      *   <li>{@link #NOISE_REDUCTION_MODE_MINIMAL MINIMAL}</li>
3328      *   <li>{@link #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li>
3329      * </ul></p>
3330      * <p><b>Available values for this device:</b><br>
3331      * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}</p>
3332      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3333      * <p><b>Full capability</b> -
3334      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3335      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3336      *
3337      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3338      * @see CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES
3339      * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR
3340      * @see #NOISE_REDUCTION_MODE_OFF
3341      * @see #NOISE_REDUCTION_MODE_FAST
3342      * @see #NOISE_REDUCTION_MODE_HIGH_QUALITY
3343      * @see #NOISE_REDUCTION_MODE_MINIMAL
3344      * @see #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG
3345      */
3346     @PublicKey
3347     @NonNull
3348     public static final Key<Integer> NOISE_REDUCTION_MODE =
3349             new Key<Integer>("android.noiseReduction.mode", int.class);
3350 
3351     /**
3352      * <p>Whether a result given to the framework is the
3353      * final one for the capture, or only a partial that contains a
3354      * subset of the full set of dynamic metadata
3355      * values.</p>
3356      * <p>The entries in the result metadata buffers for a
3357      * single capture may not overlap, except for this entry. The
3358      * FINAL buffers must retain FIFO ordering relative to the
3359      * requests that generate them, so the FINAL buffer for frame 3 must
3360      * always be sent to the framework after the FINAL buffer for frame 2, and
3361      * before the FINAL buffer for frame 4. PARTIAL buffers may be returned
3362      * in any order relative to other frames, but all PARTIAL buffers for a given
3363      * capture must arrive before the FINAL buffer for that capture. This entry may
3364      * only be used by the camera device if quirks.usePartialResult is set to 1.</p>
3365      * <p><b>Range of valid values:</b><br>
3366      * Optional. Default value is FINAL.</p>
3367      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3368      * @deprecated
3369      * <p>Not used in HALv3 or newer</p>
3370 
3371      * @hide
3372      */
3373     @Deprecated
3374     public static final Key<Boolean> QUIRKS_PARTIAL_RESULT =
3375             new Key<Boolean>("android.quirks.partialResult", boolean.class);
3376 
3377     /**
3378      * <p>A frame counter set by the framework. This value monotonically
3379      * increases with every new result (that is, each new result has a unique
3380      * frameCount value).</p>
3381      * <p>Reset on release()</p>
3382      * <p><b>Units</b>: count of frames</p>
3383      * <p><b>Range of valid values:</b><br>
3384      * &gt; 0</p>
3385      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3386      * @deprecated
3387      * <p>Not used in HALv3 or newer</p>
3388 
3389      * @hide
3390      */
3391     @Deprecated
3392     public static final Key<Integer> REQUEST_FRAME_COUNT =
3393             new Key<Integer>("android.request.frameCount", int.class);
3394 
3395     /**
3396      * <p>An application-specified ID for the current
3397      * request. Must be maintained unchanged in output
3398      * frame</p>
3399      * <p><b>Units</b>: arbitrary integer assigned by application</p>
3400      * <p><b>Range of valid values:</b><br>
3401      * Any int</p>
3402      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3403      * @hide
3404      */
3405     public static final Key<Integer> REQUEST_ID =
3406             new Key<Integer>("android.request.id", int.class);
3407 
3408     /**
3409      * <p>Specifies the number of pipeline stages the frame went
3410      * through from when it was exposed to when the final completed result
3411      * was available to the framework.</p>
3412      * <p>Depending on what settings are used in the request, and
3413      * what streams are configured, the data may undergo less processing,
3414      * and some pipeline stages skipped.</p>
3415      * <p>See {@link CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH android.request.pipelineMaxDepth} for more details.</p>
3416      * <p><b>Range of valid values:</b><br>
3417      * &lt;= {@link CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH android.request.pipelineMaxDepth}</p>
3418      * <p>This key is available on all devices.</p>
3419      *
3420      * @see CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH
3421      */
3422     @PublicKey
3423     @NonNull
3424     public static final Key<Byte> REQUEST_PIPELINE_DEPTH =
3425             new Key<Byte>("android.request.pipelineDepth", byte.class);
3426 
3427     /**
3428      * <p>The desired region of the sensor to read out for this capture.</p>
3429      * <p>This control can be used to implement digital zoom.</p>
3430      * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
3431      * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being
3432      * the top-left pixel of the active array.</p>
3433      * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate system
3434      * depends on the mode being set.  When the distortion correction mode is OFF, the
3435      * coordinate system follows {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with <code>(0,
3436      * 0)</code> being the top-left pixel of the pre-correction active array.  When the distortion
3437      * correction mode is not OFF, the coordinate system follows
3438      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being the top-left pixel of the
3439      * active array.</p>
3440      * <p>Output streams use this rectangle to produce their output, cropping to a smaller region
3441      * if necessary to maintain the stream's aspect ratio, then scaling the sensor input to
3442      * match the output's configured resolution.</p>
3443      * <p>The crop region is applied after the RAW to other color space (e.g. YUV)
3444      * conversion. Since raw streams (e.g. RAW16) don't have the conversion stage, they are not
3445      * croppable. The crop region will be ignored by raw streams.</p>
3446      * <p>For non-raw streams, any additional per-stream cropping will be done to maximize the
3447      * final pixel area of the stream.</p>
3448      * <p>For example, if the crop region is set to a 4:3 aspect ratio, then 4:3 streams will use
3449      * the exact crop region. 16:9 streams will further crop vertically (letterbox).</p>
3450      * <p>Conversely, if the crop region is set to a 16:9, then 4:3 outputs will crop horizontally
3451      * (pillarbox), and 16:9 streams will match exactly. These additional crops will be
3452      * centered within the crop region.</p>
3453      * <p>To illustrate, here are several scenarios of different crop regions and output streams,
3454      * for a hypothetical camera device with an active array of size <code>(2000,1500)</code>.  Note that
3455      * several of these examples use non-centered crop regions for ease of illustration; such
3456      * regions are only supported on devices with FREEFORM capability
3457      * ({@link CameraCharacteristics#SCALER_CROPPING_TYPE android.scaler.croppingType} <code>== FREEFORM</code>), but this does not affect the way the crop
3458      * rules work otherwise.</p>
3459      * <ul>
3460      * <li>Camera Configuration:<ul>
3461      * <li>Active array size: <code>2000x1500</code> (3 MP, 4:3 aspect ratio)</li>
3462      * <li>Output stream #1: <code>640x480</code> (VGA, 4:3 aspect ratio)</li>
3463      * <li>Output stream #2: <code>1280x720</code> (720p, 16:9 aspect ratio)</li>
3464      * </ul>
3465      * </li>
3466      * <li>Case #1: 4:3 crop region with 2x digital zoom<ul>
3467      * <li>Crop region: <code>Rect(500, 375, 1500, 1125) // (left, top, right, bottom)</code></li>
3468      * <li><img alt="4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-43-ratio.png" /></li>
3469      * <li><code>640x480</code> stream source area: <code>(500, 375, 1500, 1125)</code> (equal to crop region)</li>
3470      * <li><code>1280x720</code> stream source area: <code>(500, 469, 1500, 1031)</code> (letterboxed)</li>
3471      * </ul>
3472      * </li>
3473      * <li>Case #2: 16:9 crop region with ~1.5x digital zoom.<ul>
3474      * <li>Crop region: <code>Rect(500, 375, 1833, 1125)</code></li>
3475      * <li><img alt="16:9 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-169-ratio.png" /></li>
3476      * <li><code>640x480</code> stream source area: <code>(666, 375, 1666, 1125)</code> (pillarboxed)</li>
3477      * <li><code>1280x720</code> stream source area: <code>(500, 375, 1833, 1125)</code> (equal to crop region)</li>
3478      * </ul>
3479      * </li>
3480      * <li>Case #3: 1:1 crop region with ~2.6x digital zoom.<ul>
3481      * <li>Crop region: <code>Rect(500, 375, 1250, 1125)</code></li>
3482      * <li><img alt="1:1 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-11-ratio.png" /></li>
3483      * <li><code>640x480</code> stream source area: <code>(500, 469, 1250, 1031)</code> (letterboxed)</li>
3484      * <li><code>1280x720</code> stream source area: <code>(500, 543, 1250, 957)</code> (letterboxed)</li>
3485      * </ul>
3486      * </li>
3487      * <li>Case #4: Replace <code>640x480</code> stream with <code>1024x1024</code> stream, with 4:3 crop region:<ul>
3488      * <li>Crop region: <code>Rect(500, 375, 1500, 1125)</code></li>
3489      * <li><img alt="Square output, 4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-43-square-ratio.png" /></li>
3490      * <li><code>1024x1024</code> stream source area: <code>(625, 375, 1375, 1125)</code> (pillarboxed)</li>
3491      * <li><code>1280x720</code> stream source area: <code>(500, 469, 1500, 1031)</code> (letterboxed)</li>
3492      * <li>Note that in this case, neither of the two outputs is a subset of the other, with
3493      *   each containing image data the other doesn't have.</li>
3494      * </ul>
3495      * </li>
3496      * </ul>
3497      * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, the width and height
3498      * of the crop region cannot be set to be smaller than
3499      * <code>floor( activeArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> and
3500      * <code>floor( activeArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, respectively.</p>
3501      * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, the width
3502      * and height of the crop region cannot be set to be smaller than
3503      * <code>floor( preCorrectionActiveArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>
3504      * and
3505      * <code>floor( preCorrectionActiveArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>,
3506      * respectively.</p>
3507      * <p>The camera device may adjust the crop region to account for rounding and other hardware
3508      * requirements; the final crop region used will be included in the output capture result.</p>
3509      * <p>Starting from API level 30, it's strongly recommended to use {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}
3510      * to take advantage of better support for zoom with logical multi-camera. The benefits
3511      * include better precision with optical-digital zoom combination, and ability to do
3512      * zoom-out from 1.0x. When using {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for zoom, the crop region in
3513      * the capture request must be either letterboxing or pillarboxing (but not both). The
3514      * coordinate system is post-zoom, meaning that the activeArraySize or
3515      * preCorrectionActiveArraySize covers the camera device's field of view "after" zoom.  See
3516      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details.</p>
3517      * <p><b>Units</b>: Pixel coordinates relative to
3518      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
3519      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on distortion correction
3520      * capability and mode</p>
3521      * <p>This key is available on all devices.</p>
3522      *
3523      * @see CaptureRequest#CONTROL_ZOOM_RATIO
3524      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
3525      * @see CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM
3526      * @see CameraCharacteristics#SCALER_CROPPING_TYPE
3527      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
3528      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
3529      */
3530     @PublicKey
3531     @NonNull
3532     public static final Key<android.graphics.Rect> SCALER_CROP_REGION =
3533             new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class);
3534 
3535     /**
3536      * <p>Whether a rotation-and-crop operation is applied to processed
3537      * outputs from the camera.</p>
3538      * <p>This control is primarily intended to help camera applications with no support for
3539      * multi-window modes to work correctly on devices where multi-window scenarios are
3540      * unavoidable, such as foldables or other devices with variable display geometry or more
3541      * free-form window placement (such as laptops, which often place portrait-orientation apps
3542      * in landscape with pillarboxing).</p>
3543      * <p>If supported, the default value is <code>ROTATE_AND_CROP_AUTO</code>, which allows the camera API
3544      * to enable backwards-compatibility support for applications that do not support resizing
3545      * / multi-window modes, when the device is in fact in a multi-window mode (such as inset
3546      * portrait on laptops, or on a foldable device in some fold states).  In addition,
3547      * <code>ROTATE_AND_CROP_NONE</code> and <code>ROTATE_AND_CROP_90</code> will always be available if this control
3548      * is supported by the device.  If not supported, devices API level 30 or higher will always
3549      * list only <code>ROTATE_AND_CROP_NONE</code>.</p>
3550      * <p>When <code>CROP_AUTO</code> is in use, and the camera API activates backward-compatibility mode,
3551      * several metadata fields will also be parsed differently to ensure that coordinates are
3552      * correctly handled for features like drawing face detection boxes or passing in
3553      * tap-to-focus coordinates.  The camera API will convert positions in the active array
3554      * coordinate system to/from the cropped-and-rotated coordinate system to make the
3555      * operation transparent for applications.  The following controls are affected:</p>
3556      * <ul>
3557      * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li>
3558      * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li>
3559      * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li>
3560      * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li>
3561      * </ul>
3562      * <p>Capture results will contain the actual value selected by the API;
3563      * <code>ROTATE_AND_CROP_AUTO</code> will never be seen in a capture result.</p>
3564      * <p>Applications can also select their preferred cropping mode, either to opt out of the
3565      * backwards-compatibility treatment, or to use the cropping feature themselves as needed.
3566      * In this case, no coordinate translation will be done automatically, and all controls
3567      * will continue to use the normal active array coordinates.</p>
3568      * <p>Cropping and rotating is done after the application of digital zoom (via either
3569      * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}), but before each individual
3570      * output is further cropped and scaled. It only affects processed outputs such as
3571      * YUV, PRIVATE, and JPEG.  It has no effect on RAW outputs.</p>
3572      * <p>When <code>CROP_90</code> or <code>CROP_270</code> are selected, there is a significant loss to the field of
3573      * view. For example, with a 4:3 aspect ratio output of 1600x1200, <code>CROP_90</code> will still
3574      * produce 1600x1200 output, but these buffers are cropped from a vertical 3:4 slice at the
3575      * center of the 4:3 area, then rotated to be 4:3, and then upscaled to 1600x1200.  Only
3576      * 56.25% of the original FOV is still visible.  In general, for an aspect ratio of <code>w:h</code>,
3577      * the crop and rotate operation leaves <code>(h/w)^2</code> of the field of view visible. For 16:9,
3578      * this is ~31.6%.</p>
3579      * <p>As a visual example, the figure below shows the effect of <code>ROTATE_AND_CROP_90</code> on the
3580      * outputs for the following parameters:</p>
3581      * <ul>
3582      * <li>Sensor active array: <code>2000x1500</code></li>
3583      * <li>Crop region: top-left: <code>(500, 375)</code>, size: <code>(1000, 750)</code> (4:3 aspect ratio)</li>
3584      * <li>Output streams: YUV <code>640x480</code> and YUV <code>1280x720</code></li>
3585      * <li><code>ROTATE_AND_CROP_90</code></li>
3586      * </ul>
3587      * <p><img alt="Effect of ROTATE_AND_CROP_90" src="/reference/images/camera2/metadata/android.scaler.rotateAndCrop/crop-region-rotate-90-43-ratio.png" /></p>
3588      * <p>With these settings, the regions of the active array covered by the output streams are:</p>
3589      * <ul>
3590      * <li>640x480 stream crop: top-left: <code>(219, 375)</code>, size: <code>(562, 750)</code></li>
3591      * <li>1280x720 stream crop: top-left: <code>(289, 375)</code>, size: <code>(422, 750)</code></li>
3592      * </ul>
3593      * <p>Since the buffers are rotated, the buffers as seen by the application are:</p>
3594      * <ul>
3595      * <li>640x480 stream: top-left: <code>(781, 375)</code> on active array, size: <code>(640, 480)</code>, downscaled 1.17x from sensor pixels</li>
3596      * <li>1280x720 stream: top-left: <code>(711, 375)</code> on active array, size: <code>(1280, 720)</code>, upscaled 1.71x from sensor pixels</li>
3597      * </ul>
3598      * <p><b>Possible values:</b>
3599      * <ul>
3600      *   <li>{@link #SCALER_ROTATE_AND_CROP_NONE NONE}</li>
3601      *   <li>{@link #SCALER_ROTATE_AND_CROP_90 90}</li>
3602      *   <li>{@link #SCALER_ROTATE_AND_CROP_180 180}</li>
3603      *   <li>{@link #SCALER_ROTATE_AND_CROP_270 270}</li>
3604      *   <li>{@link #SCALER_ROTATE_AND_CROP_AUTO AUTO}</li>
3605      * </ul></p>
3606      * <p><b>Available values for this device:</b><br>
3607      * android.scaler.availableRotateAndCropModes</p>
3608      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3609      *
3610      * @see CaptureRequest#CONTROL_AE_REGIONS
3611      * @see CaptureRequest#CONTROL_AF_REGIONS
3612      * @see CaptureRequest#CONTROL_AWB_REGIONS
3613      * @see CaptureRequest#CONTROL_ZOOM_RATIO
3614      * @see CaptureRequest#SCALER_CROP_REGION
3615      * @see CaptureResult#STATISTICS_FACES
3616      * @see #SCALER_ROTATE_AND_CROP_NONE
3617      * @see #SCALER_ROTATE_AND_CROP_90
3618      * @see #SCALER_ROTATE_AND_CROP_180
3619      * @see #SCALER_ROTATE_AND_CROP_270
3620      * @see #SCALER_ROTATE_AND_CROP_AUTO
3621      * @hide
3622      */
3623     public static final Key<Integer> SCALER_ROTATE_AND_CROP =
3624             new Key<Integer>("android.scaler.rotateAndCrop", int.class);
3625 
3626     /**
3627      * <p>Duration each pixel is exposed to
3628      * light.</p>
3629      * <p>If the sensor can't expose this exact duration, it will shorten the
3630      * duration exposed to the nearest possible value (rather than expose longer).
3631      * The final exposure time used will be available in the output capture result.</p>
3632      * <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
3633      * OFF; otherwise the auto-exposure algorithm will override this value.</p>
3634      * <p><b>Units</b>: Nanoseconds</p>
3635      * <p><b>Range of valid values:</b><br>
3636      * {@link CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE android.sensor.info.exposureTimeRange}</p>
3637      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3638      * <p><b>Full capability</b> -
3639      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3640      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3641      *
3642      * @see CaptureRequest#CONTROL_AE_MODE
3643      * @see CaptureRequest#CONTROL_MODE
3644      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3645      * @see CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE
3646      */
3647     @PublicKey
3648     @NonNull
3649     public static final Key<Long> SENSOR_EXPOSURE_TIME =
3650             new Key<Long>("android.sensor.exposureTime", long.class);
3651 
3652     /**
3653      * <p>Duration from start of frame exposure to
3654      * start of next frame exposure.</p>
3655      * <p>The maximum frame rate that can be supported by a camera subsystem is
3656      * a function of many factors:</p>
3657      * <ul>
3658      * <li>Requested resolutions of output image streams</li>
3659      * <li>Availability of binning / skipping modes on the imager</li>
3660      * <li>The bandwidth of the imager interface</li>
3661      * <li>The bandwidth of the various ISP processing blocks</li>
3662      * </ul>
3663      * <p>Since these factors can vary greatly between different ISPs and
3664      * sensors, the camera abstraction tries to represent the bandwidth
3665      * restrictions with as simple a model as possible.</p>
3666      * <p>The model presented has the following characteristics:</p>
3667      * <ul>
3668      * <li>The image sensor is always configured to output the smallest
3669      * resolution possible given the application's requested output stream
3670      * sizes.  The smallest resolution is defined as being at least as large
3671      * as the largest requested output stream size; the camera pipeline must
3672      * never digitally upsample sensor data when the crop region covers the
3673      * whole sensor. In general, this means that if only small output stream
3674      * resolutions are configured, the sensor can provide a higher frame
3675      * rate.</li>
3676      * <li>Since any request may use any or all the currently configured
3677      * output streams, the sensor and ISP must be configured to support
3678      * scaling a single capture to all the streams at the same time.  This
3679      * means the camera pipeline must be ready to produce the largest
3680      * requested output size without any delay.  Therefore, the overall
3681      * frame rate of a given configured stream set is governed only by the
3682      * largest requested stream resolution.</li>
3683      * <li>Using more than one output stream in a request does not affect the
3684      * frame duration.</li>
3685      * <li>Certain format-streams may need to do additional background processing
3686      * before data is consumed/produced by that stream. These processors
3687      * can run concurrently to the rest of the camera pipeline, but
3688      * cannot process more than 1 capture at a time.</li>
3689      * </ul>
3690      * <p>The necessary information for the application, given the model above, is provided via
3691      * {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputMinFrameDuration }.
3692      * These are used to determine the maximum frame rate / minimum frame duration that is
3693      * possible for a given stream configuration.</p>
3694      * <p>Specifically, the application can use the following rules to
3695      * determine the minimum frame duration it can request from the camera
3696      * device:</p>
3697      * <ol>
3698      * <li>Let the set of currently configured input/output streams be called <code>S</code>.</li>
3699      * <li>Find the minimum frame durations for each stream in <code>S</code>, by looking it up in {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputMinFrameDuration }
3700      * (with its respective size/format). Let this set of frame durations be called <code>F</code>.</li>
3701      * <li>For any given request <code>R</code>, the minimum frame duration allowed for <code>R</code> is the maximum
3702      * out of all values in <code>F</code>. Let the streams used in <code>R</code> be called <code>S_r</code>.</li>
3703      * </ol>
3704      * <p>If none of the streams in <code>S_r</code> have a stall time (listed in {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputStallDuration }
3705      * using its respective size/format), then the frame duration in <code>F</code> determines the steady
3706      * state frame rate that the application will get if it uses <code>R</code> as a repeating request. Let
3707      * this special kind of request be called <code>Rsimple</code>.</p>
3708      * <p>A repeating request <code>Rsimple</code> can be <em>occasionally</em> interleaved by a single capture of a
3709      * new request <code>Rstall</code> (which has at least one in-use stream with a non-0 stall time) and if
3710      * <code>Rstall</code> has the same minimum frame duration this will not cause a frame rate loss if all
3711      * buffers from the previous <code>Rstall</code> have already been delivered.</p>
3712      * <p>For more details about stalling, see {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputStallDuration }.</p>
3713      * <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
3714      * OFF; otherwise the auto-exposure algorithm will override this value.</p>
3715      * <p><b>Units</b>: Nanoseconds</p>
3716      * <p><b>Range of valid values:</b><br>
3717      * See {@link CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION android.sensor.info.maxFrameDuration}, {@link android.hardware.camera2.params.StreamConfigurationMap }.
3718      * The duration is capped to <code>max(duration, exposureTime + overhead)</code>.</p>
3719      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3720      * <p><b>Full capability</b> -
3721      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3722      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3723      *
3724      * @see CaptureRequest#CONTROL_AE_MODE
3725      * @see CaptureRequest#CONTROL_MODE
3726      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3727      * @see CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION
3728      */
3729     @PublicKey
3730     @NonNull
3731     public static final Key<Long> SENSOR_FRAME_DURATION =
3732             new Key<Long>("android.sensor.frameDuration", long.class);
3733 
3734     /**
3735      * <p>The amount of gain applied to sensor data
3736      * before processing.</p>
3737      * <p>The sensitivity is the standard ISO sensitivity value,
3738      * as defined in ISO 12232:2006.</p>
3739      * <p>The sensitivity must be within {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}, and
3740      * if if it less than {@link CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY android.sensor.maxAnalogSensitivity}, the camera device
3741      * is guaranteed to use only analog amplification for applying the gain.</p>
3742      * <p>If the camera device cannot apply the exact sensitivity
3743      * requested, it will reduce the gain to the nearest supported
3744      * value. The final sensitivity used will be available in the
3745      * output capture result.</p>
3746      * <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
3747      * OFF; otherwise the auto-exposure algorithm will override this value.</p>
3748      * <p>Note that for devices supporting postRawSensitivityBoost, the total sensitivity applied
3749      * to the final processed image is the combination of {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} and
3750      * {@link CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST android.control.postRawSensitivityBoost}. In case the application uses the sensor
3751      * sensitivity from last capture result of an auto request for a manual request, in order
3752      * to achieve the same brightness in the output image, the application should also
3753      * set postRawSensitivityBoost.</p>
3754      * <p><b>Units</b>: ISO arithmetic units</p>
3755      * <p><b>Range of valid values:</b><br>
3756      * {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}</p>
3757      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3758      * <p><b>Full capability</b> -
3759      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3760      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3761      *
3762      * @see CaptureRequest#CONTROL_AE_MODE
3763      * @see CaptureRequest#CONTROL_MODE
3764      * @see CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST
3765      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3766      * @see CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE
3767      * @see CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY
3768      * @see CaptureRequest#SENSOR_SENSITIVITY
3769      */
3770     @PublicKey
3771     @NonNull
3772     public static final Key<Integer> SENSOR_SENSITIVITY =
3773             new Key<Integer>("android.sensor.sensitivity", int.class);
3774 
3775     /**
3776      * <p>Time at start of exposure of first
3777      * row of the image sensor active array, in nanoseconds.</p>
3778      * <p>The timestamps are also included in all image
3779      * buffers produced for the same capture, and will be identical
3780      * on all the outputs.</p>
3781      * <p>When {@link CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE android.sensor.info.timestampSource} <code>==</code> UNKNOWN,
3782      * the timestamps measure time since an unspecified starting point,
3783      * and are monotonically increasing. They can be compared with the
3784      * timestamps for other captures from the same camera device, but are
3785      * not guaranteed to be comparable to any other time source.</p>
3786      * <p>When {@link CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE android.sensor.info.timestampSource} <code>==</code> REALTIME, the
3787      * timestamps measure time in the same timebase as {@link android.os.SystemClock#elapsedRealtimeNanos }, and they can
3788      * be compared to other timestamps from other subsystems that
3789      * are using that base.</p>
3790      * <p>For reprocessing, the timestamp will match the start of exposure of
3791      * the input image, i.e. {@link CaptureResult#SENSOR_TIMESTAMP the
3792      * timestamp} in the TotalCaptureResult that was used to create the
3793      * reprocess capture request.</p>
3794      * <p><b>Units</b>: Nanoseconds</p>
3795      * <p><b>Range of valid values:</b><br>
3796      * &gt; 0</p>
3797      * <p>This key is available on all devices.</p>
3798      *
3799      * @see CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE
3800      */
3801     @PublicKey
3802     @NonNull
3803     public static final Key<Long> SENSOR_TIMESTAMP =
3804             new Key<Long>("android.sensor.timestamp", long.class);
3805 
3806     /**
3807      * <p>The estimated camera neutral color in the native sensor colorspace at
3808      * the time of capture.</p>
3809      * <p>This value gives the neutral color point encoded as an RGB value in the
3810      * native sensor color space.  The neutral color point indicates the
3811      * currently estimated white point of the scene illumination.  It can be
3812      * used to interpolate between the provided color transforms when
3813      * processing raw sensor data.</p>
3814      * <p>The order of the values is R, G, B; where R is in the lowest index.</p>
3815      * <p>Starting from Android Q, this key will not be present for a MONOCHROME camera, even if
3816      * the camera device has RAW capability.</p>
3817      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3818      */
3819     @PublicKey
3820     @NonNull
3821     public static final Key<Rational[]> SENSOR_NEUTRAL_COLOR_POINT =
3822             new Key<Rational[]>("android.sensor.neutralColorPoint", Rational[].class);
3823 
3824     /**
3825      * <p>Noise model coefficients for each CFA mosaic channel.</p>
3826      * <p>This key contains two noise model coefficients for each CFA channel
3827      * corresponding to the sensor amplification (S) and sensor readout
3828      * noise (O).  These are given as pairs of coefficients for each channel
3829      * in the same order as channels listed for the CFA layout key
3830      * (see {@link CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT android.sensor.info.colorFilterArrangement}).  This is
3831      * represented as an array of Pair&lt;Double, Double&gt;, where
3832      * the first member of the Pair at index n is the S coefficient and the
3833      * second member is the O coefficient for the nth color channel in the CFA.</p>
3834      * <p>These coefficients are used in a two parameter noise model to describe
3835      * the amount of noise present in the image for each CFA channel.  The
3836      * noise model used here is:</p>
3837      * <p>N(x) = sqrt(Sx + O)</p>
3838      * <p>Where x represents the recorded signal of a CFA channel normalized to
3839      * the range [0, 1], and S and O are the noise model coeffiecients for
3840      * that channel.</p>
3841      * <p>A more detailed description of the noise model can be found in the
3842      * Adobe DNG specification for the NoiseProfile tag.</p>
3843      * <p>For a MONOCHROME camera, there is only one color channel. So the noise model coefficients
3844      * will only contain one S and one O.</p>
3845      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3846      *
3847      * @see CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
3848      */
3849     @PublicKey
3850     @NonNull
3851     public static final Key<android.util.Pair<Double,Double>[]> SENSOR_NOISE_PROFILE =
3852             new Key<android.util.Pair<Double,Double>[]>("android.sensor.noiseProfile", new TypeReference<android.util.Pair<Double,Double>[]>() {{ }});
3853 
3854     /**
3855      * <p>The worst-case divergence between Bayer green channels.</p>
3856      * <p>This value is an estimate of the worst case split between the
3857      * Bayer green channels in the red and blue rows in the sensor color
3858      * filter array.</p>
3859      * <p>The green split is calculated as follows:</p>
3860      * <ol>
3861      * <li>A 5x5 pixel (or larger) window W within the active sensor array is
3862      * chosen. The term 'pixel' here is taken to mean a group of 4 Bayer
3863      * mosaic channels (R, Gr, Gb, B).  The location and size of the window
3864      * chosen is implementation defined, and should be chosen to provide a
3865      * green split estimate that is both representative of the entire image
3866      * for this camera sensor, and can be calculated quickly.</li>
3867      * <li>The arithmetic mean of the green channels from the red
3868      * rows (mean_Gr) within W is computed.</li>
3869      * <li>The arithmetic mean of the green channels from the blue
3870      * rows (mean_Gb) within W is computed.</li>
3871      * <li>The maximum ratio R of the two means is computed as follows:
3872      * <code>R = max((mean_Gr + 1)/(mean_Gb + 1), (mean_Gb + 1)/(mean_Gr + 1))</code></li>
3873      * </ol>
3874      * <p>The ratio R is the green split divergence reported for this property,
3875      * which represents how much the green channels differ in the mosaic
3876      * pattern.  This value is typically used to determine the treatment of
3877      * the green mosaic channels when demosaicing.</p>
3878      * <p>The green split value can be roughly interpreted as follows:</p>
3879      * <ul>
3880      * <li>R &lt; 1.03 is a negligible split (&lt;3% divergence).</li>
3881      * <li>1.20 &lt;= R &gt;= 1.03 will require some software
3882      * correction to avoid demosaic errors (3-20% divergence).</li>
3883      * <li>R &gt; 1.20 will require strong software correction to produce
3884      * a usuable image (&gt;20% divergence).</li>
3885      * </ul>
3886      * <p>Starting from Android Q, this key will not be present for a MONOCHROME camera, even if
3887      * the camera device has RAW capability.</p>
3888      * <p><b>Range of valid values:</b><br></p>
3889      * <p>&gt;= 0</p>
3890      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3891      */
3892     @PublicKey
3893     @NonNull
3894     public static final Key<Float> SENSOR_GREEN_SPLIT =
3895             new Key<Float>("android.sensor.greenSplit", float.class);
3896 
3897     /**
3898      * <p>A pixel <code>[R, G_even, G_odd, B]</code> that supplies the test pattern
3899      * when {@link CaptureRequest#SENSOR_TEST_PATTERN_MODE android.sensor.testPatternMode} is SOLID_COLOR.</p>
3900      * <p>Each color channel is treated as an unsigned 32-bit integer.
3901      * The camera device then uses the most significant X bits
3902      * that correspond to how many bits are in its Bayer raw sensor
3903      * output.</p>
3904      * <p>For example, a sensor with RAW10 Bayer output would use the
3905      * 10 most significant bits from each color channel.</p>
3906      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3907      *
3908      * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE
3909      */
3910     @PublicKey
3911     @NonNull
3912     public static final Key<int[]> SENSOR_TEST_PATTERN_DATA =
3913             new Key<int[]>("android.sensor.testPatternData", int[].class);
3914 
3915     /**
3916      * <p>When enabled, the sensor sends a test pattern instead of
3917      * doing a real exposure from the camera.</p>
3918      * <p>When a test pattern is enabled, all manual sensor controls specified
3919      * by android.sensor.* will be ignored. All other controls should
3920      * work as normal.</p>
3921      * <p>For example, if manual flash is enabled, flash firing should still
3922      * occur (and that the test pattern remain unmodified, since the flash
3923      * would not actually affect it).</p>
3924      * <p>Defaults to OFF.</p>
3925      * <p><b>Possible values:</b>
3926      * <ul>
3927      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_OFF OFF}</li>
3928      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR SOLID_COLOR}</li>
3929      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS COLOR_BARS}</li>
3930      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY COLOR_BARS_FADE_TO_GRAY}</li>
3931      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_PN9 PN9}</li>
3932      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_CUSTOM1 CUSTOM1}</li>
3933      * </ul></p>
3934      * <p><b>Available values for this device:</b><br>
3935      * {@link CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES android.sensor.availableTestPatternModes}</p>
3936      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3937      *
3938      * @see CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES
3939      * @see #SENSOR_TEST_PATTERN_MODE_OFF
3940      * @see #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR
3941      * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS
3942      * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY
3943      * @see #SENSOR_TEST_PATTERN_MODE_PN9
3944      * @see #SENSOR_TEST_PATTERN_MODE_CUSTOM1
3945      */
3946     @PublicKey
3947     @NonNull
3948     public static final Key<Integer> SENSOR_TEST_PATTERN_MODE =
3949             new Key<Integer>("android.sensor.testPatternMode", int.class);
3950 
3951     /**
3952      * <p>Duration between the start of exposure for the first row of the image sensor,
3953      * and the start of exposure for one past the last row of the image sensor.</p>
3954      * <p>This is the exposure time skew between the first and <code>(last+1)</code> row exposure start times. The
3955      * first row and the last row are the first and last rows inside of the
3956      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p>
3957      * <p>For typical camera sensors that use rolling shutters, this is also equivalent to the frame
3958      * readout time.</p>
3959      * <p>If the image sensor is operating in a binned or cropped mode due to the current output
3960      * target resolutions, it's possible this skew is reported to be larger than the exposure
3961      * time, for example, since it is based on the full array even if a partial array is read
3962      * out. Be sure to scale the number to cover the section of the sensor actually being used
3963      * for the outputs you care about. So if your output covers N rows of the active array of
3964      * height H, scale this value by N/H to get the total skew for that viewport.</p>
3965      * <p><em>Note:</em> Prior to Android 11, this field was described as measuring duration from
3966      * first to last row of the image sensor, which is not equal to the frame readout time for a
3967      * rolling shutter sensor. Implementations generally reported the latter value, so to resolve
3968      * the inconsistency, the description has been updated to range from (first, last+1) row
3969      * exposure start, instead.</p>
3970      * <p><b>Units</b>: Nanoseconds</p>
3971      * <p><b>Range of valid values:</b><br>
3972      * &gt;= 0 and &lt;
3973      * {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputMinFrameDuration }.</p>
3974      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3975      * <p><b>Limited capability</b> -
3976      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
3977      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3978      *
3979      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3980      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
3981      */
3982     @PublicKey
3983     @NonNull
3984     public static final Key<Long> SENSOR_ROLLING_SHUTTER_SKEW =
3985             new Key<Long>("android.sensor.rollingShutterSkew", long.class);
3986 
3987     /**
3988      * <p>A per-frame dynamic black level offset for each of the color filter
3989      * arrangement (CFA) mosaic channels.</p>
3990      * <p>Camera sensor black levels may vary dramatically for different
3991      * capture settings (e.g. {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}). The fixed black
3992      * level reported by {@link CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN android.sensor.blackLevelPattern} may be too
3993      * inaccurate to represent the actual value on a per-frame basis. The
3994      * camera device internal pipeline relies on reliable black level values
3995      * to process the raw images appropriately. To get the best image
3996      * quality, the camera device may choose to estimate the per frame black
3997      * level values either based on optically shielded black regions
3998      * ({@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions}) or its internal model.</p>
3999      * <p>This key reports the camera device estimated per-frame zero light
4000      * value for each of the CFA mosaic channels in the camera sensor. The
4001      * {@link CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN android.sensor.blackLevelPattern} may only represent a coarse
4002      * approximation of the actual black level values. This value is the
4003      * black level used in camera device internal image processing pipeline
4004      * and generally more accurate than the fixed black level values.
4005      * However, since they are estimated values by the camera device, they
4006      * may not be as accurate as the black level values calculated from the
4007      * optical black pixels reported by {@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions}.</p>
4008      * <p>The values are given in the same order as channels listed for the CFA
4009      * layout key (see {@link CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT android.sensor.info.colorFilterArrangement}), i.e. the
4010      * nth value given corresponds to the black level offset for the nth
4011      * color channel listed in the CFA.</p>
4012      * <p>For a MONOCHROME camera, all of the 2x2 channels must have the same values.</p>
4013      * <p>This key will be available if {@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions} is available or the
4014      * camera device advertises this key via {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureResultKeys }.</p>
4015      * <p><b>Range of valid values:</b><br>
4016      * &gt;= 0 for each.</p>
4017      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4018      *
4019      * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN
4020      * @see CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
4021      * @see CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS
4022      * @see CaptureRequest#SENSOR_SENSITIVITY
4023      */
4024     @PublicKey
4025     @NonNull
4026     public static final Key<float[]> SENSOR_DYNAMIC_BLACK_LEVEL =
4027             new Key<float[]>("android.sensor.dynamicBlackLevel", float[].class);
4028 
4029     /**
4030      * <p>Maximum raw value output by sensor for this frame.</p>
4031      * <p>Since the {@link CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN android.sensor.blackLevelPattern} may change for different
4032      * capture settings (e.g., {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}), the white
4033      * level will change accordingly. This key is similar to
4034      * {@link CameraCharacteristics#SENSOR_INFO_WHITE_LEVEL android.sensor.info.whiteLevel}, but specifies the camera device
4035      * estimated white level for each frame.</p>
4036      * <p>This key will be available if {@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions} is
4037      * available or the camera device advertises this key via
4038      * {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureRequestKeys }.</p>
4039      * <p><b>Range of valid values:</b><br>
4040      * &gt;= 0</p>
4041      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4042      *
4043      * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN
4044      * @see CameraCharacteristics#SENSOR_INFO_WHITE_LEVEL
4045      * @see CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS
4046      * @see CaptureRequest#SENSOR_SENSITIVITY
4047      */
4048     @PublicKey
4049     @NonNull
4050     public static final Key<Integer> SENSOR_DYNAMIC_WHITE_LEVEL =
4051             new Key<Integer>("android.sensor.dynamicWhiteLevel", int.class);
4052 
4053     /**
4054      * <p>Quality of lens shading correction applied
4055      * to the image data.</p>
4056      * <p>When set to OFF mode, no lens shading correction will be applied by the
4057      * camera device, and an identity lens shading map data will be provided
4058      * if <code>{@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} == ON</code>. For example, for lens
4059      * shading map with size of <code>[ 4, 3 ]</code>,
4060      * the output {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap} for this case will be an identity
4061      * map shown below:</p>
4062      * <pre><code>[ 1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
4063      *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
4064      *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
4065      *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
4066      *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
4067      *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0 ]
4068      * </code></pre>
4069      * <p>When set to other modes, lens shading correction will be applied by the camera
4070      * device. Applications can request lens shading map data by setting
4071      * {@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} to ON, and then the camera device will provide lens
4072      * shading map data in {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap}; the returned shading map
4073      * data will be the one applied by the camera device for this capture request.</p>
4074      * <p>The shading map data may depend on the auto-exposure (AE) and AWB statistics, therefore
4075      * the reliability of the map data may be affected by the AE and AWB algorithms. When AE and
4076      * 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>
4077      * OFF), to get best results, it is recommended that the applications wait for the AE and AWB
4078      * to be converged before using the returned shading map data.</p>
4079      * <p><b>Possible values:</b>
4080      * <ul>
4081      *   <li>{@link #SHADING_MODE_OFF OFF}</li>
4082      *   <li>{@link #SHADING_MODE_FAST FAST}</li>
4083      *   <li>{@link #SHADING_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
4084      * </ul></p>
4085      * <p><b>Available values for this device:</b><br>
4086      * {@link CameraCharacteristics#SHADING_AVAILABLE_MODES android.shading.availableModes}</p>
4087      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4088      * <p><b>Full capability</b> -
4089      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4090      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4091      *
4092      * @see CaptureRequest#CONTROL_AE_MODE
4093      * @see CaptureRequest#CONTROL_AWB_MODE
4094      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4095      * @see CameraCharacteristics#SHADING_AVAILABLE_MODES
4096      * @see CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP
4097      * @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE
4098      * @see #SHADING_MODE_OFF
4099      * @see #SHADING_MODE_FAST
4100      * @see #SHADING_MODE_HIGH_QUALITY
4101      */
4102     @PublicKey
4103     @NonNull
4104     public static final Key<Integer> SHADING_MODE =
4105             new Key<Integer>("android.shading.mode", int.class);
4106 
4107     /**
4108      * <p>Operating mode for the face detector
4109      * unit.</p>
4110      * <p>Whether face detection is enabled, and whether it
4111      * should output just the basic fields or the full set of
4112      * fields.</p>
4113      * <p><b>Possible values:</b>
4114      * <ul>
4115      *   <li>{@link #STATISTICS_FACE_DETECT_MODE_OFF OFF}</li>
4116      *   <li>{@link #STATISTICS_FACE_DETECT_MODE_SIMPLE SIMPLE}</li>
4117      *   <li>{@link #STATISTICS_FACE_DETECT_MODE_FULL FULL}</li>
4118      * </ul></p>
4119      * <p><b>Available values for this device:</b><br>
4120      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES android.statistics.info.availableFaceDetectModes}</p>
4121      * <p>This key is available on all devices.</p>
4122      *
4123      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES
4124      * @see #STATISTICS_FACE_DETECT_MODE_OFF
4125      * @see #STATISTICS_FACE_DETECT_MODE_SIMPLE
4126      * @see #STATISTICS_FACE_DETECT_MODE_FULL
4127      */
4128     @PublicKey
4129     @NonNull
4130     public static final Key<Integer> STATISTICS_FACE_DETECT_MODE =
4131             new Key<Integer>("android.statistics.faceDetectMode", int.class);
4132 
4133     /**
4134      * <p>List of unique IDs for detected faces.</p>
4135      * <p>Each detected face is given a unique ID that is valid for as long as the face is visible
4136      * to the camera device.  A face that leaves the field of view and later returns may be
4137      * assigned a new ID.</p>
4138      * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} == FULL
4139      * This key is available on all devices.</p>
4140      *
4141      * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
4142      * @hide
4143      */
4144     public static final Key<int[]> STATISTICS_FACE_IDS =
4145             new Key<int[]>("android.statistics.faceIds", int[].class);
4146 
4147     /**
4148      * <p>List of landmarks for detected
4149      * faces.</p>
4150      * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
4151      * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being
4152      * the top-left pixel of the active array.</p>
4153      * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
4154      * system depends on the mode being set.
4155      * When the distortion correction mode is OFF, the coordinate system follows
4156      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
4157      * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array.
4158      * When the distortion correction mode is not OFF, the coordinate system follows
4159      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
4160      * <code>(0, 0)</code> being the top-left pixel of the active array.</p>
4161      * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} == FULL.</p>
4162      * <p>Starting from API level 30, the coordinate system of activeArraySize or
4163      * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
4164      * pre-zoomRatio field of view. This means that if the relative position of faces and
4165      * the camera device doesn't change, when zooming in by increasing
4166      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, the face landmarks move farther away from the center of the
4167      * activeArray or preCorrectionActiveArray. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0
4168      * (default), the face landmarks coordinates won't change as {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}
4169      * changes. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use activeArraySize or
4170      * preCorrectionActiveArraySize still depends on distortion correction mode.</p>
4171      * <p>This key is available on all devices.</p>
4172      *
4173      * @see CaptureRequest#CONTROL_ZOOM_RATIO
4174      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
4175      * @see CaptureRequest#SCALER_CROP_REGION
4176      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
4177      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
4178      * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
4179      * @hide
4180      */
4181     public static final Key<int[]> STATISTICS_FACE_LANDMARKS =
4182             new Key<int[]>("android.statistics.faceLandmarks", int[].class);
4183 
4184     /**
4185      * <p>List of the bounding rectangles for detected
4186      * faces.</p>
4187      * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
4188      * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being
4189      * the top-left pixel of the active array.</p>
4190      * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
4191      * system depends on the mode being set.
4192      * When the distortion correction mode is OFF, the coordinate system follows
4193      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
4194      * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array.
4195      * When the distortion correction mode is not OFF, the coordinate system follows
4196      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
4197      * <code>(0, 0)</code> being the top-left pixel of the active array.</p>
4198      * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} != OFF.</p>
4199      * <p>Starting from API level 30, the coordinate system of activeArraySize or
4200      * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
4201      * pre-zoomRatio field of view. This means that if the relative position of faces and
4202      * the camera device doesn't change, when zooming in by increasing
4203      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, the face rectangles grow larger and move farther away from
4204      * the center of the activeArray or preCorrectionActiveArray. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}
4205      * is set to 1.0 (default), the face rectangles won't change as {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}
4206      * changes. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use activeArraySize or
4207      * preCorrectionActiveArraySize still depends on distortion correction mode.</p>
4208      * <p>This key is available on all devices.</p>
4209      *
4210      * @see CaptureRequest#CONTROL_ZOOM_RATIO
4211      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
4212      * @see CaptureRequest#SCALER_CROP_REGION
4213      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
4214      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
4215      * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
4216      * @hide
4217      */
4218     public static final Key<android.graphics.Rect[]> STATISTICS_FACE_RECTANGLES =
4219             new Key<android.graphics.Rect[]>("android.statistics.faceRectangles", android.graphics.Rect[].class);
4220 
4221     /**
4222      * <p>List of the face confidence scores for
4223      * detected faces</p>
4224      * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} != OFF.</p>
4225      * <p><b>Range of valid values:</b><br>
4226      * 1-100</p>
4227      * <p>This key is available on all devices.</p>
4228      *
4229      * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
4230      * @hide
4231      */
4232     public static final Key<byte[]> STATISTICS_FACE_SCORES =
4233             new Key<byte[]>("android.statistics.faceScores", byte[].class);
4234 
4235     /**
4236      * <p>List of the faces detected through camera face detection
4237      * in this capture.</p>
4238      * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} <code>!=</code> OFF.</p>
4239      * <p>This key is available on all devices.</p>
4240      *
4241      * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
4242      */
4243     @PublicKey
4244     @NonNull
4245     @SyntheticKey
4246     public static final Key<android.hardware.camera2.params.Face[]> STATISTICS_FACES =
4247             new Key<android.hardware.camera2.params.Face[]>("android.statistics.faces", android.hardware.camera2.params.Face[].class);
4248 
4249     /**
4250      * <p>The shading map is a low-resolution floating-point map
4251      * that lists the coefficients used to correct for vignetting, for each
4252      * Bayer color channel.</p>
4253      * <p>The map provided here is the same map that is used by the camera device to
4254      * correct both color shading and vignetting for output non-RAW images.</p>
4255      * <p>When there is no lens shading correction applied to RAW
4256      * output images ({@link CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED android.sensor.info.lensShadingApplied} <code>==</code>
4257      * false), this map is the complete lens shading correction
4258      * map; when there is some lens shading correction applied to
4259      * the RAW output image ({@link CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED android.sensor.info.lensShadingApplied}<code>==</code> true), this map reports the remaining lens shading
4260      * correction map that needs to be applied to get shading
4261      * corrected images that match the camera device's output for
4262      * non-RAW formats.</p>
4263      * <p>For a complete shading correction map, the least shaded
4264      * section of the image will have a gain factor of 1; all
4265      * other sections will have gains above 1.</p>
4266      * <p>When {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} = TRANSFORM_MATRIX, the map
4267      * will take into account the colorCorrection settings.</p>
4268      * <p>The shading map is for the entire active pixel array, and is not
4269      * affected by the crop region specified in the request. Each shading map
4270      * entry is the value of the shading compensation map over a specific
4271      * pixel on the sensor.  Specifically, with a (N x M) resolution shading
4272      * map, and an active pixel array size (W x H), shading map entry
4273      * (x,y) ϵ (0 ... N-1, 0 ... M-1) is the value of the shading map at
4274      * pixel ( ((W-1)/(N-1)) * x, ((H-1)/(M-1)) * y) for the four color channels.
4275      * The map is assumed to be bilinearly interpolated between the sample points.</p>
4276      * <p>The channel order is [R, Geven, Godd, B], where Geven is the green
4277      * channel for the even rows of a Bayer pattern, and Godd is the odd rows.
4278      * The shading map is stored in a fully interleaved format.</p>
4279      * <p>The shading map will generally have on the order of 30-40 rows and columns,
4280      * and will be smaller than 64x64.</p>
4281      * <p>As an example, given a very small map defined as:</p>
4282      * <pre><code>width,height = [ 4, 3 ]
4283      * values =
4284      * [ 1.3, 1.2, 1.15, 1.2,  1.2, 1.2, 1.15, 1.2,
4285      *     1.1, 1.2, 1.2, 1.2,  1.3, 1.2, 1.3, 1.3,
4286      *   1.2, 1.2, 1.25, 1.1,  1.1, 1.1, 1.1, 1.0,
4287      *     1.0, 1.0, 1.0, 1.0,  1.2, 1.3, 1.25, 1.2,
4288      *   1.3, 1.2, 1.2, 1.3,   1.2, 1.15, 1.1, 1.2,
4289      *     1.2, 1.1, 1.0, 1.2,  1.3, 1.15, 1.2, 1.3 ]
4290      * </code></pre>
4291      * <p>The low-resolution scaling map images for each channel are
4292      * (displayed using nearest-neighbor interpolation):</p>
4293      * <p><img alt="Red lens shading map" src="/reference/images/camera2/metadata/android.statistics.lensShadingMap/red_shading.png" />
4294      * <img alt="Green (even rows) lens shading map" src="/reference/images/camera2/metadata/android.statistics.lensShadingMap/green_e_shading.png" />
4295      * <img alt="Green (odd rows) lens shading map" src="/reference/images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png" />
4296      * <img alt="Blue lens shading map" src="/reference/images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png" /></p>
4297      * <p>As a visualization only, inverting the full-color map to recover an
4298      * image of a gray wall (using bicubic interpolation for visual quality) as captured by the sensor gives:</p>
4299      * <p><img alt="Image of a uniform white wall (inverse shading map)" src="/reference/images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png" /></p>
4300      * <p>For a MONOCHROME camera, all of the 2x2 channels must have the same values. An example
4301      * shading map for such a camera is defined as:</p>
4302      * <pre><code>android.lens.info.shadingMapSize = [ 4, 3 ]
4303      * android.statistics.lensShadingMap =
4304      * [ 1.3, 1.3, 1.3, 1.3,  1.2, 1.2, 1.2, 1.2,
4305      *     1.1, 1.1, 1.1, 1.1,  1.3, 1.3, 1.3, 1.3,
4306      *   1.2, 1.2, 1.2, 1.2,  1.1, 1.1, 1.1, 1.1,
4307      *     1.0, 1.0, 1.0, 1.0,  1.2, 1.2, 1.2, 1.2,
4308      *   1.3, 1.3, 1.3, 1.3,   1.2, 1.2, 1.2, 1.2,
4309      *     1.2, 1.2, 1.2, 1.2,  1.3, 1.3, 1.3, 1.3 ]
4310      * </code></pre>
4311      * <p><b>Range of valid values:</b><br>
4312      * Each gain factor is &gt;= 1</p>
4313      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4314      * <p><b>Full capability</b> -
4315      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4316      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4317      *
4318      * @see CaptureRequest#COLOR_CORRECTION_MODE
4319      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4320      * @see CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED
4321      */
4322     @PublicKey
4323     @NonNull
4324     public static final Key<android.hardware.camera2.params.LensShadingMap> STATISTICS_LENS_SHADING_CORRECTION_MAP =
4325             new Key<android.hardware.camera2.params.LensShadingMap>("android.statistics.lensShadingCorrectionMap", android.hardware.camera2.params.LensShadingMap.class);
4326 
4327     /**
4328      * <p>The shading map is a low-resolution floating-point map
4329      * that lists the coefficients used to correct for vignetting and color shading,
4330      * for each Bayer color channel of RAW image data.</p>
4331      * <p>The map provided here is the same map that is used by the camera device to
4332      * correct both color shading and vignetting for output non-RAW images.</p>
4333      * <p>When there is no lens shading correction applied to RAW
4334      * output images ({@link CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED android.sensor.info.lensShadingApplied} <code>==</code>
4335      * false), this map is the complete lens shading correction
4336      * map; when there is some lens shading correction applied to
4337      * the RAW output image ({@link CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED android.sensor.info.lensShadingApplied}<code>==</code> true), this map reports the remaining lens shading
4338      * correction map that needs to be applied to get shading
4339      * corrected images that match the camera device's output for
4340      * non-RAW formats.</p>
4341      * <p>For a complete shading correction map, the least shaded
4342      * section of the image will have a gain factor of 1; all
4343      * other sections will have gains above 1.</p>
4344      * <p>When {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} = TRANSFORM_MATRIX, the map
4345      * will take into account the colorCorrection settings.</p>
4346      * <p>The shading map is for the entire active pixel array, and is not
4347      * affected by the crop region specified in the request. Each shading map
4348      * entry is the value of the shading compensation map over a specific
4349      * pixel on the sensor.  Specifically, with a (N x M) resolution shading
4350      * map, and an active pixel array size (W x H), shading map entry
4351      * (x,y) ϵ (0 ... N-1, 0 ... M-1) is the value of the shading map at
4352      * pixel ( ((W-1)/(N-1)) * x, ((H-1)/(M-1)) * y) for the four color channels.
4353      * The map is assumed to be bilinearly interpolated between the sample points.</p>
4354      * <p>For a Bayer camera, the channel order is [R, Geven, Godd, B], where Geven is
4355      * the green channel for the even rows of a Bayer pattern, and Godd is the odd rows.
4356      * The shading map is stored in a fully interleaved format, and its size
4357      * is provided in the camera static metadata by android.lens.info.shadingMapSize.</p>
4358      * <p>The shading map will generally have on the order of 30-40 rows and columns,
4359      * and will be smaller than 64x64.</p>
4360      * <p>As an example, given a very small map for a Bayer camera defined as:</p>
4361      * <pre><code>android.lens.info.shadingMapSize = [ 4, 3 ]
4362      * android.statistics.lensShadingMap =
4363      * [ 1.3, 1.2, 1.15, 1.2,  1.2, 1.2, 1.15, 1.2,
4364      *     1.1, 1.2, 1.2, 1.2,  1.3, 1.2, 1.3, 1.3,
4365      *   1.2, 1.2, 1.25, 1.1,  1.1, 1.1, 1.1, 1.0,
4366      *     1.0, 1.0, 1.0, 1.0,  1.2, 1.3, 1.25, 1.2,
4367      *   1.3, 1.2, 1.2, 1.3,   1.2, 1.15, 1.1, 1.2,
4368      *     1.2, 1.1, 1.0, 1.2,  1.3, 1.15, 1.2, 1.3 ]
4369      * </code></pre>
4370      * <p>The low-resolution scaling map images for each channel are
4371      * (displayed using nearest-neighbor interpolation):</p>
4372      * <p><img alt="Red lens shading map" src="/reference/images/camera2/metadata/android.statistics.lensShadingMap/red_shading.png" />
4373      * <img alt="Green (even rows) lens shading map" src="/reference/images/camera2/metadata/android.statistics.lensShadingMap/green_e_shading.png" />
4374      * <img alt="Green (odd rows) lens shading map" src="/reference/images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png" />
4375      * <img alt="Blue lens shading map" src="/reference/images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png" /></p>
4376      * <p>As a visualization only, inverting the full-color map to recover an
4377      * image of a gray wall (using bicubic interpolation for visual quality)
4378      * as captured by the sensor gives:</p>
4379      * <p><img alt="Image of a uniform white wall (inverse shading map)" src="/reference/images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png" /></p>
4380      * <p>For a MONOCHROME camera, all of the 2x2 channels must have the same values. An example
4381      * shading map for such a camera is defined as:</p>
4382      * <pre><code>android.lens.info.shadingMapSize = [ 4, 3 ]
4383      * android.statistics.lensShadingMap =
4384      * [ 1.3, 1.3, 1.3, 1.3,  1.2, 1.2, 1.2, 1.2,
4385      *     1.1, 1.1, 1.1, 1.1,  1.3, 1.3, 1.3, 1.3,
4386      *   1.2, 1.2, 1.2, 1.2,  1.1, 1.1, 1.1, 1.1,
4387      *     1.0, 1.0, 1.0, 1.0,  1.2, 1.2, 1.2, 1.2,
4388      *   1.3, 1.3, 1.3, 1.3,   1.2, 1.2, 1.2, 1.2,
4389      *     1.2, 1.2, 1.2, 1.2,  1.3, 1.3, 1.3, 1.3 ]
4390      * </code></pre>
4391      * <p>Note that the RAW image data might be subject to lens shading
4392      * correction not reported on this map. Query
4393      * {@link CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED android.sensor.info.lensShadingApplied} to see if RAW image data has subject
4394      * to lens shading correction. If {@link CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED android.sensor.info.lensShadingApplied}
4395      * is TRUE, the RAW image data is subject to partial or full lens shading
4396      * correction. In the case full lens shading correction is applied to RAW
4397      * images, the gain factor map reported in this key will contain all 1.0 gains.
4398      * In other words, the map reported in this key is the remaining lens shading
4399      * that needs to be applied on the RAW image to get images without lens shading
4400      * artifacts. See {@link CameraCharacteristics#REQUEST_MAX_NUM_OUTPUT_RAW android.request.maxNumOutputRaw} for a list of RAW image
4401      * formats.</p>
4402      * <p><b>Range of valid values:</b><br>
4403      * Each gain factor is &gt;= 1</p>
4404      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4405      * <p><b>Full capability</b> -
4406      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4407      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4408      *
4409      * @see CaptureRequest#COLOR_CORRECTION_MODE
4410      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4411      * @see CameraCharacteristics#REQUEST_MAX_NUM_OUTPUT_RAW
4412      * @see CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED
4413      * @hide
4414      */
4415     public static final Key<float[]> STATISTICS_LENS_SHADING_MAP =
4416             new Key<float[]>("android.statistics.lensShadingMap", float[].class);
4417 
4418     /**
4419      * <p>The best-fit color channel gains calculated
4420      * by the camera device's statistics units for the current output frame.</p>
4421      * <p>This may be different than the gains used for this frame,
4422      * since statistics processing on data from a new frame
4423      * typically completes after the transform has already been
4424      * applied to that frame.</p>
4425      * <p>The 4 channel gains are defined in Bayer domain,
4426      * see {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} for details.</p>
4427      * <p>This value should always be calculated by the auto-white balance (AWB) block,
4428      * regardless of the android.control.* current values.</p>
4429      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4430      *
4431      * @see CaptureRequest#COLOR_CORRECTION_GAINS
4432      * @deprecated
4433      * <p>Never fully implemented or specified; do not use</p>
4434 
4435      * @hide
4436      */
4437     @Deprecated
4438     public static final Key<float[]> STATISTICS_PREDICTED_COLOR_GAINS =
4439             new Key<float[]>("android.statistics.predictedColorGains", float[].class);
4440 
4441     /**
4442      * <p>The best-fit color transform matrix estimate
4443      * calculated by the camera device's statistics units for the current
4444      * output frame.</p>
4445      * <p>The camera device will provide the estimate from its
4446      * statistics unit on the white balance transforms to use
4447      * for the next frame. These are the values the camera device believes
4448      * are the best fit for the current output frame. This may
4449      * be different than the transform used for this frame, since
4450      * statistics processing on data from a new frame typically
4451      * completes after the transform has already been applied to
4452      * that frame.</p>
4453      * <p>These estimates must be provided for all frames, even if
4454      * capture settings and color transforms are set by the application.</p>
4455      * <p>This value should always be calculated by the auto-white balance (AWB) block,
4456      * regardless of the android.control.* current values.</p>
4457      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4458      * @deprecated
4459      * <p>Never fully implemented or specified; do not use</p>
4460 
4461      * @hide
4462      */
4463     @Deprecated
4464     public static final Key<Rational[]> STATISTICS_PREDICTED_COLOR_TRANSFORM =
4465             new Key<Rational[]>("android.statistics.predictedColorTransform", Rational[].class);
4466 
4467     /**
4468      * <p>The camera device estimated scene illumination lighting
4469      * frequency.</p>
4470      * <p>Many light sources, such as most fluorescent lights, flicker at a rate
4471      * that depends on the local utility power standards. This flicker must be
4472      * accounted for by auto-exposure routines to avoid artifacts in captured images.
4473      * The camera device uses this entry to tell the application what the scene
4474      * illuminant frequency is.</p>
4475      * <p>When manual exposure control is enabled
4476      * (<code>{@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} == OFF</code> or <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} ==
4477      * OFF</code>), the {@link CaptureRequest#CONTROL_AE_ANTIBANDING_MODE android.control.aeAntibandingMode} doesn't perform
4478      * antibanding, and the application can ensure it selects
4479      * exposure times that do not cause banding issues by looking
4480      * into this metadata field. See
4481      * {@link CaptureRequest#CONTROL_AE_ANTIBANDING_MODE android.control.aeAntibandingMode} for more details.</p>
4482      * <p>Reports NONE if there doesn't appear to be flickering illumination.</p>
4483      * <p><b>Possible values:</b>
4484      * <ul>
4485      *   <li>{@link #STATISTICS_SCENE_FLICKER_NONE NONE}</li>
4486      *   <li>{@link #STATISTICS_SCENE_FLICKER_50HZ 50HZ}</li>
4487      *   <li>{@link #STATISTICS_SCENE_FLICKER_60HZ 60HZ}</li>
4488      * </ul></p>
4489      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4490      * <p><b>Full capability</b> -
4491      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4492      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4493      *
4494      * @see CaptureRequest#CONTROL_AE_ANTIBANDING_MODE
4495      * @see CaptureRequest#CONTROL_AE_MODE
4496      * @see CaptureRequest#CONTROL_MODE
4497      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4498      * @see #STATISTICS_SCENE_FLICKER_NONE
4499      * @see #STATISTICS_SCENE_FLICKER_50HZ
4500      * @see #STATISTICS_SCENE_FLICKER_60HZ
4501      */
4502     @PublicKey
4503     @NonNull
4504     public static final Key<Integer> STATISTICS_SCENE_FLICKER =
4505             new Key<Integer>("android.statistics.sceneFlicker", int.class);
4506 
4507     /**
4508      * <p>Operating mode for hot pixel map generation.</p>
4509      * <p>If set to <code>true</code>, a hot pixel map is returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.
4510      * If set to <code>false</code>, no hot pixel map will be returned.</p>
4511      * <p><b>Range of valid values:</b><br>
4512      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}</p>
4513      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4514      *
4515      * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
4516      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES
4517      */
4518     @PublicKey
4519     @NonNull
4520     public static final Key<Boolean> STATISTICS_HOT_PIXEL_MAP_MODE =
4521             new Key<Boolean>("android.statistics.hotPixelMapMode", boolean.class);
4522 
4523     /**
4524      * <p>List of <code>(x, y)</code> coordinates of hot/defective pixels on the sensor.</p>
4525      * <p>A coordinate <code>(x, y)</code> must lie between <code>(0, 0)</code>, and
4526      * <code>(width - 1, height - 1)</code> (inclusive), which are the top-left and
4527      * bottom-right of the pixel array, respectively. The width and
4528      * height dimensions are given in {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}.
4529      * This may include hot pixels that lie outside of the active array
4530      * bounds given by {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p>
4531      * <p><b>Range of valid values:</b><br></p>
4532      * <p>n &lt;= number of pixels on the sensor.
4533      * The <code>(x, y)</code> coordinates must be bounded by
4534      * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}.</p>
4535      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4536      *
4537      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
4538      * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE
4539      */
4540     @PublicKey
4541     @NonNull
4542     public static final Key<android.graphics.Point[]> STATISTICS_HOT_PIXEL_MAP =
4543             new Key<android.graphics.Point[]>("android.statistics.hotPixelMap", android.graphics.Point[].class);
4544 
4545     /**
4546      * <p>Whether the camera device will output the lens
4547      * shading map in output result metadata.</p>
4548      * <p>When set to ON,
4549      * android.statistics.lensShadingMap will be provided in
4550      * the output result metadata.</p>
4551      * <p>ON is always supported on devices with the RAW capability.</p>
4552      * <p><b>Possible values:</b>
4553      * <ul>
4554      *   <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_OFF OFF}</li>
4555      *   <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_ON ON}</li>
4556      * </ul></p>
4557      * <p><b>Available values for this device:</b><br>
4558      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES android.statistics.info.availableLensShadingMapModes}</p>
4559      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4560      * <p><b>Full capability</b> -
4561      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4562      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4563      *
4564      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4565      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES
4566      * @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF
4567      * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON
4568      */
4569     @PublicKey
4570     @NonNull
4571     public static final Key<Integer> STATISTICS_LENS_SHADING_MAP_MODE =
4572             new Key<Integer>("android.statistics.lensShadingMapMode", int.class);
4573 
4574     /**
4575      * <p>A control for selecting whether optical stabilization (OIS) position
4576      * information is included in output result metadata.</p>
4577      * <p>Since optical image stabilization generally involves motion much faster than the duration
4578      * of individualq image exposure, multiple OIS samples can be included for a single capture
4579      * result. For example, if the OIS reporting operates at 200 Hz, a typical camera operating
4580      * at 30fps may have 6-7 OIS samples per capture result. This information can be combined
4581      * with the rolling shutter skew to account for lens motion during image exposure in
4582      * post-processing algorithms.</p>
4583      * <p><b>Possible values:</b>
4584      * <ul>
4585      *   <li>{@link #STATISTICS_OIS_DATA_MODE_OFF OFF}</li>
4586      *   <li>{@link #STATISTICS_OIS_DATA_MODE_ON ON}</li>
4587      * </ul></p>
4588      * <p><b>Available values for this device:</b><br>
4589      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES android.statistics.info.availableOisDataModes}</p>
4590      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4591      *
4592      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES
4593      * @see #STATISTICS_OIS_DATA_MODE_OFF
4594      * @see #STATISTICS_OIS_DATA_MODE_ON
4595      */
4596     @PublicKey
4597     @NonNull
4598     public static final Key<Integer> STATISTICS_OIS_DATA_MODE =
4599             new Key<Integer>("android.statistics.oisDataMode", int.class);
4600 
4601     /**
4602      * <p>An array of timestamps of OIS samples, in nanoseconds.</p>
4603      * <p>The array contains the timestamps of OIS samples. The timestamps are in the same
4604      * timebase as and comparable to {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp}.</p>
4605      * <p><b>Units</b>: nanoseconds</p>
4606      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4607      *
4608      * @see CaptureResult#SENSOR_TIMESTAMP
4609      * @hide
4610      */
4611     public static final Key<long[]> STATISTICS_OIS_TIMESTAMPS =
4612             new Key<long[]>("android.statistics.oisTimestamps", long[].class);
4613 
4614     /**
4615      * <p>An array of shifts of OIS samples, in x direction.</p>
4616      * <p>The array contains the amount of shifts in x direction, in pixels, based on OIS samples.
4617      * A positive value is a shift from left to right in the pre-correction active array
4618      * coordinate system. For example, if the optical center is (1000, 500) in pre-correction
4619      * active array coordinates, a shift of (3, 0) puts the new optical center at (1003, 500).</p>
4620      * <p>The number of shifts must match the number of timestamps in
4621      * android.statistics.oisTimestamps.</p>
4622      * <p>The OIS samples are not affected by whether lens distortion correction is enabled (on
4623      * supporting devices). They are always reported in pre-correction active array coordinates,
4624      * since the scaling of OIS shifts would depend on the specific spot on the sensor the shift
4625      * is needed.</p>
4626      * <p><b>Units</b>: Pixels in active array.</p>
4627      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4628      * @hide
4629      */
4630     public static final Key<float[]> STATISTICS_OIS_X_SHIFTS =
4631             new Key<float[]>("android.statistics.oisXShifts", float[].class);
4632 
4633     /**
4634      * <p>An array of shifts of OIS samples, in y direction.</p>
4635      * <p>The array contains the amount of shifts in y direction, in pixels, based on OIS samples.
4636      * A positive value is a shift from top to bottom in pre-correction active array coordinate
4637      * system. For example, if the optical center is (1000, 500) in active array coordinates, a
4638      * shift of (0, 5) puts the new optical center at (1000, 505).</p>
4639      * <p>The number of shifts must match the number of timestamps in
4640      * android.statistics.oisTimestamps.</p>
4641      * <p>The OIS samples are not affected by whether lens distortion correction is enabled (on
4642      * supporting devices). They are always reported in pre-correction active array coordinates,
4643      * since the scaling of OIS shifts would depend on the specific spot on the sensor the shift
4644      * is needed.</p>
4645      * <p><b>Units</b>: Pixels in active array.</p>
4646      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4647      * @hide
4648      */
4649     public static final Key<float[]> STATISTICS_OIS_Y_SHIFTS =
4650             new Key<float[]>("android.statistics.oisYShifts", float[].class);
4651 
4652     /**
4653      * <p>An array of optical stabilization (OIS) position samples.</p>
4654      * <p>Each OIS sample contains the timestamp and the amount of shifts in x and y direction,
4655      * in pixels, of the OIS sample.</p>
4656      * <p>A positive value for a shift in x direction is a shift from left to right in the
4657      * pre-correction active array coordinate system. For example, if the optical center is
4658      * (1000, 500) in pre-correction active array coordinates, a shift of (3, 0) puts the new
4659      * optical center at (1003, 500).</p>
4660      * <p>A positive value for a shift in y direction is a shift from top to bottom in
4661      * pre-correction active array coordinate system. For example, if the optical center is
4662      * (1000, 500) in active array coordinates, a shift of (0, 5) puts the new optical center at
4663      * (1000, 505).</p>
4664      * <p>The OIS samples are not affected by whether lens distortion correction is enabled (on
4665      * supporting devices). They are always reported in pre-correction active array coordinates,
4666      * since the scaling of OIS shifts would depend on the specific spot on the sensor the shift
4667      * is needed.</p>
4668      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4669      */
4670     @PublicKey
4671     @NonNull
4672     @SyntheticKey
4673     public static final Key<android.hardware.camera2.params.OisSample[]> STATISTICS_OIS_SAMPLES =
4674             new Key<android.hardware.camera2.params.OisSample[]>("android.statistics.oisSamples", android.hardware.camera2.params.OisSample[].class);
4675 
4676     /**
4677      * <p>Tonemapping / contrast / gamma curve for the blue
4678      * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
4679      * CONTRAST_CURVE.</p>
4680      * <p>See android.tonemap.curveRed for more details.</p>
4681      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4682      * <p><b>Full capability</b> -
4683      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4684      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4685      *
4686      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4687      * @see CaptureRequest#TONEMAP_MODE
4688      * @hide
4689      */
4690     public static final Key<float[]> TONEMAP_CURVE_BLUE =
4691             new Key<float[]>("android.tonemap.curveBlue", float[].class);
4692 
4693     /**
4694      * <p>Tonemapping / contrast / gamma curve for the green
4695      * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
4696      * CONTRAST_CURVE.</p>
4697      * <p>See android.tonemap.curveRed for more details.</p>
4698      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4699      * <p><b>Full capability</b> -
4700      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4701      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4702      *
4703      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4704      * @see CaptureRequest#TONEMAP_MODE
4705      * @hide
4706      */
4707     public static final Key<float[]> TONEMAP_CURVE_GREEN =
4708             new Key<float[]>("android.tonemap.curveGreen", float[].class);
4709 
4710     /**
4711      * <p>Tonemapping / contrast / gamma curve for the red
4712      * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
4713      * CONTRAST_CURVE.</p>
4714      * <p>Each channel's curve is defined by an array of control points:</p>
4715      * <pre><code>android.tonemap.curveRed =
4716      *   [ P0in, P0out, P1in, P1out, P2in, P2out, P3in, P3out, ..., PNin, PNout ]
4717      * 2 &lt;= N &lt;= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
4718      * <p>These are sorted in order of increasing <code>Pin</code>; it is
4719      * required that input values 0.0 and 1.0 are included in the list to
4720      * define a complete mapping. For input values between control points,
4721      * the camera device must linearly interpolate between the control
4722      * points.</p>
4723      * <p>Each curve can have an independent number of points, and the number
4724      * of points can be less than max (that is, the request doesn't have to
4725      * always provide a curve with number of points equivalent to
4726      * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p>
4727      * <p>For devices with MONOCHROME capability, all three channels must have the same set of
4728      * control points.</p>
4729      * <p>A few examples, and their corresponding graphical mappings; these
4730      * only specify the red channel and the precision is limited to 4
4731      * digits, for conciseness.</p>
4732      * <p>Linear mapping:</p>
4733      * <pre><code>android.tonemap.curveRed = [ 0, 0, 1.0, 1.0 ]
4734      * </code></pre>
4735      * <p><img alt="Linear mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p>
4736      * <p>Invert mapping:</p>
4737      * <pre><code>android.tonemap.curveRed = [ 0, 1.0, 1.0, 0 ]
4738      * </code></pre>
4739      * <p><img alt="Inverting mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p>
4740      * <p>Gamma 1/2.2 mapping, with 16 control points:</p>
4741      * <pre><code>android.tonemap.curveRed = [
4742      *   0.0000, 0.0000, 0.0667, 0.2920, 0.1333, 0.4002, 0.2000, 0.4812,
4743      *   0.2667, 0.5484, 0.3333, 0.6069, 0.4000, 0.6594, 0.4667, 0.7072,
4744      *   0.5333, 0.7515, 0.6000, 0.7928, 0.6667, 0.8317, 0.7333, 0.8685,
4745      *   0.8000, 0.9035, 0.8667, 0.9370, 0.9333, 0.9691, 1.0000, 1.0000 ]
4746      * </code></pre>
4747      * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p>
4748      * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p>
4749      * <pre><code>android.tonemap.curveRed = [
4750      *   0.0000, 0.0000, 0.0667, 0.2864, 0.1333, 0.4007, 0.2000, 0.4845,
4751      *   0.2667, 0.5532, 0.3333, 0.6125, 0.4000, 0.6652, 0.4667, 0.7130,
4752      *   0.5333, 0.7569, 0.6000, 0.7977, 0.6667, 0.8360, 0.7333, 0.8721,
4753      *   0.8000, 0.9063, 0.8667, 0.9389, 0.9333, 0.9701, 1.0000, 1.0000 ]
4754      * </code></pre>
4755      * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
4756      * <p><b>Range of valid values:</b><br>
4757      * 0-1 on both input and output coordinates, normalized
4758      * as a floating-point value such that 0 == black and 1 == white.</p>
4759      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4760      * <p><b>Full capability</b> -
4761      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4762      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4763      *
4764      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4765      * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS
4766      * @see CaptureRequest#TONEMAP_MODE
4767      * @hide
4768      */
4769     public static final Key<float[]> TONEMAP_CURVE_RED =
4770             new Key<float[]>("android.tonemap.curveRed", float[].class);
4771 
4772     /**
4773      * <p>Tonemapping / contrast / gamma curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode}
4774      * is CONTRAST_CURVE.</p>
4775      * <p>The tonemapCurve consist of three curves for each of red, green, and blue
4776      * channels respectively. The following example uses the red channel as an
4777      * example. The same logic applies to green and blue channel.
4778      * Each channel's curve is defined by an array of control points:</p>
4779      * <pre><code>curveRed =
4780      *   [ P0(in, out), P1(in, out), P2(in, out), P3(in, out), ..., PN(in, out) ]
4781      * 2 &lt;= N &lt;= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
4782      * <p>These are sorted in order of increasing <code>Pin</code>; it is always
4783      * guaranteed that input values 0.0 and 1.0 are included in the list to
4784      * define a complete mapping. For input values between control points,
4785      * the camera device must linearly interpolate between the control
4786      * points.</p>
4787      * <p>Each curve can have an independent number of points, and the number
4788      * of points can be less than max (that is, the request doesn't have to
4789      * always provide a curve with number of points equivalent to
4790      * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p>
4791      * <p>For devices with MONOCHROME capability, all three channels must have the same set of
4792      * control points.</p>
4793      * <p>A few examples, and their corresponding graphical mappings; these
4794      * only specify the red channel and the precision is limited to 4
4795      * digits, for conciseness.</p>
4796      * <p>Linear mapping:</p>
4797      * <pre><code>curveRed = [ (0, 0), (1.0, 1.0) ]
4798      * </code></pre>
4799      * <p><img alt="Linear mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p>
4800      * <p>Invert mapping:</p>
4801      * <pre><code>curveRed = [ (0, 1.0), (1.0, 0) ]
4802      * </code></pre>
4803      * <p><img alt="Inverting mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p>
4804      * <p>Gamma 1/2.2 mapping, with 16 control points:</p>
4805      * <pre><code>curveRed = [
4806      *   (0.0000, 0.0000), (0.0667, 0.2920), (0.1333, 0.4002), (0.2000, 0.4812),
4807      *   (0.2667, 0.5484), (0.3333, 0.6069), (0.4000, 0.6594), (0.4667, 0.7072),
4808      *   (0.5333, 0.7515), (0.6000, 0.7928), (0.6667, 0.8317), (0.7333, 0.8685),
4809      *   (0.8000, 0.9035), (0.8667, 0.9370), (0.9333, 0.9691), (1.0000, 1.0000) ]
4810      * </code></pre>
4811      * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p>
4812      * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p>
4813      * <pre><code>curveRed = [
4814      *   (0.0000, 0.0000), (0.0667, 0.2864), (0.1333, 0.4007), (0.2000, 0.4845),
4815      *   (0.2667, 0.5532), (0.3333, 0.6125), (0.4000, 0.6652), (0.4667, 0.7130),
4816      *   (0.5333, 0.7569), (0.6000, 0.7977), (0.6667, 0.8360), (0.7333, 0.8721),
4817      *   (0.8000, 0.9063), (0.8667, 0.9389), (0.9333, 0.9701), (1.0000, 1.0000) ]
4818      * </code></pre>
4819      * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
4820      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4821      * <p><b>Full capability</b> -
4822      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4823      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4824      *
4825      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4826      * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS
4827      * @see CaptureRequest#TONEMAP_MODE
4828      */
4829     @PublicKey
4830     @NonNull
4831     @SyntheticKey
4832     public static final Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE =
4833             new Key<android.hardware.camera2.params.TonemapCurve>("android.tonemap.curve", android.hardware.camera2.params.TonemapCurve.class);
4834 
4835     /**
4836      * <p>High-level global contrast/gamma/tonemapping control.</p>
4837      * <p>When switching to an application-defined contrast curve by setting
4838      * {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} to CONTRAST_CURVE, the curve is defined
4839      * per-channel with a set of <code>(in, out)</code> points that specify the
4840      * mapping from input high-bit-depth pixel value to the output
4841      * low-bit-depth value.  Since the actual pixel ranges of both input
4842      * and output may change depending on the camera pipeline, the values
4843      * are specified by normalized floating-point numbers.</p>
4844      * <p>More-complex color mapping operations such as 3D color look-up
4845      * tables, selective chroma enhancement, or other non-linear color
4846      * transforms will be disabled when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
4847      * CONTRAST_CURVE.</p>
4848      * <p>When using either FAST or HIGH_QUALITY, the camera device will
4849      * emit its own tonemap curve in {@link CaptureRequest#TONEMAP_CURVE android.tonemap.curve}.
4850      * These values are always available, and as close as possible to the
4851      * actually used nonlinear/nonglobal transforms.</p>
4852      * <p>If a request is sent with CONTRAST_CURVE with the camera device's
4853      * provided curve in FAST or HIGH_QUALITY, the image's tonemap will be
4854      * roughly the same.</p>
4855      * <p><b>Possible values:</b>
4856      * <ul>
4857      *   <li>{@link #TONEMAP_MODE_CONTRAST_CURVE CONTRAST_CURVE}</li>
4858      *   <li>{@link #TONEMAP_MODE_FAST FAST}</li>
4859      *   <li>{@link #TONEMAP_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
4860      *   <li>{@link #TONEMAP_MODE_GAMMA_VALUE GAMMA_VALUE}</li>
4861      *   <li>{@link #TONEMAP_MODE_PRESET_CURVE PRESET_CURVE}</li>
4862      * </ul></p>
4863      * <p><b>Available values for this device:</b><br>
4864      * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}</p>
4865      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4866      * <p><b>Full capability</b> -
4867      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4868      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4869      *
4870      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4871      * @see CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES
4872      * @see CaptureRequest#TONEMAP_CURVE
4873      * @see CaptureRequest#TONEMAP_MODE
4874      * @see #TONEMAP_MODE_CONTRAST_CURVE
4875      * @see #TONEMAP_MODE_FAST
4876      * @see #TONEMAP_MODE_HIGH_QUALITY
4877      * @see #TONEMAP_MODE_GAMMA_VALUE
4878      * @see #TONEMAP_MODE_PRESET_CURVE
4879      */
4880     @PublicKey
4881     @NonNull
4882     public static final Key<Integer> TONEMAP_MODE =
4883             new Key<Integer>("android.tonemap.mode", int.class);
4884 
4885     /**
4886      * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
4887      * GAMMA_VALUE</p>
4888      * <p>The tonemap curve will be defined the following formula:
4889      * * OUT = pow(IN, 1.0 / gamma)
4890      * where IN and OUT is the input pixel value scaled to range [0.0, 1.0],
4891      * pow is the power function and gamma is the gamma value specified by this
4892      * key.</p>
4893      * <p>The same curve will be applied to all color channels. The camera device
4894      * may clip the input gamma value to its supported range. The actual applied
4895      * value will be returned in capture result.</p>
4896      * <p>The valid range of gamma value varies on different devices, but values
4897      * within [1.0, 5.0] are guaranteed not to be clipped.</p>
4898      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4899      *
4900      * @see CaptureRequest#TONEMAP_MODE
4901      */
4902     @PublicKey
4903     @NonNull
4904     public static final Key<Float> TONEMAP_GAMMA =
4905             new Key<Float>("android.tonemap.gamma", float.class);
4906 
4907     /**
4908      * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
4909      * PRESET_CURVE</p>
4910      * <p>The tonemap curve will be defined by specified standard.</p>
4911      * <p>sRGB (approximated by 16 control points):</p>
4912      * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
4913      * <p>Rec. 709 (approximated by 16 control points):</p>
4914      * <p><img alt="Rec. 709 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png" /></p>
4915      * <p>Note that above figures show a 16 control points approximation of preset
4916      * curves. Camera devices may apply a different approximation to the curve.</p>
4917      * <p><b>Possible values:</b>
4918      * <ul>
4919      *   <li>{@link #TONEMAP_PRESET_CURVE_SRGB SRGB}</li>
4920      *   <li>{@link #TONEMAP_PRESET_CURVE_REC709 REC709}</li>
4921      * </ul></p>
4922      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4923      *
4924      * @see CaptureRequest#TONEMAP_MODE
4925      * @see #TONEMAP_PRESET_CURVE_SRGB
4926      * @see #TONEMAP_PRESET_CURVE_REC709
4927      */
4928     @PublicKey
4929     @NonNull
4930     public static final Key<Integer> TONEMAP_PRESET_CURVE =
4931             new Key<Integer>("android.tonemap.presetCurve", int.class);
4932 
4933     /**
4934      * <p>This LED is nominally used to indicate to the user
4935      * that the camera is powered on and may be streaming images back to the
4936      * Application Processor. In certain rare circumstances, the OS may
4937      * disable this when video is processed locally and not transmitted to
4938      * any untrusted applications.</p>
4939      * <p>In particular, the LED <em>must</em> always be on when the data could be
4940      * transmitted off the device. The LED <em>should</em> always be on whenever
4941      * data is stored locally on the device.</p>
4942      * <p>The LED <em>may</em> be off if a trusted application is using the data that
4943      * doesn't violate the above rules.</p>
4944      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4945      * @hide
4946      */
4947     public static final Key<Boolean> LED_TRANSMIT =
4948             new Key<Boolean>("android.led.transmit", boolean.class);
4949 
4950     /**
4951      * <p>Whether black-level compensation is locked
4952      * to its current values, or is free to vary.</p>
4953      * <p>Whether the black level offset was locked for this frame.  Should be
4954      * ON if {@link CaptureRequest#BLACK_LEVEL_LOCK android.blackLevel.lock} was ON in the capture request, unless
4955      * a change in other capture settings forced the camera device to
4956      * perform a black level reset.</p>
4957      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4958      * <p><b>Full capability</b> -
4959      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4960      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4961      *
4962      * @see CaptureRequest#BLACK_LEVEL_LOCK
4963      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4964      */
4965     @PublicKey
4966     @NonNull
4967     public static final Key<Boolean> BLACK_LEVEL_LOCK =
4968             new Key<Boolean>("android.blackLevel.lock", boolean.class);
4969 
4970     /**
4971      * <p>The frame number corresponding to the last request
4972      * with which the output result (metadata + buffers) has been fully
4973      * synchronized.</p>
4974      * <p>When a request is submitted to the camera device, there is usually a
4975      * delay of several frames before the controls get applied. A camera
4976      * device may either choose to account for this delay by implementing a
4977      * pipeline and carefully submit well-timed atomic control updates, or
4978      * it may start streaming control changes that span over several frame
4979      * boundaries.</p>
4980      * <p>In the latter case, whenever a request's settings change relative to
4981      * the previous submitted request, the full set of changes may take
4982      * multiple frame durations to fully take effect. Some settings may
4983      * take effect sooner (in less frame durations) than others.</p>
4984      * <p>While a set of control changes are being propagated, this value
4985      * will be CONVERGING.</p>
4986      * <p>Once it is fully known that a set of control changes have been
4987      * finished propagating, and the resulting updated control settings
4988      * have been read back by the camera device, this value will be set
4989      * to a non-negative frame number (corresponding to the request to
4990      * which the results have synchronized to).</p>
4991      * <p>Older camera device implementations may not have a way to detect
4992      * when all camera controls have been applied, and will always set this
4993      * value to UNKNOWN.</p>
4994      * <p>FULL capability devices will always have this value set to the
4995      * frame number of the request corresponding to this result.</p>
4996      * <p><em>Further details</em>:</p>
4997      * <ul>
4998      * <li>Whenever a request differs from the last request, any future
4999      * results not yet returned may have this value set to CONVERGING (this
5000      * could include any in-progress captures not yet returned by the camera
5001      * device, for more details see pipeline considerations below).</li>
5002      * <li>Submitting a series of multiple requests that differ from the
5003      * previous request (e.g. r1, r2, r3 s.t. r1 != r2 != r3)
5004      * moves the new synchronization frame to the last non-repeating
5005      * request (using the smallest frame number from the contiguous list of
5006      * repeating requests).</li>
5007      * <li>Submitting the same request repeatedly will not change this value
5008      * to CONVERGING, if it was already a non-negative value.</li>
5009      * <li>When this value changes to non-negative, that means that all of the
5010      * metadata controls from the request have been applied, all of the
5011      * metadata controls from the camera device have been read to the
5012      * updated values (into the result), and all of the graphics buffers
5013      * corresponding to this result are also synchronized to the request.</li>
5014      * </ul>
5015      * <p><em>Pipeline considerations</em>:</p>
5016      * <p>Submitting a request with updated controls relative to the previously
5017      * submitted requests may also invalidate the synchronization state
5018      * of all the results corresponding to currently in-flight requests.</p>
5019      * <p>In other words, results for this current request and up to
5020      * {@link CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH android.request.pipelineMaxDepth} prior requests may have their
5021      * android.sync.frameNumber change to CONVERGING.</p>
5022      * <p><b>Possible values:</b>
5023      * <ul>
5024      *   <li>{@link #SYNC_FRAME_NUMBER_CONVERGING CONVERGING}</li>
5025      *   <li>{@link #SYNC_FRAME_NUMBER_UNKNOWN UNKNOWN}</li>
5026      * </ul></p>
5027      * <p><b>Available values for this device:</b><br>
5028      * Either a non-negative value corresponding to a
5029      * <code>frame_number</code>, or one of the two enums (CONVERGING / UNKNOWN).</p>
5030      * <p>This key is available on all devices.</p>
5031      *
5032      * @see CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH
5033      * @see #SYNC_FRAME_NUMBER_CONVERGING
5034      * @see #SYNC_FRAME_NUMBER_UNKNOWN
5035      * @hide
5036      */
5037     public static final Key<Long> SYNC_FRAME_NUMBER =
5038             new Key<Long>("android.sync.frameNumber", long.class);
5039 
5040     /**
5041      * <p>The amount of exposure time increase factor applied to the original output
5042      * frame by the application processing before sending for reprocessing.</p>
5043      * <p>This is optional, and will be supported if the camera device supports YUV_REPROCESSING
5044      * capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains YUV_REPROCESSING).</p>
5045      * <p>For some YUV reprocessing use cases, the application may choose to filter the original
5046      * output frames to effectively reduce the noise to the same level as a frame that was
5047      * captured with longer exposure time. To be more specific, assuming the original captured
5048      * images were captured with a sensitivity of S and an exposure time of T, the model in
5049      * the camera device is that the amount of noise in the image would be approximately what
5050      * would be expected if the original capture parameters had been a sensitivity of
5051      * S/effectiveExposureFactor and an exposure time of T*effectiveExposureFactor, rather
5052      * than S and T respectively. If the captured images were processed by the application
5053      * before being sent for reprocessing, then the application may have used image processing
5054      * algorithms and/or multi-frame image fusion to reduce the noise in the
5055      * application-processed images (input images). By using the effectiveExposureFactor
5056      * control, the application can communicate to the camera device the actual noise level
5057      * improvement in the application-processed image. With this information, the camera
5058      * device can select appropriate noise reduction and edge enhancement parameters to avoid
5059      * excessive noise reduction ({@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode}) and insufficient edge
5060      * enhancement ({@link CaptureRequest#EDGE_MODE android.edge.mode}) being applied to the reprocessed frames.</p>
5061      * <p>For example, for multi-frame image fusion use case, the application may fuse
5062      * multiple output frames together to a final frame for reprocessing. When N image are
5063      * fused into 1 image for reprocessing, the exposure time increase factor could be up to
5064      * square root of N (based on a simple photon shot noise model). The camera device will
5065      * adjust the reprocessing noise reduction and edge enhancement parameters accordingly to
5066      * produce the best quality images.</p>
5067      * <p>This is relative factor, 1.0 indicates the application hasn't processed the input
5068      * buffer in a way that affects its effective exposure time.</p>
5069      * <p>This control is only effective for YUV reprocessing capture request. For noise
5070      * reduction reprocessing, it is only effective when <code>{@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode} != OFF</code>.
5071      * Similarly, for edge enhancement reprocessing, it is only effective when
5072      * <code>{@link CaptureRequest#EDGE_MODE android.edge.mode} != OFF</code>.</p>
5073      * <p><b>Units</b>: Relative exposure time increase factor.</p>
5074      * <p><b>Range of valid values:</b><br>
5075      * &gt;= 1.0</p>
5076      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
5077      * <p><b>Limited capability</b> -
5078      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
5079      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
5080      *
5081      * @see CaptureRequest#EDGE_MODE
5082      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
5083      * @see CaptureRequest#NOISE_REDUCTION_MODE
5084      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
5085      */
5086     @PublicKey
5087     @NonNull
5088     public static final Key<Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR =
5089             new Key<Float>("android.reprocess.effectiveExposureFactor", float.class);
5090 
5091     /**
5092      * <p>String containing the ID of the underlying active physical camera.</p>
5093      * <p>The ID of the active physical camera that's backing the logical camera. All camera
5094      * streams and metadata that are not physical camera specific will be originating from this
5095      * physical camera.</p>
5096      * <p>For a logical camera made up of physical cameras where each camera's lenses have
5097      * different characteristics, the camera device may choose to switch between the physical
5098      * cameras when application changes FOCAL_LENGTH or SCALER_CROP_REGION.
5099      * At the time of lens switch, this result metadata reflects the new active physical camera
5100      * ID.</p>
5101      * <p>This key will be available if the camera device advertises this key via {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureResultKeys }.
5102      * When available, this must be one of valid physical IDs backing this logical multi-camera.
5103      * If this key is not available for a logical multi-camera, the camera device implementation
5104      * may still switch between different active physical cameras based on use case, but the
5105      * current active physical camera information won't be available to the application.</p>
5106      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
5107      */
5108     @PublicKey
5109     @NonNull
5110     public static final Key<String> LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID =
5111             new Key<String>("android.logicalMultiCamera.activePhysicalId", String.class);
5112 
5113     /**
5114      * <p>Mode of operation for the lens distortion correction block.</p>
5115      * <p>The lens distortion correction block attempts to improve image quality by fixing
5116      * radial, tangential, or other geometric aberrations in the camera device's optics.  If
5117      * available, the {@link CameraCharacteristics#LENS_DISTORTION android.lens.distortion} field documents the lens's distortion parameters.</p>
5118      * <p>OFF means no distortion correction is done.</p>
5119      * <p>FAST/HIGH_QUALITY both mean camera device determined distortion correction will be
5120      * applied. HIGH_QUALITY mode indicates that the camera device will use the highest-quality
5121      * correction algorithms, even if it slows down capture rate. FAST means the camera device
5122      * will not slow down capture rate when applying correction. FAST may be the same as OFF if
5123      * any correction at all would slow down capture rate.  Every output stream will have a
5124      * similar amount of enhancement applied.</p>
5125      * <p>The correction only applies to processed outputs such as YUV, Y8, JPEG, or DEPTH16; it is
5126      * not applied to any RAW output.</p>
5127      * <p>This control will be on by default on devices that support this control. Applications
5128      * disabling distortion correction need to pay extra attention with the coordinate system of
5129      * metering regions, crop region, and face rectangles. When distortion correction is OFF,
5130      * metadata coordinates follow the coordinate system of
5131      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}. When distortion is not OFF, metadata
5132      * coordinates follow the coordinate system of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.  The
5133      * camera device will map these metadata fields to match the corrected image produced by the
5134      * camera device, for both capture requests and results.  However, this mapping is not very
5135      * precise, since rectangles do not generally map to rectangles when corrected.  Only linear
5136      * scaling between the active array and precorrection active array coordinates is
5137      * performed. Applications that require precise correction of metadata need to undo that
5138      * linear scaling, and apply a more complete correction that takes into the account the app's
5139      * own requirements.</p>
5140      * <p>The full list of metadata that is affected in this way by distortion correction is:</p>
5141      * <ul>
5142      * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li>
5143      * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li>
5144      * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li>
5145      * <li>{@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}</li>
5146      * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li>
5147      * </ul>
5148      * <p><b>Possible values:</b>
5149      * <ul>
5150      *   <li>{@link #DISTORTION_CORRECTION_MODE_OFF OFF}</li>
5151      *   <li>{@link #DISTORTION_CORRECTION_MODE_FAST FAST}</li>
5152      *   <li>{@link #DISTORTION_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
5153      * </ul></p>
5154      * <p><b>Available values for this device:</b><br>
5155      * {@link CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES android.distortionCorrection.availableModes}</p>
5156      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
5157      *
5158      * @see CaptureRequest#CONTROL_AE_REGIONS
5159      * @see CaptureRequest#CONTROL_AF_REGIONS
5160      * @see CaptureRequest#CONTROL_AWB_REGIONS
5161      * @see CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES
5162      * @see CameraCharacteristics#LENS_DISTORTION
5163      * @see CaptureRequest#SCALER_CROP_REGION
5164      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
5165      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
5166      * @see CaptureResult#STATISTICS_FACES
5167      * @see #DISTORTION_CORRECTION_MODE_OFF
5168      * @see #DISTORTION_CORRECTION_MODE_FAST
5169      * @see #DISTORTION_CORRECTION_MODE_HIGH_QUALITY
5170      */
5171     @PublicKey
5172     @NonNull
5173     public static final Key<Integer> DISTORTION_CORRECTION_MODE =
5174             new Key<Integer>("android.distortionCorrection.mode", int.class);
5175 
5176     /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
5177      * End generated code
5178      *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/
5179 
5180 
5181 
5182 
5183 
5184 
5185 }
5186