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