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