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