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