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