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