1 /*
2  * Copyright (C) 2013 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.PublicKey;
24 import android.hardware.camera2.impl.SyntheticKey;
25 import android.hardware.camera2.params.OutputConfiguration;
26 import android.hardware.camera2.utils.HashCodeHelpers;
27 import android.hardware.camera2.utils.SurfaceUtils;
28 import android.hardware.camera2.utils.TypeReference;
29 import android.os.Build;
30 import android.os.Parcel;
31 import android.os.Parcelable;
32 import android.util.ArraySet;
33 import android.util.Log;
34 import android.util.SparseArray;
35 import android.view.Surface;
36 
37 import java.util.Collection;
38 import java.util.Collections;
39 import java.util.HashMap;
40 import java.util.List;
41 import java.util.Map;
42 import java.util.Objects;
43 import java.util.Set;
44 
45 /**
46  * <p>An immutable package of settings and outputs needed to capture a single
47  * image from the camera device.</p>
48  *
49  * <p>Contains the configuration for the capture hardware (sensor, lens, flash),
50  * the processing pipeline, the control algorithms, and the output buffers. Also
51  * contains the list of target Surfaces to send image data to for this
52  * capture.</p>
53  *
54  * <p>CaptureRequests can be created by using a {@link Builder} instance,
55  * obtained by calling {@link CameraDevice#createCaptureRequest}</p>
56  *
57  * <p>CaptureRequests are given to {@link CameraCaptureSession#capture} or
58  * {@link CameraCaptureSession#setRepeatingRequest} to capture images from a camera.</p>
59  *
60  * <p>Each request can specify a different subset of target Surfaces for the
61  * camera to send the captured data to. All the surfaces used in a request must
62  * be part of the surface list given to the last call to
63  * {@link CameraDevice#createCaptureSession}, when the request is submitted to the
64  * session.</p>
65  *
66  * <p>For example, a request meant for repeating preview might only include the
67  * Surface for the preview SurfaceView or SurfaceTexture, while a
68  * high-resolution still capture would also include a Surface from a ImageReader
69  * configured for high-resolution JPEG images.</p>
70  *
71  * <p>A reprocess capture request allows a previously-captured image from the camera device to be
72  * sent back to the device for further processing. It can be created with
73  * {@link CameraDevice#createReprocessCaptureRequest}, and used with a reprocessable capture session
74  * created with {@link CameraDevice#createReprocessableCaptureSession}.</p>
75  *
76  * @see CameraCaptureSession#capture
77  * @see CameraCaptureSession#setRepeatingRequest
78  * @see CameraCaptureSession#captureBurst
79  * @see CameraCaptureSession#setRepeatingBurst
80  * @see CameraDevice#createCaptureRequest
81  * @see CameraDevice#createReprocessCaptureRequest
82  */
83 public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
84         implements Parcelable {
85 
86     /**
87      * A {@code Key} is used to do capture request field lookups with
88      * {@link CaptureRequest#get} or to set fields with
89      * {@link CaptureRequest.Builder#set(Key, Object)}.
90      *
91      * <p>For example, to set the crop rectangle for the next capture:
92      * <code><pre>
93      * Rect cropRectangle = new Rect(0, 0, 640, 480);
94      * captureRequestBuilder.set(SCALER_CROP_REGION, cropRectangle);
95      * </pre></code>
96      * </p>
97      *
98      * <p>To enumerate over all possible keys for {@link CaptureRequest}, see
99      * {@link CameraCharacteristics#getAvailableCaptureRequestKeys}.</p>
100      *
101      * @see CaptureRequest#get
102      * @see CameraCharacteristics#getAvailableCaptureRequestKeys
103      */
104     public final static class Key<T> {
105         private final CameraMetadataNative.Key<T> mKey;
106 
107         /**
108          * Visible for testing and vendor extensions only.
109          *
110          * @hide
111          */
112         @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
Key(String name, Class<T> type, long vendorId)113         public Key(String name, Class<T> type, long vendorId) {
114             mKey = new CameraMetadataNative.Key<T>(name, type, vendorId);
115         }
116 
117         /**
118          * Construct a new Key with a given name and type.
119          *
120          * <p>Normally, applications should use the existing Key definitions in
121          * {@link CaptureRequest}, and not need to construct their own Key objects. However, they
122          * may be useful for testing purposes and for defining custom capture request fields.</p>
123          */
Key(@onNull String name, @NonNull Class<T> type)124         public Key(@NonNull String name, @NonNull Class<T> type) {
125             mKey = new CameraMetadataNative.Key<T>(name, type);
126         }
127 
128         /**
129          * Visible for testing and vendor extensions only.
130          *
131          * @hide
132          */
133         @UnsupportedAppUsage
Key(String name, TypeReference<T> typeReference)134         public Key(String name, TypeReference<T> typeReference) {
135             mKey = new CameraMetadataNative.Key<T>(name, typeReference);
136         }
137 
138         /**
139          * Return a camelCase, period separated name formatted like:
140          * {@code "root.section[.subsections].name"}.
141          *
142          * <p>Built-in keys exposed by the Android SDK are always prefixed with {@code "android."};
143          * keys that are device/platform-specific are prefixed with {@code "com."}.</p>
144          *
145          * <p>For example, {@code CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP} would
146          * have a name of {@code "android.scaler.streamConfigurationMap"}; whereas a device
147          * specific key might look like {@code "com.google.nexus.data.private"}.</p>
148          *
149          * @return String representation of the key name
150          */
151         @NonNull
getName()152         public String getName() {
153             return mKey.getName();
154         }
155 
156         /**
157          * Return vendor tag id.
158          *
159          * @hide
160          */
getVendorId()161         public long getVendorId() {
162             return mKey.getVendorId();
163         }
164 
165         /**
166          * {@inheritDoc}
167          */
168         @Override
hashCode()169         public final int hashCode() {
170             return mKey.hashCode();
171         }
172 
173         /**
174          * {@inheritDoc}
175          */
176         @SuppressWarnings("unchecked")
177         @Override
equals(Object o)178         public final boolean equals(Object o) {
179             return o instanceof Key && ((Key<T>)o).mKey.equals(mKey);
180         }
181 
182         /**
183          * Return this {@link Key} as a string representation.
184          *
185          * <p>{@code "CaptureRequest.Key(%s)"}, where {@code %s} represents
186          * the name of this key as returned by {@link #getName}.</p>
187          *
188          * @return string representation of {@link Key}
189          */
190         @NonNull
191         @Override
toString()192         public String toString() {
193             return String.format("CaptureRequest.Key(%s)", mKey.getName());
194         }
195 
196         /**
197          * Visible for CameraMetadataNative implementation only; do not use.
198          *
199          * TODO: Make this private or remove it altogether.
200          *
201          * @hide
202          */
203         @UnsupportedAppUsage
getNativeKey()204         public CameraMetadataNative.Key<T> getNativeKey() {
205             return mKey;
206         }
207 
208         @SuppressWarnings({ "unchecked" })
Key(CameraMetadataNative.Key<?> nativeKey)209         /*package*/ Key(CameraMetadataNative.Key<?> nativeKey) {
210             mKey = (CameraMetadataNative.Key<T>) nativeKey;
211         }
212     }
213 
214     private final String            TAG = "CaptureRequest-JV";
215 
216     private final ArraySet<Surface> mSurfaceSet = new ArraySet<Surface>();
217 
218     // Speed up sending CaptureRequest across IPC:
219     // mSurfaceConverted should only be set to true during capture request
220     // submission by {@link #convertSurfaceToStreamId}. The method will convert
221     // surfaces to stream/surface indexes based on passed in stream configuration at that time.
222     // This will save significant unparcel time for remote camera device.
223     // Once the request is submitted, camera device will call {@link #recoverStreamIdToSurface}
224     // to reset the capture request back to its original state.
225     private final Object           mSurfacesLock = new Object();
226     private boolean                mSurfaceConverted = false;
227     private int[]                  mStreamIdxArray;
228     private int[]                  mSurfaceIdxArray;
229 
230     private static final ArraySet<Surface> mEmptySurfaceSet = new ArraySet<Surface>();
231 
232     private String mLogicalCameraId;
233     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
234     private CameraMetadataNative mLogicalCameraSettings;
235     private final HashMap<String, CameraMetadataNative> mPhysicalCameraSettings =
236             new HashMap<String, CameraMetadataNative>();
237 
238     private boolean mIsReprocess;
239 
240     //
241     // Enumeration values for types of CaptureRequest
242     //
243 
244     /**
245      * @hide
246      */
247     public static final int REQUEST_TYPE_REGULAR = 0;
248 
249     /**
250      * @hide
251      */
252     public static final int REQUEST_TYPE_REPROCESS = 1;
253 
254     /**
255      * @hide
256      */
257     public static final int REQUEST_TYPE_ZSL_STILL = 2;
258 
259     /**
260      * Note: To add another request type, the FrameNumberTracker in CameraDeviceImpl must be
261      * adjusted accordingly.
262      * @hide
263      */
264     public static final int REQUEST_TYPE_COUNT = 3;
265 
266 
267     private int mRequestType = -1;
268 
269     private static final String SET_TAG_STRING_PREFIX =
270             "android.hardware.camera2.CaptureRequest.setTag.";
271     /**
272      * Get the type of the capture request
273      *
274      * Return one of REGULAR, ZSL_STILL, or REPROCESS.
275      * @hide
276      */
getRequestType()277     public int getRequestType() {
278         if (mRequestType == -1) {
279             if (mIsReprocess) {
280                 mRequestType = REQUEST_TYPE_REPROCESS;
281             } else {
282                 Boolean enableZsl = mLogicalCameraSettings.get(CaptureRequest.CONTROL_ENABLE_ZSL);
283                 boolean isZslStill = false;
284                 if (enableZsl != null && enableZsl) {
285                     int captureIntent = mLogicalCameraSettings.get(
286                             CaptureRequest.CONTROL_CAPTURE_INTENT);
287                     if (captureIntent == CameraMetadata.CONTROL_CAPTURE_INTENT_STILL_CAPTURE) {
288                         isZslStill = true;
289                     }
290                 }
291                 mRequestType = isZslStill ? REQUEST_TYPE_ZSL_STILL : REQUEST_TYPE_REGULAR;
292             }
293         }
294         return mRequestType;
295     }
296 
297     // If this request is part of constrained high speed request list that was created by
298     // {@link android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList}
299     private boolean mIsPartOfCHSRequestList = false;
300     // Each reprocess request must be tied to a reprocessable session ID.
301     // Valid only for reprocess requests (mIsReprocess == true).
302     private int mReprocessableSessionId;
303 
304     private Object mUserTag;
305 
306     /**
307      * Construct empty request.
308      *
309      * Used by Binder to unparcel this object only.
310      */
CaptureRequest()311     private CaptureRequest() {
312         mIsReprocess = false;
313         mReprocessableSessionId = CameraCaptureSession.SESSION_ID_NONE;
314     }
315 
316     /**
317      * Clone from source capture request.
318      *
319      * Used by the Builder to create an immutable copy.
320      */
321     @SuppressWarnings("unchecked")
CaptureRequest(CaptureRequest source)322     private CaptureRequest(CaptureRequest source) {
323         mLogicalCameraId = new String(source.mLogicalCameraId);
324         for (Map.Entry<String, CameraMetadataNative> entry :
325                 source.mPhysicalCameraSettings.entrySet()) {
326             mPhysicalCameraSettings.put(new String(entry.getKey()),
327                     new CameraMetadataNative(entry.getValue()));
328         }
329         mLogicalCameraSettings = mPhysicalCameraSettings.get(mLogicalCameraId);
330         setNativeInstance(mLogicalCameraSettings);
331         mSurfaceSet.addAll(source.mSurfaceSet);
332         mIsReprocess = source.mIsReprocess;
333         mIsPartOfCHSRequestList = source.mIsPartOfCHSRequestList;
334         mReprocessableSessionId = source.mReprocessableSessionId;
335         mUserTag = source.mUserTag;
336     }
337 
338     /**
339      * Take ownership of passed-in settings.
340      *
341      * Used by the Builder to create a mutable CaptureRequest.
342      *
343      * @param settings Settings for this capture request.
344      * @param isReprocess Indicates whether to create a reprocess capture request. {@code true}
345      *                    to create a reprocess capture request. {@code false} to create a regular
346      *                    capture request.
347      * @param reprocessableSessionId The ID of the camera capture session this capture is created
348      *                               for. This is used to validate if the application submits a
349      *                               reprocess capture request to the same session where
350      *                               the {@link TotalCaptureResult}, used to create the reprocess
351      *                               capture, came from.
352      * @param logicalCameraId Camera Id of the actively open camera that instantiates the
353      *                        Builder.
354      *
355      * @param physicalCameraIdSet A set of physical camera ids that can be used to customize
356      *                            the request for a specific physical camera.
357      *
358      * @throws IllegalArgumentException If creating a reprocess capture request with an invalid
359      *                                  reprocessableSessionId, or multiple physical cameras.
360      *
361      * @see CameraDevice#createReprocessCaptureRequest
362      */
CaptureRequest(CameraMetadataNative settings, boolean isReprocess, int reprocessableSessionId, String logicalCameraId, Set<String> physicalCameraIdSet)363     private CaptureRequest(CameraMetadataNative settings, boolean isReprocess,
364             int reprocessableSessionId, String logicalCameraId, Set<String> physicalCameraIdSet) {
365         if ((physicalCameraIdSet != null) && isReprocess) {
366             throw new IllegalArgumentException("Create a reprocess capture request with " +
367                     "with more than one physical camera is not supported!");
368         }
369 
370         mLogicalCameraId = logicalCameraId;
371         mLogicalCameraSettings = CameraMetadataNative.move(settings);
372         mPhysicalCameraSettings.put(mLogicalCameraId, mLogicalCameraSettings);
373         if (physicalCameraIdSet != null) {
374             for (String physicalId : physicalCameraIdSet) {
375                 mPhysicalCameraSettings.put(physicalId, new CameraMetadataNative(
376                             mLogicalCameraSettings));
377             }
378         }
379 
380         setNativeInstance(mLogicalCameraSettings);
381         mIsReprocess = isReprocess;
382         if (isReprocess) {
383             if (reprocessableSessionId == CameraCaptureSession.SESSION_ID_NONE) {
384                 throw new IllegalArgumentException("Create a reprocess capture request with an " +
385                         "invalid session ID: " + reprocessableSessionId);
386             }
387             mReprocessableSessionId = reprocessableSessionId;
388         } else {
389             mReprocessableSessionId = CameraCaptureSession.SESSION_ID_NONE;
390         }
391     }
392 
393     /**
394      * Get a capture request field value.
395      *
396      * <p>The field definitions can be found in {@link CaptureRequest}.</p>
397      *
398      * <p>Querying the value for the same key more than once will return a value
399      * which is equal to the previous queried value.</p>
400      *
401      * @throws IllegalArgumentException if the key was not valid
402      *
403      * @param key The result field to read.
404      * @return The value of that key, or {@code null} if the field is not set.
405      */
406     @Nullable
get(Key<T> key)407     public <T> T get(Key<T> key) {
408         return mLogicalCameraSettings.get(key);
409     }
410 
411     /**
412      * {@inheritDoc}
413      * @hide
414      */
415     @SuppressWarnings("unchecked")
416     @Override
getProtected(Key<?> key)417     protected <T> T getProtected(Key<?> key) {
418         return (T) mLogicalCameraSettings.get(key);
419     }
420 
421     /**
422      * {@inheritDoc}
423      * @hide
424      */
425     @SuppressWarnings("unchecked")
426     @Override
getKeyClass()427     protected Class<Key<?>> getKeyClass() {
428         Object thisClass = Key.class;
429         return (Class<Key<?>>)thisClass;
430     }
431 
432     /**
433      * {@inheritDoc}
434      */
435     @Override
436     @NonNull
getKeys()437     public List<Key<?>> getKeys() {
438         // Force the javadoc for this function to show up on the CaptureRequest page
439         return super.getKeys();
440     }
441 
442     /**
443      * Retrieve the tag for this request, if any.
444      *
445      * <p>This tag is not used for anything by the camera device, but can be
446      * used by an application to easily identify a CaptureRequest when it is
447      * returned by
448      * {@link CameraCaptureSession.CaptureCallback#onCaptureCompleted CaptureCallback.onCaptureCompleted}
449      * </p>
450      *
451      * @return the last tag Object set on this request, or {@code null} if
452      *     no tag has been set.
453      * @see Builder#setTag
454      */
455     @Nullable
getTag()456     public Object getTag() {
457         return mUserTag;
458     }
459 
460     /**
461      * Determine if this is a reprocess capture request.
462      *
463      * <p>A reprocess capture request produces output images from an input buffer from the
464      * {@link CameraCaptureSession}'s input {@link Surface}. A reprocess capture request can be
465      * created by {@link CameraDevice#createReprocessCaptureRequest}.</p>
466      *
467      * @return {@code true} if this is a reprocess capture request. {@code false} if this is not a
468      * reprocess capture request.
469      *
470      * @see CameraDevice#createReprocessCaptureRequest
471      */
isReprocess()472     public boolean isReprocess() {
473         return mIsReprocess;
474     }
475 
476     /**
477      * <p>Determine if this request is part of a constrained high speed request list that was
478      * created by
479      * {@link android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList}.
480      * A constrained high speed request list contains some constrained high speed capture requests
481      * with certain interleaved pattern that is suitable for high speed preview/video streaming. An
482      * active constrained high speed capture session only accepts constrained high speed request
483      * lists.  This method can be used to do the correctness check when a constrained high speed
484      * capture session receives a request list via {@link CameraCaptureSession#setRepeatingBurst} or
485      * {@link CameraCaptureSession#captureBurst}.  </p>
486      *
487      *
488      * @return {@code true} if this request is part of a constrained high speed request list,
489      * {@code false} otherwise.
490      *
491      * @hide
492      */
isPartOfCRequestList()493     public boolean isPartOfCRequestList() {
494         return mIsPartOfCHSRequestList;
495     }
496 
497     /**
498      * Returns a copy of the underlying {@link CameraMetadataNative}.
499      * @hide
500      */
getNativeCopy()501     public CameraMetadataNative getNativeCopy() {
502         return new CameraMetadataNative(mLogicalCameraSettings);
503     }
504 
505     /**
506      * Get the reprocessable session ID this reprocess capture request is associated with.
507      *
508      * @return the reprocessable session ID this reprocess capture request is associated with
509      *
510      * @throws IllegalStateException if this capture request is not a reprocess capture request.
511      * @hide
512      */
getReprocessableSessionId()513     public int getReprocessableSessionId() {
514         if (mIsReprocess == false ||
515                 mReprocessableSessionId == CameraCaptureSession.SESSION_ID_NONE) {
516             throw new IllegalStateException("Getting the reprocessable session ID for a "+
517                     "non-reprocess capture request is illegal.");
518         }
519         return mReprocessableSessionId;
520     }
521 
522     /**
523      * Determine whether this CaptureRequest is equal to another CaptureRequest.
524      *
525      * <p>A request is considered equal to another is if it's set of key/values is equal, it's
526      * list of output surfaces is equal, the user tag is equal, and the return values of
527      * isReprocess() are equal.</p>
528      *
529      * @param other Another instance of CaptureRequest.
530      *
531      * @return True if the requests are the same, false otherwise.
532      */
533     @Override
equals(@ullable Object other)534     public boolean equals(@Nullable Object other) {
535         return other instanceof CaptureRequest
536                 && equals((CaptureRequest)other);
537     }
538 
equals(CaptureRequest other)539     private boolean equals(CaptureRequest other) {
540         return other != null
541                 && Objects.equals(mUserTag, other.mUserTag)
542                 && mSurfaceSet.equals(other.mSurfaceSet)
543                 && mPhysicalCameraSettings.equals(other.mPhysicalCameraSettings)
544                 && mLogicalCameraId.equals(other.mLogicalCameraId)
545                 && mLogicalCameraSettings.equals(other.mLogicalCameraSettings)
546                 && mIsReprocess == other.mIsReprocess
547                 && mReprocessableSessionId == other.mReprocessableSessionId;
548     }
549 
550     @Override
hashCode()551     public int hashCode() {
552         return HashCodeHelpers.hashCodeGeneric(mPhysicalCameraSettings, mSurfaceSet, mUserTag);
553     }
554 
555     public static final @android.annotation.NonNull Parcelable.Creator<CaptureRequest> CREATOR =
556             new Parcelable.Creator<CaptureRequest>() {
557         @Override
558         public CaptureRequest createFromParcel(Parcel in) {
559             CaptureRequest request = new CaptureRequest();
560             request.readFromParcel(in);
561 
562             return request;
563         }
564 
565         @Override
566         public CaptureRequest[] newArray(int size) {
567             return new CaptureRequest[size];
568         }
569     };
570 
571     /**
572      * Expand this object from a Parcel.
573      * Hidden since this breaks the immutability of CaptureRequest, but is
574      * needed to receive CaptureRequests with aidl.
575      *
576      * @param in The parcel from which the object should be read
577      * @hide
578      */
readFromParcel(Parcel in)579     private void readFromParcel(Parcel in) {
580         int physicalCameraCount = in.readInt();
581         if (physicalCameraCount <= 0) {
582             throw new RuntimeException("Physical camera count" + physicalCameraCount +
583                     " should always be positive");
584         }
585 
586         //Always start with the logical camera id
587         mLogicalCameraId = in.readString();
588         mLogicalCameraSettings = new CameraMetadataNative();
589         mLogicalCameraSettings.readFromParcel(in);
590         setNativeInstance(mLogicalCameraSettings);
591         mPhysicalCameraSettings.put(mLogicalCameraId, mLogicalCameraSettings);
592         for (int i = 1; i < physicalCameraCount; i++) {
593             String physicalId = in.readString();
594             CameraMetadataNative physicalCameraSettings = new CameraMetadataNative();
595             physicalCameraSettings.readFromParcel(in);
596             mPhysicalCameraSettings.put(physicalId, physicalCameraSettings);
597         }
598 
599         mIsReprocess = (in.readInt() == 0) ? false : true;
600         mReprocessableSessionId = CameraCaptureSession.SESSION_ID_NONE;
601 
602         synchronized (mSurfacesLock) {
603             mSurfaceSet.clear();
604             Parcelable[] parcelableArray = in.readParcelableArray(Surface.class.getClassLoader(),
605                     Surface.class);
606             if (parcelableArray != null) {
607                 for (Parcelable p : parcelableArray) {
608                     Surface s = (Surface) p;
609                     mSurfaceSet.add(s);
610                 }
611             }
612             // Intentionally disallow java side readFromParcel to receive streamIdx/surfaceIdx
613             // Since there is no good way to convert indexes back to Surface
614             int streamSurfaceSize = in.readInt();
615             if (streamSurfaceSize != 0) {
616                 throw new RuntimeException("Reading cached CaptureRequest is not supported");
617             }
618         }
619 
620         boolean hasUserTagStr = (in.readInt() == 1) ? true : false;
621         if (hasUserTagStr) {
622             mUserTag = in.readString();
623         }
624     }
625 
626     @Override
describeContents()627     public int describeContents() {
628         return 0;
629     }
630 
631     @Override
writeToParcel(Parcel dest, int flags)632     public void writeToParcel(Parcel dest, int flags) {
633         if (!mPhysicalCameraSettings.containsKey(mLogicalCameraId)) {
634             throw new IllegalStateException("Physical camera settings map must contain a key for "
635                     + "the logical camera id.");
636         }
637 
638         int physicalCameraCount = mPhysicalCameraSettings.size();
639         dest.writeInt(physicalCameraCount);
640         //Logical camera id and settings always come first.
641         dest.writeString(mLogicalCameraId);
642         mLogicalCameraSettings.writeToParcel(dest, flags);
643         for (Map.Entry<String, CameraMetadataNative> entry : mPhysicalCameraSettings.entrySet()) {
644             if (entry.getKey().equals(mLogicalCameraId)) {
645                 continue;
646             }
647             dest.writeString(entry.getKey());
648             entry.getValue().writeToParcel(dest, flags);
649         }
650 
651         dest.writeInt(mIsReprocess ? 1 : 0);
652 
653         synchronized (mSurfacesLock) {
654             final ArraySet<Surface> surfaces = mSurfaceConverted ? mEmptySurfaceSet : mSurfaceSet;
655             dest.writeParcelableArray(surfaces.toArray(new Surface[surfaces.size()]), flags);
656             if (mSurfaceConverted) {
657                 dest.writeInt(mStreamIdxArray.length);
658                 for (int i = 0; i < mStreamIdxArray.length; i++) {
659                     dest.writeInt(mStreamIdxArray[i]);
660                     dest.writeInt(mSurfaceIdxArray[i]);
661                 }
662             } else {
663                 dest.writeInt(0);
664             }
665         }
666 
667         // Write string for user tag if set to something in the same namespace
668         if (mUserTag != null) {
669             String userTagStr = mUserTag.toString();
670             if (userTagStr != null && userTagStr.startsWith(SET_TAG_STRING_PREFIX)) {
671                 dest.writeInt(1);
672                 dest.writeString(userTagStr.substring(SET_TAG_STRING_PREFIX.length()));
673             } else {
674                 dest.writeInt(0);
675             }
676         } else {
677             dest.writeInt(0);
678         }
679     }
680 
681     /**
682      * @hide
683      */
containsTarget(Surface surface)684     public boolean containsTarget(Surface surface) {
685         return mSurfaceSet.contains(surface);
686     }
687 
688     /**
689      * @hide
690      */
691     @UnsupportedAppUsage
getTargets()692     public Collection<Surface> getTargets() {
693         return Collections.unmodifiableCollection(mSurfaceSet);
694     }
695 
696     /**
697      * Retrieves the logical camera id.
698      * @hide
699      */
getLogicalCameraId()700     public String getLogicalCameraId() {
701         return mLogicalCameraId;
702     }
703 
704     /**
705      * @hide
706      */
convertSurfaceToStreamId( final SparseArray<OutputConfiguration> configuredOutputs)707     public void convertSurfaceToStreamId(
708             final SparseArray<OutputConfiguration> configuredOutputs) {
709         synchronized (mSurfacesLock) {
710             if (mSurfaceConverted) {
711                 Log.v(TAG, "Cannot convert already converted surfaces!");
712                 return;
713             }
714 
715             mStreamIdxArray = new int[mSurfaceSet.size()];
716             mSurfaceIdxArray = new int[mSurfaceSet.size()];
717             int i = 0;
718             for (Surface s : mSurfaceSet) {
719                 boolean streamFound = false;
720                 for (int j = 0; j < configuredOutputs.size(); ++j) {
721                     int streamId = configuredOutputs.keyAt(j);
722                     OutputConfiguration outConfig = configuredOutputs.valueAt(j);
723                     int surfaceId = 0;
724                     for (Surface outSurface : outConfig.getSurfaces()) {
725                         if (s == outSurface) {
726                             streamFound = true;
727                             mStreamIdxArray[i] = streamId;
728                             mSurfaceIdxArray[i] = surfaceId;
729                             i++;
730                             break;
731                         }
732                         surfaceId++;
733                     }
734                     if (streamFound) {
735                         break;
736                     }
737                 }
738 
739                 if (!streamFound) {
740                     // Check if we can match s by native object ID
741                     long reqSurfaceId = SurfaceUtils.getSurfaceId(s);
742                     for (int j = 0; j < configuredOutputs.size(); ++j) {
743                         int streamId = configuredOutputs.keyAt(j);
744                         OutputConfiguration outConfig = configuredOutputs.valueAt(j);
745                         int surfaceId = 0;
746                         for (Surface outSurface : outConfig.getSurfaces()) {
747                             if (reqSurfaceId == SurfaceUtils.getSurfaceId(outSurface)) {
748                                 streamFound = true;
749                                 mStreamIdxArray[i] = streamId;
750                                 mSurfaceIdxArray[i] = surfaceId;
751                                 i++;
752                                 break;
753                             }
754                             surfaceId++;
755                         }
756                         if (streamFound) {
757                             break;
758                         }
759                     }
760                 }
761 
762                 if (!streamFound) {
763                     mStreamIdxArray = null;
764                     mSurfaceIdxArray = null;
765                     throw new IllegalArgumentException(
766                             "CaptureRequest contains unconfigured Input/Output Surface!");
767                 }
768             }
769             mSurfaceConverted = true;
770         }
771     }
772 
773     /**
774      * @hide
775      */
recoverStreamIdToSurface()776     public void recoverStreamIdToSurface() {
777         synchronized (mSurfacesLock) {
778             if (!mSurfaceConverted) {
779                 Log.v(TAG, "Cannot convert already converted surfaces!");
780                 return;
781             }
782 
783             mStreamIdxArray = null;
784             mSurfaceIdxArray = null;
785             mSurfaceConverted = false;
786         }
787     }
788 
789     /**
790      * A builder for capture requests.
791      *
792      * <p>To obtain a builder instance, use the
793      * {@link CameraDevice#createCaptureRequest} method, which initializes the
794      * request fields to one of the templates defined in {@link CameraDevice}.
795      *
796      * @see CameraDevice#createCaptureRequest
797      * @see CameraDevice#TEMPLATE_PREVIEW
798      * @see CameraDevice#TEMPLATE_RECORD
799      * @see CameraDevice#TEMPLATE_STILL_CAPTURE
800      * @see CameraDevice#TEMPLATE_VIDEO_SNAPSHOT
801      * @see CameraDevice#TEMPLATE_MANUAL
802      */
803     public final static class Builder {
804 
805         private final CaptureRequest mRequest;
806 
807         /**
808          * Initialize the builder using the template; the request takes
809          * ownership of the template.
810          *
811          * @param template Template settings for this capture request.
812          * @param reprocess Indicates whether to create a reprocess capture request. {@code true}
813          *                  to create a reprocess capture request. {@code false} to create a regular
814          *                  capture request.
815          * @param reprocessableSessionId The ID of the camera capture session this capture is
816          *                               created for. This is used to validate if the application
817          *                               submits a reprocess capture request to the same session
818          *                               where the {@link TotalCaptureResult}, used to create the
819          *                               reprocess capture, came from.
820          * @param logicalCameraId Camera Id of the actively open camera that instantiates the
821          *                        Builder.
822          * @param physicalCameraIdSet A set of physical camera ids that can be used to customize
823          *                            the request for a specific physical camera.
824          *
825          * @throws IllegalArgumentException If creating a reprocess capture request with an invalid
826          *                                  reprocessableSessionId.
827          * @hide
828          */
Builder(CameraMetadataNative template, boolean reprocess, int reprocessableSessionId, String logicalCameraId, Set<String> physicalCameraIdSet)829         public Builder(CameraMetadataNative template, boolean reprocess,
830                 int reprocessableSessionId, String logicalCameraId,
831                 Set<String> physicalCameraIdSet) {
832             mRequest = new CaptureRequest(template, reprocess, reprocessableSessionId,
833                     logicalCameraId, physicalCameraIdSet);
834         }
835 
836         /**
837          * <p>Add a surface to the list of targets for this request</p>
838          *
839          * <p>The Surface added must be one of the surfaces included in the most
840          * recent call to {@link CameraDevice#createCaptureSession}, when the
841          * request is given to the camera device.</p>
842          *
843          * <p>Adding a target more than once has no effect.</p>
844          *
845          * @param outputTarget Surface to use as an output target for this request
846          */
addTarget(@onNull Surface outputTarget)847         public void addTarget(@NonNull Surface outputTarget) {
848             mRequest.mSurfaceSet.add(outputTarget);
849         }
850 
851         /**
852          * <p>Remove a surface from the list of targets for this request.</p>
853          *
854          * <p>Removing a target that is not currently added has no effect.</p>
855          *
856          * @param outputTarget Surface to use as an output target for this request
857          */
removeTarget(@onNull Surface outputTarget)858         public void removeTarget(@NonNull Surface outputTarget) {
859             mRequest.mSurfaceSet.remove(outputTarget);
860         }
861 
862         /**
863          * Set a capture request field to a value. The field definitions can be
864          * found in {@link CaptureRequest}.
865          *
866          * <p>Setting a field to {@code null} will remove that field from the capture request.
867          * Unless the field is optional, removing it will likely produce an error from the camera
868          * device when the request is submitted.</p>
869          *
870          * @param key The metadata field to write.
871          * @param value The value to set the field to, which must be of a matching
872          * type to the key.
873          */
set(@onNull Key<T> key, T value)874         public <T> void set(@NonNull Key<T> key, T value) {
875             mRequest.mLogicalCameraSettings.set(key, value);
876         }
877 
878         /**
879          * Get a capture request field value. The field definitions can be
880          * found in {@link CaptureRequest}.
881          *
882          * @throws IllegalArgumentException if the key was not valid
883          *
884          * @param key The metadata field to read.
885          * @return The value of that key, or {@code null} if the field is not set.
886          */
887         @Nullable
get(Key<T> key)888         public <T> T get(Key<T> key) {
889             return mRequest.mLogicalCameraSettings.get(key);
890         }
891 
892         /**
893          * Set a capture request field to a value. The field definitions can be
894          * found in {@link CaptureRequest}.
895          *
896          * <p>Setting a field to {@code null} will remove that field from the capture request.
897          * Unless the field is optional, removing it will likely produce an error from the camera
898          * device when the request is submitted.</p>
899          *
900          *<p>This method can be called for logical camera devices, which are devices that have
901          * REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA capability and calls to
902          * {@link CameraCharacteristics#getPhysicalCameraIds} return a non-empty set of
903          * physical devices that are backing the logical camera. The camera Id included in the
904          * 'physicalCameraId' argument selects an individual physical device that will receive
905          * the customized capture request field.</p>
906          *
907          * @throws IllegalArgumentException if the physical camera id is not valid
908          *
909          * @param key The metadata field to write.
910          * @param value The value to set the field to, which must be of a matching type to the key.
911          * @param physicalCameraId A valid physical camera Id. The valid camera Ids can be obtained
912          *                         via calls to {@link CameraCharacteristics#getPhysicalCameraIds}.
913          * @return The builder object.
914          */
setPhysicalCameraKey(@onNull Key<T> key, T value, @NonNull String physicalCameraId)915         public <T> Builder setPhysicalCameraKey(@NonNull Key<T> key, T value,
916                 @NonNull String physicalCameraId) {
917             if (!mRequest.mPhysicalCameraSettings.containsKey(physicalCameraId)) {
918                 throw new IllegalArgumentException("Physical camera id: " + physicalCameraId +
919                         " is not valid!");
920             }
921 
922             mRequest.mPhysicalCameraSettings.get(physicalCameraId).set(key, value);
923 
924             return this;
925         }
926 
927         /**
928          * Get a capture request field value for a specific physical camera Id. The field
929          * definitions can be found in {@link CaptureRequest}.
930          *
931          *<p>This method can be called for logical camera devices, which are devices that have
932          * REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA capability and calls to
933          * {@link CameraCharacteristics#getPhysicalCameraIds} return a non-empty list of
934          * physical devices that are backing the logical camera. The camera Id included in the
935          * 'physicalCameraId' argument selects an individual physical device and returns
936          * its specific capture request field.</p>
937          *
938          * @throws IllegalArgumentException if the key or physical camera id were not valid
939          *
940          * @param key The metadata field to read.
941          * @param physicalCameraId A valid physical camera Id. The valid camera Ids can be obtained
942          *                         via calls to {@link CameraCharacteristics#getPhysicalCameraIds}.
943          * @return The value of that key, or {@code null} if the field is not set.
944          */
945         @Nullable
getPhysicalCameraKey(Key<T> key,@NonNull String physicalCameraId)946         public <T> T getPhysicalCameraKey(Key<T> key,@NonNull String physicalCameraId) {
947             if (!mRequest.mPhysicalCameraSettings.containsKey(physicalCameraId)) {
948                 throw new IllegalArgumentException("Physical camera id: " + physicalCameraId +
949                         " is not valid!");
950             }
951 
952             return mRequest.mPhysicalCameraSettings.get(physicalCameraId).get(key);
953         }
954 
955         /**
956          * Set a tag for this request.
957          *
958          * <p>This tag is not used for anything by the camera device, but can be
959          * used by an application to easily identify a CaptureRequest when it is
960          * returned by
961          * {@link CameraCaptureSession.CaptureCallback#onCaptureCompleted CaptureCallback.onCaptureCompleted}.</p>
962          *
963          * <p>If the application overrides the tag object's {@link Object#toString} function, the
964          * returned string must not contain personal identifiable information.</p>
965          *
966          * @param tag an arbitrary Object to store with this request
967          * @see CaptureRequest#getTag
968          */
setTag(@ullable Object tag)969         public void setTag(@Nullable Object tag) {
970             mRequest.mUserTag = tag;
971         }
972 
973         /**
974          * <p>Mark this request as part of a constrained high speed request list created by
975          * {@link android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList}.
976          * A constrained high speed request list contains some constrained high speed capture
977          * requests with certain interleaved pattern that is suitable for high speed preview/video
978          * streaming.</p>
979          *
980          * @hide
981          */
982         @UnsupportedAppUsage
setPartOfCHSRequestList(boolean partOfCHSList)983         public void setPartOfCHSRequestList(boolean partOfCHSList) {
984             mRequest.mIsPartOfCHSRequestList = partOfCHSList;
985         }
986 
987         /**
988          * Build a request using the current target Surfaces and settings.
989          * <p>Note that, although it is possible to create a {@code CaptureRequest} with no target
990          * {@link Surface}s, passing such a request into {@link CameraCaptureSession#capture},
991          * {@link CameraCaptureSession#captureBurst},
992          * {@link CameraCaptureSession#setRepeatingBurst}, or
993          * {@link CameraCaptureSession#setRepeatingRequest} will cause that method to throw an
994          * {@link IllegalArgumentException}.</p>
995          *
996          * @return A new capture request instance, ready for submission to the
997          * camera device.
998          */
999         @NonNull
build()1000         public CaptureRequest build() {
1001             return new CaptureRequest(mRequest);
1002         }
1003 
1004         /**
1005          * @hide
1006          */
isEmpty()1007         public boolean isEmpty() {
1008             return mRequest.mLogicalCameraSettings.isEmpty();
1009         }
1010 
1011     }
1012 
1013     /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
1014      * The key entries below this point are generated from metadata
1015      * definitions in /system/media/camera/docs. Do not modify by hand or
1016      * modify the comment blocks at the start or end.
1017      *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/
1018 
1019     /**
1020      * <p>The mode control selects how the image data is converted from the
1021      * sensor's native color into linear sRGB color.</p>
1022      * <p>When auto-white balance (AWB) is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this
1023      * control is overridden by the AWB routine. When AWB is disabled, the
1024      * application controls how the color mapping is performed.</p>
1025      * <p>We define the expected processing pipeline below. For consistency
1026      * across devices, this is always the case with TRANSFORM_MATRIX.</p>
1027      * <p>When either FAST or HIGH_QUALITY is used, the camera device may
1028      * do additional processing but {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
1029      * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} will still be provided by the
1030      * camera device (in the results) and be roughly correct.</p>
1031      * <p>Switching to TRANSFORM_MATRIX and using the data provided from
1032      * FAST or HIGH_QUALITY will yield a picture with the same white point
1033      * as what was produced by the camera device in the earlier frame.</p>
1034      * <p>The expected processing pipeline is as follows:</p>
1035      * <p><img alt="White balance processing pipeline" src="/reference/images/camera2/metadata/android.colorCorrection.mode/processing_pipeline.png" /></p>
1036      * <p>The white balance is encoded by two values, a 4-channel white-balance
1037      * gain vector (applied in the Bayer domain), and a 3x3 color transform
1038      * matrix (applied after demosaic).</p>
1039      * <p>The 4-channel white-balance gains are defined as:</p>
1040      * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} = [ R G_even G_odd B ]
1041      * </code></pre>
1042      * <p>where <code>G_even</code> is the gain for green pixels on even rows of the
1043      * output, and <code>G_odd</code> is the gain for green pixels on the odd rows.
1044      * These may be identical for a given camera device implementation; if
1045      * the camera device does not support a separate gain for even/odd green
1046      * channels, it will use the <code>G_even</code> value, and write <code>G_odd</code> equal to
1047      * <code>G_even</code> in the output result metadata.</p>
1048      * <p>The matrices for color transforms are defined as a 9-entry vector:</p>
1049      * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} = [ I0 I1 I2 I3 I4 I5 I6 I7 I8 ]
1050      * </code></pre>
1051      * <p>which define a transform from input sensor colors, <code>P_in = [ r g b ]</code>,
1052      * to output linear sRGB, <code>P_out = [ r' g' b' ]</code>,</p>
1053      * <p>with colors as follows:</p>
1054      * <pre><code>r' = I0r + I1g + I2b
1055      * g' = I3r + I4g + I5b
1056      * b' = I6r + I7g + I8b
1057      * </code></pre>
1058      * <p>Both the input and output value ranges must match. Overflow/underflow
1059      * values are clipped to fit within the range.</p>
1060      * <p><b>Possible values:</b></p>
1061      * <ul>
1062      *   <li>{@link #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX TRANSFORM_MATRIX}</li>
1063      *   <li>{@link #COLOR_CORRECTION_MODE_FAST FAST}</li>
1064      *   <li>{@link #COLOR_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
1065      * </ul>
1066      *
1067      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
1068      * <p><b>Full capability</b> -
1069      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
1070      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
1071      *
1072      * @see CaptureRequest#COLOR_CORRECTION_GAINS
1073      * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
1074      * @see CaptureRequest#CONTROL_AWB_MODE
1075      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
1076      * @see #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX
1077      * @see #COLOR_CORRECTION_MODE_FAST
1078      * @see #COLOR_CORRECTION_MODE_HIGH_QUALITY
1079      */
1080     @PublicKey
1081     @NonNull
1082     public static final Key<Integer> COLOR_CORRECTION_MODE =
1083             new Key<Integer>("android.colorCorrection.mode", int.class);
1084 
1085     /**
1086      * <p>A color transform matrix to use to transform
1087      * from sensor RGB color space to output linear sRGB color space.</p>
1088      * <p>This matrix is either set by the camera device when the request
1089      * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not TRANSFORM_MATRIX, or
1090      * directly by the application in the request when the
1091      * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is TRANSFORM_MATRIX.</p>
1092      * <p>In the latter case, the camera device may round the matrix to account
1093      * for precision issues; the final rounded matrix should be reported back
1094      * in this matrix result metadata. The transform should keep the magnitude
1095      * of the output color values within <code>[0, 1.0]</code> (assuming input color
1096      * values is within the normalized range <code>[0, 1.0]</code>), or clipping may occur.</p>
1097      * <p>The valid range of each matrix element varies on different devices, but
1098      * values within [-1.5, 3.0] are guaranteed not to be clipped.</p>
1099      * <p><b>Units</b>: Unitless scale factors</p>
1100      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
1101      * <p><b>Full capability</b> -
1102      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
1103      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
1104      *
1105      * @see CaptureRequest#COLOR_CORRECTION_MODE
1106      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
1107      */
1108     @PublicKey
1109     @NonNull
1110     public static final Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM =
1111             new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.colorCorrection.transform", android.hardware.camera2.params.ColorSpaceTransform.class);
1112 
1113     /**
1114      * <p>Gains applying to Bayer raw color channels for
1115      * white-balance.</p>
1116      * <p>These per-channel gains are either set by the camera device
1117      * when the request {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not
1118      * TRANSFORM_MATRIX, or directly by the application in the
1119      * request when the {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is
1120      * TRANSFORM_MATRIX.</p>
1121      * <p>The gains in the result metadata are the gains actually
1122      * applied by the camera device to the current frame.</p>
1123      * <p>The valid range of gains varies on different devices, but gains
1124      * between [1.0, 3.0] are guaranteed not to be clipped. Even if a given
1125      * device allows gains below 1.0, this is usually not recommended because
1126      * this can create color artifacts.</p>
1127      * <p><b>Units</b>: Unitless gain factors</p>
1128      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
1129      * <p><b>Full capability</b> -
1130      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
1131      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
1132      *
1133      * @see CaptureRequest#COLOR_CORRECTION_MODE
1134      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
1135      */
1136     @PublicKey
1137     @NonNull
1138     public static final Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS =
1139             new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class);
1140 
1141     /**
1142      * <p>Mode of operation for the chromatic aberration correction algorithm.</p>
1143      * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light
1144      * can not focus on the same point after exiting from the lens. This metadata defines
1145      * the high level control of chromatic aberration correction algorithm, which aims to
1146      * minimize the chromatic artifacts that may occur along the object boundaries in an
1147      * image.</p>
1148      * <p>FAST/HIGH_QUALITY both mean that camera device determined aberration
1149      * correction will be applied. HIGH_QUALITY mode indicates that the camera device will
1150      * use the highest-quality aberration correction algorithms, even if it slows down
1151      * capture rate. FAST means the camera device will not slow down capture rate when
1152      * applying aberration correction.</p>
1153      * <p>LEGACY devices will always be in FAST mode.</p>
1154      * <p><b>Possible values:</b></p>
1155      * <ul>
1156      *   <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_OFF OFF}</li>
1157      *   <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_FAST FAST}</li>
1158      *   <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
1159      * </ul>
1160      *
1161      * <p><b>Available values for this device:</b><br>
1162      * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES android.colorCorrection.availableAberrationModes}</p>
1163      * <p>This key is available on all devices.</p>
1164      *
1165      * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES
1166      * @see #COLOR_CORRECTION_ABERRATION_MODE_OFF
1167      * @see #COLOR_CORRECTION_ABERRATION_MODE_FAST
1168      * @see #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY
1169      */
1170     @PublicKey
1171     @NonNull
1172     public static final Key<Integer> COLOR_CORRECTION_ABERRATION_MODE =
1173             new Key<Integer>("android.colorCorrection.aberrationMode", int.class);
1174 
1175     /**
1176      * <p>The desired setting for the camera device's auto-exposure
1177      * algorithm's antibanding compensation.</p>
1178      * <p>Some kinds of lighting fixtures, such as some fluorescent
1179      * lights, flicker at the rate of the power supply frequency
1180      * (60Hz or 50Hz, depending on country). While this is
1181      * typically not noticeable to a person, it can be visible to
1182      * a camera device. If a camera sets its exposure time to the
1183      * wrong value, the flicker may become visible in the
1184      * viewfinder as flicker or in a final captured image, as a
1185      * set of variable-brightness bands across the image.</p>
1186      * <p>Therefore, the auto-exposure routines of camera devices
1187      * include antibanding routines that ensure that the chosen
1188      * exposure value will not cause such banding. The choice of
1189      * exposure time depends on the rate of flicker, which the
1190      * camera device can detect automatically, or the expected
1191      * rate can be selected by the application using this
1192      * control.</p>
1193      * <p>A given camera device may not support all of the possible
1194      * options for the antibanding mode. The
1195      * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes} key contains
1196      * the available modes for a given camera device.</p>
1197      * <p>AUTO mode is the default if it is available on given
1198      * camera device. When AUTO mode is not available, the
1199      * default will be either 50HZ or 60HZ, and both 50HZ
1200      * and 60HZ will be available.</p>
1201      * <p>If manual exposure control is enabled (by setting
1202      * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} to OFF),
1203      * then this setting has no effect, and the application must
1204      * ensure it selects exposure times that do not cause banding
1205      * issues. The {@link CaptureResult#STATISTICS_SCENE_FLICKER android.statistics.sceneFlicker} key can assist
1206      * the application in this.</p>
1207      * <p><b>Possible values:</b></p>
1208      * <ul>
1209      *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_OFF OFF}</li>
1210      *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_50HZ 50HZ}</li>
1211      *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_60HZ 60HZ}</li>
1212      *   <li>{@link #CONTROL_AE_ANTIBANDING_MODE_AUTO AUTO}</li>
1213      * </ul>
1214      *
1215      * <p><b>Available values for this device:</b><br></p>
1216      * <p>{@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes}</p>
1217      * <p>This key is available on all devices.</p>
1218      *
1219      * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES
1220      * @see CaptureRequest#CONTROL_AE_MODE
1221      * @see CaptureRequest#CONTROL_MODE
1222      * @see CaptureResult#STATISTICS_SCENE_FLICKER
1223      * @see #CONTROL_AE_ANTIBANDING_MODE_OFF
1224      * @see #CONTROL_AE_ANTIBANDING_MODE_50HZ
1225      * @see #CONTROL_AE_ANTIBANDING_MODE_60HZ
1226      * @see #CONTROL_AE_ANTIBANDING_MODE_AUTO
1227      */
1228     @PublicKey
1229     @NonNull
1230     public static final Key<Integer> CONTROL_AE_ANTIBANDING_MODE =
1231             new Key<Integer>("android.control.aeAntibandingMode", int.class);
1232 
1233     /**
1234      * <p>Adjustment to auto-exposure (AE) target image
1235      * brightness.</p>
1236      * <p>The adjustment is measured as a count of steps, with the
1237      * step size defined by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP android.control.aeCompensationStep} and the
1238      * allowed range by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}.</p>
1239      * <p>For example, if the exposure value (EV) step is 0.333, '6'
1240      * will mean an exposure compensation of +2 EV; -3 will mean an
1241      * exposure compensation of -1 EV. One EV represents a doubling
1242      * of image brightness. Note that this control will only be
1243      * effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF. This control
1244      * will take effect even when {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} <code>== true</code>.</p>
1245      * <p>In the event of exposure compensation value being changed, camera device
1246      * may take several frames to reach the newly requested exposure target.
1247      * During that time, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} field will be in the SEARCHING
1248      * state. Once the new exposure target is reached, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} will
1249      * change from SEARCHING to either CONVERGED, LOCKED (if AE lock is enabled), or
1250      * FLASH_REQUIRED (if the scene is too dark for still capture).</p>
1251      * <p><b>Units</b>: Compensation steps</p>
1252      * <p><b>Range of valid values:</b><br>
1253      * {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}</p>
1254      * <p>This key is available on all devices.</p>
1255      *
1256      * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE
1257      * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP
1258      * @see CaptureRequest#CONTROL_AE_LOCK
1259      * @see CaptureRequest#CONTROL_AE_MODE
1260      * @see CaptureResult#CONTROL_AE_STATE
1261      */
1262     @PublicKey
1263     @NonNull
1264     public static final Key<Integer> CONTROL_AE_EXPOSURE_COMPENSATION =
1265             new Key<Integer>("android.control.aeExposureCompensation", int.class);
1266 
1267     /**
1268      * <p>Whether auto-exposure (AE) is currently locked to its latest
1269      * calculated values.</p>
1270      * <p>When set to <code>true</code> (ON), the AE algorithm is locked to its latest parameters,
1271      * and will not change exposure settings until the lock is set to <code>false</code> (OFF).</p>
1272      * <p>Note that even when AE is locked, the flash may be fired if
1273      * the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_AUTO_FLASH /
1274      * ON_ALWAYS_FLASH / ON_AUTO_FLASH_REDEYE.</p>
1275      * <p>When {@link CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION android.control.aeExposureCompensation} is changed, even if the AE lock
1276      * is ON, the camera device will still adjust its exposure value.</p>
1277      * <p>If AE precapture is triggered (see {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger})
1278      * when AE is already locked, the camera device will not change the exposure time
1279      * ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}) and sensitivity ({@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity})
1280      * parameters. The flash may be fired if the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}
1281      * is ON_AUTO_FLASH/ON_AUTO_FLASH_REDEYE and the scene is too dark. If the
1282      * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_ALWAYS_FLASH, the scene may become overexposed.
1283      * Similarly, AE precapture trigger CANCEL has no effect when AE is already locked.</p>
1284      * <p>When an AE precapture sequence is triggered, AE unlock will not be able to unlock
1285      * the AE if AE is locked by the camera device internally during precapture metering
1286      * sequence In other words, submitting requests with AE unlock has no effect for an
1287      * ongoing precapture metering sequence. Otherwise, the precapture metering sequence
1288      * will never succeed in a sequence of preview requests where AE lock is always set
1289      * to <code>false</code>.</p>
1290      * <p>Since the camera device has a pipeline of in-flight requests, the settings that
1291      * get locked do not necessarily correspond to the settings that were present in the
1292      * latest capture result received from the camera device, since additional captures
1293      * and AE updates may have occurred even before the result was sent out. If an
1294      * application is switching between automatic and manual control and wishes to eliminate
1295      * any flicker during the switch, the following procedure is recommended:</p>
1296      * <ol>
1297      * <li>Starting in auto-AE mode:</li>
1298      * <li>Lock AE</li>
1299      * <li>Wait for the first result to be output that has the AE locked</li>
1300      * <li>Copy exposure settings from that result into a request, set the request to manual AE</li>
1301      * <li>Submit the capture request, proceed to run manual AE as desired.</li>
1302      * </ol>
1303      * <p>See {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE lock related state transition details.</p>
1304      * <p>This key is available on all devices.</p>
1305      *
1306      * @see CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION
1307      * @see CaptureRequest#CONTROL_AE_MODE
1308      * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
1309      * @see CaptureResult#CONTROL_AE_STATE
1310      * @see CaptureRequest#SENSOR_EXPOSURE_TIME
1311      * @see CaptureRequest#SENSOR_SENSITIVITY
1312      */
1313     @PublicKey
1314     @NonNull
1315     public static final Key<Boolean> CONTROL_AE_LOCK =
1316             new Key<Boolean>("android.control.aeLock", boolean.class);
1317 
1318     /**
1319      * <p>The desired mode for the camera device's
1320      * auto-exposure routine.</p>
1321      * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is
1322      * AUTO.</p>
1323      * <p>When set to any of the ON modes, the camera device's
1324      * auto-exposure routine is enabled, overriding the
1325      * application's selected exposure time, sensor sensitivity,
1326      * and frame duration ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
1327      * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and
1328      * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}). If one of the FLASH modes
1329      * is selected, the camera device's flash unit controls are
1330      * also overridden.</p>
1331      * <p>The FLASH modes are only available if the camera device
1332      * has a flash unit ({@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} is <code>true</code>).</p>
1333      * <p>If flash TORCH mode is desired, this field must be set to
1334      * ON or OFF, and {@link CaptureRequest#FLASH_MODE android.flash.mode} set to TORCH.</p>
1335      * <p>When set to any of the ON modes, the values chosen by the
1336      * camera device auto-exposure routine for the overridden
1337      * fields for a given capture will be available in its
1338      * CaptureResult.</p>
1339      * <p><b>Possible values:</b></p>
1340      * <ul>
1341      *   <li>{@link #CONTROL_AE_MODE_OFF OFF}</li>
1342      *   <li>{@link #CONTROL_AE_MODE_ON ON}</li>
1343      *   <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH ON_AUTO_FLASH}</li>
1344      *   <li>{@link #CONTROL_AE_MODE_ON_ALWAYS_FLASH ON_ALWAYS_FLASH}</li>
1345      *   <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE ON_AUTO_FLASH_REDEYE}</li>
1346      *   <li>{@link #CONTROL_AE_MODE_ON_EXTERNAL_FLASH ON_EXTERNAL_FLASH}</li>
1347      * </ul>
1348      *
1349      * <p><b>Available values for this device:</b><br>
1350      * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES android.control.aeAvailableModes}</p>
1351      * <p>This key is available on all devices.</p>
1352      *
1353      * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES
1354      * @see CaptureRequest#CONTROL_MODE
1355      * @see CameraCharacteristics#FLASH_INFO_AVAILABLE
1356      * @see CaptureRequest#FLASH_MODE
1357      * @see CaptureRequest#SENSOR_EXPOSURE_TIME
1358      * @see CaptureRequest#SENSOR_FRAME_DURATION
1359      * @see CaptureRequest#SENSOR_SENSITIVITY
1360      * @see #CONTROL_AE_MODE_OFF
1361      * @see #CONTROL_AE_MODE_ON
1362      * @see #CONTROL_AE_MODE_ON_AUTO_FLASH
1363      * @see #CONTROL_AE_MODE_ON_ALWAYS_FLASH
1364      * @see #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE
1365      * @see #CONTROL_AE_MODE_ON_EXTERNAL_FLASH
1366      */
1367     @PublicKey
1368     @NonNull
1369     public static final Key<Integer> CONTROL_AE_MODE =
1370             new Key<Integer>("android.control.aeMode", int.class);
1371 
1372     /**
1373      * <p>List of metering areas to use for auto-exposure adjustment.</p>
1374      * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe} is 0.
1375      * Otherwise will always be present.</p>
1376      * <p>The maximum number of regions supported by the device is determined by the value
1377      * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe}.</p>
1378      * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1379      * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being
1380      * the top-left pixel in the active pixel array, and
1381      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1382      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1383      * active pixel array.</p>
1384      * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1385      * system depends on the mode being set.
1386      * When the distortion correction mode is OFF, the coordinate system follows
1387      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
1388      * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and
1389      * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1,
1390      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right
1391      * pixel in the pre-correction active pixel array.
1392      * When the distortion correction mode is not OFF, the coordinate system follows
1393      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
1394      * <code>(0, 0)</code> being the top-left pixel of the active array, and
1395      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1396      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1397      * active pixel array.</p>
1398      * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight
1399      * for every pixel in the area. This means that a large metering area
1400      * with the same weight as a smaller area will have more effect in
1401      * the metering result. Metering areas can partially overlap and the
1402      * camera device will add the weights in the overlap region.</p>
1403      * <p>The weights are relative to weights of other exposure metering regions, so if only one
1404      * region is used, all non-zero weights will have the same effect. A region with 0
1405      * weight is ignored.</p>
1406      * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
1407      * camera device.</p>
1408      * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
1409      * capture result metadata, the camera device will ignore the sections outside the crop
1410      * region and output only the intersection rectangle as the metering region in the result
1411      * metadata.  If the region is entirely outside the crop region, it will be ignored and
1412      * not reported in the result metadata.</p>
1413      * <p>When setting the AE metering regions, the application must consider the additional
1414      * crop resulted from the aspect ratio differences between the preview stream and
1415      * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}. For example, if the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} is the full
1416      * active array size with 4:3 aspect ratio, and the preview stream is 16:9,
1417      * the boundary of AE regions will be [0, y_crop] and
1418      * [active_width, active_height - 2 * y_crop] rather than [0, 0] and
1419      * [active_width, active_height], where y_crop is the additional crop due to aspect ratio
1420      * mismatch.</p>
1421      * <p>Starting from API level 30, the coordinate system of activeArraySize or
1422      * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
1423      * pre-zoom field of view. This means that the same aeRegions values at different
1424      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The aeRegions
1425      * coordinates are relative to the activeArray/preCorrectionActiveArray representing the
1426      * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same
1427      * aeRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of the
1428      * scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use
1429      * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
1430      * mode.</p>
1431      * <p>For camera devices with the
1432      * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR }
1433      * capability or devices where
1434      * {@link CameraCharacteristics#getAvailableCaptureRequestKeys }
1435      * lists {@link CaptureRequest#SENSOR_PIXEL_MODE {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode}}
1436      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.activeArraySizeMaximumResolution} /
1437      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.preCorrectionActiveArraySizeMaximumResolution} must be used as the
1438      * coordinate system for requests where {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is set to
1439      * {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION }.</p>
1440      * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
1441      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on
1442      * distortion correction capability and mode</p>
1443      * <p><b>Range of valid values:</b><br>
1444      * Coordinates must be between <code>[(0,0), (width, height))</code> of
1445      * {@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}
1446      * depending on distortion correction capability and mode</p>
1447      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
1448      *
1449      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE
1450      * @see CaptureRequest#CONTROL_ZOOM_RATIO
1451      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
1452      * @see CaptureRequest#SCALER_CROP_REGION
1453      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
1454      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
1455      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
1456      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
1457      * @see CaptureRequest#SENSOR_PIXEL_MODE
1458      */
1459     @PublicKey
1460     @NonNull
1461     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS =
1462             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.aeRegions", android.hardware.camera2.params.MeteringRectangle[].class);
1463 
1464     /**
1465      * <p>Range over which the auto-exposure routine can
1466      * adjust the capture frame rate to maintain good
1467      * exposure.</p>
1468      * <p>Only constrains auto-exposure (AE) algorithm, not
1469      * manual control of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime} and
1470      * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}.</p>
1471      * <p>Note that the actual achievable max framerate also depends on the minimum frame
1472      * duration of the output streams. The max frame rate will be
1473      * <code>min(aeTargetFpsRange.maxFps, 1 / max(individual stream min durations)</code>. For example,
1474      * if the application sets this key to <code>{60, 60}</code>, but the maximum minFrameDuration among
1475      * all configured streams is 33ms, the maximum framerate won't be 60fps, but will be
1476      * 30fps.</p>
1477      * <p>To start a CaptureSession with a target FPS range different from the
1478      * capture request template's default value, the application
1479      * is strongly recommended to call
1480      * {@link SessionConfiguration#setSessionParameters }
1481      * with the target fps range before creating the capture session. The aeTargetFpsRange is
1482      * typically a session parameter. Specifying it at session creation time helps avoid
1483      * session reconfiguration delays in cases like 60fps or high speed recording.</p>
1484      * <p><b>Units</b>: Frames per second (FPS)</p>
1485      * <p><b>Range of valid values:</b><br>
1486      * Any of the entries in {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES android.control.aeAvailableTargetFpsRanges}</p>
1487      * <p>This key is available on all devices.</p>
1488      *
1489      * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES
1490      * @see CaptureRequest#SENSOR_EXPOSURE_TIME
1491      * @see CaptureRequest#SENSOR_FRAME_DURATION
1492      */
1493     @PublicKey
1494     @NonNull
1495     public static final Key<android.util.Range<Integer>> CONTROL_AE_TARGET_FPS_RANGE =
1496             new Key<android.util.Range<Integer>>("android.control.aeTargetFpsRange", new TypeReference<android.util.Range<Integer>>() {{ }});
1497 
1498     /**
1499      * <p>Whether the camera device will trigger a precapture
1500      * metering sequence when it processes this request.</p>
1501      * <p>This entry is normally set to IDLE, or is not
1502      * included at all in the request settings. When included and
1503      * set to START, the camera device will trigger the auto-exposure (AE)
1504      * precapture metering sequence.</p>
1505      * <p>When set to CANCEL, the camera device will cancel any active
1506      * precapture metering trigger, and return to its initial AE state.
1507      * If a precapture metering sequence is already completed, and the camera
1508      * device has implicitly locked the AE for subsequent still capture, the
1509      * CANCEL trigger will unlock the AE and return to its initial AE state.</p>
1510      * <p>The precapture sequence should be triggered before starting a
1511      * high-quality still capture for final metering decisions to
1512      * be made, and for firing pre-capture flash pulses to estimate
1513      * scene brightness and required final capture flash power, when
1514      * the flash is enabled.</p>
1515      * <p>Normally, this entry should be set to START for only a
1516      * single request, and the application should wait until the
1517      * sequence completes before starting a new one.</p>
1518      * <p>When a precapture metering sequence is finished, the camera device
1519      * may lock the auto-exposure routine internally to be able to accurately expose the
1520      * subsequent still capture image (<code>{@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE</code>).
1521      * For this case, the AE may not resume normal scan if no subsequent still capture is
1522      * submitted. To ensure that the AE routine restarts normal scan, the application should
1523      * submit a request with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == true</code>, followed by a request
1524      * with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == false</code>, if the application decides not to submit a
1525      * still capture request after the precapture sequence completes. Alternatively, for
1526      * API level 23 or newer devices, the CANCEL can be used to unlock the camera device
1527      * internally locked AE if the application doesn't submit a still capture request after
1528      * the AE precapture trigger. Note that, the CANCEL was added in API level 23, and must not
1529      * be used in devices that have earlier API levels.</p>
1530      * <p>The exact effect of auto-exposure (AE) precapture trigger
1531      * depends on the current AE mode and state; see
1532      * {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture state transition
1533      * details.</p>
1534      * <p>On LEGACY-level devices, the precapture trigger is not supported;
1535      * capturing a high-resolution JPEG image will automatically trigger a
1536      * precapture sequence before the high-resolution capture, including
1537      * potentially firing a pre-capture flash.</p>
1538      * <p>Using the precapture trigger and the auto-focus trigger {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger}
1539      * simultaneously is allowed. However, since these triggers often require cooperation between
1540      * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a
1541      * focus sweep), the camera device may delay acting on a later trigger until the previous
1542      * trigger has been fully handled. This may lead to longer intervals between the trigger and
1543      * changes to {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} indicating the start of the precapture sequence, for
1544      * example.</p>
1545      * <p>If both the precapture and the auto-focus trigger are activated on the same request, then
1546      * the camera device will complete them in the optimal order for that device.</p>
1547      * <p><b>Possible values:</b></p>
1548      * <ul>
1549      *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE IDLE}</li>
1550      *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_START START}</li>
1551      *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL CANCEL}</li>
1552      * </ul>
1553      *
1554      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
1555      * <p><b>Limited capability</b> -
1556      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
1557      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
1558      *
1559      * @see CaptureRequest#CONTROL_AE_LOCK
1560      * @see CaptureResult#CONTROL_AE_STATE
1561      * @see CaptureRequest#CONTROL_AF_TRIGGER
1562      * @see CaptureRequest#CONTROL_CAPTURE_INTENT
1563      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
1564      * @see #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE
1565      * @see #CONTROL_AE_PRECAPTURE_TRIGGER_START
1566      * @see #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL
1567      */
1568     @PublicKey
1569     @NonNull
1570     public static final Key<Integer> CONTROL_AE_PRECAPTURE_TRIGGER =
1571             new Key<Integer>("android.control.aePrecaptureTrigger", int.class);
1572 
1573     /**
1574      * <p>Whether auto-focus (AF) is currently enabled, and what
1575      * mode it is set to.</p>
1576      * <p>Only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} = AUTO and the lens is not fixed focus
1577      * (i.e. <code>{@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} &gt; 0</code>). Also note that
1578      * when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF, the behavior of AF is device
1579      * dependent. It is recommended to lock AF by using {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger} before
1580      * setting {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} to OFF, or set AF mode to OFF when AE is OFF.</p>
1581      * <p>If the lens is controlled by the camera device auto-focus algorithm,
1582      * the camera device will report the current AF status in {@link CaptureResult#CONTROL_AF_STATE android.control.afState}
1583      * in result metadata.</p>
1584      * <p><b>Possible values:</b></p>
1585      * <ul>
1586      *   <li>{@link #CONTROL_AF_MODE_OFF OFF}</li>
1587      *   <li>{@link #CONTROL_AF_MODE_AUTO AUTO}</li>
1588      *   <li>{@link #CONTROL_AF_MODE_MACRO MACRO}</li>
1589      *   <li>{@link #CONTROL_AF_MODE_CONTINUOUS_VIDEO CONTINUOUS_VIDEO}</li>
1590      *   <li>{@link #CONTROL_AF_MODE_CONTINUOUS_PICTURE CONTINUOUS_PICTURE}</li>
1591      *   <li>{@link #CONTROL_AF_MODE_EDOF EDOF}</li>
1592      * </ul>
1593      *
1594      * <p><b>Available values for this device:</b><br>
1595      * {@link CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES android.control.afAvailableModes}</p>
1596      * <p>This key is available on all devices.</p>
1597      *
1598      * @see CaptureRequest#CONTROL_AE_MODE
1599      * @see CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES
1600      * @see CaptureResult#CONTROL_AF_STATE
1601      * @see CaptureRequest#CONTROL_AF_TRIGGER
1602      * @see CaptureRequest#CONTROL_MODE
1603      * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE
1604      * @see #CONTROL_AF_MODE_OFF
1605      * @see #CONTROL_AF_MODE_AUTO
1606      * @see #CONTROL_AF_MODE_MACRO
1607      * @see #CONTROL_AF_MODE_CONTINUOUS_VIDEO
1608      * @see #CONTROL_AF_MODE_CONTINUOUS_PICTURE
1609      * @see #CONTROL_AF_MODE_EDOF
1610      */
1611     @PublicKey
1612     @NonNull
1613     public static final Key<Integer> CONTROL_AF_MODE =
1614             new Key<Integer>("android.control.afMode", int.class);
1615 
1616     /**
1617      * <p>List of metering areas to use for auto-focus.</p>
1618      * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf} is 0.
1619      * Otherwise will always be present.</p>
1620      * <p>The maximum number of focus areas supported by the device is determined by the value
1621      * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf}.</p>
1622      * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1623      * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being
1624      * the top-left pixel in the active pixel array, and
1625      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1626      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1627      * active pixel array.</p>
1628      * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1629      * system depends on the mode being set.
1630      * When the distortion correction mode is OFF, the coordinate system follows
1631      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
1632      * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and
1633      * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1,
1634      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right
1635      * pixel in the pre-correction active pixel array.
1636      * When the distortion correction mode is not OFF, the coordinate system follows
1637      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
1638      * <code>(0, 0)</code> being the top-left pixel of the active array, and
1639      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1640      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1641      * active pixel array.</p>
1642      * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight
1643      * for every pixel in the area. This means that a large metering area
1644      * with the same weight as a smaller area will have more effect in
1645      * the metering result. Metering areas can partially overlap and the
1646      * camera device will add the weights in the overlap region.</p>
1647      * <p>The weights are relative to weights of other metering regions, so if only one region
1648      * is used, all non-zero weights will have the same effect. A region with 0 weight is
1649      * ignored.</p>
1650      * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
1651      * camera device. The capture result will either be a zero weight region as well, or
1652      * the region selected by the camera device as the focus area of interest.</p>
1653      * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
1654      * capture result metadata, the camera device will ignore the sections outside the crop
1655      * region and output only the intersection rectangle as the metering region in the result
1656      * metadata. If the region is entirely outside the crop region, it will be ignored and
1657      * not reported in the result metadata.</p>
1658      * <p>When setting the AF metering regions, the application must consider the additional
1659      * crop resulted from the aspect ratio differences between the preview stream and
1660      * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}. For example, if the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} is the full
1661      * active array size with 4:3 aspect ratio, and the preview stream is 16:9,
1662      * the boundary of AF regions will be [0, y_crop] and
1663      * [active_width, active_height - 2 * y_crop] rather than [0, 0] and
1664      * [active_width, active_height], where y_crop is the additional crop due to aspect ratio
1665      * mismatch.</p>
1666      * <p>Starting from API level 30, the coordinate system of activeArraySize or
1667      * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
1668      * pre-zoom field of view. This means that the same afRegions values at different
1669      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The afRegions
1670      * coordinates are relative to the activeArray/preCorrectionActiveArray representing the
1671      * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same
1672      * afRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of the
1673      * scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use
1674      * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
1675      * mode.</p>
1676      * <p>For camera devices with the
1677      * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR }
1678      * capability or devices where
1679      * {@link CameraCharacteristics#getAvailableCaptureRequestKeys }
1680      * lists {@link CaptureRequest#SENSOR_PIXEL_MODE {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode}},
1681      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.activeArraySizeMaximumResolution} /
1682      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.preCorrectionActiveArraySizeMaximumResolution} must be used as the
1683      * coordinate system for requests where {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is set to
1684      * {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION }.</p>
1685      * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
1686      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on
1687      * distortion correction capability and mode</p>
1688      * <p><b>Range of valid values:</b><br>
1689      * Coordinates must be between <code>[(0,0), (width, height))</code> of
1690      * {@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}
1691      * depending on distortion correction capability and mode</p>
1692      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
1693      *
1694      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF
1695      * @see CaptureRequest#CONTROL_ZOOM_RATIO
1696      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
1697      * @see CaptureRequest#SCALER_CROP_REGION
1698      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
1699      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
1700      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
1701      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
1702      * @see CaptureRequest#SENSOR_PIXEL_MODE
1703      */
1704     @PublicKey
1705     @NonNull
1706     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS =
1707             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.afRegions", android.hardware.camera2.params.MeteringRectangle[].class);
1708 
1709     /**
1710      * <p>Whether the camera device will trigger autofocus for this request.</p>
1711      * <p>This entry is normally set to IDLE, or is not
1712      * included at all in the request settings.</p>
1713      * <p>When included and set to START, the camera device will trigger the
1714      * autofocus algorithm. If autofocus is disabled, this trigger has no effect.</p>
1715      * <p>When set to CANCEL, the camera device will cancel any active trigger,
1716      * and return to its initial AF state.</p>
1717      * <p>Generally, applications should set this entry to START or CANCEL for only a
1718      * single capture, and then return it to IDLE (or not set at all). Specifying
1719      * START for multiple captures in a row means restarting the AF operation over
1720      * and over again.</p>
1721      * <p>See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what the trigger means for each AF mode.</p>
1722      * <p>Using the autofocus trigger and the precapture trigger {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}
1723      * simultaneously is allowed. However, since these triggers often require cooperation between
1724      * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a
1725      * focus sweep), the camera device may delay acting on a later trigger until the previous
1726      * trigger has been fully handled. This may lead to longer intervals between the trigger and
1727      * changes to {@link CaptureResult#CONTROL_AF_STATE android.control.afState}, for example.</p>
1728      * <p><b>Possible values:</b></p>
1729      * <ul>
1730      *   <li>{@link #CONTROL_AF_TRIGGER_IDLE IDLE}</li>
1731      *   <li>{@link #CONTROL_AF_TRIGGER_START START}</li>
1732      *   <li>{@link #CONTROL_AF_TRIGGER_CANCEL CANCEL}</li>
1733      * </ul>
1734      *
1735      * <p>This key is available on all devices.</p>
1736      *
1737      * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
1738      * @see CaptureResult#CONTROL_AF_STATE
1739      * @see #CONTROL_AF_TRIGGER_IDLE
1740      * @see #CONTROL_AF_TRIGGER_START
1741      * @see #CONTROL_AF_TRIGGER_CANCEL
1742      */
1743     @PublicKey
1744     @NonNull
1745     public static final Key<Integer> CONTROL_AF_TRIGGER =
1746             new Key<Integer>("android.control.afTrigger", int.class);
1747 
1748     /**
1749      * <p>Whether auto-white balance (AWB) is currently locked to its
1750      * latest calculated values.</p>
1751      * <p>When set to <code>true</code> (ON), the AWB algorithm is locked to its latest parameters,
1752      * and will not change color balance settings until the lock is set to <code>false</code> (OFF).</p>
1753      * <p>Since the camera device has a pipeline of in-flight requests, the settings that
1754      * get locked do not necessarily correspond to the settings that were present in the
1755      * latest capture result received from the camera device, since additional captures
1756      * and AWB updates may have occurred even before the result was sent out. If an
1757      * application is switching between automatic and manual control and wishes to eliminate
1758      * any flicker during the switch, the following procedure is recommended:</p>
1759      * <ol>
1760      * <li>Starting in auto-AWB mode:</li>
1761      * <li>Lock AWB</li>
1762      * <li>Wait for the first result to be output that has the AWB locked</li>
1763      * <li>Copy AWB settings from that result into a request, set the request to manual AWB</li>
1764      * <li>Submit the capture request, proceed to run manual AWB as desired.</li>
1765      * </ol>
1766      * <p>Note that AWB lock is only meaningful when
1767      * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} is in the AUTO mode; in other modes,
1768      * AWB is already fixed to a specific setting.</p>
1769      * <p>Some LEGACY devices may not support ON; the value is then overridden to OFF.</p>
1770      * <p>This key is available on all devices.</p>
1771      *
1772      * @see CaptureRequest#CONTROL_AWB_MODE
1773      */
1774     @PublicKey
1775     @NonNull
1776     public static final Key<Boolean> CONTROL_AWB_LOCK =
1777             new Key<Boolean>("android.control.awbLock", boolean.class);
1778 
1779     /**
1780      * <p>Whether auto-white balance (AWB) is currently setting the color
1781      * transform fields, and what its illumination target
1782      * is.</p>
1783      * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is AUTO.</p>
1784      * <p>When set to the AUTO mode, the camera device's auto-white balance
1785      * routine is enabled, overriding the application's selected
1786      * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
1787      * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}. Note that when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}
1788      * is OFF, the behavior of AWB is device dependent. It is recommended to
1789      * also set AWB mode to OFF or lock AWB by using {@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} before
1790      * setting AE mode to OFF.</p>
1791      * <p>When set to the OFF mode, the camera device's auto-white balance
1792      * routine is disabled. The application manually controls the white
1793      * balance by {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains}
1794      * and {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p>
1795      * <p>When set to any other modes, the camera device's auto-white
1796      * balance routine is disabled. The camera device uses each
1797      * particular illumination target for white balance
1798      * adjustment. The application's values for
1799      * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform},
1800      * {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
1801      * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} are ignored.</p>
1802      * <p><b>Possible values:</b></p>
1803      * <ul>
1804      *   <li>{@link #CONTROL_AWB_MODE_OFF OFF}</li>
1805      *   <li>{@link #CONTROL_AWB_MODE_AUTO AUTO}</li>
1806      *   <li>{@link #CONTROL_AWB_MODE_INCANDESCENT INCANDESCENT}</li>
1807      *   <li>{@link #CONTROL_AWB_MODE_FLUORESCENT FLUORESCENT}</li>
1808      *   <li>{@link #CONTROL_AWB_MODE_WARM_FLUORESCENT WARM_FLUORESCENT}</li>
1809      *   <li>{@link #CONTROL_AWB_MODE_DAYLIGHT DAYLIGHT}</li>
1810      *   <li>{@link #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT CLOUDY_DAYLIGHT}</li>
1811      *   <li>{@link #CONTROL_AWB_MODE_TWILIGHT TWILIGHT}</li>
1812      *   <li>{@link #CONTROL_AWB_MODE_SHADE SHADE}</li>
1813      * </ul>
1814      *
1815      * <p><b>Available values for this device:</b><br>
1816      * {@link CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES android.control.awbAvailableModes}</p>
1817      * <p>This key is available on all devices.</p>
1818      *
1819      * @see CaptureRequest#COLOR_CORRECTION_GAINS
1820      * @see CaptureRequest#COLOR_CORRECTION_MODE
1821      * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
1822      * @see CaptureRequest#CONTROL_AE_MODE
1823      * @see CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES
1824      * @see CaptureRequest#CONTROL_AWB_LOCK
1825      * @see CaptureRequest#CONTROL_MODE
1826      * @see #CONTROL_AWB_MODE_OFF
1827      * @see #CONTROL_AWB_MODE_AUTO
1828      * @see #CONTROL_AWB_MODE_INCANDESCENT
1829      * @see #CONTROL_AWB_MODE_FLUORESCENT
1830      * @see #CONTROL_AWB_MODE_WARM_FLUORESCENT
1831      * @see #CONTROL_AWB_MODE_DAYLIGHT
1832      * @see #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT
1833      * @see #CONTROL_AWB_MODE_TWILIGHT
1834      * @see #CONTROL_AWB_MODE_SHADE
1835      */
1836     @PublicKey
1837     @NonNull
1838     public static final Key<Integer> CONTROL_AWB_MODE =
1839             new Key<Integer>("android.control.awbMode", int.class);
1840 
1841     /**
1842      * <p>List of metering areas to use for auto-white-balance illuminant
1843      * estimation.</p>
1844      * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb} is 0.
1845      * Otherwise will always be present.</p>
1846      * <p>The maximum number of regions supported by the device is determined by the value
1847      * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb}.</p>
1848      * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1849      * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being
1850      * the top-left pixel in the active pixel array, and
1851      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1852      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1853      * active pixel array.</p>
1854      * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1855      * system depends on the mode being set.
1856      * When the distortion correction mode is OFF, the coordinate system follows
1857      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
1858      * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and
1859      * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1,
1860      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right
1861      * pixel in the pre-correction active pixel array.
1862      * When the distortion correction mode is not OFF, the coordinate system follows
1863      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
1864      * <code>(0, 0)</code> being the top-left pixel of the active array, and
1865      * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1866      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1867      * active pixel array.</p>
1868      * <p>The weight must range from 0 to 1000, and represents a weight
1869      * for every pixel in the area. This means that a large metering area
1870      * with the same weight as a smaller area will have more effect in
1871      * the metering result. Metering areas can partially overlap and the
1872      * camera device will add the weights in the overlap region.</p>
1873      * <p>The weights are relative to weights of other white balance metering regions, so if
1874      * only one region is used, all non-zero weights will have the same effect. A region with
1875      * 0 weight is ignored.</p>
1876      * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
1877      * camera device.</p>
1878      * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
1879      * capture result metadata, the camera device will ignore the sections outside the crop
1880      * region and output only the intersection rectangle as the metering region in the result
1881      * metadata.  If the region is entirely outside the crop region, it will be ignored and
1882      * not reported in the result metadata.</p>
1883      * <p>When setting the AWB metering regions, the application must consider the additional
1884      * crop resulted from the aspect ratio differences between the preview stream and
1885      * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}. For example, if the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} is the full
1886      * active array size with 4:3 aspect ratio, and the preview stream is 16:9,
1887      * the boundary of AWB regions will be [0, y_crop] and
1888      * [active_width, active_height - 2 * y_crop] rather than [0, 0] and
1889      * [active_width, active_height], where y_crop is the additional crop due to aspect ratio
1890      * mismatch.</p>
1891      * <p>Starting from API level 30, the coordinate system of activeArraySize or
1892      * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
1893      * pre-zoom field of view. This means that the same awbRegions values at different
1894      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The awbRegions
1895      * coordinates are relative to the activeArray/preCorrectionActiveArray representing the
1896      * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same
1897      * awbRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of
1898      * the scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use
1899      * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
1900      * mode.</p>
1901      * <p>For camera devices with the
1902      * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR }
1903      * capability or devices where
1904      * {@link CameraCharacteristics#getAvailableCaptureRequestKeys }
1905      * lists {@link CaptureRequest#SENSOR_PIXEL_MODE {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode}},
1906      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.activeArraySizeMaximumResolution} /
1907      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.preCorrectionActiveArraySizeMaximumResolution} must be used as the
1908      * coordinate system for requests where {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is set to
1909      * {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION }.</p>
1910      * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
1911      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on
1912      * distortion correction capability and mode</p>
1913      * <p><b>Range of valid values:</b><br>
1914      * Coordinates must be between <code>[(0,0), (width, height))</code> of
1915      * {@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}
1916      * depending on distortion correction capability and mode</p>
1917      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
1918      *
1919      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB
1920      * @see CaptureRequest#CONTROL_ZOOM_RATIO
1921      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
1922      * @see CaptureRequest#SCALER_CROP_REGION
1923      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
1924      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
1925      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
1926      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
1927      * @see CaptureRequest#SENSOR_PIXEL_MODE
1928      */
1929     @PublicKey
1930     @NonNull
1931     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS =
1932             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.awbRegions", android.hardware.camera2.params.MeteringRectangle[].class);
1933 
1934     /**
1935      * <p>Information to the camera device 3A (auto-exposure,
1936      * auto-focus, auto-white balance) routines about the purpose
1937      * of this capture, to help the camera device to decide optimal 3A
1938      * strategy.</p>
1939      * <p>This control (except for MANUAL) is only effective if
1940      * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} != OFF</code> and any 3A routine is active.</p>
1941      * <p>All intents are supported by all devices, except that:</p>
1942      * <ul>
1943      * <li>ZERO_SHUTTER_LAG will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains
1944      * PRIVATE_REPROCESSING or YUV_REPROCESSING.</li>
1945      * <li>MANUAL will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains
1946      * MANUAL_SENSOR.</li>
1947      * <li>MOTION_TRACKING will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains
1948      * MOTION_TRACKING.</li>
1949      * </ul>
1950      * <p><b>Possible values:</b></p>
1951      * <ul>
1952      *   <li>{@link #CONTROL_CAPTURE_INTENT_CUSTOM CUSTOM}</li>
1953      *   <li>{@link #CONTROL_CAPTURE_INTENT_PREVIEW PREVIEW}</li>
1954      *   <li>{@link #CONTROL_CAPTURE_INTENT_STILL_CAPTURE STILL_CAPTURE}</li>
1955      *   <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_RECORD VIDEO_RECORD}</li>
1956      *   <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT VIDEO_SNAPSHOT}</li>
1957      *   <li>{@link #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li>
1958      *   <li>{@link #CONTROL_CAPTURE_INTENT_MANUAL MANUAL}</li>
1959      *   <li>{@link #CONTROL_CAPTURE_INTENT_MOTION_TRACKING MOTION_TRACKING}</li>
1960      * </ul>
1961      *
1962      * <p>This key is available on all devices.</p>
1963      *
1964      * @see CaptureRequest#CONTROL_MODE
1965      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
1966      * @see #CONTROL_CAPTURE_INTENT_CUSTOM
1967      * @see #CONTROL_CAPTURE_INTENT_PREVIEW
1968      * @see #CONTROL_CAPTURE_INTENT_STILL_CAPTURE
1969      * @see #CONTROL_CAPTURE_INTENT_VIDEO_RECORD
1970      * @see #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT
1971      * @see #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG
1972      * @see #CONTROL_CAPTURE_INTENT_MANUAL
1973      * @see #CONTROL_CAPTURE_INTENT_MOTION_TRACKING
1974      */
1975     @PublicKey
1976     @NonNull
1977     public static final Key<Integer> CONTROL_CAPTURE_INTENT =
1978             new Key<Integer>("android.control.captureIntent", int.class);
1979 
1980     /**
1981      * <p>A special color effect to apply.</p>
1982      * <p>When this mode is set, a color effect will be applied
1983      * to images produced by the camera device. The interpretation
1984      * and implementation of these color effects is left to the
1985      * implementor of the camera device, and should not be
1986      * depended on to be consistent (or present) across all
1987      * devices.</p>
1988      * <p><b>Possible values:</b></p>
1989      * <ul>
1990      *   <li>{@link #CONTROL_EFFECT_MODE_OFF OFF}</li>
1991      *   <li>{@link #CONTROL_EFFECT_MODE_MONO MONO}</li>
1992      *   <li>{@link #CONTROL_EFFECT_MODE_NEGATIVE NEGATIVE}</li>
1993      *   <li>{@link #CONTROL_EFFECT_MODE_SOLARIZE SOLARIZE}</li>
1994      *   <li>{@link #CONTROL_EFFECT_MODE_SEPIA SEPIA}</li>
1995      *   <li>{@link #CONTROL_EFFECT_MODE_POSTERIZE POSTERIZE}</li>
1996      *   <li>{@link #CONTROL_EFFECT_MODE_WHITEBOARD WHITEBOARD}</li>
1997      *   <li>{@link #CONTROL_EFFECT_MODE_BLACKBOARD BLACKBOARD}</li>
1998      *   <li>{@link #CONTROL_EFFECT_MODE_AQUA AQUA}</li>
1999      * </ul>
2000      *
2001      * <p><b>Available values for this device:</b><br>
2002      * {@link CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS android.control.availableEffects}</p>
2003      * <p>This key is available on all devices.</p>
2004      *
2005      * @see CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS
2006      * @see #CONTROL_EFFECT_MODE_OFF
2007      * @see #CONTROL_EFFECT_MODE_MONO
2008      * @see #CONTROL_EFFECT_MODE_NEGATIVE
2009      * @see #CONTROL_EFFECT_MODE_SOLARIZE
2010      * @see #CONTROL_EFFECT_MODE_SEPIA
2011      * @see #CONTROL_EFFECT_MODE_POSTERIZE
2012      * @see #CONTROL_EFFECT_MODE_WHITEBOARD
2013      * @see #CONTROL_EFFECT_MODE_BLACKBOARD
2014      * @see #CONTROL_EFFECT_MODE_AQUA
2015      */
2016     @PublicKey
2017     @NonNull
2018     public static final Key<Integer> CONTROL_EFFECT_MODE =
2019             new Key<Integer>("android.control.effectMode", int.class);
2020 
2021     /**
2022      * <p>Overall mode of 3A (auto-exposure, auto-white-balance, auto-focus) control
2023      * routines.</p>
2024      * <p>This is a top-level 3A control switch. When set to OFF, all 3A control
2025      * by the camera device is disabled. The application must set the fields for
2026      * capture parameters itself.</p>
2027      * <p>When set to AUTO, the individual algorithm controls in
2028      * android.control.* are in effect, such as {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}.</p>
2029      * <p>When set to USE_SCENE_MODE or USE_EXTENDED_SCENE_MODE, the individual controls in
2030      * android.control.* are mostly disabled, and the camera device
2031      * implements one of the scene mode or extended scene mode settings (such as ACTION,
2032      * SUNSET, PARTY, or BOKEH) as it wishes. The camera device scene mode
2033      * 3A settings are provided by {@link android.hardware.camera2.CaptureResult capture results}.</p>
2034      * <p>When set to OFF_KEEP_STATE, it is similar to OFF mode, the only difference
2035      * is that this frame will not be used by camera device background 3A statistics
2036      * update, as if this frame is never captured. This mode can be used in the scenario
2037      * where the application doesn't want a 3A manual control capture to affect
2038      * the subsequent auto 3A capture results.</p>
2039      * <p><b>Possible values:</b></p>
2040      * <ul>
2041      *   <li>{@link #CONTROL_MODE_OFF OFF}</li>
2042      *   <li>{@link #CONTROL_MODE_AUTO AUTO}</li>
2043      *   <li>{@link #CONTROL_MODE_USE_SCENE_MODE USE_SCENE_MODE}</li>
2044      *   <li>{@link #CONTROL_MODE_OFF_KEEP_STATE OFF_KEEP_STATE}</li>
2045      *   <li>{@link #CONTROL_MODE_USE_EXTENDED_SCENE_MODE USE_EXTENDED_SCENE_MODE}</li>
2046      * </ul>
2047      *
2048      * <p><b>Available values for this device:</b><br>
2049      * {@link CameraCharacteristics#CONTROL_AVAILABLE_MODES android.control.availableModes}</p>
2050      * <p>This key is available on all devices.</p>
2051      *
2052      * @see CaptureRequest#CONTROL_AF_MODE
2053      * @see CameraCharacteristics#CONTROL_AVAILABLE_MODES
2054      * @see #CONTROL_MODE_OFF
2055      * @see #CONTROL_MODE_AUTO
2056      * @see #CONTROL_MODE_USE_SCENE_MODE
2057      * @see #CONTROL_MODE_OFF_KEEP_STATE
2058      * @see #CONTROL_MODE_USE_EXTENDED_SCENE_MODE
2059      */
2060     @PublicKey
2061     @NonNull
2062     public static final Key<Integer> CONTROL_MODE =
2063             new Key<Integer>("android.control.mode", int.class);
2064 
2065     /**
2066      * <p>Control for which scene mode is currently active.</p>
2067      * <p>Scene modes are custom camera modes optimized for a certain set of conditions and
2068      * capture settings.</p>
2069      * <p>This is the mode that that is active when
2070      * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY, these modes will
2071      * 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}
2072      * while in use.</p>
2073      * <p>The interpretation and implementation of these scene modes is left
2074      * to the implementor of the camera device. Their behavior will not be
2075      * consistent across all devices, and any given device may only implement
2076      * a subset of these modes.</p>
2077      * <p><b>Possible values:</b></p>
2078      * <ul>
2079      *   <li>{@link #CONTROL_SCENE_MODE_DISABLED DISABLED}</li>
2080      *   <li>{@link #CONTROL_SCENE_MODE_FACE_PRIORITY FACE_PRIORITY}</li>
2081      *   <li>{@link #CONTROL_SCENE_MODE_ACTION ACTION}</li>
2082      *   <li>{@link #CONTROL_SCENE_MODE_PORTRAIT PORTRAIT}</li>
2083      *   <li>{@link #CONTROL_SCENE_MODE_LANDSCAPE LANDSCAPE}</li>
2084      *   <li>{@link #CONTROL_SCENE_MODE_NIGHT NIGHT}</li>
2085      *   <li>{@link #CONTROL_SCENE_MODE_NIGHT_PORTRAIT NIGHT_PORTRAIT}</li>
2086      *   <li>{@link #CONTROL_SCENE_MODE_THEATRE THEATRE}</li>
2087      *   <li>{@link #CONTROL_SCENE_MODE_BEACH BEACH}</li>
2088      *   <li>{@link #CONTROL_SCENE_MODE_SNOW SNOW}</li>
2089      *   <li>{@link #CONTROL_SCENE_MODE_SUNSET SUNSET}</li>
2090      *   <li>{@link #CONTROL_SCENE_MODE_STEADYPHOTO STEADYPHOTO}</li>
2091      *   <li>{@link #CONTROL_SCENE_MODE_FIREWORKS FIREWORKS}</li>
2092      *   <li>{@link #CONTROL_SCENE_MODE_SPORTS SPORTS}</li>
2093      *   <li>{@link #CONTROL_SCENE_MODE_PARTY PARTY}</li>
2094      *   <li>{@link #CONTROL_SCENE_MODE_CANDLELIGHT CANDLELIGHT}</li>
2095      *   <li>{@link #CONTROL_SCENE_MODE_BARCODE BARCODE}</li>
2096      *   <li>{@link #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO HIGH_SPEED_VIDEO}</li>
2097      *   <li>{@link #CONTROL_SCENE_MODE_HDR HDR}</li>
2098      * </ul>
2099      *
2100      * <p><b>Available values for this device:</b><br>
2101      * {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes}</p>
2102      * <p>This key is available on all devices.</p>
2103      *
2104      * @see CaptureRequest#CONTROL_AE_MODE
2105      * @see CaptureRequest#CONTROL_AF_MODE
2106      * @see CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES
2107      * @see CaptureRequest#CONTROL_AWB_MODE
2108      * @see CaptureRequest#CONTROL_MODE
2109      * @see #CONTROL_SCENE_MODE_DISABLED
2110      * @see #CONTROL_SCENE_MODE_FACE_PRIORITY
2111      * @see #CONTROL_SCENE_MODE_ACTION
2112      * @see #CONTROL_SCENE_MODE_PORTRAIT
2113      * @see #CONTROL_SCENE_MODE_LANDSCAPE
2114      * @see #CONTROL_SCENE_MODE_NIGHT
2115      * @see #CONTROL_SCENE_MODE_NIGHT_PORTRAIT
2116      * @see #CONTROL_SCENE_MODE_THEATRE
2117      * @see #CONTROL_SCENE_MODE_BEACH
2118      * @see #CONTROL_SCENE_MODE_SNOW
2119      * @see #CONTROL_SCENE_MODE_SUNSET
2120      * @see #CONTROL_SCENE_MODE_STEADYPHOTO
2121      * @see #CONTROL_SCENE_MODE_FIREWORKS
2122      * @see #CONTROL_SCENE_MODE_SPORTS
2123      * @see #CONTROL_SCENE_MODE_PARTY
2124      * @see #CONTROL_SCENE_MODE_CANDLELIGHT
2125      * @see #CONTROL_SCENE_MODE_BARCODE
2126      * @see #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO
2127      * @see #CONTROL_SCENE_MODE_HDR
2128      */
2129     @PublicKey
2130     @NonNull
2131     public static final Key<Integer> CONTROL_SCENE_MODE =
2132             new Key<Integer>("android.control.sceneMode", int.class);
2133 
2134     /**
2135      * <p>Whether video stabilization is
2136      * active.</p>
2137      * <p>Video stabilization automatically warps images from
2138      * the camera in order to stabilize motion between consecutive frames.</p>
2139      * <p>If enabled, video stabilization can modify the
2140      * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to keep the video stream stabilized.</p>
2141      * <p>Switching between different video stabilization modes may take several
2142      * frames to initialize, the camera device will report the current mode
2143      * in capture result metadata. For example, When "ON" mode is requested,
2144      * the video stabilization modes in the first several capture results may
2145      * still be "OFF", and it will become "ON" when the initialization is
2146      * done.</p>
2147      * <p>In addition, not all recording sizes or frame rates may be supported for
2148      * stabilization by a device that reports stabilization support. It is guaranteed
2149      * that an output targeting a MediaRecorder or MediaCodec will be stabilized if
2150      * the recording resolution is less than or equal to 1920 x 1080 (width less than
2151      * or equal to 1920, height less than or equal to 1080), and the recording
2152      * frame rate is less than or equal to 30fps.  At other sizes, the CaptureResult
2153      * {@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode} field will return
2154      * OFF if the recording output is not stabilized, or if there are no output
2155      * Surface types that can be stabilized.</p>
2156      * <p>The application is strongly recommended to call
2157      * {@link SessionConfiguration#setSessionParameters }
2158      * with the desired video stabilization mode before creating the capture session.
2159      * Video stabilization mode is a session parameter on many devices. Specifying
2160      * it at session creation time helps avoid reconfiguration delay caused by difference
2161      * between the default value and the first CaptureRequest.</p>
2162      * <p>If a camera device supports both this mode and OIS
2163      * ({@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode}), turning both modes on may
2164      * produce undesirable interaction, so it is recommended not to enable
2165      * both at the same time.</p>
2166      * <p>If video stabilization is set to "PREVIEW_STABILIZATION",
2167      * {@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode} is overridden. The camera sub-system may choose
2168      * to turn on hardware based image stabilization in addition to software based stabilization
2169      * if it deems that appropriate.
2170      * This key may be a part of the available session keys, which camera clients may
2171      * query via
2172      * {@link android.hardware.camera2.CameraCharacteristics#getAvailableSessionKeys }.
2173      * If this is the case, changing this key over the life-time of a capture session may
2174      * cause delays / glitches.</p>
2175      * <p><b>Possible values:</b></p>
2176      * <ul>
2177      *   <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_OFF OFF}</li>
2178      *   <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_ON ON}</li>
2179      *   <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION PREVIEW_STABILIZATION}</li>
2180      * </ul>
2181      *
2182      * <p>This key is available on all devices.</p>
2183      *
2184      * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
2185      * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE
2186      * @see CaptureRequest#SCALER_CROP_REGION
2187      * @see #CONTROL_VIDEO_STABILIZATION_MODE_OFF
2188      * @see #CONTROL_VIDEO_STABILIZATION_MODE_ON
2189      * @see #CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION
2190      */
2191     @PublicKey
2192     @NonNull
2193     public static final Key<Integer> CONTROL_VIDEO_STABILIZATION_MODE =
2194             new Key<Integer>("android.control.videoStabilizationMode", int.class);
2195 
2196     /**
2197      * <p>The amount of additional sensitivity boost applied to output images
2198      * after RAW sensor data is captured.</p>
2199      * <p>Some camera devices support additional digital sensitivity boosting in the
2200      * camera processing pipeline after sensor RAW image is captured.
2201      * Such a boost will be applied to YUV/JPEG format output images but will not
2202      * have effect on RAW output formats like RAW_SENSOR, RAW10, RAW12 or RAW_OPAQUE.</p>
2203      * <p>This key will be <code>null</code> for devices that do not support any RAW format
2204      * outputs. For devices that do support RAW format outputs, this key will always
2205      * present, and if a device does not support post RAW sensitivity boost, it will
2206      * list <code>100</code> in this key.</p>
2207      * <p>If the camera device cannot apply the exact boost requested, it will reduce the
2208      * boost to the nearest supported value.
2209      * The final boost value used will be available in the output capture result.</p>
2210      * <p>For devices that support post RAW sensitivity boost, the YUV/JPEG output images
2211      * of such device will have the total sensitivity of
2212      * <code>{@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} * {@link CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST android.control.postRawSensitivityBoost} / 100</code>
2213      * The sensitivity of RAW format images will always be <code>{@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</code></p>
2214      * <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
2215      * OFF; otherwise the auto-exposure algorithm will override this value.</p>
2216      * <p><b>Units</b>: ISO arithmetic units, the same as {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</p>
2217      * <p><b>Range of valid values:</b><br>
2218      * {@link CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE android.control.postRawSensitivityBoostRange}</p>
2219      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2220      *
2221      * @see CaptureRequest#CONTROL_AE_MODE
2222      * @see CaptureRequest#CONTROL_MODE
2223      * @see CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST
2224      * @see CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE
2225      * @see CaptureRequest#SENSOR_SENSITIVITY
2226      */
2227     @PublicKey
2228     @NonNull
2229     public static final Key<Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST =
2230             new Key<Integer>("android.control.postRawSensitivityBoost", int.class);
2231 
2232     /**
2233      * <p>Allow camera device to enable zero-shutter-lag mode for requests with
2234      * {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE.</p>
2235      * <p>If enableZsl is <code>true</code>, the camera device may enable zero-shutter-lag mode for requests with
2236      * STILL_CAPTURE capture intent. The camera device may use images captured in the past to
2237      * produce output images for a zero-shutter-lag request. The result metadata including the
2238      * {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp} reflects the source frames used to produce output images.
2239      * Therefore, the contents of the output images and the result metadata may be out of order
2240      * compared to previous regular requests. enableZsl does not affect requests with other
2241      * capture intents.</p>
2242      * <p>For example, when requests are submitted in the following order:
2243      *   Request A: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is PREVIEW
2244      *   Request B: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is STILL_CAPTURE</p>
2245      * <p>The output images for request B may have contents captured before the output images for
2246      * request A, and the result metadata for request B may be older than the result metadata for
2247      * request A.</p>
2248      * <p>Note that when enableZsl is <code>true</code>, it is not guaranteed to get output images captured in
2249      * the past for requests with STILL_CAPTURE capture intent.</p>
2250      * <p>For applications targeting SDK versions O and newer, the value of enableZsl in
2251      * TEMPLATE_STILL_CAPTURE template may be <code>true</code>. The value in other templates is always
2252      * <code>false</code> if present.</p>
2253      * <p>For applications targeting SDK versions older than O, the value of enableZsl in all
2254      * capture templates is always <code>false</code> if present.</p>
2255      * <p>For application-operated ZSL, use CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG template.</p>
2256      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2257      *
2258      * @see CaptureRequest#CONTROL_CAPTURE_INTENT
2259      * @see CaptureResult#SENSOR_TIMESTAMP
2260      */
2261     @PublicKey
2262     @NonNull
2263     public static final Key<Boolean> CONTROL_ENABLE_ZSL =
2264             new Key<Boolean>("android.control.enableZsl", boolean.class);
2265 
2266     /**
2267      * <p>Whether extended scene mode is enabled for a particular capture request.</p>
2268      * <p>With bokeh mode, the camera device may blur out the parts of scene that are not in
2269      * focus, creating a bokeh (or shallow depth of field) effect for people or objects.</p>
2270      * <p>When set to BOKEH_STILL_CAPTURE mode with STILL_CAPTURE capture intent, due to the extra
2271      * processing needed for high quality bokeh effect, the stall may be longer than when
2272      * capture intent is not STILL_CAPTURE.</p>
2273      * <p>When set to BOKEH_STILL_CAPTURE mode with PREVIEW capture intent,</p>
2274      * <ul>
2275      * <li>If the camera device has BURST_CAPTURE capability, the frame rate requirement of
2276      * BURST_CAPTURE must still be met.</li>
2277      * <li>All streams not larger than the maximum streaming dimension for BOKEH_STILL_CAPTURE mode
2278      * (queried via {@link android.hardware.camera2.CameraCharacteristics#CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_CAPABILITIES })
2279      * will have preview bokeh effect applied.</li>
2280      * </ul>
2281      * <p>When set to BOKEH_CONTINUOUS mode, configured streams dimension should not exceed this mode's
2282      * maximum streaming dimension in order to have bokeh effect applied. Bokeh effect may not
2283      * be available for streams larger than the maximum streaming dimension.</p>
2284      * <p>Switching between different extended scene modes may involve reconfiguration of the camera
2285      * pipeline, resulting in long latency. The application should check this key against the
2286      * available session keys queried via
2287      * {@link android.hardware.camera2.CameraCharacteristics#getAvailableSessionKeys }.</p>
2288      * <p>For a logical multi-camera, bokeh may be implemented by stereo vision from sub-cameras
2289      * with different field of view. As a result, when bokeh mode is enabled, the camera device
2290      * may override {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, and the field of
2291      * view may be smaller than when bokeh mode is off.</p>
2292      * <p><b>Possible values:</b></p>
2293      * <ul>
2294      *   <li>{@link #CONTROL_EXTENDED_SCENE_MODE_DISABLED DISABLED}</li>
2295      *   <li>{@link #CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE BOKEH_STILL_CAPTURE}</li>
2296      *   <li>{@link #CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS BOKEH_CONTINUOUS}</li>
2297      * </ul>
2298      *
2299      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2300      *
2301      * @see CaptureRequest#CONTROL_ZOOM_RATIO
2302      * @see CaptureRequest#SCALER_CROP_REGION
2303      * @see #CONTROL_EXTENDED_SCENE_MODE_DISABLED
2304      * @see #CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE
2305      * @see #CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS
2306      */
2307     @PublicKey
2308     @NonNull
2309     public static final Key<Integer> CONTROL_EXTENDED_SCENE_MODE =
2310             new Key<Integer>("android.control.extendedSceneMode", int.class);
2311 
2312     /**
2313      * <p>The desired zoom ratio</p>
2314      * <p>Instead of using {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} for zoom, the application can now choose to
2315      * use this tag to specify the desired zoom level.</p>
2316      * <p>By using this control, the application gains a simpler way to control zoom, which can
2317      * be a combination of optical and digital zoom. For example, a multi-camera system may
2318      * contain more than one lens with different focal lengths, and the user can use optical
2319      * zoom by switching between lenses. Using zoomRatio has benefits in the scenarios below:</p>
2320      * <ul>
2321      * <li>Zooming in from a wide-angle lens to a telephoto lens: A floating-point ratio provides
2322      *   better precision compared to an integer value of {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}.</li>
2323      * <li>Zooming out from a wide lens to an ultrawide lens: zoomRatio supports zoom-out whereas
2324      *   {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} doesn't.</li>
2325      * </ul>
2326      * <p>To illustrate, here are several scenarios of different zoom ratios, crop regions,
2327      * and output streams, for a hypothetical camera device with an active array of size
2328      * <code>(2000,1500)</code>.</p>
2329      * <ul>
2330      * <li>Camera Configuration:<ul>
2331      * <li>Active array size: <code>2000x1500</code> (3 MP, 4:3 aspect ratio)</li>
2332      * <li>Output stream #1: <code>640x480</code> (VGA, 4:3 aspect ratio)</li>
2333      * <li>Output stream #2: <code>1280x720</code> (720p, 16:9 aspect ratio)</li>
2334      * </ul>
2335      * </li>
2336      * <li>Case #1: 4:3 crop region with 2.0x zoom ratio<ul>
2337      * <li>Zoomed field of view: 1/4 of original field of view</li>
2338      * <li>Crop region: <code>Rect(0, 0, 2000, 1500) // (left, top, right, bottom)</code> (post zoom)</li>
2339      * </ul>
2340      * </li>
2341      * <li><img alt="4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-2-crop-43.png" /><ul>
2342      * <li><code>640x480</code> stream source area: <code>(0, 0, 2000, 1500)</code> (equal to crop region)</li>
2343      * <li><code>1280x720</code> stream source area: <code>(0, 187, 2000, 1312)</code> (letterboxed)</li>
2344      * </ul>
2345      * </li>
2346      * <li>Case #2: 16:9 crop region with 2.0x zoom.<ul>
2347      * <li>Zoomed field of view: 1/4 of original field of view</li>
2348      * <li>Crop region: <code>Rect(0, 187, 2000, 1312)</code></li>
2349      * <li><img alt="16:9 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-2-crop-169.png" /></li>
2350      * <li><code>640x480</code> stream source area: <code>(250, 187, 1750, 1312)</code> (pillarboxed)</li>
2351      * <li><code>1280x720</code> stream source area: <code>(0, 187, 2000, 1312)</code> (equal to crop region)</li>
2352      * </ul>
2353      * </li>
2354      * <li>Case #3: 1:1 crop region with 0.5x zoom out to ultrawide lens.<ul>
2355      * <li>Zoomed field of view: 4x of original field of view (switched from wide lens to ultrawide lens)</li>
2356      * <li>Crop region: <code>Rect(250, 0, 1750, 1500)</code></li>
2357      * <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>
2358      * <li><code>640x480</code> stream source area: <code>(250, 187, 1750, 1312)</code> (letterboxed)</li>
2359      * <li><code>1280x720</code> stream source area: <code>(250, 328, 1750, 1172)</code> (letterboxed)</li>
2360      * </ul>
2361      * </li>
2362      * </ul>
2363      * <p>As seen from the graphs above, the coordinate system of cropRegion now changes to the
2364      * effective after-zoom field-of-view, and is represented by the rectangle of (0, 0,
2365      * activeArrayWith, activeArrayHeight). The same applies to AE/AWB/AF regions, and faces.
2366      * This coordinate system change isn't applicable to RAW capture and its related
2367      * metadata such as intrinsicCalibration and lensShadingMap.</p>
2368      * <p>Using the same hypothetical example above, and assuming output stream #1 (640x480) is
2369      * the viewfinder stream, the application can achieve 2.0x zoom in one of two ways:</p>
2370      * <ul>
2371      * <li>zoomRatio = 2.0, scaler.cropRegion = (0, 0, 2000, 1500)</li>
2372      * <li>zoomRatio = 1.0 (default), scaler.cropRegion = (500, 375, 1500, 1125)</li>
2373      * </ul>
2374      * <p>If the application intends to set aeRegions to be top-left quarter of the viewfinder
2375      * field-of-view, the {@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions} should be set to (0, 0, 1000, 750) with
2376      * zoomRatio set to 2.0. Alternatively, the application can set aeRegions to the equivalent
2377      * region of (500, 375, 1000, 750) for zoomRatio of 1.0. If the application doesn't
2378      * explicitly set {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, its value defaults to 1.0.</p>
2379      * <p>One limitation of controlling zoom using zoomRatio is that the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}
2380      * must only be used for letterboxing or pillarboxing of the sensor active array, and no
2381      * FREEFORM cropping can be used with {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} other than 1.0. If
2382      * {@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
2383      * windowboxing, the camera framework will override the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to be
2384      * the active array.</p>
2385      * <p>In the capture request, if the application sets {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} to a
2386      * value != 1.0, the {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} tag in the capture result reflects the
2387      * effective zoom ratio achieved by the camera device, and the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}
2388      * adjusts for additional crops that are not zoom related. Otherwise, if the application
2389      * sets {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} to 1.0, or does not set it at all, the
2390      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} tag in the result metadata will also be 1.0.</p>
2391      * <p>When the application requests a physical stream for a logical multi-camera, the
2392      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} in the physical camera result metadata will be 1.0, and
2393      * the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} tag reflects the amount of zoom and crop done by the
2394      * physical camera device.</p>
2395      * <p><b>Range of valid values:</b><br>
2396      * {@link CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE android.control.zoomRatioRange}</p>
2397      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2398      * <p><b>Limited capability</b> -
2399      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2400      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2401      *
2402      * @see CaptureRequest#CONTROL_AE_REGIONS
2403      * @see CaptureRequest#CONTROL_ZOOM_RATIO
2404      * @see CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE
2405      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2406      * @see CaptureRequest#SCALER_CROP_REGION
2407      */
2408     @PublicKey
2409     @NonNull
2410     public static final Key<Float> CONTROL_ZOOM_RATIO =
2411             new Key<Float>("android.control.zoomRatio", float.class);
2412 
2413     /**
2414      * <p>Framework-only private key which informs camera fwk that the AF regions has been set
2415      * by the client and those regions need not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is
2416      * set to MAXIMUM_RESOLUTION.</p>
2417      * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
2418      * {@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}.</p>
2419      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2420      *
2421      * @see CaptureRequest#CONTROL_AF_REGIONS
2422      * @see CaptureRequest#SENSOR_PIXEL_MODE
2423      * @hide
2424      */
2425     public static final Key<Boolean> CONTROL_AF_REGIONS_SET =
2426             new Key<Boolean>("android.control.afRegionsSet", boolean.class);
2427 
2428     /**
2429      * <p>Framework-only private key which informs camera fwk that the AE regions has been set
2430      * by the client and those regions need not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is
2431      * set to MAXIMUM_RESOLUTION.</p>
2432      * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
2433      * {@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}.</p>
2434      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2435      *
2436      * @see CaptureRequest#CONTROL_AE_REGIONS
2437      * @see CaptureRequest#SENSOR_PIXEL_MODE
2438      * @hide
2439      */
2440     public static final Key<Boolean> CONTROL_AE_REGIONS_SET =
2441             new Key<Boolean>("android.control.aeRegionsSet", boolean.class);
2442 
2443     /**
2444      * <p>Framework-only private key which informs camera fwk that the AF regions has been set
2445      * by the client and those regions need not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is
2446      * set to MAXIMUM_RESOLUTION.</p>
2447      * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
2448      * {@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}.</p>
2449      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2450      *
2451      * @see CaptureRequest#CONTROL_AWB_REGIONS
2452      * @see CaptureRequest#SENSOR_PIXEL_MODE
2453      * @hide
2454      */
2455     public static final Key<Boolean> CONTROL_AWB_REGIONS_SET =
2456             new Key<Boolean>("android.control.awbRegionsSet", boolean.class);
2457 
2458     /**
2459      * <p>The desired CaptureRequest settings override with which certain keys are
2460      * applied earlier so that they can take effect sooner.</p>
2461      * <p>There are some CaptureRequest keys which can be applied earlier than others
2462      * when controls within a CaptureRequest aren't required to take effect at the same time.
2463      * One such example is zoom. Zoom can be applied at a later stage of the camera pipeline.
2464      * As soon as the camera device receives the CaptureRequest, it can apply the requested
2465      * zoom value onto an earlier request that's already in the pipeline, thus improves zoom
2466      * latency.</p>
2467      * <p>This key's value in the capture result reflects whether the controls for this capture
2468      * are overridden "by" a newer request. This means that if a capture request turns on
2469      * settings override, the capture result of an earlier request will contain the key value
2470      * of ZOOM. On the other hand, if a capture request has settings override turned on,
2471      * but all newer requests have it turned off, the key's value in the capture result will
2472      * be OFF because this capture isn't overridden by a newer capture. In the two examples
2473      * below, the capture results columns illustrate the settingsOverride values in different
2474      * scenarios.</p>
2475      * <p>Assuming the zoom settings override can speed up by 1 frame, below example illustrates
2476      * the speed-up at the start of capture session:</p>
2477      * <pre><code>Camera session created
2478      * Request 1 (zoom=1.0x, override=ZOOM) -&gt;
2479      * Request 2 (zoom=1.2x, override=ZOOM) -&gt;
2480      * Request 3 (zoom=1.4x, override=ZOOM) -&gt;  Result 1 (zoom=1.2x, override=ZOOM)
2481      * Request 4 (zoom=1.6x, override=ZOOM) -&gt;  Result 2 (zoom=1.4x, override=ZOOM)
2482      * Request 5 (zoom=1.8x, override=ZOOM) -&gt;  Result 3 (zoom=1.6x, override=ZOOM)
2483      *                                      -&gt;  Result 4 (zoom=1.8x, override=ZOOM)
2484      *                                      -&gt;  Result 5 (zoom=1.8x, override=OFF)
2485      * </code></pre>
2486      * <p>The application can turn on settings override and use zoom as normal. The example
2487      * shows that the later zoom values (1.2x, 1.4x, 1.6x, and 1.8x) overwrite the zoom
2488      * values (1.0x, 1.2x, 1.4x, and 1.8x) of earlier requests (#1, #2, #3, and #4).</p>
2489      * <p>The application must make sure the settings override doesn't interfere with user
2490      * journeys requiring simultaneous application of all controls in CaptureRequest on the
2491      * requested output targets. For example, if the application takes a still capture using
2492      * CameraCaptureSession#capture, and the repeating request immediately sets a different
2493      * zoom value using override, the inflight still capture could have its zoom value
2494      * overwritten unexpectedly.</p>
2495      * <p>So the application is strongly recommended to turn off settingsOverride when taking
2496      * still/burst captures, and turn it back on when there is only repeating viewfinder
2497      * request and no inflight still/burst captures.</p>
2498      * <p>Below is the example demonstrating the transitions in and out of the
2499      * settings override:</p>
2500      * <pre><code>Request 1 (zoom=1.0x, override=OFF)
2501      * Request 2 (zoom=1.2x, override=OFF)
2502      * Request 3 (zoom=1.4x, override=ZOOM)  -&gt; Result 1 (zoom=1.0x, override=OFF)
2503      * Request 4 (zoom=1.6x, override=ZOOM)  -&gt; Result 2 (zoom=1.4x, override=ZOOM)
2504      * Request 5 (zoom=1.8x, override=OFF)   -&gt; Result 3 (zoom=1.6x, override=ZOOM)
2505      *                                       -&gt; Result 4 (zoom=1.6x, override=OFF)
2506      *                                       -&gt; Result 5 (zoom=1.8x, override=OFF)
2507      * </code></pre>
2508      * <p>This example shows that:</p>
2509      * <ul>
2510      * <li>The application "ramps in" settings override by setting the control to ZOOM.
2511      * In the example, request #3 enables zoom settings override. Because the camera device
2512      * can speed up applying zoom by 1 frame, the outputs of request #2 has 1.4x zoom, the
2513      * value specified in request #3.</li>
2514      * <li>The application "ramps out" of settings override by setting the control to OFF. In
2515      * the example, request #5 changes the override to OFF. Because request #4's zoom
2516      * takes effect in result #3, result #4's zoom remains the same until new value takes
2517      * effect in result #5.</li>
2518      * </ul>
2519      * <p><b>Possible values:</b></p>
2520      * <ul>
2521      *   <li>{@link #CONTROL_SETTINGS_OVERRIDE_OFF OFF}</li>
2522      *   <li>{@link #CONTROL_SETTINGS_OVERRIDE_ZOOM ZOOM}</li>
2523      * </ul>
2524      *
2525      * <p><b>Available values for this device:</b><br>
2526      * {@link CameraCharacteristics#CONTROL_AVAILABLE_SETTINGS_OVERRIDES android.control.availableSettingsOverrides}</p>
2527      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2528      *
2529      * @see CameraCharacteristics#CONTROL_AVAILABLE_SETTINGS_OVERRIDES
2530      * @see #CONTROL_SETTINGS_OVERRIDE_OFF
2531      * @see #CONTROL_SETTINGS_OVERRIDE_ZOOM
2532      */
2533     @PublicKey
2534     @NonNull
2535     public static final Key<Integer> CONTROL_SETTINGS_OVERRIDE =
2536             new Key<Integer>("android.control.settingsOverride", int.class);
2537 
2538     /**
2539      * <p>Automatic crop, pan and zoom to keep objects in the center of the frame.</p>
2540      * <p>Auto-framing is a special mode provided by the camera device to dynamically crop, zoom
2541      * or pan the camera feed to try to ensure that the people in a scene occupy a reasonable
2542      * portion of the viewport. It is primarily designed to support video calling in
2543      * situations where the user isn't directly in front of the device, especially for
2544      * wide-angle cameras.
2545      * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} and {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} in CaptureResult will be used
2546      * to denote the coordinates of the auto-framed region.
2547      * Zoom and video stabilization controls are disabled when auto-framing is enabled. The 3A
2548      * regions must map the screen coordinates into the scaler crop returned from the capture
2549      * result instead of using the active array sensor.</p>
2550      * <p><b>Possible values:</b></p>
2551      * <ul>
2552      *   <li>{@link #CONTROL_AUTOFRAMING_OFF OFF}</li>
2553      *   <li>{@link #CONTROL_AUTOFRAMING_ON ON}</li>
2554      * </ul>
2555      *
2556      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2557      * <p><b>Limited capability</b> -
2558      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2559      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2560      *
2561      * @see CaptureRequest#CONTROL_ZOOM_RATIO
2562      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2563      * @see CaptureRequest#SCALER_CROP_REGION
2564      * @see #CONTROL_AUTOFRAMING_OFF
2565      * @see #CONTROL_AUTOFRAMING_ON
2566      */
2567     @PublicKey
2568     @NonNull
2569     public static final Key<Integer> CONTROL_AUTOFRAMING =
2570             new Key<Integer>("android.control.autoframing", int.class);
2571 
2572     /**
2573      * <p>Operation mode for edge
2574      * enhancement.</p>
2575      * <p>Edge enhancement improves sharpness and details in the captured image. OFF means
2576      * no enhancement will be applied by the camera device.</p>
2577      * <p>FAST/HIGH_QUALITY both mean camera device determined enhancement
2578      * will be applied. HIGH_QUALITY mode indicates that the
2579      * camera device will use the highest-quality enhancement algorithms,
2580      * even if it slows down capture rate. FAST means the camera device will
2581      * not slow down capture rate when applying edge enhancement. FAST may be the same as OFF if
2582      * edge enhancement will slow down capture rate. Every output stream will have a similar
2583      * amount of enhancement applied.</p>
2584      * <p>ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular
2585      * buffer of high-resolution images during preview and reprocess image(s) from that buffer
2586      * into a final capture when triggered by the user. In this mode, the camera device applies
2587      * edge enhancement to low-resolution streams (below maximum recording resolution) to
2588      * maximize preview quality, but does not apply edge enhancement to high-resolution streams,
2589      * since those will be reprocessed later if necessary.</p>
2590      * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera
2591      * device will apply FAST/HIGH_QUALITY YUV-domain edge enhancement, respectively.
2592      * The camera device may adjust its internal edge enhancement parameters for best
2593      * image quality based on the {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor}, if it is set.</p>
2594      * <p><b>Possible values:</b></p>
2595      * <ul>
2596      *   <li>{@link #EDGE_MODE_OFF OFF}</li>
2597      *   <li>{@link #EDGE_MODE_FAST FAST}</li>
2598      *   <li>{@link #EDGE_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
2599      *   <li>{@link #EDGE_MODE_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li>
2600      * </ul>
2601      *
2602      * <p><b>Available values for this device:</b><br>
2603      * {@link CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES android.edge.availableEdgeModes}</p>
2604      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2605      * <p><b>Full capability</b> -
2606      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2607      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2608      *
2609      * @see CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES
2610      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2611      * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR
2612      * @see #EDGE_MODE_OFF
2613      * @see #EDGE_MODE_FAST
2614      * @see #EDGE_MODE_HIGH_QUALITY
2615      * @see #EDGE_MODE_ZERO_SHUTTER_LAG
2616      */
2617     @PublicKey
2618     @NonNull
2619     public static final Key<Integer> EDGE_MODE =
2620             new Key<Integer>("android.edge.mode", int.class);
2621 
2622     /**
2623      * <p>The desired mode for for the camera device's flash control.</p>
2624      * <p>This control is only effective when flash unit is available
2625      * (<code>{@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} == true</code>).</p>
2626      * <p>When this control is used, the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} must be set to ON or OFF.
2627      * Otherwise, the camera device auto-exposure related flash control (ON_AUTO_FLASH,
2628      * ON_ALWAYS_FLASH, or ON_AUTO_FLASH_REDEYE) will override this control.</p>
2629      * <p>When set to OFF, the camera device will not fire flash for this capture.</p>
2630      * <p>When set to SINGLE, the camera device will fire flash regardless of the camera
2631      * device's auto-exposure routine's result. When used in still capture case, this
2632      * control should be used along with auto-exposure (AE) precapture metering sequence
2633      * ({@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}), otherwise, the image may be incorrectly exposed.</p>
2634      * <p>When set to TORCH, the flash will be on continuously. This mode can be used
2635      * for use cases such as preview, auto-focus assist, still capture, or video recording.</p>
2636      * <p>The flash status will be reported by {@link CaptureResult#FLASH_STATE android.flash.state} in the capture result metadata.</p>
2637      * <p><b>Possible values:</b></p>
2638      * <ul>
2639      *   <li>{@link #FLASH_MODE_OFF OFF}</li>
2640      *   <li>{@link #FLASH_MODE_SINGLE SINGLE}</li>
2641      *   <li>{@link #FLASH_MODE_TORCH TORCH}</li>
2642      * </ul>
2643      *
2644      * <p>This key is available on all devices.</p>
2645      *
2646      * @see CaptureRequest#CONTROL_AE_MODE
2647      * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
2648      * @see CameraCharacteristics#FLASH_INFO_AVAILABLE
2649      * @see CaptureResult#FLASH_STATE
2650      * @see #FLASH_MODE_OFF
2651      * @see #FLASH_MODE_SINGLE
2652      * @see #FLASH_MODE_TORCH
2653      */
2654     @PublicKey
2655     @NonNull
2656     public static final Key<Integer> FLASH_MODE =
2657             new Key<Integer>("android.flash.mode", int.class);
2658 
2659     /**
2660      * <p>Operational mode for hot pixel correction.</p>
2661      * <p>Hotpixel correction interpolates out, or otherwise removes, pixels
2662      * that do not accurately measure the incoming light (i.e. pixels that
2663      * are stuck at an arbitrary value or are oversensitive).</p>
2664      * <p><b>Possible values:</b></p>
2665      * <ul>
2666      *   <li>{@link #HOT_PIXEL_MODE_OFF OFF}</li>
2667      *   <li>{@link #HOT_PIXEL_MODE_FAST FAST}</li>
2668      *   <li>{@link #HOT_PIXEL_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
2669      * </ul>
2670      *
2671      * <p><b>Available values for this device:</b><br>
2672      * {@link CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES android.hotPixel.availableHotPixelModes}</p>
2673      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2674      *
2675      * @see CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES
2676      * @see #HOT_PIXEL_MODE_OFF
2677      * @see #HOT_PIXEL_MODE_FAST
2678      * @see #HOT_PIXEL_MODE_HIGH_QUALITY
2679      */
2680     @PublicKey
2681     @NonNull
2682     public static final Key<Integer> HOT_PIXEL_MODE =
2683             new Key<Integer>("android.hotPixel.mode", int.class);
2684 
2685     /**
2686      * <p>A location object to use when generating image GPS metadata.</p>
2687      * <p>Setting a location object in a request will include the GPS coordinates of the location
2688      * into any JPEG images captured based on the request. These coordinates can then be
2689      * viewed by anyone who receives the JPEG image.</p>
2690      * <p>This tag is also used for HEIC image capture.</p>
2691      * <p>This key is available on all devices.</p>
2692      */
2693     @PublicKey
2694     @NonNull
2695     @SyntheticKey
2696     public static final Key<android.location.Location> JPEG_GPS_LOCATION =
2697             new Key<android.location.Location>("android.jpeg.gpsLocation", android.location.Location.class);
2698 
2699     /**
2700      * <p>GPS coordinates to include in output JPEG
2701      * EXIF.</p>
2702      * <p>This tag is also used for HEIC image capture.</p>
2703      * <p><b>Range of valid values:</b><br>
2704      * (-180 - 180], [-90,90], [-inf, inf]</p>
2705      * <p>This key is available on all devices.</p>
2706      * @hide
2707      */
2708     public static final Key<double[]> JPEG_GPS_COORDINATES =
2709             new Key<double[]>("android.jpeg.gpsCoordinates", double[].class);
2710 
2711     /**
2712      * <p>32 characters describing GPS algorithm to
2713      * include in EXIF.</p>
2714      * <p>This tag is also used for HEIC image capture.</p>
2715      * <p>This key is available on all devices.</p>
2716      * @hide
2717      */
2718     public static final Key<String> JPEG_GPS_PROCESSING_METHOD =
2719             new Key<String>("android.jpeg.gpsProcessingMethod", String.class);
2720 
2721     /**
2722      * <p>Time GPS fix was made to include in
2723      * EXIF.</p>
2724      * <p>This tag is also used for HEIC image capture.</p>
2725      * <p><b>Units</b>: UTC in seconds since January 1, 1970</p>
2726      * <p>This key is available on all devices.</p>
2727      * @hide
2728      */
2729     public static final Key<Long> JPEG_GPS_TIMESTAMP =
2730             new Key<Long>("android.jpeg.gpsTimestamp", long.class);
2731 
2732     /**
2733      * <p>The orientation for a JPEG image.</p>
2734      * <p>The clockwise rotation angle in degrees, relative to the orientation
2735      * to the camera, that the JPEG picture needs to be rotated by, to be viewed
2736      * upright.</p>
2737      * <p>Camera devices may either encode this value into the JPEG EXIF header, or
2738      * rotate the image data to match this orientation. When the image data is rotated,
2739      * the thumbnail data will also be rotated.</p>
2740      * <p>Note that this orientation is relative to the orientation of the camera sensor, given
2741      * by {@link CameraCharacteristics#SENSOR_ORIENTATION android.sensor.orientation}.</p>
2742      * <p>To translate from the device orientation given by the Android sensor APIs for camera
2743      * sensors which are not EXTERNAL, the following sample code may be used:</p>
2744      * <pre><code>private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) {
2745      *     if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0;
2746      *     int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION);
2747      *
2748      *     // Round device orientation to a multiple of 90
2749      *     deviceOrientation = (deviceOrientation + 45) / 90 * 90;
2750      *
2751      *     // Reverse device orientation for front-facing cameras
2752      *     boolean facingFront = c.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT;
2753      *     if (facingFront) deviceOrientation = -deviceOrientation;
2754      *
2755      *     // Calculate desired JPEG orientation relative to camera orientation to make
2756      *     // the image upright relative to the device orientation
2757      *     int jpegOrientation = (sensorOrientation + deviceOrientation + 360) % 360;
2758      *
2759      *     return jpegOrientation;
2760      * }
2761      * </code></pre>
2762      * <p>For EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will
2763      * also be set to EXTERNAL. The above code is not relevant in such case.</p>
2764      * <p>This tag is also used to describe the orientation of the HEIC image capture, in which
2765      * case the rotation is reflected by
2766      * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by
2767      * rotating the image data itself.</p>
2768      * <p><b>Units</b>: Degrees in multiples of 90</p>
2769      * <p><b>Range of valid values:</b><br>
2770      * 0, 90, 180, 270</p>
2771      * <p>This key is available on all devices.</p>
2772      *
2773      * @see CameraCharacteristics#SENSOR_ORIENTATION
2774      */
2775     @PublicKey
2776     @NonNull
2777     public static final Key<Integer> JPEG_ORIENTATION =
2778             new Key<Integer>("android.jpeg.orientation", int.class);
2779 
2780     /**
2781      * <p>Compression quality of the final JPEG
2782      * image.</p>
2783      * <p>85-95 is typical usage range. This tag is also used to describe the quality
2784      * of the HEIC image capture.</p>
2785      * <p><b>Range of valid values:</b><br>
2786      * 1-100; larger is higher quality</p>
2787      * <p>This key is available on all devices.</p>
2788      */
2789     @PublicKey
2790     @NonNull
2791     public static final Key<Byte> JPEG_QUALITY =
2792             new Key<Byte>("android.jpeg.quality", byte.class);
2793 
2794     /**
2795      * <p>Compression quality of JPEG
2796      * thumbnail.</p>
2797      * <p>This tag is also used to describe the quality of the HEIC image capture.</p>
2798      * <p><b>Range of valid values:</b><br>
2799      * 1-100; larger is higher quality</p>
2800      * <p>This key is available on all devices.</p>
2801      */
2802     @PublicKey
2803     @NonNull
2804     public static final Key<Byte> JPEG_THUMBNAIL_QUALITY =
2805             new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
2806 
2807     /**
2808      * <p>Resolution of embedded JPEG thumbnail.</p>
2809      * <p>When set to (0, 0) value, the JPEG EXIF will not contain thumbnail,
2810      * but the captured JPEG will still be a valid image.</p>
2811      * <p>For best results, when issuing a request for a JPEG image, the thumbnail size selected
2812      * should have the same aspect ratio as the main JPEG output.</p>
2813      * <p>If the thumbnail image aspect ratio differs from the JPEG primary image aspect
2814      * ratio, the camera device creates the thumbnail by cropping it from the primary image.
2815      * For example, if the primary image has 4:3 aspect ratio, the thumbnail image has
2816      * 16:9 aspect ratio, the primary image will be cropped vertically (letterbox) to
2817      * generate the thumbnail image. The thumbnail image will always have a smaller Field
2818      * Of View (FOV) than the primary image when aspect ratios differ.</p>
2819      * <p>When an {@link CaptureRequest#JPEG_ORIENTATION android.jpeg.orientation} of non-zero degree is requested,
2820      * the camera device will handle thumbnail rotation in one of the following ways:</p>
2821      * <ul>
2822      * <li>Set the {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}
2823      *   and keep jpeg and thumbnail image data unrotated.</li>
2824      * <li>Rotate the jpeg and thumbnail image data and not set
2825      *   {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}. In this
2826      *   case, LIMITED or FULL hardware level devices will report rotated thumbnail size in
2827      *   capture result, so the width and height will be interchanged if 90 or 270 degree
2828      *   orientation is requested. LEGACY device will always report unrotated thumbnail
2829      *   size.</li>
2830      * </ul>
2831      * <p>The tag is also used as thumbnail size for HEIC image format capture, in which case the
2832      * the thumbnail rotation is reflected by
2833      * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by
2834      * rotating the thumbnail data itself.</p>
2835      * <p><b>Range of valid values:</b><br>
2836      * {@link CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES android.jpeg.availableThumbnailSizes}</p>
2837      * <p>This key is available on all devices.</p>
2838      *
2839      * @see CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES
2840      * @see CaptureRequest#JPEG_ORIENTATION
2841      */
2842     @PublicKey
2843     @NonNull
2844     public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE =
2845             new Key<android.util.Size>("android.jpeg.thumbnailSize", android.util.Size.class);
2846 
2847     /**
2848      * <p>The desired lens aperture size, as a ratio of lens focal length to the
2849      * effective aperture diameter.</p>
2850      * <p>Setting this value is only supported on the camera devices that have a variable
2851      * aperture lens.</p>
2852      * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF,
2853      * this can be set along with {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
2854      * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}
2855      * to achieve manual exposure control.</p>
2856      * <p>The requested aperture value may take several frames to reach the
2857      * requested value; the camera device will report the current (intermediate)
2858      * aperture size in capture result metadata while the aperture is changing.
2859      * While the aperture is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p>
2860      * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is one of
2861      * the ON modes, this will be overridden by the camera device
2862      * auto-exposure algorithm, the overridden values are then provided
2863      * back to the user in the corresponding result.</p>
2864      * <p><b>Units</b>: The f-number (f/N)</p>
2865      * <p><b>Range of valid values:</b><br>
2866      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES android.lens.info.availableApertures}</p>
2867      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2868      * <p><b>Full capability</b> -
2869      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2870      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2871      *
2872      * @see CaptureRequest#CONTROL_AE_MODE
2873      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2874      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES
2875      * @see CaptureResult#LENS_STATE
2876      * @see CaptureRequest#SENSOR_EXPOSURE_TIME
2877      * @see CaptureRequest#SENSOR_FRAME_DURATION
2878      * @see CaptureRequest#SENSOR_SENSITIVITY
2879      */
2880     @PublicKey
2881     @NonNull
2882     public static final Key<Float> LENS_APERTURE =
2883             new Key<Float>("android.lens.aperture", float.class);
2884 
2885     /**
2886      * <p>The desired setting for the lens neutral density filter(s).</p>
2887      * <p>This control will not be supported on most camera devices.</p>
2888      * <p>Lens filters are typically used to lower the amount of light the
2889      * sensor is exposed to (measured in steps of EV). As used here, an EV
2890      * step is the standard logarithmic representation, which are
2891      * non-negative, and inversely proportional to the amount of light
2892      * hitting the sensor.  For example, setting this to 0 would result
2893      * in no reduction of the incoming light, and setting this to 2 would
2894      * mean that the filter is set to reduce incoming light by two stops
2895      * (allowing 1/4 of the prior amount of light to the sensor).</p>
2896      * <p>It may take several frames before the lens filter density changes
2897      * to the requested value. While the filter density is still changing,
2898      * {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p>
2899      * <p><b>Units</b>: Exposure Value (EV)</p>
2900      * <p><b>Range of valid values:</b><br>
2901      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES android.lens.info.availableFilterDensities}</p>
2902      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2903      * <p><b>Full capability</b> -
2904      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2905      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2906      *
2907      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2908      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES
2909      * @see CaptureResult#LENS_STATE
2910      */
2911     @PublicKey
2912     @NonNull
2913     public static final Key<Float> LENS_FILTER_DENSITY =
2914             new Key<Float>("android.lens.filterDensity", float.class);
2915 
2916     /**
2917      * <p>The desired lens focal length; used for optical zoom.</p>
2918      * <p>This setting controls the physical focal length of the camera
2919      * device's lens. Changing the focal length changes the field of
2920      * view of the camera device, and is usually used for optical zoom.</p>
2921      * <p>Like {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} and {@link CaptureRequest#LENS_APERTURE android.lens.aperture}, this
2922      * setting won't be applied instantaneously, and it may take several
2923      * frames before the lens can change to the requested focal length.
2924      * While the focal length is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will
2925      * be set to MOVING.</p>
2926      * <p>Optical zoom via this control will not be supported on most devices. Starting from API
2927      * level 30, the camera device may combine optical and digital zoom through the
2928      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} control.</p>
2929      * <p><b>Units</b>: Millimeters</p>
2930      * <p><b>Range of valid values:</b><br>
2931      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS android.lens.info.availableFocalLengths}</p>
2932      * <p>This key is available on all devices.</p>
2933      *
2934      * @see CaptureRequest#CONTROL_ZOOM_RATIO
2935      * @see CaptureRequest#LENS_APERTURE
2936      * @see CaptureRequest#LENS_FOCUS_DISTANCE
2937      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS
2938      * @see CaptureResult#LENS_STATE
2939      */
2940     @PublicKey
2941     @NonNull
2942     public static final Key<Float> LENS_FOCAL_LENGTH =
2943             new Key<Float>("android.lens.focalLength", float.class);
2944 
2945     /**
2946      * <p>Desired distance to plane of sharpest focus,
2947      * measured from frontmost surface of the lens.</p>
2948      * <p>This control can be used for setting manual focus, on devices that support
2949      * the MANUAL_SENSOR capability and have a variable-focus lens (see
2950      * {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance}).</p>
2951      * <p>A value of <code>0.0f</code> means infinity focus. The value set will be clamped to
2952      * <code>[0.0f, {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance}]</code>.</p>
2953      * <p>Like {@link CaptureRequest#LENS_FOCAL_LENGTH android.lens.focalLength}, this setting won't be applied
2954      * instantaneously, and it may take several frames before the lens
2955      * can move to the requested focus distance. While the lens is still moving,
2956      * {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p>
2957      * <p>LEGACY devices support at most setting this to <code>0.0f</code>
2958      * for infinity focus.</p>
2959      * <p><b>Units</b>: See {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details</p>
2960      * <p><b>Range of valid values:</b><br>
2961      * &gt;= 0</p>
2962      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2963      * <p><b>Full capability</b> -
2964      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2965      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2966      *
2967      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2968      * @see CaptureRequest#LENS_FOCAL_LENGTH
2969      * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
2970      * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE
2971      * @see CaptureResult#LENS_STATE
2972      */
2973     @PublicKey
2974     @NonNull
2975     public static final Key<Float> LENS_FOCUS_DISTANCE =
2976             new Key<Float>("android.lens.focusDistance", float.class);
2977 
2978     /**
2979      * <p>Sets whether the camera device uses optical image stabilization (OIS)
2980      * when capturing images.</p>
2981      * <p>OIS is used to compensate for motion blur due to small
2982      * movements of the camera during capture. Unlike digital image
2983      * stabilization ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), OIS
2984      * makes use of mechanical elements to stabilize the camera
2985      * sensor, and thus allows for longer exposure times before
2986      * camera shake becomes apparent.</p>
2987      * <p>Switching between different optical stabilization modes may take several
2988      * frames to initialize, the camera device will report the current mode in
2989      * capture result metadata. For example, When "ON" mode is requested, the
2990      * optical stabilization modes in the first several capture results may still
2991      * be "OFF", and it will become "ON" when the initialization is done.</p>
2992      * <p>If a camera device supports both OIS and digital image stabilization
2993      * ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), turning both modes on may produce undesirable
2994      * interaction, so it is recommended not to enable both at the same time.</p>
2995      * <p>If {@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode} is set to "PREVIEW_STABILIZATION",
2996      * {@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode} is overridden. The camera sub-system may choose
2997      * to turn on hardware based image stabilization in addition to software based stabilization
2998      * if it deems that appropriate. This key's value in the capture result will reflect which
2999      * OIS mode was chosen.</p>
3000      * <p>Not all devices will support OIS; see
3001      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization} for
3002      * available controls.</p>
3003      * <p><b>Possible values:</b></p>
3004      * <ul>
3005      *   <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_OFF OFF}</li>
3006      *   <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_ON ON}</li>
3007      * </ul>
3008      *
3009      * <p><b>Available values for this device:</b><br>
3010      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization}</p>
3011      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3012      * <p><b>Limited capability</b> -
3013      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
3014      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3015      *
3016      * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
3017      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3018      * @see CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION
3019      * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE
3020      * @see #LENS_OPTICAL_STABILIZATION_MODE_OFF
3021      * @see #LENS_OPTICAL_STABILIZATION_MODE_ON
3022      */
3023     @PublicKey
3024     @NonNull
3025     public static final Key<Integer> LENS_OPTICAL_STABILIZATION_MODE =
3026             new Key<Integer>("android.lens.opticalStabilizationMode", int.class);
3027 
3028     /**
3029      * <p>Mode of operation for the noise reduction algorithm.</p>
3030      * <p>The noise reduction algorithm attempts to improve image quality by removing
3031      * excessive noise added by the capture process, especially in dark conditions.</p>
3032      * <p>OFF means no noise reduction will be applied by the camera device, for both raw and
3033      * YUV domain.</p>
3034      * <p>MINIMAL means that only sensor raw domain basic noise reduction is enabled ,to remove
3035      * demosaicing or other processing artifacts. For YUV_REPROCESSING, MINIMAL is same as OFF.
3036      * This mode is optional, may not be support by all devices. The application should check
3037      * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes} before using it.</p>
3038      * <p>FAST/HIGH_QUALITY both mean camera device determined noise filtering
3039      * will be applied. HIGH_QUALITY mode indicates that the camera device
3040      * will use the highest-quality noise filtering algorithms,
3041      * even if it slows down capture rate. FAST means the camera device will not
3042      * slow down capture rate when applying noise filtering. FAST may be the same as MINIMAL if
3043      * MINIMAL is listed, or the same as OFF if any noise filtering will slow down capture rate.
3044      * Every output stream will have a similar amount of enhancement applied.</p>
3045      * <p>ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular
3046      * buffer of high-resolution images during preview and reprocess image(s) from that buffer
3047      * into a final capture when triggered by the user. In this mode, the camera device applies
3048      * noise reduction to low-resolution streams (below maximum recording resolution) to maximize
3049      * preview quality, but does not apply noise reduction to high-resolution streams, since
3050      * those will be reprocessed later if necessary.</p>
3051      * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera device
3052      * will apply FAST/HIGH_QUALITY YUV domain noise reduction, respectively. The camera device
3053      * may adjust the noise reduction parameters for best image quality based on the
3054      * {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor} if it is set.</p>
3055      * <p><b>Possible values:</b></p>
3056      * <ul>
3057      *   <li>{@link #NOISE_REDUCTION_MODE_OFF OFF}</li>
3058      *   <li>{@link #NOISE_REDUCTION_MODE_FAST FAST}</li>
3059      *   <li>{@link #NOISE_REDUCTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
3060      *   <li>{@link #NOISE_REDUCTION_MODE_MINIMAL MINIMAL}</li>
3061      *   <li>{@link #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li>
3062      * </ul>
3063      *
3064      * <p><b>Available values for this device:</b><br>
3065      * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}</p>
3066      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3067      * <p><b>Full capability</b> -
3068      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3069      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3070      *
3071      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3072      * @see CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES
3073      * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR
3074      * @see #NOISE_REDUCTION_MODE_OFF
3075      * @see #NOISE_REDUCTION_MODE_FAST
3076      * @see #NOISE_REDUCTION_MODE_HIGH_QUALITY
3077      * @see #NOISE_REDUCTION_MODE_MINIMAL
3078      * @see #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG
3079      */
3080     @PublicKey
3081     @NonNull
3082     public static final Key<Integer> NOISE_REDUCTION_MODE =
3083             new Key<Integer>("android.noiseReduction.mode", int.class);
3084 
3085     /**
3086      * <p>An application-specified ID for the current
3087      * request. Must be maintained unchanged in output
3088      * frame</p>
3089      * <p><b>Units</b>: arbitrary integer assigned by application</p>
3090      * <p><b>Range of valid values:</b><br>
3091      * Any int</p>
3092      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3093      * @hide
3094      */
3095     public static final Key<Integer> REQUEST_ID =
3096             new Key<Integer>("android.request.id", int.class);
3097 
3098     /**
3099      * <p>The desired region of the sensor to read out for this capture.</p>
3100      * <p>This control can be used to implement digital zoom.</p>
3101      * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
3102      * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being
3103      * the top-left pixel of the active array.</p>
3104      * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate system
3105      * depends on the mode being set.  When the distortion correction mode is OFF, the
3106      * coordinate system follows {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with <code>(0,
3107      * 0)</code> being the top-left pixel of the pre-correction active array.  When the distortion
3108      * correction mode is not OFF, the coordinate system follows
3109      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being the top-left pixel of the
3110      * active array.</p>
3111      * <p>Output streams use this rectangle to produce their output, cropping to a smaller region
3112      * if necessary to maintain the stream's aspect ratio, then scaling the sensor input to
3113      * match the output's configured resolution.</p>
3114      * <p>The crop region is usually applied after the RAW to other color space (e.g. YUV)
3115      * conversion. As a result RAW streams are not croppable unless supported by the
3116      * camera device. See {@link CameraCharacteristics#SCALER_AVAILABLE_STREAM_USE_CASES android.scaler.availableStreamUseCases}#CROPPED_RAW for details.</p>
3117      * <p>For non-raw streams, any additional per-stream cropping will be done to maximize the
3118      * final pixel area of the stream.</p>
3119      * <p>For example, if the crop region is set to a 4:3 aspect ratio, then 4:3 streams will use
3120      * the exact crop region. 16:9 streams will further crop vertically (letterbox).</p>
3121      * <p>Conversely, if the crop region is set to a 16:9, then 4:3 outputs will crop horizontally
3122      * (pillarbox), and 16:9 streams will match exactly. These additional crops will be
3123      * centered within the crop region.</p>
3124      * <p>To illustrate, here are several scenarios of different crop regions and output streams,
3125      * for a hypothetical camera device with an active array of size <code>(2000,1500)</code>.  Note that
3126      * several of these examples use non-centered crop regions for ease of illustration; such
3127      * regions are only supported on devices with FREEFORM capability
3128      * ({@link CameraCharacteristics#SCALER_CROPPING_TYPE android.scaler.croppingType} <code>== FREEFORM</code>), but this does not affect the way the crop
3129      * rules work otherwise.</p>
3130      * <ul>
3131      * <li>Camera Configuration:<ul>
3132      * <li>Active array size: <code>2000x1500</code> (3 MP, 4:3 aspect ratio)</li>
3133      * <li>Output stream #1: <code>640x480</code> (VGA, 4:3 aspect ratio)</li>
3134      * <li>Output stream #2: <code>1280x720</code> (720p, 16:9 aspect ratio)</li>
3135      * </ul>
3136      * </li>
3137      * <li>Case #1: 4:3 crop region with 2x digital zoom<ul>
3138      * <li>Crop region: <code>Rect(500, 375, 1500, 1125) // (left, top, right, bottom)</code></li>
3139      * <li><img alt="4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-43-ratio.png" /></li>
3140      * <li><code>640x480</code> stream source area: <code>(500, 375, 1500, 1125)</code> (equal to crop region)</li>
3141      * <li><code>1280x720</code> stream source area: <code>(500, 469, 1500, 1031)</code> (letterboxed)</li>
3142      * </ul>
3143      * </li>
3144      * <li>Case #2: 16:9 crop region with ~1.5x digital zoom.<ul>
3145      * <li>Crop region: <code>Rect(500, 375, 1833, 1125)</code></li>
3146      * <li><img alt="16:9 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-169-ratio.png" /></li>
3147      * <li><code>640x480</code> stream source area: <code>(666, 375, 1666, 1125)</code> (pillarboxed)</li>
3148      * <li><code>1280x720</code> stream source area: <code>(500, 375, 1833, 1125)</code> (equal to crop region)</li>
3149      * </ul>
3150      * </li>
3151      * <li>Case #3: 1:1 crop region with ~2.6x digital zoom.<ul>
3152      * <li>Crop region: <code>Rect(500, 375, 1250, 1125)</code></li>
3153      * <li><img alt="1:1 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-11-ratio.png" /></li>
3154      * <li><code>640x480</code> stream source area: <code>(500, 469, 1250, 1031)</code> (letterboxed)</li>
3155      * <li><code>1280x720</code> stream source area: <code>(500, 543, 1250, 957)</code> (letterboxed)</li>
3156      * </ul>
3157      * </li>
3158      * <li>Case #4: Replace <code>640x480</code> stream with <code>1024x1024</code> stream, with 4:3 crop region:<ul>
3159      * <li>Crop region: <code>Rect(500, 375, 1500, 1125)</code></li>
3160      * <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>
3161      * <li><code>1024x1024</code> stream source area: <code>(625, 375, 1375, 1125)</code> (pillarboxed)</li>
3162      * <li><code>1280x720</code> stream source area: <code>(500, 469, 1500, 1031)</code> (letterboxed)</li>
3163      * <li>Note that in this case, neither of the two outputs is a subset of the other, with
3164      *   each containing image data the other doesn't have.</li>
3165      * </ul>
3166      * </li>
3167      * </ul>
3168      * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, the width and height
3169      * of the crop region cannot be set to be smaller than
3170      * <code>floor( activeArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> and
3171      * <code>floor( activeArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, respectively.</p>
3172      * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, the width
3173      * and height of the crop region cannot be set to be smaller than
3174      * <code>floor( preCorrectionActiveArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>
3175      * and
3176      * <code>floor( preCorrectionActiveArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>,
3177      * respectively.</p>
3178      * <p>The camera device may adjust the crop region to account for rounding and other hardware
3179      * requirements; the final crop region used will be included in the output capture result.</p>
3180      * <p>The camera sensor output aspect ratio depends on factors such as output stream
3181      * combination and {@link CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE android.control.aeTargetFpsRange}, and shouldn't be adjusted by using
3182      * this control. And the camera device will treat different camera sensor output sizes
3183      * (potentially with in-sensor crop) as the same crop of
3184      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}. As a result, the application shouldn't assume the
3185      * maximum crop region always maps to the same aspect ratio or field of view for the
3186      * sensor output.</p>
3187      * <p>Starting from API level 30, it's strongly recommended to use {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}
3188      * to take advantage of better support for zoom with logical multi-camera. The benefits
3189      * include better precision with optical-digital zoom combination, and ability to do
3190      * zoom-out from 1.0x. When using {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for zoom, the crop region in
3191      * the capture request should be left as the default activeArray size. The
3192      * coordinate system is post-zoom, meaning that the activeArraySize or
3193      * preCorrectionActiveArraySize covers the camera device's field of view "after" zoom.  See
3194      * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details.</p>
3195      * <p>For camera devices with the
3196      * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR }
3197      * capability or devices where {@link CameraCharacteristics#getAvailableCaptureRequestKeys }
3198      * lists {@link CaptureRequest#SENSOR_PIXEL_MODE {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode}}</p>
3199      * <p>{@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.activeArraySizeMaximumResolution} /
3200      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.preCorrectionActiveArraySizeMaximumResolution} must be used as the
3201      * coordinate system for requests where {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is set to
3202      * {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION }.</p>
3203      * <p><b>Units</b>: Pixel coordinates relative to
3204      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
3205      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on distortion correction
3206      * capability and mode</p>
3207      * <p>This key is available on all devices.</p>
3208      *
3209      * @see CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE
3210      * @see CaptureRequest#CONTROL_ZOOM_RATIO
3211      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
3212      * @see CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM
3213      * @see CameraCharacteristics#SCALER_AVAILABLE_STREAM_USE_CASES
3214      * @see CameraCharacteristics#SCALER_CROPPING_TYPE
3215      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
3216      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
3217      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
3218      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
3219      * @see CaptureRequest#SENSOR_PIXEL_MODE
3220      */
3221     @PublicKey
3222     @NonNull
3223     public static final Key<android.graphics.Rect> SCALER_CROP_REGION =
3224             new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class);
3225 
3226     /**
3227      * <p>Whether a rotation-and-crop operation is applied to processed
3228      * outputs from the camera.</p>
3229      * <p>This control is primarily intended to help camera applications with no support for
3230      * multi-window modes to work correctly on devices where multi-window scenarios are
3231      * unavoidable, such as foldables or other devices with variable display geometry or more
3232      * free-form window placement (such as laptops, which often place portrait-orientation apps
3233      * in landscape with pillarboxing).</p>
3234      * <p>If supported, the default value is <code>ROTATE_AND_CROP_AUTO</code>, which allows the camera API
3235      * to enable backwards-compatibility support for applications that do not support resizing
3236      * / multi-window modes, when the device is in fact in a multi-window mode (such as inset
3237      * portrait on laptops, or on a foldable device in some fold states).  In addition,
3238      * <code>ROTATE_AND_CROP_NONE</code> and <code>ROTATE_AND_CROP_90</code> will always be available if this control
3239      * is supported by the device.  If not supported, devices API level 30 or higher will always
3240      * list only <code>ROTATE_AND_CROP_NONE</code>.</p>
3241      * <p>When <code>CROP_AUTO</code> is in use, and the camera API activates backward-compatibility mode,
3242      * several metadata fields will also be parsed differently to ensure that coordinates are
3243      * correctly handled for features like drawing face detection boxes or passing in
3244      * tap-to-focus coordinates.  The camera API will convert positions in the active array
3245      * coordinate system to/from the cropped-and-rotated coordinate system to make the
3246      * operation transparent for applications.  The following controls are affected:</p>
3247      * <ul>
3248      * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li>
3249      * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li>
3250      * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li>
3251      * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li>
3252      * </ul>
3253      * <p>Capture results will contain the actual value selected by the API;
3254      * <code>ROTATE_AND_CROP_AUTO</code> will never be seen in a capture result.</p>
3255      * <p>Applications can also select their preferred cropping mode, either to opt out of the
3256      * backwards-compatibility treatment, or to use the cropping feature themselves as needed.
3257      * In this case, no coordinate translation will be done automatically, and all controls
3258      * will continue to use the normal active array coordinates.</p>
3259      * <p>Cropping and rotating is done after the application of digital zoom (via either
3260      * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}), but before each individual
3261      * output is further cropped and scaled. It only affects processed outputs such as
3262      * YUV, PRIVATE, and JPEG.  It has no effect on RAW outputs.</p>
3263      * <p>When <code>CROP_90</code> or <code>CROP_270</code> are selected, there is a significant loss to the field of
3264      * view. For example, with a 4:3 aspect ratio output of 1600x1200, <code>CROP_90</code> will still
3265      * produce 1600x1200 output, but these buffers are cropped from a vertical 3:4 slice at the
3266      * center of the 4:3 area, then rotated to be 4:3, and then upscaled to 1600x1200.  Only
3267      * 56.25% of the original FOV is still visible.  In general, for an aspect ratio of <code>w:h</code>,
3268      * the crop and rotate operation leaves <code>(h/w)^2</code> of the field of view visible. For 16:9,
3269      * this is ~31.6%.</p>
3270      * <p>As a visual example, the figure below shows the effect of <code>ROTATE_AND_CROP_90</code> on the
3271      * outputs for the following parameters:</p>
3272      * <ul>
3273      * <li>Sensor active array: <code>2000x1500</code></li>
3274      * <li>Crop region: top-left: <code>(500, 375)</code>, size: <code>(1000, 750)</code> (4:3 aspect ratio)</li>
3275      * <li>Output streams: YUV <code>640x480</code> and YUV <code>1280x720</code></li>
3276      * <li><code>ROTATE_AND_CROP_90</code></li>
3277      * </ul>
3278      * <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>
3279      * <p>With these settings, the regions of the active array covered by the output streams are:</p>
3280      * <ul>
3281      * <li>640x480 stream crop: top-left: <code>(219, 375)</code>, size: <code>(562, 750)</code></li>
3282      * <li>1280x720 stream crop: top-left: <code>(289, 375)</code>, size: <code>(422, 750)</code></li>
3283      * </ul>
3284      * <p>Since the buffers are rotated, the buffers as seen by the application are:</p>
3285      * <ul>
3286      * <li>640x480 stream: top-left: <code>(781, 375)</code> on active array, size: <code>(640, 480)</code>, downscaled 1.17x from sensor pixels</li>
3287      * <li>1280x720 stream: top-left: <code>(711, 375)</code> on active array, size: <code>(1280, 720)</code>, upscaled 1.71x from sensor pixels</li>
3288      * </ul>
3289      * <p><b>Possible values:</b></p>
3290      * <ul>
3291      *   <li>{@link #SCALER_ROTATE_AND_CROP_NONE NONE}</li>
3292      *   <li>{@link #SCALER_ROTATE_AND_CROP_90 90}</li>
3293      *   <li>{@link #SCALER_ROTATE_AND_CROP_180 180}</li>
3294      *   <li>{@link #SCALER_ROTATE_AND_CROP_270 270}</li>
3295      *   <li>{@link #SCALER_ROTATE_AND_CROP_AUTO AUTO}</li>
3296      * </ul>
3297      *
3298      * <p><b>Available values for this device:</b><br>
3299      * {@link CameraCharacteristics#SCALER_AVAILABLE_ROTATE_AND_CROP_MODES android.scaler.availableRotateAndCropModes}</p>
3300      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3301      *
3302      * @see CaptureRequest#CONTROL_AE_REGIONS
3303      * @see CaptureRequest#CONTROL_AF_REGIONS
3304      * @see CaptureRequest#CONTROL_AWB_REGIONS
3305      * @see CaptureRequest#CONTROL_ZOOM_RATIO
3306      * @see CameraCharacteristics#SCALER_AVAILABLE_ROTATE_AND_CROP_MODES
3307      * @see CaptureRequest#SCALER_CROP_REGION
3308      * @see CaptureResult#STATISTICS_FACES
3309      * @see #SCALER_ROTATE_AND_CROP_NONE
3310      * @see #SCALER_ROTATE_AND_CROP_90
3311      * @see #SCALER_ROTATE_AND_CROP_180
3312      * @see #SCALER_ROTATE_AND_CROP_270
3313      * @see #SCALER_ROTATE_AND_CROP_AUTO
3314      */
3315     @PublicKey
3316     @NonNull
3317     public static final Key<Integer> SCALER_ROTATE_AND_CROP =
3318             new Key<Integer>("android.scaler.rotateAndCrop", int.class);
3319 
3320     /**
3321      * <p>Framework-only private key which informs camera fwk that the scaler crop region
3322      * ({@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}) has been set by the client and it need
3323      * not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is set to MAXIMUM_RESOLUTION.</p>
3324      * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
3325      * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}.</p>
3326      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3327      *
3328      * @see CaptureRequest#SCALER_CROP_REGION
3329      * @see CaptureRequest#SENSOR_PIXEL_MODE
3330      * @hide
3331      */
3332     public static final Key<Boolean> SCALER_CROP_REGION_SET =
3333             new Key<Boolean>("android.scaler.cropRegionSet", boolean.class);
3334 
3335     /**
3336      * <p>Duration each pixel is exposed to
3337      * light.</p>
3338      * <p>If the sensor can't expose this exact duration, it will shorten the
3339      * duration exposed to the nearest possible value (rather than expose longer).
3340      * The final exposure time used will be available in the output capture result.</p>
3341      * <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
3342      * OFF; otherwise the auto-exposure algorithm will override this value.</p>
3343      * <p><b>Units</b>: Nanoseconds</p>
3344      * <p><b>Range of valid values:</b><br>
3345      * {@link CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE android.sensor.info.exposureTimeRange}</p>
3346      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3347      * <p><b>Full capability</b> -
3348      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3349      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3350      *
3351      * @see CaptureRequest#CONTROL_AE_MODE
3352      * @see CaptureRequest#CONTROL_MODE
3353      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3354      * @see CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE
3355      */
3356     @PublicKey
3357     @NonNull
3358     public static final Key<Long> SENSOR_EXPOSURE_TIME =
3359             new Key<Long>("android.sensor.exposureTime", long.class);
3360 
3361     /**
3362      * <p>Duration from start of frame exposure to
3363      * start of next frame exposure.</p>
3364      * <p>The maximum frame rate that can be supported by a camera subsystem is
3365      * a function of many factors:</p>
3366      * <ul>
3367      * <li>Requested resolutions of output image streams</li>
3368      * <li>Availability of binning / skipping modes on the imager</li>
3369      * <li>The bandwidth of the imager interface</li>
3370      * <li>The bandwidth of the various ISP processing blocks</li>
3371      * </ul>
3372      * <p>Since these factors can vary greatly between different ISPs and
3373      * sensors, the camera abstraction tries to represent the bandwidth
3374      * restrictions with as simple a model as possible.</p>
3375      * <p>The model presented has the following characteristics:</p>
3376      * <ul>
3377      * <li>The image sensor is always configured to output the smallest
3378      * resolution possible given the application's requested output stream
3379      * sizes.  The smallest resolution is defined as being at least as large
3380      * as the largest requested output stream size; the camera pipeline must
3381      * never digitally upsample sensor data when the crop region covers the
3382      * whole sensor. In general, this means that if only small output stream
3383      * resolutions are configured, the sensor can provide a higher frame
3384      * rate.</li>
3385      * <li>Since any request may use any or all the currently configured
3386      * output streams, the sensor and ISP must be configured to support
3387      * scaling a single capture to all the streams at the same time.  This
3388      * means the camera pipeline must be ready to produce the largest
3389      * requested output size without any delay.  Therefore, the overall
3390      * frame rate of a given configured stream set is governed only by the
3391      * largest requested stream resolution.</li>
3392      * <li>Using more than one output stream in a request does not affect the
3393      * frame duration.</li>
3394      * <li>Certain format-streams may need to do additional background processing
3395      * before data is consumed/produced by that stream. These processors
3396      * can run concurrently to the rest of the camera pipeline, but
3397      * cannot process more than 1 capture at a time.</li>
3398      * </ul>
3399      * <p>The necessary information for the application, given the model above, is provided via
3400      * {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputMinFrameDuration }.
3401      * These are used to determine the maximum frame rate / minimum frame duration that is
3402      * possible for a given stream configuration.</p>
3403      * <p>Specifically, the application can use the following rules to
3404      * determine the minimum frame duration it can request from the camera
3405      * device:</p>
3406      * <ol>
3407      * <li>Let the set of currently configured input/output streams be called <code>S</code>.</li>
3408      * <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 }
3409      * (with its respective size/format). Let this set of frame durations be called <code>F</code>.</li>
3410      * <li>For any given request <code>R</code>, the minimum frame duration allowed for <code>R</code> is the maximum
3411      * out of all values in <code>F</code>. Let the streams used in <code>R</code> be called <code>S_r</code>.</li>
3412      * </ol>
3413      * <p>If none of the streams in <code>S_r</code> have a stall time (listed in {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputStallDuration }
3414      * using its respective size/format), then the frame duration in <code>F</code> determines the steady
3415      * state frame rate that the application will get if it uses <code>R</code> as a repeating request. Let
3416      * this special kind of request be called <code>Rsimple</code>.</p>
3417      * <p>A repeating request <code>Rsimple</code> can be <em>occasionally</em> interleaved by a single capture of a
3418      * new request <code>Rstall</code> (which has at least one in-use stream with a non-0 stall time) and if
3419      * <code>Rstall</code> has the same minimum frame duration this will not cause a frame rate loss if all
3420      * buffers from the previous <code>Rstall</code> have already been delivered.</p>
3421      * <p>For more details about stalling, see {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputStallDuration }.</p>
3422      * <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
3423      * OFF; otherwise the auto-exposure algorithm will override this value.</p>
3424      * <p><b>Units</b>: Nanoseconds</p>
3425      * <p><b>Range of valid values:</b><br>
3426      * See {@link CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION android.sensor.info.maxFrameDuration}, {@link android.hardware.camera2.params.StreamConfigurationMap }.
3427      * The duration is capped to <code>max(duration, exposureTime + overhead)</code>.</p>
3428      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3429      * <p><b>Full capability</b> -
3430      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3431      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3432      *
3433      * @see CaptureRequest#CONTROL_AE_MODE
3434      * @see CaptureRequest#CONTROL_MODE
3435      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3436      * @see CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION
3437      */
3438     @PublicKey
3439     @NonNull
3440     public static final Key<Long> SENSOR_FRAME_DURATION =
3441             new Key<Long>("android.sensor.frameDuration", long.class);
3442 
3443     /**
3444      * <p>The amount of gain applied to sensor data
3445      * before processing.</p>
3446      * <p>The sensitivity is the standard ISO sensitivity value,
3447      * as defined in ISO 12232:2006.</p>
3448      * <p>The sensitivity must be within {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}, and
3449      * if if it less than {@link CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY android.sensor.maxAnalogSensitivity}, the camera device
3450      * is guaranteed to use only analog amplification for applying the gain.</p>
3451      * <p>If the camera device cannot apply the exact sensitivity
3452      * requested, it will reduce the gain to the nearest supported
3453      * value. The final sensitivity used will be available in the
3454      * output capture result.</p>
3455      * <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
3456      * OFF; otherwise the auto-exposure algorithm will override this value.</p>
3457      * <p>Note that for devices supporting postRawSensitivityBoost, the total sensitivity applied
3458      * to the final processed image is the combination of {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} and
3459      * {@link CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST android.control.postRawSensitivityBoost}. In case the application uses the sensor
3460      * sensitivity from last capture result of an auto request for a manual request, in order
3461      * to achieve the same brightness in the output image, the application should also
3462      * set postRawSensitivityBoost.</p>
3463      * <p><b>Units</b>: ISO arithmetic units</p>
3464      * <p><b>Range of valid values:</b><br>
3465      * {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}</p>
3466      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3467      * <p><b>Full capability</b> -
3468      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3469      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3470      *
3471      * @see CaptureRequest#CONTROL_AE_MODE
3472      * @see CaptureRequest#CONTROL_MODE
3473      * @see CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST
3474      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3475      * @see CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE
3476      * @see CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY
3477      * @see CaptureRequest#SENSOR_SENSITIVITY
3478      */
3479     @PublicKey
3480     @NonNull
3481     public static final Key<Integer> SENSOR_SENSITIVITY =
3482             new Key<Integer>("android.sensor.sensitivity", int.class);
3483 
3484     /**
3485      * <p>A pixel <code>[R, G_even, G_odd, B]</code> that supplies the test pattern
3486      * when {@link CaptureRequest#SENSOR_TEST_PATTERN_MODE android.sensor.testPatternMode} is SOLID_COLOR.</p>
3487      * <p>Each color channel is treated as an unsigned 32-bit integer.
3488      * The camera device then uses the most significant X bits
3489      * that correspond to how many bits are in its Bayer raw sensor
3490      * output.</p>
3491      * <p>For example, a sensor with RAW10 Bayer output would use the
3492      * 10 most significant bits from each color channel.</p>
3493      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3494      *
3495      * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE
3496      */
3497     @PublicKey
3498     @NonNull
3499     public static final Key<int[]> SENSOR_TEST_PATTERN_DATA =
3500             new Key<int[]>("android.sensor.testPatternData", int[].class);
3501 
3502     /**
3503      * <p>When enabled, the sensor sends a test pattern instead of
3504      * doing a real exposure from the camera.</p>
3505      * <p>When a test pattern is enabled, all manual sensor controls specified
3506      * by android.sensor.* will be ignored. All other controls should
3507      * work as normal.</p>
3508      * <p>For example, if manual flash is enabled, flash firing should still
3509      * occur (and that the test pattern remain unmodified, since the flash
3510      * would not actually affect it).</p>
3511      * <p>Defaults to OFF.</p>
3512      * <p><b>Possible values:</b></p>
3513      * <ul>
3514      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_OFF OFF}</li>
3515      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR SOLID_COLOR}</li>
3516      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS COLOR_BARS}</li>
3517      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY COLOR_BARS_FADE_TO_GRAY}</li>
3518      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_PN9 PN9}</li>
3519      *   <li>{@link #SENSOR_TEST_PATTERN_MODE_CUSTOM1 CUSTOM1}</li>
3520      * </ul>
3521      *
3522      * <p><b>Available values for this device:</b><br>
3523      * {@link CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES android.sensor.availableTestPatternModes}</p>
3524      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3525      *
3526      * @see CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES
3527      * @see #SENSOR_TEST_PATTERN_MODE_OFF
3528      * @see #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR
3529      * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS
3530      * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY
3531      * @see #SENSOR_TEST_PATTERN_MODE_PN9
3532      * @see #SENSOR_TEST_PATTERN_MODE_CUSTOM1
3533      */
3534     @PublicKey
3535     @NonNull
3536     public static final Key<Integer> SENSOR_TEST_PATTERN_MODE =
3537             new Key<Integer>("android.sensor.testPatternMode", int.class);
3538 
3539     /**
3540      * <p>Switches sensor pixel mode between maximum resolution mode and default mode.</p>
3541      * <p>This key controls whether the camera sensor operates in
3542      * {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION }
3543      * mode or not. By default, all camera devices operate in
3544      * {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT } mode.
3545      * When operating in
3546      * {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT } mode, sensors
3547      * would typically perform pixel binning in order to improve low light
3548      * performance, noise reduction etc. However, in
3549      * {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION }
3550      * mode, sensors typically operate in unbinned mode allowing for a larger image size.
3551      * The stream configurations supported in
3552      * {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION }
3553      * mode are also different from those of
3554      * {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT } mode.
3555      * They can be queried through
3556      * {@link android.hardware.camera2.CameraCharacteristics#get } with
3557      * {@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP_MAXIMUM_RESOLUTION }.
3558      * Unless reported by both
3559      * {@link android.hardware.camera2.params.StreamConfigurationMap }s, the outputs from
3560      * <code>{@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP_MAXIMUM_RESOLUTION android.scaler.streamConfigurationMapMaximumResolution}</code> and
3561      * <code>{@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP android.scaler.streamConfigurationMap}</code>
3562      * must not be mixed in the same CaptureRequest. In other words, these outputs are
3563      * exclusive to each other.
3564      * This key does not need to be set for reprocess requests.
3565      * This key will be be present on devices supporting the
3566      * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR }
3567      * capability. It may also be present on devices which do not support the aforementioned
3568      * capability. In that case:</p>
3569      * <ul>
3570      * <li>
3571      * <p>The mandatory stream combinations listed in
3572      *   {@link CameraCharacteristics#SCALER_MANDATORY_MAXIMUM_RESOLUTION_STREAM_COMBINATIONS android.scaler.mandatoryMaximumResolutionStreamCombinations}  would not apply.</p>
3573      * </li>
3574      * <li>
3575      * <p>The bayer pattern of {@code RAW} streams when
3576      *   {@link android.hardware.camera2.CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION }
3577      *   is selected will be the one listed in {@link CameraCharacteristics#SENSOR_INFO_BINNING_FACTOR android.sensor.info.binningFactor}.</p>
3578      * </li>
3579      * <li>
3580      * <p>The following keys will always be present:</p>
3581      * <ul>
3582      * <li>{@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP_MAXIMUM_RESOLUTION android.scaler.streamConfigurationMapMaximumResolution}</li>
3583      * <li>{@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.activeArraySizeMaximumResolution}</li>
3584      * <li>{@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.pixelArraySizeMaximumResolution}</li>
3585      * <li>{@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION android.sensor.info.preCorrectionActiveArraySizeMaximumResolution}</li>
3586      * </ul>
3587      * </li>
3588      * </ul>
3589      * <p><b>Possible values:</b></p>
3590      * <ul>
3591      *   <li>{@link #SENSOR_PIXEL_MODE_DEFAULT DEFAULT}</li>
3592      *   <li>{@link #SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION MAXIMUM_RESOLUTION}</li>
3593      * </ul>
3594      *
3595      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3596      *
3597      * @see CameraCharacteristics#SCALER_MANDATORY_MAXIMUM_RESOLUTION_STREAM_COMBINATIONS
3598      * @see CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP
3599      * @see CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP_MAXIMUM_RESOLUTION
3600      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
3601      * @see CameraCharacteristics#SENSOR_INFO_BINNING_FACTOR
3602      * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION
3603      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
3604      * @see #SENSOR_PIXEL_MODE_DEFAULT
3605      * @see #SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION
3606      */
3607     @PublicKey
3608     @NonNull
3609     public static final Key<Integer> SENSOR_PIXEL_MODE =
3610             new Key<Integer>("android.sensor.pixelMode", int.class);
3611 
3612     /**
3613      * <p>Quality of lens shading correction applied
3614      * to the image data.</p>
3615      * <p>When set to OFF mode, no lens shading correction will be applied by the
3616      * camera device, and an identity lens shading map data will be provided
3617      * if <code>{@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} == ON</code>. For example, for lens
3618      * shading map with size of <code>[ 4, 3 ]</code>,
3619      * the output {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap} for this case will be an identity
3620      * map shown below:</p>
3621      * <pre><code>[ 1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
3622      *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
3623      *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
3624      *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
3625      *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
3626      *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0 ]
3627      * </code></pre>
3628      * <p>When set to other modes, lens shading correction will be applied by the camera
3629      * device. Applications can request lens shading map data by setting
3630      * {@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} to ON, and then the camera device will provide lens
3631      * shading map data in {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap}; the returned shading map
3632      * data will be the one applied by the camera device for this capture request.</p>
3633      * <p>The shading map data may depend on the auto-exposure (AE) and AWB statistics, therefore
3634      * the reliability of the map data may be affected by the AE and AWB algorithms. When AE and
3635      * 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>
3636      * OFF), to get best results, it is recommended that the applications wait for the AE and AWB
3637      * to be converged before using the returned shading map data.</p>
3638      * <p><b>Possible values:</b></p>
3639      * <ul>
3640      *   <li>{@link #SHADING_MODE_OFF OFF}</li>
3641      *   <li>{@link #SHADING_MODE_FAST FAST}</li>
3642      *   <li>{@link #SHADING_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
3643      * </ul>
3644      *
3645      * <p><b>Available values for this device:</b><br>
3646      * {@link CameraCharacteristics#SHADING_AVAILABLE_MODES android.shading.availableModes}</p>
3647      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3648      * <p><b>Full capability</b> -
3649      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3650      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3651      *
3652      * @see CaptureRequest#CONTROL_AE_MODE
3653      * @see CaptureRequest#CONTROL_AWB_MODE
3654      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3655      * @see CameraCharacteristics#SHADING_AVAILABLE_MODES
3656      * @see CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP
3657      * @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE
3658      * @see #SHADING_MODE_OFF
3659      * @see #SHADING_MODE_FAST
3660      * @see #SHADING_MODE_HIGH_QUALITY
3661      */
3662     @PublicKey
3663     @NonNull
3664     public static final Key<Integer> SHADING_MODE =
3665             new Key<Integer>("android.shading.mode", int.class);
3666 
3667     /**
3668      * <p>Operating mode for the face detector
3669      * unit.</p>
3670      * <p>Whether face detection is enabled, and whether it
3671      * should output just the basic fields or the full set of
3672      * fields.</p>
3673      * <p><b>Possible values:</b></p>
3674      * <ul>
3675      *   <li>{@link #STATISTICS_FACE_DETECT_MODE_OFF OFF}</li>
3676      *   <li>{@link #STATISTICS_FACE_DETECT_MODE_SIMPLE SIMPLE}</li>
3677      *   <li>{@link #STATISTICS_FACE_DETECT_MODE_FULL FULL}</li>
3678      * </ul>
3679      *
3680      * <p><b>Available values for this device:</b><br>
3681      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES android.statistics.info.availableFaceDetectModes}</p>
3682      * <p>This key is available on all devices.</p>
3683      *
3684      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES
3685      * @see #STATISTICS_FACE_DETECT_MODE_OFF
3686      * @see #STATISTICS_FACE_DETECT_MODE_SIMPLE
3687      * @see #STATISTICS_FACE_DETECT_MODE_FULL
3688      */
3689     @PublicKey
3690     @NonNull
3691     public static final Key<Integer> STATISTICS_FACE_DETECT_MODE =
3692             new Key<Integer>("android.statistics.faceDetectMode", int.class);
3693 
3694     /**
3695      * <p>Operating mode for hot pixel map generation.</p>
3696      * <p>If set to <code>true</code>, a hot pixel map is returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.
3697      * If set to <code>false</code>, no hot pixel map will be returned.</p>
3698      * <p><b>Range of valid values:</b><br>
3699      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}</p>
3700      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3701      *
3702      * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
3703      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES
3704      */
3705     @PublicKey
3706     @NonNull
3707     public static final Key<Boolean> STATISTICS_HOT_PIXEL_MAP_MODE =
3708             new Key<Boolean>("android.statistics.hotPixelMapMode", boolean.class);
3709 
3710     /**
3711      * <p>Whether the camera device will output the lens
3712      * shading map in output result metadata.</p>
3713      * <p>When set to ON,
3714      * android.statistics.lensShadingMap will be provided in
3715      * the output result metadata.</p>
3716      * <p>ON is always supported on devices with the RAW capability.</p>
3717      * <p><b>Possible values:</b></p>
3718      * <ul>
3719      *   <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_OFF OFF}</li>
3720      *   <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_ON ON}</li>
3721      * </ul>
3722      *
3723      * <p><b>Available values for this device:</b><br>
3724      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES android.statistics.info.availableLensShadingMapModes}</p>
3725      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3726      * <p><b>Full capability</b> -
3727      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3728      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3729      *
3730      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3731      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES
3732      * @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF
3733      * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON
3734      */
3735     @PublicKey
3736     @NonNull
3737     public static final Key<Integer> STATISTICS_LENS_SHADING_MAP_MODE =
3738             new Key<Integer>("android.statistics.lensShadingMapMode", int.class);
3739 
3740     /**
3741      * <p>A control for selecting whether optical stabilization (OIS) position
3742      * information is included in output result metadata.</p>
3743      * <p>Since optical image stabilization generally involves motion much faster than the duration
3744      * of individual image exposure, multiple OIS samples can be included for a single capture
3745      * result. For example, if the OIS reporting operates at 200 Hz, a typical camera operating
3746      * at 30fps may have 6-7 OIS samples per capture result. This information can be combined
3747      * with the rolling shutter skew to account for lens motion during image exposure in
3748      * post-processing algorithms.</p>
3749      * <p><b>Possible values:</b></p>
3750      * <ul>
3751      *   <li>{@link #STATISTICS_OIS_DATA_MODE_OFF OFF}</li>
3752      *   <li>{@link #STATISTICS_OIS_DATA_MODE_ON ON}</li>
3753      * </ul>
3754      *
3755      * <p><b>Available values for this device:</b><br>
3756      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES android.statistics.info.availableOisDataModes}</p>
3757      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3758      *
3759      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES
3760      * @see #STATISTICS_OIS_DATA_MODE_OFF
3761      * @see #STATISTICS_OIS_DATA_MODE_ON
3762      */
3763     @PublicKey
3764     @NonNull
3765     public static final Key<Integer> STATISTICS_OIS_DATA_MODE =
3766             new Key<Integer>("android.statistics.oisDataMode", int.class);
3767 
3768     /**
3769      * <p>Tonemapping / contrast / gamma curve for the blue
3770      * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3771      * CONTRAST_CURVE.</p>
3772      * <p>See android.tonemap.curveRed for more details.</p>
3773      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3774      * <p><b>Full capability</b> -
3775      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3776      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3777      *
3778      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3779      * @see CaptureRequest#TONEMAP_MODE
3780      * @hide
3781      */
3782     public static final Key<float[]> TONEMAP_CURVE_BLUE =
3783             new Key<float[]>("android.tonemap.curveBlue", float[].class);
3784 
3785     /**
3786      * <p>Tonemapping / contrast / gamma curve for the green
3787      * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3788      * CONTRAST_CURVE.</p>
3789      * <p>See android.tonemap.curveRed for more details.</p>
3790      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3791      * <p><b>Full capability</b> -
3792      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3793      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3794      *
3795      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3796      * @see CaptureRequest#TONEMAP_MODE
3797      * @hide
3798      */
3799     public static final Key<float[]> TONEMAP_CURVE_GREEN =
3800             new Key<float[]>("android.tonemap.curveGreen", float[].class);
3801 
3802     /**
3803      * <p>Tonemapping / contrast / gamma curve for the red
3804      * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3805      * CONTRAST_CURVE.</p>
3806      * <p>Each channel's curve is defined by an array of control points:</p>
3807      * <pre><code>android.tonemap.curveRed =
3808      *   [ P0in, P0out, P1in, P1out, P2in, P2out, P3in, P3out, ..., PNin, PNout ]
3809      * 2 &lt;= N &lt;= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
3810      * <p>These are sorted in order of increasing <code>Pin</code>; it is
3811      * required that input values 0.0 and 1.0 are included in the list to
3812      * define a complete mapping. For input values between control points,
3813      * the camera device must linearly interpolate between the control
3814      * points.</p>
3815      * <p>Each curve can have an independent number of points, and the number
3816      * of points can be less than max (that is, the request doesn't have to
3817      * always provide a curve with number of points equivalent to
3818      * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p>
3819      * <p>For devices with MONOCHROME capability, all three channels must have the same set of
3820      * control points.</p>
3821      * <p>A few examples, and their corresponding graphical mappings; these
3822      * only specify the red channel and the precision is limited to 4
3823      * digits, for conciseness.</p>
3824      * <p>Linear mapping:</p>
3825      * <pre><code>android.tonemap.curveRed = [ 0, 0, 1.0, 1.0 ]
3826      * </code></pre>
3827      * <p><img alt="Linear mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p>
3828      * <p>Invert mapping:</p>
3829      * <pre><code>android.tonemap.curveRed = [ 0, 1.0, 1.0, 0 ]
3830      * </code></pre>
3831      * <p><img alt="Inverting mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p>
3832      * <p>Gamma 1/2.2 mapping, with 16 control points:</p>
3833      * <pre><code>android.tonemap.curveRed = [
3834      *   0.0000, 0.0000, 0.0667, 0.2920, 0.1333, 0.4002, 0.2000, 0.4812,
3835      *   0.2667, 0.5484, 0.3333, 0.6069, 0.4000, 0.6594, 0.4667, 0.7072,
3836      *   0.5333, 0.7515, 0.6000, 0.7928, 0.6667, 0.8317, 0.7333, 0.8685,
3837      *   0.8000, 0.9035, 0.8667, 0.9370, 0.9333, 0.9691, 1.0000, 1.0000 ]
3838      * </code></pre>
3839      * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p>
3840      * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p>
3841      * <pre><code>android.tonemap.curveRed = [
3842      *   0.0000, 0.0000, 0.0667, 0.2864, 0.1333, 0.4007, 0.2000, 0.4845,
3843      *   0.2667, 0.5532, 0.3333, 0.6125, 0.4000, 0.6652, 0.4667, 0.7130,
3844      *   0.5333, 0.7569, 0.6000, 0.7977, 0.6667, 0.8360, 0.7333, 0.8721,
3845      *   0.8000, 0.9063, 0.8667, 0.9389, 0.9333, 0.9701, 1.0000, 1.0000 ]
3846      * </code></pre>
3847      * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
3848      * <p><b>Range of valid values:</b><br>
3849      * 0-1 on both input and output coordinates, normalized
3850      * as a floating-point value such that 0 == black and 1 == white.</p>
3851      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3852      * <p><b>Full capability</b> -
3853      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3854      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3855      *
3856      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3857      * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS
3858      * @see CaptureRequest#TONEMAP_MODE
3859      * @hide
3860      */
3861     public static final Key<float[]> TONEMAP_CURVE_RED =
3862             new Key<float[]>("android.tonemap.curveRed", float[].class);
3863 
3864     /**
3865      * <p>Tonemapping / contrast / gamma curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode}
3866      * is CONTRAST_CURVE.</p>
3867      * <p>The tonemapCurve consist of three curves for each of red, green, and blue
3868      * channels respectively. The following example uses the red channel as an
3869      * example. The same logic applies to green and blue channel.
3870      * Each channel's curve is defined by an array of control points:</p>
3871      * <pre><code>curveRed =
3872      *   [ P0(in, out), P1(in, out), P2(in, out), P3(in, out), ..., PN(in, out) ]
3873      * 2 &lt;= N &lt;= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
3874      * <p>These are sorted in order of increasing <code>Pin</code>; it is always
3875      * guaranteed that input values 0.0 and 1.0 are included in the list to
3876      * define a complete mapping. For input values between control points,
3877      * the camera device must linearly interpolate between the control
3878      * points.</p>
3879      * <p>Each curve can have an independent number of points, and the number
3880      * of points can be less than max (that is, the request doesn't have to
3881      * always provide a curve with number of points equivalent to
3882      * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p>
3883      * <p>For devices with MONOCHROME capability, all three channels must have the same set of
3884      * control points.</p>
3885      * <p>A few examples, and their corresponding graphical mappings; these
3886      * only specify the red channel and the precision is limited to 4
3887      * digits, for conciseness.</p>
3888      * <p>Linear mapping:</p>
3889      * <pre><code>curveRed = [ (0, 0), (1.0, 1.0) ]
3890      * </code></pre>
3891      * <p><img alt="Linear mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p>
3892      * <p>Invert mapping:</p>
3893      * <pre><code>curveRed = [ (0, 1.0), (1.0, 0) ]
3894      * </code></pre>
3895      * <p><img alt="Inverting mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p>
3896      * <p>Gamma 1/2.2 mapping, with 16 control points:</p>
3897      * <pre><code>curveRed = [
3898      *   (0.0000, 0.0000), (0.0667, 0.2920), (0.1333, 0.4002), (0.2000, 0.4812),
3899      *   (0.2667, 0.5484), (0.3333, 0.6069), (0.4000, 0.6594), (0.4667, 0.7072),
3900      *   (0.5333, 0.7515), (0.6000, 0.7928), (0.6667, 0.8317), (0.7333, 0.8685),
3901      *   (0.8000, 0.9035), (0.8667, 0.9370), (0.9333, 0.9691), (1.0000, 1.0000) ]
3902      * </code></pre>
3903      * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p>
3904      * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p>
3905      * <pre><code>curveRed = [
3906      *   (0.0000, 0.0000), (0.0667, 0.2864), (0.1333, 0.4007), (0.2000, 0.4845),
3907      *   (0.2667, 0.5532), (0.3333, 0.6125), (0.4000, 0.6652), (0.4667, 0.7130),
3908      *   (0.5333, 0.7569), (0.6000, 0.7977), (0.6667, 0.8360), (0.7333, 0.8721),
3909      *   (0.8000, 0.9063), (0.8667, 0.9389), (0.9333, 0.9701), (1.0000, 1.0000) ]
3910      * </code></pre>
3911      * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
3912      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3913      * <p><b>Full capability</b> -
3914      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3915      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3916      *
3917      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3918      * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS
3919      * @see CaptureRequest#TONEMAP_MODE
3920      */
3921     @PublicKey
3922     @NonNull
3923     @SyntheticKey
3924     public static final Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE =
3925             new Key<android.hardware.camera2.params.TonemapCurve>("android.tonemap.curve", android.hardware.camera2.params.TonemapCurve.class);
3926 
3927     /**
3928      * <p>High-level global contrast/gamma/tonemapping control.</p>
3929      * <p>When switching to an application-defined contrast curve by setting
3930      * {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} to CONTRAST_CURVE, the curve is defined
3931      * per-channel with a set of <code>(in, out)</code> points that specify the
3932      * mapping from input high-bit-depth pixel value to the output
3933      * low-bit-depth value.  Since the actual pixel ranges of both input
3934      * and output may change depending on the camera pipeline, the values
3935      * are specified by normalized floating-point numbers.</p>
3936      * <p>More-complex color mapping operations such as 3D color look-up
3937      * tables, selective chroma enhancement, or other non-linear color
3938      * transforms will be disabled when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3939      * CONTRAST_CURVE.</p>
3940      * <p>When using either FAST or HIGH_QUALITY, the camera device will
3941      * emit its own tonemap curve in {@link CaptureRequest#TONEMAP_CURVE android.tonemap.curve}.
3942      * These values are always available, and as close as possible to the
3943      * actually used nonlinear/nonglobal transforms.</p>
3944      * <p>If a request is sent with CONTRAST_CURVE with the camera device's
3945      * provided curve in FAST or HIGH_QUALITY, the image's tonemap will be
3946      * roughly the same.</p>
3947      * <p><b>Possible values:</b></p>
3948      * <ul>
3949      *   <li>{@link #TONEMAP_MODE_CONTRAST_CURVE CONTRAST_CURVE}</li>
3950      *   <li>{@link #TONEMAP_MODE_FAST FAST}</li>
3951      *   <li>{@link #TONEMAP_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
3952      *   <li>{@link #TONEMAP_MODE_GAMMA_VALUE GAMMA_VALUE}</li>
3953      *   <li>{@link #TONEMAP_MODE_PRESET_CURVE PRESET_CURVE}</li>
3954      * </ul>
3955      *
3956      * <p><b>Available values for this device:</b><br>
3957      * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}</p>
3958      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3959      * <p><b>Full capability</b> -
3960      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3961      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3962      *
3963      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
3964      * @see CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES
3965      * @see CaptureRequest#TONEMAP_CURVE
3966      * @see CaptureRequest#TONEMAP_MODE
3967      * @see #TONEMAP_MODE_CONTRAST_CURVE
3968      * @see #TONEMAP_MODE_FAST
3969      * @see #TONEMAP_MODE_HIGH_QUALITY
3970      * @see #TONEMAP_MODE_GAMMA_VALUE
3971      * @see #TONEMAP_MODE_PRESET_CURVE
3972      */
3973     @PublicKey
3974     @NonNull
3975     public static final Key<Integer> TONEMAP_MODE =
3976             new Key<Integer>("android.tonemap.mode", int.class);
3977 
3978     /**
3979      * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3980      * GAMMA_VALUE</p>
3981      * <p>The tonemap curve will be defined the following formula:</p>
3982      * <ul>
3983      * <li>OUT = pow(IN, 1.0 / gamma)</li>
3984      * </ul>
3985      * <p>where IN and OUT is the input pixel value scaled to range [0.0, 1.0],
3986      * pow is the power function and gamma is the gamma value specified by this
3987      * key.</p>
3988      * <p>The same curve will be applied to all color channels. The camera device
3989      * may clip the input gamma value to its supported range. The actual applied
3990      * value will be returned in capture result.</p>
3991      * <p>The valid range of gamma value varies on different devices, but values
3992      * within [1.0, 5.0] are guaranteed not to be clipped.</p>
3993      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
3994      *
3995      * @see CaptureRequest#TONEMAP_MODE
3996      */
3997     @PublicKey
3998     @NonNull
3999     public static final Key<Float> TONEMAP_GAMMA =
4000             new Key<Float>("android.tonemap.gamma", float.class);
4001 
4002     /**
4003      * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
4004      * PRESET_CURVE</p>
4005      * <p>The tonemap curve will be defined by specified standard.</p>
4006      * <p>sRGB (approximated by 16 control points):</p>
4007      * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
4008      * <p>Rec. 709 (approximated by 16 control points):</p>
4009      * <p><img alt="Rec. 709 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png" /></p>
4010      * <p>Note that above figures show a 16 control points approximation of preset
4011      * curves. Camera devices may apply a different approximation to the curve.</p>
4012      * <p><b>Possible values:</b></p>
4013      * <ul>
4014      *   <li>{@link #TONEMAP_PRESET_CURVE_SRGB SRGB}</li>
4015      *   <li>{@link #TONEMAP_PRESET_CURVE_REC709 REC709}</li>
4016      * </ul>
4017      *
4018      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4019      *
4020      * @see CaptureRequest#TONEMAP_MODE
4021      * @see #TONEMAP_PRESET_CURVE_SRGB
4022      * @see #TONEMAP_PRESET_CURVE_REC709
4023      */
4024     @PublicKey
4025     @NonNull
4026     public static final Key<Integer> TONEMAP_PRESET_CURVE =
4027             new Key<Integer>("android.tonemap.presetCurve", int.class);
4028 
4029     /**
4030      * <p>This LED is nominally used to indicate to the user
4031      * that the camera is powered on and may be streaming images back to the
4032      * Application Processor. In certain rare circumstances, the OS may
4033      * disable this when video is processed locally and not transmitted to
4034      * any untrusted applications.</p>
4035      * <p>In particular, the LED <em>must</em> always be on when the data could be
4036      * transmitted off the device. The LED <em>should</em> always be on whenever
4037      * data is stored locally on the device.</p>
4038      * <p>The LED <em>may</em> be off if a trusted application is using the data that
4039      * doesn't violate the above rules.</p>
4040      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4041      * @hide
4042      */
4043     public static final Key<Boolean> LED_TRANSMIT =
4044             new Key<Boolean>("android.led.transmit", boolean.class);
4045 
4046     /**
4047      * <p>Whether black-level compensation is locked
4048      * to its current values, or is free to vary.</p>
4049      * <p>When set to <code>true</code> (ON), the values used for black-level
4050      * compensation will not change until the lock is set to
4051      * <code>false</code> (OFF).</p>
4052      * <p>Since changes to certain capture parameters (such as
4053      * exposure time) may require resetting of black level
4054      * compensation, the camera device must report whether setting
4055      * the black level lock was successful in the output result
4056      * metadata.</p>
4057      * <p>For example, if a sequence of requests is as follows:</p>
4058      * <ul>
4059      * <li>Request 1: Exposure = 10ms, Black level lock = OFF</li>
4060      * <li>Request 2: Exposure = 10ms, Black level lock = ON</li>
4061      * <li>Request 3: Exposure = 10ms, Black level lock = ON</li>
4062      * <li>Request 4: Exposure = 20ms, Black level lock = ON</li>
4063      * <li>Request 5: Exposure = 20ms, Black level lock = ON</li>
4064      * <li>Request 6: Exposure = 20ms, Black level lock = ON</li>
4065      * </ul>
4066      * <p>And the exposure change in Request 4 requires the camera
4067      * device to reset the black level offsets, then the output
4068      * result metadata is expected to be:</p>
4069      * <ul>
4070      * <li>Result 1: Exposure = 10ms, Black level lock = OFF</li>
4071      * <li>Result 2: Exposure = 10ms, Black level lock = ON</li>
4072      * <li>Result 3: Exposure = 10ms, Black level lock = ON</li>
4073      * <li>Result 4: Exposure = 20ms, Black level lock = OFF</li>
4074      * <li>Result 5: Exposure = 20ms, Black level lock = ON</li>
4075      * <li>Result 6: Exposure = 20ms, Black level lock = ON</li>
4076      * </ul>
4077      * <p>This indicates to the application that on frame 4, black
4078      * levels were reset due to exposure value changes, and pixel
4079      * values may not be consistent across captures.</p>
4080      * <p>The camera device will maintain the lock to the extent
4081      * possible, only overriding the lock to OFF when changes to
4082      * other request parameters require a black level recalculation
4083      * or reset.</p>
4084      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4085      * <p><b>Full capability</b> -
4086      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
4087      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4088      *
4089      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4090      */
4091     @PublicKey
4092     @NonNull
4093     public static final Key<Boolean> BLACK_LEVEL_LOCK =
4094             new Key<Boolean>("android.blackLevel.lock", boolean.class);
4095 
4096     /**
4097      * <p>The amount of exposure time increase factor applied to the original output
4098      * frame by the application processing before sending for reprocessing.</p>
4099      * <p>This is optional, and will be supported if the camera device supports YUV_REPROCESSING
4100      * capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains YUV_REPROCESSING).</p>
4101      * <p>For some YUV reprocessing use cases, the application may choose to filter the original
4102      * output frames to effectively reduce the noise to the same level as a frame that was
4103      * captured with longer exposure time. To be more specific, assuming the original captured
4104      * images were captured with a sensitivity of S and an exposure time of T, the model in
4105      * the camera device is that the amount of noise in the image would be approximately what
4106      * would be expected if the original capture parameters had been a sensitivity of
4107      * S/effectiveExposureFactor and an exposure time of T*effectiveExposureFactor, rather
4108      * than S and T respectively. If the captured images were processed by the application
4109      * before being sent for reprocessing, then the application may have used image processing
4110      * algorithms and/or multi-frame image fusion to reduce the noise in the
4111      * application-processed images (input images). By using the effectiveExposureFactor
4112      * control, the application can communicate to the camera device the actual noise level
4113      * improvement in the application-processed image. With this information, the camera
4114      * device can select appropriate noise reduction and edge enhancement parameters to avoid
4115      * excessive noise reduction ({@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode}) and insufficient edge
4116      * enhancement ({@link CaptureRequest#EDGE_MODE android.edge.mode}) being applied to the reprocessed frames.</p>
4117      * <p>For example, for multi-frame image fusion use case, the application may fuse
4118      * multiple output frames together to a final frame for reprocessing. When N image are
4119      * fused into 1 image for reprocessing, the exposure time increase factor could be up to
4120      * square root of N (based on a simple photon shot noise model). The camera device will
4121      * adjust the reprocessing noise reduction and edge enhancement parameters accordingly to
4122      * produce the best quality images.</p>
4123      * <p>This is relative factor, 1.0 indicates the application hasn't processed the input
4124      * buffer in a way that affects its effective exposure time.</p>
4125      * <p>This control is only effective for YUV reprocessing capture request. For noise
4126      * reduction reprocessing, it is only effective when <code>{@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode} != OFF</code>.
4127      * Similarly, for edge enhancement reprocessing, it is only effective when
4128      * <code>{@link CaptureRequest#EDGE_MODE android.edge.mode} != OFF</code>.</p>
4129      * <p><b>Units</b>: Relative exposure time increase factor.</p>
4130      * <p><b>Range of valid values:</b><br>
4131      * &gt;= 1.0</p>
4132      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4133      * <p><b>Limited capability</b> -
4134      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
4135      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
4136      *
4137      * @see CaptureRequest#EDGE_MODE
4138      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
4139      * @see CaptureRequest#NOISE_REDUCTION_MODE
4140      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
4141      */
4142     @PublicKey
4143     @NonNull
4144     public static final Key<Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR =
4145             new Key<Float>("android.reprocess.effectiveExposureFactor", float.class);
4146 
4147     /**
4148      * <p>Mode of operation for the lens distortion correction block.</p>
4149      * <p>The lens distortion correction block attempts to improve image quality by fixing
4150      * radial, tangential, or other geometric aberrations in the camera device's optics.  If
4151      * available, the {@link CameraCharacteristics#LENS_DISTORTION android.lens.distortion} field documents the lens's distortion parameters.</p>
4152      * <p>OFF means no distortion correction is done.</p>
4153      * <p>FAST/HIGH_QUALITY both mean camera device determined distortion correction will be
4154      * applied. HIGH_QUALITY mode indicates that the camera device will use the highest-quality
4155      * correction algorithms, even if it slows down capture rate. FAST means the camera device
4156      * will not slow down capture rate when applying correction. FAST may be the same as OFF if
4157      * any correction at all would slow down capture rate.  Every output stream will have a
4158      * similar amount of enhancement applied.</p>
4159      * <p>The correction only applies to processed outputs such as YUV, Y8, JPEG, or DEPTH16; it is
4160      * not applied to any RAW output.</p>
4161      * <p>This control will be on by default on devices that support this control. Applications
4162      * disabling distortion correction need to pay extra attention with the coordinate system of
4163      * metering regions, crop region, and face rectangles. When distortion correction is OFF,
4164      * metadata coordinates follow the coordinate system of
4165      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}. When distortion is not OFF, metadata
4166      * coordinates follow the coordinate system of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.  The
4167      * camera device will map these metadata fields to match the corrected image produced by the
4168      * camera device, for both capture requests and results.  However, this mapping is not very
4169      * precise, since rectangles do not generally map to rectangles when corrected.  Only linear
4170      * scaling between the active array and precorrection active array coordinates is
4171      * performed. Applications that require precise correction of metadata need to undo that
4172      * linear scaling, and apply a more complete correction that takes into the account the app's
4173      * own requirements.</p>
4174      * <p>The full list of metadata that is affected in this way by distortion correction is:</p>
4175      * <ul>
4176      * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li>
4177      * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li>
4178      * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li>
4179      * <li>{@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}</li>
4180      * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li>
4181      * </ul>
4182      * <p><b>Possible values:</b></p>
4183      * <ul>
4184      *   <li>{@link #DISTORTION_CORRECTION_MODE_OFF OFF}</li>
4185      *   <li>{@link #DISTORTION_CORRECTION_MODE_FAST FAST}</li>
4186      *   <li>{@link #DISTORTION_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
4187      * </ul>
4188      *
4189      * <p><b>Available values for this device:</b><br>
4190      * {@link CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES android.distortionCorrection.availableModes}</p>
4191      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4192      *
4193      * @see CaptureRequest#CONTROL_AE_REGIONS
4194      * @see CaptureRequest#CONTROL_AF_REGIONS
4195      * @see CaptureRequest#CONTROL_AWB_REGIONS
4196      * @see CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES
4197      * @see CameraCharacteristics#LENS_DISTORTION
4198      * @see CaptureRequest#SCALER_CROP_REGION
4199      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
4200      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
4201      * @see CaptureResult#STATISTICS_FACES
4202      * @see #DISTORTION_CORRECTION_MODE_OFF
4203      * @see #DISTORTION_CORRECTION_MODE_FAST
4204      * @see #DISTORTION_CORRECTION_MODE_HIGH_QUALITY
4205      */
4206     @PublicKey
4207     @NonNull
4208     public static final Key<Integer> DISTORTION_CORRECTION_MODE =
4209             new Key<Integer>("android.distortionCorrection.mode", int.class);
4210 
4211     /**
4212      * <p>Strength of the extension post-processing effect</p>
4213      * <p>This control allows Camera extension clients to configure the strength of the applied
4214      * extension effect. Strength equal to 0 means that the extension must not apply any
4215      * post-processing and return a regular captured frame. Strength equal to 100 is the
4216      * maximum level of post-processing. Values between 0 and 100 will have different effect
4217      * depending on the extension type as described below:</p>
4218      * <ul>
4219      * <li>{@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_BOKEH BOKEH} -
4220      * the strength is expected to control the amount of blur.</li>
4221      * <li>{@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_HDR HDR} and
4222      * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_NIGHT NIGHT} -
4223      * the strength can control the amount of images fused and the brightness of the final image.</li>
4224      * <li>{@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_FACE_RETOUCH FACE_RETOUCH} -
4225      * the strength value will control the amount of cosmetic enhancement and skin
4226      * smoothing.</li>
4227      * </ul>
4228      * <p>The control will be supported if the capture request key is part of the list generated by
4229      * {@link android.hardware.camera2.CameraExtensionCharacteristics#getAvailableCaptureRequestKeys }.
4230      * The control is only defined and available to clients sending capture requests via
4231      * {@link android.hardware.camera2.CameraExtensionSession }.
4232      * If the client doesn't specify the extension strength value, then a default value will
4233      * be set by the extension. Clients can retrieve the default value by checking the
4234      * corresponding capture result.</p>
4235      * <p><b>Range of valid values:</b><br>
4236      * 0 - 100</p>
4237      * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
4238      */
4239     @PublicKey
4240     @NonNull
4241     public static final Key<Integer> EXTENSION_STRENGTH =
4242             new Key<Integer>("android.extension.strength", int.class);
4243 
4244     /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
4245      * End generated code
4246      *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/
4247 
4248 
4249 
4250 
4251 
4252 
4253 
4254 
4255 
4256 }
4257