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