blob: 6905f83104cde2e9047f15b7dd77a11e4321450f [file] [log] [blame]
Eino-Ville Talvalab2675542012-12-12 13:29:45 -08001/*
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
Eino-Ville Talvala2f1a2e42013-07-25 17:12:05 -070017package android.hardware.camera2;
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080018
Eino-Ville Talvala8b905572015-05-14 15:43:01 -070019import android.annotation.NonNull;
20import android.annotation.Nullable;
Artur Satayev26958002019-12-10 17:47:52 +000021import android.compat.annotation.UnsupportedAppUsage;
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070022import android.hardware.camera2.impl.CameraMetadataNative;
Igor Murashkin6c76f582014-07-15 17:19:49 -070023import android.hardware.camera2.impl.PublicKey;
24import android.hardware.camera2.impl.SyntheticKey;
Yin-Chia Yehc60af902017-11-10 20:02:29 -080025import android.hardware.camera2.params.OutputConfiguration;
Ruben Brunk5776aaf2014-06-19 13:42:40 -070026import android.hardware.camera2.utils.HashCodeHelpers;
Yin-Chia Yeh4f151472018-02-21 12:38:19 -080027import android.hardware.camera2.utils.SurfaceUtils;
Shuzhen Wanga8d36032018-10-15 12:01:53 -070028import android.hardware.camera2.utils.TypeReference;
Igor Murashkin70725502013-06-25 20:27:06 +000029import android.os.Parcel;
30import android.os.Parcelable;
Yin-Chia Yehc60af902017-11-10 20:02:29 -080031import android.util.ArraySet;
32import android.util.Log;
33import android.util.SparseArray;
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080034import android.view.Surface;
35
Ruben Brunkfeb50af2014-05-09 19:58:49 -070036import java.util.Collection;
37import java.util.Collections;
Emilian Peev2100ae72018-01-12 16:56:25 +000038import java.util.HashMap;
Igor Murashkind6d65152014-05-19 16:31:02 -070039import java.util.List;
Emilian Peev2100ae72018-01-12 16:56:25 +000040import java.util.Map;
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -070041import java.util.Objects;
Emilian Peev2100ae72018-01-12 16:56:25 +000042import java.util.Set;
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080043
44/**
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070045 * <p>An immutable package of settings and outputs needed to capture a single
46 * image from the camera device.</p>
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080047 *
48 * <p>Contains the configuration for the capture hardware (sensor, lens, flash),
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070049 * the processing pipeline, the control algorithms, and the output buffers. Also
50 * contains the list of target Surfaces to send image data to for this
51 * capture.</p>
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080052 *
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070053 * <p>CaptureRequests can be created by using a {@link Builder} instance,
54 * obtained by calling {@link CameraDevice#createCaptureRequest}</p>
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080055 *
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -070056 * <p>CaptureRequests are given to {@link CameraCaptureSession#capture} or
57 * {@link CameraCaptureSession#setRepeatingRequest} to capture images from a camera.</p>
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080058 *
59 * <p>Each request can specify a different subset of target Surfaces for the
60 * camera to send the captured data to. All the surfaces used in a request must
61 * be part of the surface list given to the last call to
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -070062 * {@link CameraDevice#createCaptureSession}, when the request is submitted to the
63 * session.</p>
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080064 *
65 * <p>For example, a request meant for repeating preview might only include the
66 * Surface for the preview SurfaceView or SurfaceTexture, while a
67 * high-resolution still capture would also include a Surface from a ImageReader
68 * configured for high-resolution JPEG images.</p>
69 *
Eino-Ville Talvala0aa2bde2015-05-19 17:25:54 -070070 * <p>A reprocess capture request allows a previously-captured image from the camera device to be
71 * sent back to the device for further processing. It can be created with
Eino-Ville Talvalabd7f34f2015-05-21 11:10:51 -070072 * {@link CameraDevice#createReprocessCaptureRequest}, and used with a reprocessable capture session
Eino-Ville Talvala0aa2bde2015-05-19 17:25:54 -070073 * created with {@link CameraDevice#createReprocessableCaptureSession}.</p>
74 *
75 * @see CameraCaptureSession#capture
76 * @see CameraCaptureSession#setRepeatingRequest
77 * @see CameraCaptureSession#captureBurst
78 * @see CameraCaptureSession#setRepeatingBurst
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070079 * @see CameraDevice#createCaptureRequest
Eino-Ville Talvala0aa2bde2015-05-19 17:25:54 -070080 * @see CameraDevice#createReprocessCaptureRequest
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080081 */
Igor Murashkind6d65152014-05-19 16:31:02 -070082public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
83 implements Parcelable {
84
85 /**
86 * A {@code Key} is used to do capture request field lookups with
87 * {@link CaptureResult#get} or to set fields with
88 * {@link CaptureRequest.Builder#set(Key, Object)}.
89 *
90 * <p>For example, to set the crop rectangle for the next capture:
91 * <code><pre>
92 * Rect cropRectangle = new Rect(0, 0, 640, 480);
93 * captureRequestBuilder.set(SCALER_CROP_REGION, cropRectangle);
94 * </pre></code>
95 * </p>
96 *
97 * <p>To enumerate over all possible keys for {@link CaptureResult}, see
98 * {@link CameraCharacteristics#getAvailableCaptureResultKeys}.</p>
99 *
100 * @see CaptureResult#get
101 * @see CameraCharacteristics#getAvailableCaptureResultKeys
102 */
103 public final static class Key<T> {
104 private final CameraMetadataNative.Key<T> mKey;
105
106 /**
107 * Visible for testing and vendor extensions only.
108 *
109 * @hide
110 */
Mathew Inwoodbcbe4402018-08-08 15:42:59 +0100111 @UnsupportedAppUsage
Emilian Peevde62d842017-03-23 19:20:40 +0000112 public Key(String name, Class<T> type, long vendorId) {
113 mKey = new CameraMetadataNative.Key<T>(name, type, vendorId);
114 }
115
116 /**
Eino-Ville Talvala1cf59fd2019-01-25 17:33:05 -0800117 * Construct a new Key with a given name and type.
Emilian Peevde62d842017-03-23 19:20:40 +0000118 *
Eino-Ville Talvala1cf59fd2019-01-25 17:33:05 -0800119 * <p>Normally, applications should use the existing Key definitions in
120 * {@link CaptureRequest}, and not need to construct their own Key objects. However, they
121 * may be useful for testing purposes and for defining custom capture request fields.</p>
Emilian Peevde62d842017-03-23 19:20:40 +0000122 */
Eino-Ville Talvala79d4aac2019-03-06 14:26:10 -0800123 public Key(@NonNull String name, @NonNull Class<T> type) {
Igor Murashkind6d65152014-05-19 16:31:02 -0700124 mKey = new CameraMetadataNative.Key<T>(name, type);
125 }
126
127 /**
128 * Visible for testing and vendor extensions only.
129 *
130 * @hide
131 */
Mathew Inwoodbcbe4402018-08-08 15:42:59 +0100132 @UnsupportedAppUsage
Igor Murashkind6d65152014-05-19 16:31:02 -0700133 public Key(String name, TypeReference<T> typeReference) {
134 mKey = new CameraMetadataNative.Key<T>(name, typeReference);
135 }
136
137 /**
138 * Return a camelCase, period separated name formatted like:
139 * {@code "root.section[.subsections].name"}.
140 *
141 * <p>Built-in keys exposed by the Android SDK are always prefixed with {@code "android."};
142 * keys that are device/platform-specific are prefixed with {@code "com."}.</p>
143 *
144 * <p>For example, {@code CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP} would
145 * have a name of {@code "android.scaler.streamConfigurationMap"}; whereas a device
146 * specific key might look like {@code "com.google.nexus.data.private"}.</p>
147 *
148 * @return String representation of the key name
149 */
Eino-Ville Talvala8b905572015-05-14 15:43:01 -0700150 @NonNull
Igor Murashkind6d65152014-05-19 16:31:02 -0700151 public String getName() {
152 return mKey.getName();
153 }
154
155 /**
Emilian Peevde62d842017-03-23 19:20:40 +0000156 * Return vendor tag id.
157 *
158 * @hide
159 */
160 public long getVendorId() {
161 return mKey.getVendorId();
162 }
163
164 /**
Igor Murashkind6d65152014-05-19 16:31:02 -0700165 * {@inheritDoc}
166 */
167 @Override
168 public final int hashCode() {
169 return mKey.hashCode();
170 }
171
172 /**
173 * {@inheritDoc}
174 */
175 @SuppressWarnings("unchecked")
176 @Override
177 public final boolean equals(Object o) {
178 return o instanceof Key && ((Key<T>)o).mKey.equals(mKey);
179 }
180
181 /**
Chien-Yu Chen12a83852015-07-07 12:17:22 -0700182 * Return this {@link Key} as a string representation.
183 *
184 * <p>{@code "CaptureRequest.Key(%s)"}, where {@code %s} represents
185 * the name of this key as returned by {@link #getName}.</p>
186 *
187 * @return string representation of {@link Key}
188 */
189 @NonNull
190 @Override
191 public String toString() {
192 return String.format("CaptureRequest.Key(%s)", mKey.getName());
193 }
194
195 /**
Igor Murashkind6d65152014-05-19 16:31:02 -0700196 * Visible for CameraMetadataNative implementation only; do not use.
197 *
198 * TODO: Make this private or remove it altogether.
199 *
200 * @hide
201 */
Mathew Inwoodbcbe4402018-08-08 15:42:59 +0100202 @UnsupportedAppUsage
Igor Murashkind6d65152014-05-19 16:31:02 -0700203 public CameraMetadataNative.Key<T> getNativeKey() {
204 return mKey;
205 }
206
207 @SuppressWarnings({ "unchecked" })
208 /*package*/ Key(CameraMetadataNative.Key<?> nativeKey) {
209 mKey = (CameraMetadataNative.Key<T>) nativeKey;
210 }
211 }
Igor Murashkin70725502013-06-25 20:27:06 +0000212
Yin-Chia Yehc60af902017-11-10 20:02:29 -0800213 private final String TAG = "CaptureRequest-JV";
214
215 private final ArraySet<Surface> mSurfaceSet = new ArraySet<Surface>();
216
217 // Speed up sending CaptureRequest across IPC:
218 // mSurfaceConverted should only be set to true during capture request
219 // submission by {@link #convertSurfaceToStreamId}. The method will convert
220 // surfaces to stream/surface indexes based on passed in stream configuration at that time.
221 // This will save significant unparcel time for remote camera device.
222 // Once the request is submitted, camera device will call {@link #recoverStreamIdToSurface}
223 // to reset the capture request back to its original state.
224 private final Object mSurfacesLock = new Object();
225 private boolean mSurfaceConverted = false;
226 private int[] mStreamIdxArray;
227 private int[] mSurfaceIdxArray;
228
229 private static final ArraySet<Surface> mEmptySurfaceSet = new ArraySet<Surface>();
230
Emilian Peev2100ae72018-01-12 16:56:25 +0000231 private String mLogicalCameraId;
Mathew Inwoodbcbe4402018-08-08 15:42:59 +0100232 @UnsupportedAppUsage
Emilian Peev2100ae72018-01-12 16:56:25 +0000233 private CameraMetadataNative mLogicalCameraSettings;
234 private final HashMap<String, CameraMetadataNative> mPhysicalCameraSettings =
235 new HashMap<String, CameraMetadataNative>();
236
Chien-Yu Chen5398a672015-03-19 14:48:43 -0700237 private boolean mIsReprocess;
Shuzhen Wangb45449b2019-04-17 13:32:03 -0700238
239 //
240 // Enumeration values for types of CaptureRequest
241 //
242
243 /**
244 * @hide
245 */
246 public static final int REQUEST_TYPE_REGULAR = 0;
247
248 /**
249 * @hide
250 */
251 public static final int REQUEST_TYPE_REPROCESS = 1;
252
253 /**
254 * @hide
255 */
256 public static final int REQUEST_TYPE_ZSL_STILL = 2;
257
258 /**
259 * Note: To add another request type, the FrameNumberTracker in CameraDeviceImpl must be
260 * adjusted accordingly.
261 * @hide
262 */
263 public static final int REQUEST_TYPE_COUNT = 3;
264
265
266 private int mRequestType = -1;
267
268 /**
269 * Get the type of the capture request
270 *
271 * Return one of REGULAR, ZSL_STILL, or REPROCESS.
272 * @hide
273 */
274 public int getRequestType() {
275 if (mRequestType == -1) {
276 if (mIsReprocess) {
277 mRequestType = REQUEST_TYPE_REPROCESS;
278 } else {
279 Boolean enableZsl = mLogicalCameraSettings.get(CaptureRequest.CONTROL_ENABLE_ZSL);
280 boolean isZslStill = false;
281 if (enableZsl != null && enableZsl) {
282 int captureIntent = mLogicalCameraSettings.get(
283 CaptureRequest.CONTROL_CAPTURE_INTENT);
284 if (captureIntent == CameraMetadata.CONTROL_CAPTURE_INTENT_STILL_CAPTURE) {
285 isZslStill = true;
286 }
287 }
288 mRequestType = isZslStill ? REQUEST_TYPE_ZSL_STILL : REQUEST_TYPE_REGULAR;
289 }
290 }
291 return mRequestType;
292 }
293
Zhijun Hea7677722015-06-01 16:36:06 -0700294 // If this request is part of constrained high speed request list that was created by
Eino-Ville Talvala639fffe2015-06-30 10:34:48 -0700295 // {@link android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList}
Zhijun Hea7677722015-06-01 16:36:06 -0700296 private boolean mIsPartOfCHSRequestList = false;
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700297 // Each reprocess request must be tied to a reprocessable session ID.
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700298 // Valid only for reprocess requests (mIsReprocess == true).
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700299 private int mReprocessableSessionId;
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700300
Eino-Ville Talvala40683882013-08-08 16:56:28 -0700301 private Object mUserTag;
Eino-Ville Talvalab2675542012-12-12 13:29:45 -0800302
303 /**
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700304 * Construct empty request.
305 *
306 * Used by Binder to unparcel this object only.
Igor Murashkin70725502013-06-25 20:27:06 +0000307 */
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700308 private CaptureRequest() {
Chien-Yu Chen5398a672015-03-19 14:48:43 -0700309 mIsReprocess = false;
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700310 mReprocessableSessionId = CameraCaptureSession.SESSION_ID_NONE;
Eino-Ville Talvalab2675542012-12-12 13:29:45 -0800311 }
312
313 /**
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700314 * Clone from source capture request.
315 *
316 * Used by the Builder to create an immutable copy.
Eino-Ville Talvalab2675542012-12-12 13:29:45 -0800317 */
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700318 @SuppressWarnings("unchecked")
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700319 private CaptureRequest(CaptureRequest source) {
Emilian Peev2100ae72018-01-12 16:56:25 +0000320 mLogicalCameraId = new String(source.mLogicalCameraId);
321 for (Map.Entry<String, CameraMetadataNative> entry :
322 source.mPhysicalCameraSettings.entrySet()) {
323 mPhysicalCameraSettings.put(new String(entry.getKey()),
324 new CameraMetadataNative(entry.getValue()));
325 }
326 mLogicalCameraSettings = mPhysicalCameraSettings.get(mLogicalCameraId);
327 setNativeInstance(mLogicalCameraSettings);
Yin-Chia Yehc60af902017-11-10 20:02:29 -0800328 mSurfaceSet.addAll(source.mSurfaceSet);
Chien-Yu Chen5398a672015-03-19 14:48:43 -0700329 mIsReprocess = source.mIsReprocess;
Zhijun Hea7677722015-06-01 16:36:06 -0700330 mIsPartOfCHSRequestList = source.mIsPartOfCHSRequestList;
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700331 mReprocessableSessionId = source.mReprocessableSessionId;
Eino-Ville Talvala7b01c5c2013-10-08 19:34:29 -0700332 mUserTag = source.mUserTag;
Eino-Ville Talvalab2675542012-12-12 13:29:45 -0800333 }
334
335 /**
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700336 * Take ownership of passed-in settings.
337 *
338 * Used by the Builder to create a mutable CaptureRequest.
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700339 *
340 * @param settings Settings for this capture request.
341 * @param isReprocess Indicates whether to create a reprocess capture request. {@code true}
342 * to create a reprocess capture request. {@code false} to create a regular
343 * capture request.
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700344 * @param reprocessableSessionId The ID of the camera capture session this capture is created
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700345 * for. This is used to validate if the application submits a
346 * reprocess capture request to the same session where
347 * the {@link TotalCaptureResult}, used to create the reprocess
348 * capture, came from.
Emilian Peev2100ae72018-01-12 16:56:25 +0000349 * @param logicalCameraId Camera Id of the actively open camera that instantiates the
350 * Builder.
351 *
352 * @param physicalCameraIdSet A set of physical camera ids that can be used to customize
353 * the request for a specific physical camera.
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700354 *
355 * @throws IllegalArgumentException If creating a reprocess capture request with an invalid
Emilian Peev2100ae72018-01-12 16:56:25 +0000356 * reprocessableSessionId, or multiple physical cameras.
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700357 *
358 * @see CameraDevice#createReprocessCaptureRequest
Eino-Ville Talvalab2675542012-12-12 13:29:45 -0800359 */
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700360 private CaptureRequest(CameraMetadataNative settings, boolean isReprocess,
Emilian Peev2100ae72018-01-12 16:56:25 +0000361 int reprocessableSessionId, String logicalCameraId, Set<String> physicalCameraIdSet) {
362 if ((physicalCameraIdSet != null) && isReprocess) {
363 throw new IllegalArgumentException("Create a reprocess capture request with " +
364 "with more than one physical camera is not supported!");
365 }
366
367 mLogicalCameraId = logicalCameraId;
368 mLogicalCameraSettings = CameraMetadataNative.move(settings);
369 mPhysicalCameraSettings.put(mLogicalCameraId, mLogicalCameraSettings);
370 if (physicalCameraIdSet != null) {
371 for (String physicalId : physicalCameraIdSet) {
372 mPhysicalCameraSettings.put(physicalId, new CameraMetadataNative(
373 mLogicalCameraSettings));
374 }
375 }
376
377 setNativeInstance(mLogicalCameraSettings);
Chien-Yu Chen5398a672015-03-19 14:48:43 -0700378 mIsReprocess = isReprocess;
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700379 if (isReprocess) {
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700380 if (reprocessableSessionId == CameraCaptureSession.SESSION_ID_NONE) {
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700381 throw new IllegalArgumentException("Create a reprocess capture request with an " +
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700382 "invalid session ID: " + reprocessableSessionId);
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700383 }
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700384 mReprocessableSessionId = reprocessableSessionId;
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700385 } else {
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700386 mReprocessableSessionId = CameraCaptureSession.SESSION_ID_NONE;
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700387 }
Igor Murashkin70725502013-06-25 20:27:06 +0000388 }
389
Igor Murashkind6d65152014-05-19 16:31:02 -0700390 /**
391 * Get a capture request field value.
392 *
393 * <p>The field definitions can be found in {@link CaptureRequest}.</p>
394 *
395 * <p>Querying the value for the same key more than once will return a value
396 * which is equal to the previous queried value.</p>
397 *
398 * @throws IllegalArgumentException if the key was not valid
399 *
400 * @param key The result field to read.
401 * @return The value of that key, or {@code null} if the field is not set.
402 */
Eino-Ville Talvala8b905572015-05-14 15:43:01 -0700403 @Nullable
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700404 public <T> T get(Key<T> key) {
Emilian Peev2100ae72018-01-12 16:56:25 +0000405 return mLogicalCameraSettings.get(key);
Eino-Ville Talvala40683882013-08-08 16:56:28 -0700406 }
407
408 /**
Igor Murashkind6d65152014-05-19 16:31:02 -0700409 * {@inheritDoc}
410 * @hide
411 */
412 @SuppressWarnings("unchecked")
413 @Override
414 protected <T> T getProtected(Key<?> key) {
Emilian Peev2100ae72018-01-12 16:56:25 +0000415 return (T) mLogicalCameraSettings.get(key);
Igor Murashkind6d65152014-05-19 16:31:02 -0700416 }
417
418 /**
419 * {@inheritDoc}
420 * @hide
421 */
422 @SuppressWarnings("unchecked")
423 @Override
424 protected Class<Key<?>> getKeyClass() {
425 Object thisClass = Key.class;
426 return (Class<Key<?>>)thisClass;
427 }
428
429 /**
430 * {@inheritDoc}
431 */
432 @Override
Eino-Ville Talvala8b905572015-05-14 15:43:01 -0700433 @NonNull
Igor Murashkind6d65152014-05-19 16:31:02 -0700434 public List<Key<?>> getKeys() {
435 // Force the javadoc for this function to show up on the CaptureRequest page
436 return super.getKeys();
437 }
438
439 /**
Eino-Ville Talvala40683882013-08-08 16:56:28 -0700440 * Retrieve the tag for this request, if any.
441 *
442 * <p>This tag is not used for anything by the camera device, but can be
443 * used by an application to easily identify a CaptureRequest when it is
444 * returned by
Eino-Ville Talvalafd887432014-09-04 13:07:40 -0700445 * {@link CameraCaptureSession.CaptureCallback#onCaptureCompleted CaptureCallback.onCaptureCompleted}
Eino-Ville Talvala40683882013-08-08 16:56:28 -0700446 * </p>
447 *
448 * @return the last tag Object set on this request, or {@code null} if
449 * no tag has been set.
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700450 * @see Builder#setTag
Eino-Ville Talvala40683882013-08-08 16:56:28 -0700451 */
Eino-Ville Talvala8b905572015-05-14 15:43:01 -0700452 @Nullable
Eino-Ville Talvala40683882013-08-08 16:56:28 -0700453 public Object getTag() {
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700454 return mUserTag;
Eino-Ville Talvala40683882013-08-08 16:56:28 -0700455 }
456
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700457 /**
Chien-Yu Chen5398a672015-03-19 14:48:43 -0700458 * Determine if this is a reprocess capture request.
459 *
460 * <p>A reprocess capture request produces output images from an input buffer from the
461 * {@link CameraCaptureSession}'s input {@link Surface}. A reprocess capture request can be
462 * created by {@link CameraDevice#createReprocessCaptureRequest}.</p>
463 *
464 * @return {@code true} if this is a reprocess capture request. {@code false} if this is not a
465 * reprocess capture request.
466 *
467 * @see CameraDevice#createReprocessCaptureRequest
468 */
469 public boolean isReprocess() {
470 return mIsReprocess;
471 }
472
473 /**
Zhijun Hea7677722015-06-01 16:36:06 -0700474 * <p>Determine if this request is part of a constrained high speed request list that was
Eino-Ville Talvala639fffe2015-06-30 10:34:48 -0700475 * created by
476 * {@link android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList}.
477 * A constrained high speed request list contains some constrained high speed capture requests
478 * with certain interleaved pattern that is suitable for high speed preview/video streaming. An
479 * active constrained high speed capture session only accepts constrained high speed request
480 * lists. This method can be used to do the sanity check when a constrained high speed capture
481 * session receives a request list via {@link CameraCaptureSession#setRepeatingBurst} or
482 * {@link CameraCaptureSession#captureBurst}. </p>
Zhijun Hea7677722015-06-01 16:36:06 -0700483 *
484 *
485 * @return {@code true} if this request is part of a constrained high speed request list,
486 * {@code false} otherwise.
487 *
488 * @hide
489 */
490 public boolean isPartOfCRequestList() {
491 return mIsPartOfCHSRequestList;
492 }
493
494 /**
495 * Returns a copy of the underlying {@link CameraMetadataNative}.
496 * @hide
497 */
498 public CameraMetadataNative getNativeCopy() {
Emilian Peev2100ae72018-01-12 16:56:25 +0000499 return new CameraMetadataNative(mLogicalCameraSettings);
Zhijun Hea7677722015-06-01 16:36:06 -0700500 }
501
502 /**
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700503 * Get the reprocessable session ID this reprocess capture request is associated with.
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700504 *
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700505 * @return the reprocessable session ID this reprocess capture request is associated with
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700506 *
507 * @throws IllegalStateException if this capture request is not a reprocess capture request.
508 * @hide
509 */
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700510 public int getReprocessableSessionId() {
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700511 if (mIsReprocess == false ||
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700512 mReprocessableSessionId == CameraCaptureSession.SESSION_ID_NONE) {
513 throw new IllegalStateException("Getting the reprocessable session ID for a "+
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700514 "non-reprocess capture request is illegal.");
515 }
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700516 return mReprocessableSessionId;
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700517 }
518
519 /**
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700520 * Determine whether this CaptureRequest is equal to another CaptureRequest.
521 *
522 * <p>A request is considered equal to another is if it's set of key/values is equal, it's
Chien-Yu Chen5398a672015-03-19 14:48:43 -0700523 * list of output surfaces is equal, the user tag is equal, and the return values of
524 * isReprocess() are equal.</p>
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700525 *
526 * @param other Another instance of CaptureRequest.
527 *
528 * @return True if the requests are the same, false otherwise.
529 */
530 @Override
531 public boolean equals(Object other) {
532 return other instanceof CaptureRequest
533 && equals((CaptureRequest)other);
534 }
535
536 private boolean equals(CaptureRequest other) {
537 return other != null
538 && Objects.equals(mUserTag, other.mUserTag)
539 && mSurfaceSet.equals(other.mSurfaceSet)
Emilian Peev2100ae72018-01-12 16:56:25 +0000540 && mPhysicalCameraSettings.equals(other.mPhysicalCameraSettings)
541 && mLogicalCameraId.equals(other.mLogicalCameraId)
542 && mLogicalCameraSettings.equals(other.mLogicalCameraSettings)
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700543 && mIsReprocess == other.mIsReprocess
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700544 && mReprocessableSessionId == other.mReprocessableSessionId;
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700545 }
546
547 @Override
548 public int hashCode() {
Emilian Peev2100ae72018-01-12 16:56:25 +0000549 return HashCodeHelpers.hashCodeGeneric(mPhysicalCameraSettings, mSurfaceSet, mUserTag);
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700550 }
551
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -0700552 public static final @android.annotation.NonNull Parcelable.Creator<CaptureRequest> CREATOR =
Igor Murashkin70725502013-06-25 20:27:06 +0000553 new Parcelable.Creator<CaptureRequest>() {
554 @Override
555 public CaptureRequest createFromParcel(Parcel in) {
556 CaptureRequest request = new CaptureRequest();
557 request.readFromParcel(in);
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700558
Igor Murashkin70725502013-06-25 20:27:06 +0000559 return request;
560 }
561
562 @Override
563 public CaptureRequest[] newArray(int size) {
564 return new CaptureRequest[size];
565 }
566 };
567
568 /**
569 * Expand this object from a Parcel.
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700570 * Hidden since this breaks the immutability of CaptureRequest, but is
571 * needed to receive CaptureRequests with aidl.
572 *
Igor Murashkin70725502013-06-25 20:27:06 +0000573 * @param in The parcel from which the object should be read
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700574 * @hide
Igor Murashkin70725502013-06-25 20:27:06 +0000575 */
Igor Murashkin72f9f0a2014-05-14 15:46:10 -0700576 private void readFromParcel(Parcel in) {
Emilian Peev2100ae72018-01-12 16:56:25 +0000577 int physicalCameraCount = in.readInt();
578 if (physicalCameraCount <= 0) {
579 throw new RuntimeException("Physical camera count" + physicalCameraCount +
580 " should always be positive");
581 }
582
583 //Always start with the logical camera id
584 mLogicalCameraId = in.readString();
585 mLogicalCameraSettings = new CameraMetadataNative();
586 mLogicalCameraSettings.readFromParcel(in);
587 setNativeInstance(mLogicalCameraSettings);
588 mPhysicalCameraSettings.put(mLogicalCameraId, mLogicalCameraSettings);
589 for (int i = 1; i < physicalCameraCount; i++) {
590 String physicalId = in.readString();
591 CameraMetadataNative physicalCameraSettings = new CameraMetadataNative();
592 physicalCameraSettings.readFromParcel(in);
593 mPhysicalCameraSettings.put(physicalId, physicalCameraSettings);
594 }
595
Chien-Yu Chen5398a672015-03-19 14:48:43 -0700596 mIsReprocess = (in.readInt() == 0) ? false : true;
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700597 mReprocessableSessionId = CameraCaptureSession.SESSION_ID_NONE;
Yin-Chia Yehc60af902017-11-10 20:02:29 -0800598
599 synchronized (mSurfacesLock) {
600 mSurfaceSet.clear();
601 Parcelable[] parcelableArray = in.readParcelableArray(Surface.class.getClassLoader());
602 if (parcelableArray != null) {
603 for (Parcelable p : parcelableArray) {
604 Surface s = (Surface) p;
605 mSurfaceSet.add(s);
606 }
607 }
608 // Intentionally disallow java side readFromParcel to receive streamIdx/surfaceIdx
609 // Since there is no good way to convert indexes back to Surface
610 int streamSurfaceSize = in.readInt();
611 if (streamSurfaceSize != 0) {
612 throw new RuntimeException("Reading cached CaptureRequest is not supported");
613 }
614 }
Igor Murashkin70725502013-06-25 20:27:06 +0000615 }
616
617 @Override
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700618 public int describeContents() {
619 return 0;
620 }
Igor Murashkin70725502013-06-25 20:27:06 +0000621
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700622 @Override
623 public void writeToParcel(Parcel dest, int flags) {
Emilian Peev2100ae72018-01-12 16:56:25 +0000624 int physicalCameraCount = mPhysicalCameraSettings.size();
625 dest.writeInt(physicalCameraCount);
626 //Logical camera id and settings always come first.
627 dest.writeString(mLogicalCameraId);
628 mLogicalCameraSettings.writeToParcel(dest, flags);
629 for (Map.Entry<String, CameraMetadataNative> entry : mPhysicalCameraSettings.entrySet()) {
630 if (entry.getKey().equals(mLogicalCameraId)) {
631 continue;
632 }
633 dest.writeString(entry.getKey());
634 entry.getValue().writeToParcel(dest, flags);
635 }
636
Chien-Yu Chen5398a672015-03-19 14:48:43 -0700637 dest.writeInt(mIsReprocess ? 1 : 0);
Yin-Chia Yehc60af902017-11-10 20:02:29 -0800638
639 synchronized (mSurfacesLock) {
640 final ArraySet<Surface> surfaces = mSurfaceConverted ? mEmptySurfaceSet : mSurfaceSet;
641 dest.writeParcelableArray(surfaces.toArray(new Surface[surfaces.size()]), flags);
642 if (mSurfaceConverted) {
643 dest.writeInt(mStreamIdxArray.length);
644 for (int i = 0; i < mStreamIdxArray.length; i++) {
645 dest.writeInt(mStreamIdxArray[i]);
646 dest.writeInt(mSurfaceIdxArray[i]);
647 }
648 } else {
649 dest.writeInt(0);
650 }
651 }
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700652 }
653
654 /**
Ruben Brunkfeb50af2014-05-09 19:58:49 -0700655 * @hide
656 */
657 public boolean containsTarget(Surface surface) {
658 return mSurfaceSet.contains(surface);
659 }
660
661 /**
662 * @hide
663 */
Mathew Inwoodbcbe4402018-08-08 15:42:59 +0100664 @UnsupportedAppUsage
Ruben Brunkfeb50af2014-05-09 19:58:49 -0700665 public Collection<Surface> getTargets() {
666 return Collections.unmodifiableCollection(mSurfaceSet);
667 }
668
669 /**
Emilian Peev2100ae72018-01-12 16:56:25 +0000670 * Retrieves the logical camera id.
671 * @hide
672 */
673 public String getLogicalCameraId() {
674 return mLogicalCameraId;
675 }
676
677 /**
Yin-Chia Yehc60af902017-11-10 20:02:29 -0800678 * @hide
679 */
680 public void convertSurfaceToStreamId(
681 final SparseArray<OutputConfiguration> configuredOutputs) {
682 synchronized (mSurfacesLock) {
683 if (mSurfaceConverted) {
684 Log.v(TAG, "Cannot convert already converted surfaces!");
685 return;
686 }
687
688 mStreamIdxArray = new int[mSurfaceSet.size()];
689 mSurfaceIdxArray = new int[mSurfaceSet.size()];
690 int i = 0;
691 for (Surface s : mSurfaceSet) {
692 boolean streamFound = false;
693 for (int j = 0; j < configuredOutputs.size(); ++j) {
694 int streamId = configuredOutputs.keyAt(j);
695 OutputConfiguration outConfig = configuredOutputs.valueAt(j);
696 int surfaceId = 0;
697 for (Surface outSurface : outConfig.getSurfaces()) {
698 if (s == outSurface) {
699 streamFound = true;
700 mStreamIdxArray[i] = streamId;
701 mSurfaceIdxArray[i] = surfaceId;
702 i++;
703 break;
704 }
705 surfaceId++;
706 }
707 if (streamFound) {
708 break;
709 }
710 }
Yin-Chia Yeh4f151472018-02-21 12:38:19 -0800711
712 if (!streamFound) {
713 // Check if we can match s by native object ID
714 long reqSurfaceId = SurfaceUtils.getSurfaceId(s);
715 for (int j = 0; j < configuredOutputs.size(); ++j) {
716 int streamId = configuredOutputs.keyAt(j);
717 OutputConfiguration outConfig = configuredOutputs.valueAt(j);
718 int surfaceId = 0;
719 for (Surface outSurface : outConfig.getSurfaces()) {
720 if (reqSurfaceId == SurfaceUtils.getSurfaceId(outSurface)) {
721 streamFound = true;
722 mStreamIdxArray[i] = streamId;
723 mSurfaceIdxArray[i] = surfaceId;
724 i++;
725 break;
726 }
727 surfaceId++;
728 }
729 if (streamFound) {
730 break;
731 }
732 }
733 }
734
Yin-Chia Yehc60af902017-11-10 20:02:29 -0800735 if (!streamFound) {
736 mStreamIdxArray = null;
737 mSurfaceIdxArray = null;
738 throw new IllegalArgumentException(
739 "CaptureRequest contains unconfigured Input/Output Surface!");
740 }
741 }
742 mSurfaceConverted = true;
743 }
744 }
745
746 /**
747 * @hide
748 */
749 public void recoverStreamIdToSurface() {
750 synchronized (mSurfacesLock) {
751 if (!mSurfaceConverted) {
752 Log.v(TAG, "Cannot convert already converted surfaces!");
753 return;
754 }
755
756 mStreamIdxArray = null;
757 mSurfaceIdxArray = null;
758 mSurfaceConverted = false;
759 }
760 }
761
762 /**
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700763 * A builder for capture requests.
764 *
765 * <p>To obtain a builder instance, use the
766 * {@link CameraDevice#createCaptureRequest} method, which initializes the
767 * request fields to one of the templates defined in {@link CameraDevice}.
768 *
769 * @see CameraDevice#createCaptureRequest
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -0700770 * @see CameraDevice#TEMPLATE_PREVIEW
771 * @see CameraDevice#TEMPLATE_RECORD
772 * @see CameraDevice#TEMPLATE_STILL_CAPTURE
773 * @see CameraDevice#TEMPLATE_VIDEO_SNAPSHOT
774 * @see CameraDevice#TEMPLATE_MANUAL
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700775 */
776 public final static class Builder {
777
Igor Murashkin7a36a0f2013-09-10 18:13:09 -0700778 private final CaptureRequest mRequest;
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700779
780 /**
781 * Initialize the builder using the template; the request takes
782 * ownership of the template.
783 *
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700784 * @param template Template settings for this capture request.
785 * @param reprocess Indicates whether to create a reprocess capture request. {@code true}
786 * to create a reprocess capture request. {@code false} to create a regular
787 * capture request.
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700788 * @param reprocessableSessionId The ID of the camera capture session this capture is
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700789 * created for. This is used to validate if the application
790 * submits a reprocess capture request to the same session
791 * where the {@link TotalCaptureResult}, used to create the
792 * reprocess capture, came from.
Emilian Peev2100ae72018-01-12 16:56:25 +0000793 * @param logicalCameraId Camera Id of the actively open camera that instantiates the
794 * Builder.
795 * @param physicalCameraIdSet A set of physical camera ids that can be used to customize
796 * the request for a specific physical camera.
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700797 *
798 * @throws IllegalArgumentException If creating a reprocess capture request with an invalid
Chien-Yu Chen8062d312015-05-12 14:24:10 -0700799 * reprocessableSessionId.
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700800 * @hide
801 */
Chien-Yu Chen7a316f6b2015-04-13 14:31:45 -0700802 public Builder(CameraMetadataNative template, boolean reprocess,
Emilian Peev2100ae72018-01-12 16:56:25 +0000803 int reprocessableSessionId, String logicalCameraId,
804 Set<String> physicalCameraIdSet) {
805 mRequest = new CaptureRequest(template, reprocess, reprocessableSessionId,
806 logicalCameraId, physicalCameraIdSet);
Igor Murashkin70725502013-06-25 20:27:06 +0000807 }
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700808
809 /**
810 * <p>Add a surface to the list of targets for this request</p>
811 *
812 * <p>The Surface added must be one of the surfaces included in the most
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -0700813 * recent call to {@link CameraDevice#createCaptureSession}, when the
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700814 * request is given to the camera device.</p>
815 *
816 * <p>Adding a target more than once has no effect.</p>
817 *
818 * @param outputTarget Surface to use as an output target for this request
819 */
Eino-Ville Talvala8b905572015-05-14 15:43:01 -0700820 public void addTarget(@NonNull Surface outputTarget) {
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700821 mRequest.mSurfaceSet.add(outputTarget);
822 }
823
824 /**
825 * <p>Remove a surface from the list of targets for this request.</p>
826 *
827 * <p>Removing a target that is not currently added has no effect.</p>
828 *
829 * @param outputTarget Surface to use as an output target for this request
830 */
Eino-Ville Talvala8b905572015-05-14 15:43:01 -0700831 public void removeTarget(@NonNull Surface outputTarget) {
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700832 mRequest.mSurfaceSet.remove(outputTarget);
833 }
834
835 /**
836 * Set a capture request field to a value. The field definitions can be
837 * found in {@link CaptureRequest}.
838 *
Eino-Ville Talvalad8407272015-11-08 18:27:20 -0800839 * <p>Setting a field to {@code null} will remove that field from the capture request.
840 * Unless the field is optional, removing it will likely produce an error from the camera
841 * device when the request is submitted.</p>
842 *
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700843 * @param key The metadata field to write.
844 * @param value The value to set the field to, which must be of a matching
845 * type to the key.
846 */
Eino-Ville Talvala8b905572015-05-14 15:43:01 -0700847 public <T> void set(@NonNull Key<T> key, T value) {
Emilian Peev2100ae72018-01-12 16:56:25 +0000848 mRequest.mLogicalCameraSettings.set(key, value);
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700849 }
850
851 /**
852 * Get a capture request field value. The field definitions can be
853 * found in {@link CaptureRequest}.
854 *
855 * @throws IllegalArgumentException if the key was not valid
856 *
857 * @param key The metadata field to read.
858 * @return The value of that key, or {@code null} if the field is not set.
859 */
Eino-Ville Talvala8b905572015-05-14 15:43:01 -0700860 @Nullable
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700861 public <T> T get(Key<T> key) {
Emilian Peev2100ae72018-01-12 16:56:25 +0000862 return mRequest.mLogicalCameraSettings.get(key);
863 }
864
865 /**
866 * Set a capture request field to a value. The field definitions can be
867 * found in {@link CaptureRequest}.
868 *
869 * <p>Setting a field to {@code null} will remove that field from the capture request.
870 * Unless the field is optional, removing it will likely produce an error from the camera
871 * device when the request is submitted.</p>
872 *
873 *<p>This method can be called for logical camera devices, which are devices that have
874 * REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA capability and calls to
Shuzhen Wangbde13972018-03-19 10:30:45 -0700875 * {@link CameraCharacteristics#getPhysicalCameraIds} return a non-empty set of
Emilian Peev2100ae72018-01-12 16:56:25 +0000876 * physical devices that are backing the logical camera. The camera Id included in the
877 * 'physicalCameraId' argument selects an individual physical device that will receive
878 * the customized capture request field.</p>
879 *
880 * @throws IllegalArgumentException if the physical camera id is not valid
881 *
882 * @param key The metadata field to write.
Emilian Peevca57d302019-09-13 15:58:43 -0700883 * @param value The value to set the field to, which must be of a matching type to the key.
Emilian Peev2100ae72018-01-12 16:56:25 +0000884 * @param physicalCameraId A valid physical camera Id. The valid camera Ids can be obtained
885 * via calls to {@link CameraCharacteristics#getPhysicalCameraIds}.
886 * @return The builder object.
Emilian Peev2100ae72018-01-12 16:56:25 +0000887 */
888 public <T> Builder setPhysicalCameraKey(@NonNull Key<T> key, T value,
889 @NonNull String physicalCameraId) {
890 if (!mRequest.mPhysicalCameraSettings.containsKey(physicalCameraId)) {
891 throw new IllegalArgumentException("Physical camera id: " + physicalCameraId +
892 " is not valid!");
893 }
894
895 mRequest.mPhysicalCameraSettings.get(physicalCameraId).set(key, value);
896
897 return this;
898 }
899
900 /**
901 * Get a capture request field value for a specific physical camera Id. The field
902 * definitions can be found in {@link CaptureRequest}.
903 *
904 *<p>This method can be called for logical camera devices, which are devices that have
905 * REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA capability and calls to
906 * {@link CameraCharacteristics#getPhysicalCameraIds} return a non-empty list of
907 * physical devices that are backing the logical camera. The camera Id included in the
908 * 'physicalCameraId' argument selects an individual physical device and returns
909 * its specific capture request field.</p>
910 *
911 * @throws IllegalArgumentException if the key or physical camera id were not valid
912 *
913 * @param key The metadata field to read.
914 * @param physicalCameraId A valid physical camera Id. The valid camera Ids can be obtained
915 * via calls to {@link CameraCharacteristics#getPhysicalCameraIds}.
916 * @return The value of that key, or {@code null} if the field is not set.
917 */
918 @Nullable
919 public <T> T getPhysicalCameraKey(Key<T> key,@NonNull String physicalCameraId) {
920 if (!mRequest.mPhysicalCameraSettings.containsKey(physicalCameraId)) {
921 throw new IllegalArgumentException("Physical camera id: " + physicalCameraId +
922 " is not valid!");
923 }
924
925 return mRequest.mPhysicalCameraSettings.get(physicalCameraId).get(key);
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700926 }
927
928 /**
929 * Set a tag for this request.
930 *
931 * <p>This tag is not used for anything by the camera device, but can be
932 * used by an application to easily identify a CaptureRequest when it is
933 * returned by
Eino-Ville Talvalafd887432014-09-04 13:07:40 -0700934 * {@link CameraCaptureSession.CaptureCallback#onCaptureCompleted CaptureCallback.onCaptureCompleted}
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700935 *
936 * @param tag an arbitrary Object to store with this request
937 * @see CaptureRequest#getTag
938 */
Eino-Ville Talvala8b905572015-05-14 15:43:01 -0700939 public void setTag(@Nullable Object tag) {
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700940 mRequest.mUserTag = tag;
941 }
942
943 /**
Zhijun Hea7677722015-06-01 16:36:06 -0700944 * <p>Mark this request as part of a constrained high speed request list created by
Eino-Ville Talvala639fffe2015-06-30 10:34:48 -0700945 * {@link android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList}.
946 * A constrained high speed request list contains some constrained high speed capture
947 * requests with certain interleaved pattern that is suitable for high speed preview/video
948 * streaming.</p>
Zhijun Hea7677722015-06-01 16:36:06 -0700949 *
950 * @hide
951 */
Mathew Inwoodbcbe4402018-08-08 15:42:59 +0100952 @UnsupportedAppUsage
Zhijun Hea7677722015-06-01 16:36:06 -0700953 public void setPartOfCHSRequestList(boolean partOfCHSList) {
954 mRequest.mIsPartOfCHSRequestList = partOfCHSList;
955 }
956
957 /**
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700958 * Build a request using the current target Surfaces and settings.
Sol Boucheredeab402014-07-09 18:36:28 -0700959 * <p>Note that, although it is possible to create a {@code CaptureRequest} with no target
960 * {@link Surface}s, passing such a request into {@link CameraCaptureSession#capture},
961 * {@link CameraCaptureSession#captureBurst},
962 * {@link CameraCaptureSession#setRepeatingBurst}, or
963 * {@link CameraCaptureSession#setRepeatingRequest} will cause that method to throw an
964 * {@link IllegalArgumentException}.</p>
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700965 *
966 * @return A new capture request instance, ready for submission to the
967 * camera device.
968 */
Eino-Ville Talvala8b905572015-05-14 15:43:01 -0700969 @NonNull
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700970 public CaptureRequest build() {
971 return new CaptureRequest(mRequest);
972 }
973
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700974 /**
975 * @hide
976 */
977 public boolean isEmpty() {
Emilian Peev2100ae72018-01-12 16:56:25 +0000978 return mRequest.mLogicalCameraSettings.isEmpty();
Eino-Ville Talvala70c22072013-08-27 12:09:04 -0700979 }
980
Eino-Ville Talvalab2675542012-12-12 13:29:45 -0800981 }
982
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700983 /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
984 * The key entries below this point are generated from metadata
985 * definitions in /system/media/camera/docs. Do not modify by hand or
986 * modify the comment blocks at the start or end.
987 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/
988
989 /**
Igor Murashkin7d2a5c52014-01-17 15:07:52 -0800990 * <p>The mode control selects how the image data is converted from the
991 * sensor's native color into linear sRGB color.</p>
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -0700992 * <p>When auto-white balance (AWB) is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this
Igor Murashkin7d2a5c52014-01-17 15:07:52 -0800993 * control is overridden by the AWB routine. When AWB is disabled, the
994 * application controls how the color mapping is performed.</p>
995 * <p>We define the expected processing pipeline below. For consistency
996 * across devices, this is always the case with TRANSFORM_MATRIX.</p>
Shuzhen Wang1ab85142019-07-08 15:14:16 -0700997 * <p>When either FAST or HIGH_QUALITY is used, the camera device may
Igor Murashkin7d2a5c52014-01-17 15:07:52 -0800998 * do additional processing but {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
999 * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} will still be provided by the
1000 * camera device (in the results) and be roughly correct.</p>
1001 * <p>Switching to TRANSFORM_MATRIX and using the data provided from
1002 * FAST or HIGH_QUALITY will yield a picture with the same white point
1003 * as what was produced by the camera device in the earlier frame.</p>
1004 * <p>The expected processing pipeline is as follows:</p>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08001005 * <p><img alt="White balance processing pipeline" src="/reference/images/camera2/metadata/android.colorCorrection.mode/processing_pipeline.png" /></p>
Igor Murashkin7d2a5c52014-01-17 15:07:52 -08001006 * <p>The white balance is encoded by two values, a 4-channel white-balance
1007 * gain vector (applied in the Bayer domain), and a 3x3 color transform
1008 * matrix (applied after demosaic).</p>
1009 * <p>The 4-channel white-balance gains are defined as:</p>
1010 * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} = [ R G_even G_odd B ]
1011 * </code></pre>
1012 * <p>where <code>G_even</code> is the gain for green pixels on even rows of the
1013 * output, and <code>G_odd</code> is the gain for green pixels on the odd rows.
1014 * These may be identical for a given camera device implementation; if
1015 * the camera device does not support a separate gain for even/odd green
1016 * channels, it will use the <code>G_even</code> value, and write <code>G_odd</code> equal to
1017 * <code>G_even</code> in the output result metadata.</p>
1018 * <p>The matrices for color transforms are defined as a 9-entry vector:</p>
1019 * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} = [ I0 I1 I2 I3 I4 I5 I6 I7 I8 ]
1020 * </code></pre>
1021 * <p>which define a transform from input sensor colors, <code>P_in = [ r g b ]</code>,
1022 * to output linear sRGB, <code>P_out = [ r' g' b' ]</code>,</p>
1023 * <p>with colors as follows:</p>
1024 * <pre><code>r' = I0r + I1g + I2b
1025 * g' = I3r + I4g + I5b
1026 * b' = I6r + I7g + I8b
1027 * </code></pre>
1028 * <p>Both the input and output value ranges must match. Overflow/underflow
1029 * values are clipped to fit within the range.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001030 * <p><b>Possible values:</b>
1031 * <ul>
1032 * <li>{@link #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX TRANSFORM_MATRIX}</li>
1033 * <li>{@link #COLOR_CORRECTION_MODE_FAST FAST}</li>
1034 * <li>{@link #COLOR_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
1035 * </ul></p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001036 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001037 * <p><b>Full capability</b> -
1038 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
1039 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001040 *
Igor Murashkin7d2a5c52014-01-17 15:07:52 -08001041 * @see CaptureRequest#COLOR_CORRECTION_GAINS
1042 * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001043 * @see CaptureRequest#CONTROL_AWB_MODE
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001044 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001045 * @see #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX
1046 * @see #COLOR_CORRECTION_MODE_FAST
1047 * @see #COLOR_CORRECTION_MODE_HIGH_QUALITY
1048 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001049 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001050 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001051 public static final Key<Integer> COLOR_CORRECTION_MODE =
1052 new Key<Integer>("android.colorCorrection.mode", int.class);
1053
1054 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08001055 * <p>A color transform matrix to use to transform
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07001056 * from sensor RGB color space to output linear sRGB color space.</p>
Zhijun He49a3ca92014-02-05 13:48:09 -08001057 * <p>This matrix is either set by the camera device when the request
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001058 * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not TRANSFORM_MATRIX, or
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001059 * directly by the application in the request when the
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001060 * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is TRANSFORM_MATRIX.</p>
Zhijun He49a3ca92014-02-05 13:48:09 -08001061 * <p>In the latter case, the camera device may round the matrix to account
1062 * for precision issues; the final rounded matrix should be reported back
1063 * in this matrix result metadata. The transform should keep the magnitude
1064 * of the output color values within <code>[0, 1.0]</code> (assuming input color
1065 * values is within the normalized range <code>[0, 1.0]</code>), or clipping may occur.</p>
Yin-Chia Yehd9fc67c2015-01-30 10:47:22 -08001066 * <p>The valid range of each matrix element varies on different devices, but
1067 * values within [-1.5, 3.0] are guaranteed not to be clipped.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001068 * <p><b>Units</b>: Unitless scale factors</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001069 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001070 * <p><b>Full capability</b> -
1071 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
1072 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001073 *
1074 * @see CaptureRequest#COLOR_CORRECTION_MODE
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001075 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001076 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001077 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001078 @NonNull
Eino-Ville Talvala2bb91a72014-05-27 18:16:53 -07001079 public static final Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM =
1080 new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.colorCorrection.transform", android.hardware.camera2.params.ColorSpaceTransform.class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001081
1082 /**
Igor Murashkin7d2a5c52014-01-17 15:07:52 -08001083 * <p>Gains applying to Bayer raw color channels for
Zhijun Hecc28a412014-02-24 15:11:23 -08001084 * white-balance.</p>
Eino-Ville Talvala2bb91a72014-05-27 18:16:53 -07001085 * <p>These per-channel gains are either set by the camera device
1086 * when the request {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not
1087 * TRANSFORM_MATRIX, or directly by the application in the
1088 * request when the {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is
1089 * TRANSFORM_MATRIX.</p>
1090 * <p>The gains in the result metadata are the gains actually
1091 * applied by the camera device to the current frame.</p>
Yin-Chia Yehd9fc67c2015-01-30 10:47:22 -08001092 * <p>The valid range of gains varies on different devices, but gains
1093 * between [1.0, 3.0] are guaranteed not to be clipped. Even if a given
1094 * device allows gains below 1.0, this is usually not recommended because
1095 * this can create color artifacts.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001096 * <p><b>Units</b>: Unitless gain factors</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001097 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001098 * <p><b>Full capability</b> -
1099 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
1100 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001101 *
1102 * @see CaptureRequest#COLOR_CORRECTION_MODE
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001103 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001104 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001105 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001106 @NonNull
Eino-Ville Talvala2bb91a72014-05-27 18:16:53 -07001107 public static final Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS =
1108 new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001109
1110 /**
Zhijun Hea05e59d2014-07-08 18:27:47 -07001111 * <p>Mode of operation for the chromatic aberration correction algorithm.</p>
Zhijun Hea05e59d2014-07-08 18:27:47 -07001112 * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light
1113 * can not focus on the same point after exiting from the lens. This metadata defines
1114 * the high level control of chromatic aberration correction algorithm, which aims to
1115 * minimize the chromatic artifacts that may occur along the object boundaries in an
1116 * image.</p>
1117 * <p>FAST/HIGH_QUALITY both mean that camera device determined aberration
1118 * correction will be applied. HIGH_QUALITY mode indicates that the camera device will
1119 * use the highest-quality aberration correction algorithms, even if it slows down
1120 * capture rate. FAST means the camera device will not slow down capture rate when
1121 * applying aberration correction.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001122 * <p>LEGACY devices will always be in FAST mode.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001123 * <p><b>Possible values:</b>
1124 * <ul>
1125 * <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_OFF OFF}</li>
1126 * <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_FAST FAST}</li>
1127 * <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
1128 * </ul></p>
1129 * <p><b>Available values for this device:</b><br>
1130 * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES android.colorCorrection.availableAberrationModes}</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001131 * <p>This key is available on all devices.</p>
Zhijun Hea05e59d2014-07-08 18:27:47 -07001132 *
Zhijun He9e4e4392014-08-18 11:12:32 -07001133 * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES
1134 * @see #COLOR_CORRECTION_ABERRATION_MODE_OFF
1135 * @see #COLOR_CORRECTION_ABERRATION_MODE_FAST
1136 * @see #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY
Zhijun Hea05e59d2014-07-08 18:27:47 -07001137 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001138 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001139 @NonNull
Zhijun He9e4e4392014-08-18 11:12:32 -07001140 public static final Key<Integer> COLOR_CORRECTION_ABERRATION_MODE =
1141 new Key<Integer>("android.colorCorrection.aberrationMode", int.class);
Zhijun Hea05e59d2014-07-08 18:27:47 -07001142
1143 /**
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001144 * <p>The desired setting for the camera device's auto-exposure
1145 * algorithm's antibanding compensation.</p>
1146 * <p>Some kinds of lighting fixtures, such as some fluorescent
1147 * lights, flicker at the rate of the power supply frequency
1148 * (60Hz or 50Hz, depending on country). While this is
1149 * typically not noticeable to a person, it can be visible to
1150 * a camera device. If a camera sets its exposure time to the
1151 * wrong value, the flicker may become visible in the
1152 * viewfinder as flicker or in a final captured image, as a
1153 * set of variable-brightness bands across the image.</p>
1154 * <p>Therefore, the auto-exposure routines of camera devices
1155 * include antibanding routines that ensure that the chosen
1156 * exposure value will not cause such banding. The choice of
1157 * exposure time depends on the rate of flicker, which the
1158 * camera device can detect automatically, or the expected
1159 * rate can be selected by the application using this
1160 * control.</p>
1161 * <p>A given camera device may not support all of the possible
1162 * options for the antibanding mode. The
1163 * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes} key contains
1164 * the available modes for a given camera device.</p>
Yin-Chia Yeh7b2cae62014-11-25 11:54:18 -08001165 * <p>AUTO mode is the default if it is available on given
1166 * camera device. When AUTO mode is not available, the
1167 * default will be either 50HZ or 60HZ, and both 50HZ
1168 * and 60HZ will be available.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001169 * <p>If manual exposure control is enabled (by setting
1170 * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} to OFF),
1171 * then this setting has no effect, and the application must
1172 * ensure it selects exposure times that do not cause banding
1173 * issues. The {@link CaptureResult#STATISTICS_SCENE_FLICKER android.statistics.sceneFlicker} key can assist
1174 * the application in this.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001175 * <p><b>Possible values:</b>
1176 * <ul>
1177 * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_OFF OFF}</li>
1178 * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_50HZ 50HZ}</li>
1179 * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_60HZ 60HZ}</li>
1180 * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_AUTO AUTO}</li>
1181 * </ul></p>
1182 * <p><b>Available values for this device:</b><br></p>
1183 * <p>{@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes}</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001184 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001185 *
Zhijun He5f2a47f2014-01-16 15:44:41 -08001186 * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES
Zhijun He399f05d2014-01-15 11:31:30 -08001187 * @see CaptureRequest#CONTROL_AE_MODE
Eino-Ville Talvala265b34c2014-01-16 16:18:52 -08001188 * @see CaptureRequest#CONTROL_MODE
1189 * @see CaptureResult#STATISTICS_SCENE_FLICKER
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001190 * @see #CONTROL_AE_ANTIBANDING_MODE_OFF
1191 * @see #CONTROL_AE_ANTIBANDING_MODE_50HZ
1192 * @see #CONTROL_AE_ANTIBANDING_MODE_60HZ
1193 * @see #CONTROL_AE_ANTIBANDING_MODE_AUTO
1194 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001195 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001196 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001197 public static final Key<Integer> CONTROL_AE_ANTIBANDING_MODE =
1198 new Key<Integer>("android.control.aeAntibandingMode", int.class);
1199
1200 /**
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07001201 * <p>Adjustment to auto-exposure (AE) target image
1202 * brightness.</p>
1203 * <p>The adjustment is measured as a count of steps, with the
1204 * step size defined by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP android.control.aeCompensationStep} and the
1205 * allowed range by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}.</p>
1206 * <p>For example, if the exposure value (EV) step is 0.333, '6'
1207 * will mean an exposure compensation of +2 EV; -3 will mean an
1208 * exposure compensation of -1 EV. One EV represents a doubling
1209 * of image brightness. Note that this control will only be
1210 * effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF. This control
1211 * will take effect even when {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} <code>== true</code>.</p>
Yin-Chia Yeha4227df2014-05-05 14:27:39 -07001212 * <p>In the event of exposure compensation value being changed, camera device
1213 * may take several frames to reach the newly requested exposure target.
1214 * During that time, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} field will be in the SEARCHING
1215 * state. Once the new exposure target is reached, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} will
1216 * change from SEARCHING to either CONVERGED, LOCKED (if AE lock is enabled), or
1217 * FLASH_REQUIRED (if the scene is too dark for still capture).</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001218 * <p><b>Units</b>: Compensation steps</p>
1219 * <p><b>Range of valid values:</b><br>
1220 * {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001221 * <p>This key is available on all devices.</p>
Yin-Chia Yeha4227df2014-05-05 14:27:39 -07001222 *
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07001223 * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE
1224 * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP
Yin-Chia Yeha4227df2014-05-05 14:27:39 -07001225 * @see CaptureRequest#CONTROL_AE_LOCK
1226 * @see CaptureRequest#CONTROL_AE_MODE
1227 * @see CaptureResult#CONTROL_AE_STATE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001228 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001229 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001230 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001231 public static final Key<Integer> CONTROL_AE_EXPOSURE_COMPENSATION =
1232 new Key<Integer>("android.control.aeExposureCompensation", int.class);
1233
1234 /**
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07001235 * <p>Whether auto-exposure (AE) is currently locked to its latest
Zhijun He49a3ca92014-02-05 13:48:09 -08001236 * calculated values.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001237 * <p>When set to <code>true</code> (ON), the AE algorithm is locked to its latest parameters,
1238 * and will not change exposure settings until the lock is set to <code>false</code> (OFF).</p>
1239 * <p>Note that even when AE is locked, the flash may be fired if
1240 * the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_AUTO_FLASH /
1241 * ON_ALWAYS_FLASH / ON_AUTO_FLASH_REDEYE.</p>
Yin-Chia Yeha4227df2014-05-05 14:27:39 -07001242 * <p>When {@link CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION android.control.aeExposureCompensation} is changed, even if the AE lock
1243 * is ON, the camera device will still adjust its exposure value.</p>
Zhijun He49a3ca92014-02-05 13:48:09 -08001244 * <p>If AE precapture is triggered (see {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger})
1245 * when AE is already locked, the camera device will not change the exposure time
1246 * ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}) and sensitivity ({@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity})
Eino-Ville Talvalad8fd6792014-02-10 12:41:04 -08001247 * parameters. The flash may be fired if the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}
Zhijun He49a3ca92014-02-05 13:48:09 -08001248 * is ON_AUTO_FLASH/ON_AUTO_FLASH_REDEYE and the scene is too dark. If the
Zhijun Hefa95b042015-02-09 10:40:49 -08001249 * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_ALWAYS_FLASH, the scene may become overexposed.
1250 * Similarly, AE precapture trigger CANCEL has no effect when AE is already locked.</p>
1251 * <p>When an AE precapture sequence is triggered, AE unlock will not be able to unlock
1252 * the AE if AE is locked by the camera device internally during precapture metering
1253 * sequence In other words, submitting requests with AE unlock has no effect for an
1254 * ongoing precapture metering sequence. Otherwise, the precapture metering sequence
1255 * will never succeed in a sequence of preview requests where AE lock is always set
1256 * to <code>false</code>.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001257 * <p>Since the camera device has a pipeline of in-flight requests, the settings that
1258 * get locked do not necessarily correspond to the settings that were present in the
1259 * latest capture result received from the camera device, since additional captures
1260 * and AE updates may have occurred even before the result was sent out. If an
1261 * application is switching between automatic and manual control and wishes to eliminate
1262 * any flicker during the switch, the following procedure is recommended:</p>
1263 * <ol>
1264 * <li>Starting in auto-AE mode:</li>
1265 * <li>Lock AE</li>
1266 * <li>Wait for the first result to be output that has the AE locked</li>
1267 * <li>Copy exposure settings from that result into a request, set the request to manual AE</li>
1268 * <li>Submit the capture request, proceed to run manual AE as desired.</li>
1269 * </ol>
Zhijun He49a3ca92014-02-05 13:48:09 -08001270 * <p>See {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE lock related state transition details.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001271 * <p>This key is available on all devices.</p>
Zhijun He49a3ca92014-02-05 13:48:09 -08001272 *
Yin-Chia Yeha4227df2014-05-05 14:27:39 -07001273 * @see CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION
Zhijun He49a3ca92014-02-05 13:48:09 -08001274 * @see CaptureRequest#CONTROL_AE_MODE
1275 * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
1276 * @see CaptureResult#CONTROL_AE_STATE
1277 * @see CaptureRequest#SENSOR_EXPOSURE_TIME
1278 * @see CaptureRequest#SENSOR_SENSITIVITY
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001279 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001280 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001281 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001282 public static final Key<Boolean> CONTROL_AE_LOCK =
1283 new Key<Boolean>("android.control.aeLock", boolean.class);
1284
1285 /**
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001286 * <p>The desired mode for the camera device's
1287 * auto-exposure routine.</p>
1288 * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is
1289 * AUTO.</p>
1290 * <p>When set to any of the ON modes, the camera device's
1291 * auto-exposure routine is enabled, overriding the
1292 * application's selected exposure time, sensor sensitivity,
1293 * and frame duration ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
1294 * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and
1295 * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}). If one of the FLASH modes
1296 * is selected, the camera device's flash unit controls are
1297 * also overridden.</p>
1298 * <p>The FLASH modes are only available if the camera device
1299 * has a flash unit ({@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} is <code>true</code>).</p>
1300 * <p>If flash TORCH mode is desired, this field must be set to
1301 * ON or OFF, and {@link CaptureRequest#FLASH_MODE android.flash.mode} set to TORCH.</p>
1302 * <p>When set to any of the ON modes, the values chosen by the
1303 * camera device auto-exposure routine for the overridden
1304 * fields for a given capture will be available in its
1305 * CaptureResult.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001306 * <p><b>Possible values:</b>
1307 * <ul>
1308 * <li>{@link #CONTROL_AE_MODE_OFF OFF}</li>
1309 * <li>{@link #CONTROL_AE_MODE_ON ON}</li>
1310 * <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH ON_AUTO_FLASH}</li>
1311 * <li>{@link #CONTROL_AE_MODE_ON_ALWAYS_FLASH ON_ALWAYS_FLASH}</li>
1312 * <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE ON_AUTO_FLASH_REDEYE}</li>
Chien-Yu Chen2cf33572018-01-11 11:35:41 -08001313 * <li>{@link #CONTROL_AE_MODE_ON_EXTERNAL_FLASH ON_EXTERNAL_FLASH}</li>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001314 * </ul></p>
1315 * <p><b>Available values for this device:</b><br>
1316 * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES android.control.aeAvailableModes}</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001317 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001318 *
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001319 * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES
Zhijun He5f2a47f2014-01-16 15:44:41 -08001320 * @see CaptureRequest#CONTROL_MODE
Eino-Ville Talvala265b34c2014-01-16 16:18:52 -08001321 * @see CameraCharacteristics#FLASH_INFO_AVAILABLE
1322 * @see CaptureRequest#FLASH_MODE
Igor Murashkinaef3b7e2014-01-15 13:20:37 -08001323 * @see CaptureRequest#SENSOR_EXPOSURE_TIME
1324 * @see CaptureRequest#SENSOR_FRAME_DURATION
Zhijun He399f05d2014-01-15 11:31:30 -08001325 * @see CaptureRequest#SENSOR_SENSITIVITY
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001326 * @see #CONTROL_AE_MODE_OFF
1327 * @see #CONTROL_AE_MODE_ON
1328 * @see #CONTROL_AE_MODE_ON_AUTO_FLASH
1329 * @see #CONTROL_AE_MODE_ON_ALWAYS_FLASH
1330 * @see #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE
Chien-Yu Chen2cf33572018-01-11 11:35:41 -08001331 * @see #CONTROL_AE_MODE_ON_EXTERNAL_FLASH
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001332 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001333 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001334 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001335 public static final Key<Integer> CONTROL_AE_MODE =
1336 new Key<Integer>("android.control.aeMode", int.class);
1337
1338 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001339 * <p>List of metering areas to use for auto-exposure adjustment.</p>
1340 * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe} is 0.
Yin-Chia Yeh808150f2014-09-08 15:48:47 -07001341 * Otherwise will always be present.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001342 * <p>The maximum number of regions supported by the device is determined by the value
1343 * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe}.</p>
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001344 * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1345 * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being
1346 * the top-left pixel in the active pixel array, and
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001347 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001348 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1349 * active pixel array.</p>
1350 * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1351 * system depends on the mode being set.
1352 * When the distortion correction mode is OFF, the coordinate system follows
1353 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
1354 * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and
1355 * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1,
1356 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right
1357 * pixel in the pre-correction active pixel array.
1358 * When the distortion correction mode is not OFF, the coordinate system follows
1359 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
1360 * <code>(0, 0)</code> being the top-left pixel of the active array, and
1361 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1362 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1363 * active pixel array.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001364 * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight
Yin-Chia Yeh97f1c852014-05-28 16:36:05 -07001365 * for every pixel in the area. This means that a large metering area
1366 * with the same weight as a smaller area will have more effect in
1367 * the metering result. Metering areas can partially overlap and the
1368 * camera device will add the weights in the overlap region.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001369 * <p>The weights are relative to weights of other exposure metering regions, so if only one
1370 * region is used, all non-zero weights will have the same effect. A region with 0
1371 * weight is ignored.</p>
1372 * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
1373 * camera device.</p>
1374 * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
1375 * capture result metadata, the camera device will ignore the sections outside the crop
1376 * region and output only the intersection rectangle as the metering region in the result
1377 * metadata. If the region is entirely outside the crop region, it will be ignored and
1378 * not reported in the result metadata.</p>
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08001379 * <p>Starting from API level 30, the coordinate system of activeArraySize or
1380 * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
1381 * pre-zoom field of view. This means that the same aeRegions values at different
1382 * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The aeRegions
1383 * coordinates are relative to the activeArray/preCorrectionActiveArray representing the
1384 * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same
1385 * aeRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of the
1386 * scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use
1387 * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
1388 * mode.</p>
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001389 * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
1390 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on
1391 * distortion correction capability and mode</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001392 * <p><b>Range of valid values:</b><br>
1393 * Coordinates must be between <code>[(0,0), (width, height))</code> of
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001394 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
1395 * depending on distortion correction capability and mode</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001396 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001397 *
Yin-Chia Yeh808150f2014-09-08 15:48:47 -07001398 * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08001399 * @see CaptureRequest#CONTROL_ZOOM_RATIO
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001400 * @see CaptureRequest#DISTORTION_CORRECTION_MODE
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001401 * @see CaptureRequest#SCALER_CROP_REGION
Eino-Ville Talvala265b34c2014-01-16 16:18:52 -08001402 * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001403 * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001404 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001405 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001406 @NonNull
Yin-Chia Yeh817f8932014-05-19 10:23:27 -07001407 public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS =
1408 new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.aeRegions", android.hardware.camera2.params.MeteringRectangle[].class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001409
1410 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001411 * <p>Range over which the auto-exposure routine can
1412 * adjust the capture frame rate to maintain good
1413 * exposure.</p>
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07001414 * <p>Only constrains auto-exposure (AE) algorithm, not
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001415 * manual control of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime} and
1416 * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}.</p>
1417 * <p><b>Units</b>: Frames per second (FPS)</p>
1418 * <p><b>Range of valid values:</b><br>
1419 * Any of the entries in {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES android.control.aeAvailableTargetFpsRanges}</p>
1420 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001421 *
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001422 * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001423 * @see CaptureRequest#SENSOR_EXPOSURE_TIME
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001424 * @see CaptureRequest#SENSOR_FRAME_DURATION
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001425 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001426 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001427 @NonNull
Igor Murashkin78712a82014-05-27 18:32:18 -07001428 public static final Key<android.util.Range<Integer>> CONTROL_AE_TARGET_FPS_RANGE =
1429 new Key<android.util.Range<Integer>>("android.control.aeTargetFpsRange", new TypeReference<android.util.Range<Integer>>() {{ }});
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001430
1431 /**
Zhijun He228f4f92014-01-16 17:22:05 -08001432 * <p>Whether the camera device will trigger a precapture
1433 * metering sequence when it processes this request.</p>
Igor Murashkinace5bf02013-12-10 17:36:40 -08001434 * <p>This entry is normally set to IDLE, or is not
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001435 * included at all in the request settings. When included and
Zhijun Hedd72be52015-02-06 13:49:51 -08001436 * set to START, the camera device will trigger the auto-exposure (AE)
Igor Murashkinace5bf02013-12-10 17:36:40 -08001437 * precapture metering sequence.</p>
Zhijun Hefa95b042015-02-09 10:40:49 -08001438 * <p>When set to CANCEL, the camera device will cancel any active
1439 * precapture metering trigger, and return to its initial AE state.
1440 * If a precapture metering sequence is already completed, and the camera
1441 * device has implicitly locked the AE for subsequent still capture, the
1442 * CANCEL trigger will unlock the AE and return to its initial AE state.</p>
Zhijun Hedd72be52015-02-06 13:49:51 -08001443 * <p>The precapture sequence should be triggered before starting a
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07001444 * high-quality still capture for final metering decisions to
1445 * be made, and for firing pre-capture flash pulses to estimate
1446 * scene brightness and required final capture flash power, when
1447 * the flash is enabled.</p>
1448 * <p>Normally, this entry should be set to START for only a
1449 * single request, and the application should wait until the
1450 * sequence completes before starting a new one.</p>
Zhijun Hedd72be52015-02-06 13:49:51 -08001451 * <p>When a precapture metering sequence is finished, the camera device
1452 * may lock the auto-exposure routine internally to be able to accurately expose the
1453 * subsequent still capture image (<code>{@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE</code>).
1454 * For this case, the AE may not resume normal scan if no subsequent still capture is
1455 * submitted. To ensure that the AE routine restarts normal scan, the application should
1456 * submit a request with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == true</code>, followed by a request
1457 * with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == false</code>, if the application decides not to submit a
Zhijun Hefa95b042015-02-09 10:40:49 -08001458 * still capture request after the precapture sequence completes. Alternatively, for
1459 * API level 23 or newer devices, the CANCEL can be used to unlock the camera device
1460 * internally locked AE if the application doesn't submit a still capture request after
1461 * the AE precapture trigger. Note that, the CANCEL was added in API level 23, and must not
1462 * be used in devices that have earlier API levels.</p>
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07001463 * <p>The exact effect of auto-exposure (AE) precapture trigger
1464 * depends on the current AE mode and state; see
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07001465 * {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture state transition
1466 * details.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001467 * <p>On LEGACY-level devices, the precapture trigger is not supported;
1468 * capturing a high-resolution JPEG image will automatically trigger a
1469 * precapture sequence before the high-resolution capture, including
1470 * potentially firing a pre-capture flash.</p>
Eino-Ville Talvalaf8a2f572015-06-24 15:36:38 -07001471 * <p>Using the precapture trigger and the auto-focus trigger {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger}
1472 * simultaneously is allowed. However, since these triggers often require cooperation between
1473 * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a
1474 * focus sweep), the camera device may delay acting on a later trigger until the previous
1475 * trigger has been fully handled. This may lead to longer intervals between the trigger and
1476 * changes to {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} indicating the start of the precapture sequence, for
1477 * example.</p>
1478 * <p>If both the precapture and the auto-focus trigger are activated on the same request, then
1479 * the camera device will complete them in the optimal order for that device.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001480 * <p><b>Possible values:</b>
1481 * <ul>
1482 * <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE IDLE}</li>
1483 * <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_START START}</li>
Zhijun Hefa95b042015-02-09 10:40:49 -08001484 * <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL CANCEL}</li>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001485 * </ul></p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001486 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001487 * <p><b>Limited capability</b> -
1488 * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
1489 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Zhijun He228f4f92014-01-16 17:22:05 -08001490 *
Zhijun Hedd72be52015-02-06 13:49:51 -08001491 * @see CaptureRequest#CONTROL_AE_LOCK
Zhijun He228f4f92014-01-16 17:22:05 -08001492 * @see CaptureResult#CONTROL_AE_STATE
Eino-Ville Talvalaf8a2f572015-06-24 15:36:38 -07001493 * @see CaptureRequest#CONTROL_AF_TRIGGER
Zhijun Hedd72be52015-02-06 13:49:51 -08001494 * @see CaptureRequest#CONTROL_CAPTURE_INTENT
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001495 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001496 * @see #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE
1497 * @see #CONTROL_AE_PRECAPTURE_TRIGGER_START
Zhijun Hefa95b042015-02-09 10:40:49 -08001498 * @see #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001499 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001500 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001501 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001502 public static final Key<Integer> CONTROL_AE_PRECAPTURE_TRIGGER =
1503 new Key<Integer>("android.control.aePrecaptureTrigger", int.class);
1504
1505 /**
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07001506 * <p>Whether auto-focus (AF) is currently enabled, and what
1507 * mode it is set to.</p>
Zhijun Hecc28a412014-02-24 15:11:23 -08001508 * <p>Only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} = AUTO and the lens is not fixed focus
Yin-Chia Yeh7144b5d2014-11-12 11:42:49 -08001509 * (i.e. <code>{@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} &gt; 0</code>). Also note that
1510 * when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF, the behavior of AF is device
1511 * dependent. It is recommended to lock AF by using {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger} before
1512 * setting {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} to OFF, or set AF mode to OFF when AE is OFF.</p>
Zhijun He78146ec2014-01-14 18:12:13 -08001513 * <p>If the lens is controlled by the camera device auto-focus algorithm,
Eino-Ville Talvalad8fd6792014-02-10 12:41:04 -08001514 * the camera device will report the current AF status in {@link CaptureResult#CONTROL_AF_STATE android.control.afState}
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001515 * in result metadata.</p>
1516 * <p><b>Possible values:</b>
1517 * <ul>
1518 * <li>{@link #CONTROL_AF_MODE_OFF OFF}</li>
1519 * <li>{@link #CONTROL_AF_MODE_AUTO AUTO}</li>
1520 * <li>{@link #CONTROL_AF_MODE_MACRO MACRO}</li>
1521 * <li>{@link #CONTROL_AF_MODE_CONTINUOUS_VIDEO CONTINUOUS_VIDEO}</li>
1522 * <li>{@link #CONTROL_AF_MODE_CONTINUOUS_PICTURE CONTINUOUS_PICTURE}</li>
1523 * <li>{@link #CONTROL_AF_MODE_EDOF EDOF}</li>
1524 * </ul></p>
1525 * <p><b>Available values for this device:</b><br>
1526 * {@link CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES android.control.afAvailableModes}</p>
1527 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001528 *
Yin-Chia Yeh7144b5d2014-11-12 11:42:49 -08001529 * @see CaptureRequest#CONTROL_AE_MODE
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001530 * @see CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES
Eino-Ville Talvalad8fd6792014-02-10 12:41:04 -08001531 * @see CaptureResult#CONTROL_AF_STATE
Yin-Chia Yeh7144b5d2014-11-12 11:42:49 -08001532 * @see CaptureRequest#CONTROL_AF_TRIGGER
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001533 * @see CaptureRequest#CONTROL_MODE
Zhijun Hecc28a412014-02-24 15:11:23 -08001534 * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001535 * @see #CONTROL_AF_MODE_OFF
1536 * @see #CONTROL_AF_MODE_AUTO
1537 * @see #CONTROL_AF_MODE_MACRO
1538 * @see #CONTROL_AF_MODE_CONTINUOUS_VIDEO
1539 * @see #CONTROL_AF_MODE_CONTINUOUS_PICTURE
1540 * @see #CONTROL_AF_MODE_EDOF
1541 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001542 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001543 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001544 public static final Key<Integer> CONTROL_AF_MODE =
1545 new Key<Integer>("android.control.afMode", int.class);
1546
1547 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001548 * <p>List of metering areas to use for auto-focus.</p>
1549 * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf} is 0.
Yin-Chia Yeh808150f2014-09-08 15:48:47 -07001550 * Otherwise will always be present.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001551 * <p>The maximum number of focus areas supported by the device is determined by the value
1552 * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf}.</p>
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001553 * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1554 * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being
1555 * the top-left pixel in the active pixel array, and
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001556 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001557 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1558 * active pixel array.</p>
1559 * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1560 * system depends on the mode being set.
1561 * When the distortion correction mode is OFF, the coordinate system follows
1562 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
1563 * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and
1564 * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1,
1565 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right
1566 * pixel in the pre-correction active pixel array.
1567 * When the distortion correction mode is not OFF, the coordinate system follows
1568 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
1569 * <code>(0, 0)</code> being the top-left pixel of the active array, and
1570 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1571 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1572 * active pixel array.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001573 * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight
Yin-Chia Yeh97f1c852014-05-28 16:36:05 -07001574 * for every pixel in the area. This means that a large metering area
1575 * with the same weight as a smaller area will have more effect in
1576 * the metering result. Metering areas can partially overlap and the
1577 * camera device will add the weights in the overlap region.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001578 * <p>The weights are relative to weights of other metering regions, so if only one region
1579 * is used, all non-zero weights will have the same effect. A region with 0 weight is
1580 * ignored.</p>
1581 * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
Shuzhen Wanga31d58f2018-02-08 12:44:47 -08001582 * camera device. The capture result will either be a zero weight region as well, or
1583 * the region selected by the camera device as the focus area of interest.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001584 * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
1585 * capture result metadata, the camera device will ignore the sections outside the crop
1586 * region and output only the intersection rectangle as the metering region in the result
1587 * metadata. If the region is entirely outside the crop region, it will be ignored and
1588 * not reported in the result metadata.</p>
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08001589 * <p>Starting from API level 30, the coordinate system of activeArraySize or
1590 * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
1591 * pre-zoom field of view. This means that the same afRegions values at different
1592 * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The afRegions
1593 * coordinates are relative to the activeArray/preCorrectionActiveArray representing the
1594 * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same
1595 * afRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of the
1596 * scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use
1597 * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
1598 * mode.</p>
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001599 * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
1600 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on
1601 * distortion correction capability and mode</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001602 * <p><b>Range of valid values:</b><br>
1603 * Coordinates must be between <code>[(0,0), (width, height))</code> of
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001604 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
1605 * depending on distortion correction capability and mode</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001606 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001607 *
Yin-Chia Yeh808150f2014-09-08 15:48:47 -07001608 * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08001609 * @see CaptureRequest#CONTROL_ZOOM_RATIO
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001610 * @see CaptureRequest#DISTORTION_CORRECTION_MODE
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001611 * @see CaptureRequest#SCALER_CROP_REGION
Eino-Ville Talvala265b34c2014-01-16 16:18:52 -08001612 * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001613 * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001614 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001615 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001616 @NonNull
Yin-Chia Yeh817f8932014-05-19 10:23:27 -07001617 public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS =
1618 new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.afRegions", android.hardware.camera2.params.MeteringRectangle[].class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001619
1620 /**
Zhijun He228f4f92014-01-16 17:22:05 -08001621 * <p>Whether the camera device will trigger autofocus for this request.</p>
Igor Murashkinace5bf02013-12-10 17:36:40 -08001622 * <p>This entry is normally set to IDLE, or is not
1623 * included at all in the request settings.</p>
Zhijun He228f4f92014-01-16 17:22:05 -08001624 * <p>When included and set to START, the camera device will trigger the
1625 * autofocus algorithm. If autofocus is disabled, this trigger has no effect.</p>
1626 * <p>When set to CANCEL, the camera device will cancel any active trigger,
1627 * and return to its initial AF state.</p>
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07001628 * <p>Generally, applications should set this entry to START or CANCEL for only a
1629 * single capture, and then return it to IDLE (or not set at all). Specifying
1630 * START for multiple captures in a row means restarting the AF operation over
1631 * and over again.</p>
1632 * <p>See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what the trigger means for each AF mode.</p>
Eino-Ville Talvalaf8a2f572015-06-24 15:36:38 -07001633 * <p>Using the autofocus trigger and the precapture trigger {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}
1634 * simultaneously is allowed. However, since these triggers often require cooperation between
1635 * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a
1636 * focus sweep), the camera device may delay acting on a later trigger until the previous
1637 * trigger has been fully handled. This may lead to longer intervals between the trigger and
1638 * changes to {@link CaptureResult#CONTROL_AF_STATE android.control.afState}, for example.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001639 * <p><b>Possible values:</b>
1640 * <ul>
1641 * <li>{@link #CONTROL_AF_TRIGGER_IDLE IDLE}</li>
1642 * <li>{@link #CONTROL_AF_TRIGGER_START START}</li>
1643 * <li>{@link #CONTROL_AF_TRIGGER_CANCEL CANCEL}</li>
1644 * </ul></p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001645 * <p>This key is available on all devices.</p>
Zhijun He228f4f92014-01-16 17:22:05 -08001646 *
Eino-Ville Talvalaf8a2f572015-06-24 15:36:38 -07001647 * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
Zhijun He228f4f92014-01-16 17:22:05 -08001648 * @see CaptureResult#CONTROL_AF_STATE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001649 * @see #CONTROL_AF_TRIGGER_IDLE
1650 * @see #CONTROL_AF_TRIGGER_START
1651 * @see #CONTROL_AF_TRIGGER_CANCEL
1652 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001653 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001654 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001655 public static final Key<Integer> CONTROL_AF_TRIGGER =
1656 new Key<Integer>("android.control.afTrigger", int.class);
1657
1658 /**
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07001659 * <p>Whether auto-white balance (AWB) is currently locked to its
Zhijun He2d5e8972014-02-07 16:13:46 -08001660 * latest calculated values.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001661 * <p>When set to <code>true</code> (ON), the AWB algorithm is locked to its latest parameters,
1662 * and will not change color balance settings until the lock is set to <code>false</code> (OFF).</p>
1663 * <p>Since the camera device has a pipeline of in-flight requests, the settings that
1664 * get locked do not necessarily correspond to the settings that were present in the
1665 * latest capture result received from the camera device, since additional captures
1666 * and AWB updates may have occurred even before the result was sent out. If an
1667 * application is switching between automatic and manual control and wishes to eliminate
1668 * any flicker during the switch, the following procedure is recommended:</p>
1669 * <ol>
1670 * <li>Starting in auto-AWB mode:</li>
1671 * <li>Lock AWB</li>
1672 * <li>Wait for the first result to be output that has the AWB locked</li>
1673 * <li>Copy AWB settings from that result into a request, set the request to manual AWB</li>
1674 * <li>Submit the capture request, proceed to run manual AWB as desired.</li>
1675 * </ol>
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07001676 * <p>Note that AWB lock is only meaningful when
1677 * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} is in the AUTO mode; in other modes,
1678 * AWB is already fixed to a specific setting.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001679 * <p>Some LEGACY devices may not support ON; the value is then overridden to OFF.</p>
1680 * <p>This key is available on all devices.</p>
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07001681 *
1682 * @see CaptureRequest#CONTROL_AWB_MODE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001683 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001684 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001685 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001686 public static final Key<Boolean> CONTROL_AWB_LOCK =
1687 new Key<Boolean>("android.control.awbLock", boolean.class);
1688
1689 /**
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07001690 * <p>Whether auto-white balance (AWB) is currently setting the color
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001691 * transform fields, and what its illumination target
Zhijun Hecc28a412014-02-24 15:11:23 -08001692 * is.</p>
Zhijun He399f05d2014-01-15 11:31:30 -08001693 * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is AUTO.</p>
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07001694 * <p>When set to the ON mode, the camera device's auto-white balance
Zhijun He399f05d2014-01-15 11:31:30 -08001695 * routine is enabled, overriding the application's selected
1696 * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
Yin-Chia Yeh7144b5d2014-11-12 11:42:49 -08001697 * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}. Note that when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}
1698 * is OFF, the behavior of AWB is device dependent. It is recommened to
1699 * also set AWB mode to OFF or lock AWB by using {@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} before
1700 * setting AE mode to OFF.</p>
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07001701 * <p>When set to the OFF mode, the camera device's auto-white balance
Zhijun Hecc28a412014-02-24 15:11:23 -08001702 * routine is disabled. The application manually controls the white
Eino-Ville Talvalad8fd6792014-02-10 12:41:04 -08001703 * balance by {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains}
Zhijun He399f05d2014-01-15 11:31:30 -08001704 * and {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p>
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07001705 * <p>When set to any other modes, the camera device's auto-white
1706 * balance routine is disabled. The camera device uses each
1707 * particular illumination target for white balance
1708 * adjustment. The application's values for
1709 * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform},
1710 * {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
1711 * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} are ignored.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001712 * <p><b>Possible values:</b>
1713 * <ul>
1714 * <li>{@link #CONTROL_AWB_MODE_OFF OFF}</li>
1715 * <li>{@link #CONTROL_AWB_MODE_AUTO AUTO}</li>
1716 * <li>{@link #CONTROL_AWB_MODE_INCANDESCENT INCANDESCENT}</li>
1717 * <li>{@link #CONTROL_AWB_MODE_FLUORESCENT FLUORESCENT}</li>
1718 * <li>{@link #CONTROL_AWB_MODE_WARM_FLUORESCENT WARM_FLUORESCENT}</li>
1719 * <li>{@link #CONTROL_AWB_MODE_DAYLIGHT DAYLIGHT}</li>
1720 * <li>{@link #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT CLOUDY_DAYLIGHT}</li>
1721 * <li>{@link #CONTROL_AWB_MODE_TWILIGHT TWILIGHT}</li>
1722 * <li>{@link #CONTROL_AWB_MODE_SHADE SHADE}</li>
1723 * </ul></p>
1724 * <p><b>Available values for this device:</b><br>
1725 * {@link CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES android.control.awbAvailableModes}</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001726 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001727 *
Eino-Ville Talvala265b34c2014-01-16 16:18:52 -08001728 * @see CaptureRequest#COLOR_CORRECTION_GAINS
Zhijun He5f2a47f2014-01-16 15:44:41 -08001729 * @see CaptureRequest#COLOR_CORRECTION_MODE
1730 * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
Yin-Chia Yeh7144b5d2014-11-12 11:42:49 -08001731 * @see CaptureRequest#CONTROL_AE_MODE
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001732 * @see CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES
Yin-Chia Yeh7144b5d2014-11-12 11:42:49 -08001733 * @see CaptureRequest#CONTROL_AWB_LOCK
Eino-Ville Talvala265b34c2014-01-16 16:18:52 -08001734 * @see CaptureRequest#CONTROL_MODE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001735 * @see #CONTROL_AWB_MODE_OFF
1736 * @see #CONTROL_AWB_MODE_AUTO
1737 * @see #CONTROL_AWB_MODE_INCANDESCENT
1738 * @see #CONTROL_AWB_MODE_FLUORESCENT
1739 * @see #CONTROL_AWB_MODE_WARM_FLUORESCENT
1740 * @see #CONTROL_AWB_MODE_DAYLIGHT
1741 * @see #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT
1742 * @see #CONTROL_AWB_MODE_TWILIGHT
1743 * @see #CONTROL_AWB_MODE_SHADE
1744 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001745 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001746 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001747 public static final Key<Integer> CONTROL_AWB_MODE =
1748 new Key<Integer>("android.control.awbMode", int.class);
1749
1750 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001751 * <p>List of metering areas to use for auto-white-balance illuminant
Ruben Brunkf59521d2014-02-03 17:14:33 -08001752 * estimation.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001753 * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb} is 0.
Yin-Chia Yeh808150f2014-09-08 15:48:47 -07001754 * Otherwise will always be present.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001755 * <p>The maximum number of regions supported by the device is determined by the value
1756 * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb}.</p>
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001757 * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1758 * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being
1759 * the top-left pixel in the active pixel array, and
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001760 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001761 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1762 * active pixel array.</p>
1763 * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
1764 * system depends on the mode being set.
1765 * When the distortion correction mode is OFF, the coordinate system follows
1766 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with
1767 * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and
1768 * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1,
1769 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right
1770 * pixel in the pre-correction active pixel array.
1771 * When the distortion correction mode is not OFF, the coordinate system follows
1772 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
1773 * <code>(0, 0)</code> being the top-left pixel of the active array, and
1774 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
1775 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the
1776 * active pixel array.</p>
Yin-Chia Yeh97f1c852014-05-28 16:36:05 -07001777 * <p>The weight must range from 0 to 1000, and represents a weight
1778 * for every pixel in the area. This means that a large metering area
1779 * with the same weight as a smaller area will have more effect in
1780 * the metering result. Metering areas can partially overlap and the
1781 * camera device will add the weights in the overlap region.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001782 * <p>The weights are relative to weights of other white balance metering regions, so if
1783 * only one region is used, all non-zero weights will have the same effect. A region with
1784 * 0 weight is ignored.</p>
1785 * <p>If all regions have 0 weight, then no specific metering area needs to be used by the
1786 * camera device.</p>
1787 * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in
1788 * capture result metadata, the camera device will ignore the sections outside the crop
1789 * region and output only the intersection rectangle as the metering region in the result
1790 * metadata. If the region is entirely outside the crop region, it will be ignored and
1791 * not reported in the result metadata.</p>
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08001792 * <p>Starting from API level 30, the coordinate system of activeArraySize or
1793 * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not
1794 * pre-zoom field of view. This means that the same awbRegions values at different
1795 * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The awbRegions
1796 * coordinates are relative to the activeArray/preCorrectionActiveArray representing the
1797 * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same
1798 * awbRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of
1799 * the scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use
1800 * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
1801 * mode.</p>
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001802 * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
1803 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on
1804 * distortion correction capability and mode</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001805 * <p><b>Range of valid values:</b><br>
1806 * Coordinates must be between <code>[(0,0), (width, height))</code> of
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001807 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
1808 * depending on distortion correction capability and mode</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001809 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001810 *
Yin-Chia Yeh808150f2014-09-08 15:48:47 -07001811 * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08001812 * @see CaptureRequest#CONTROL_ZOOM_RATIO
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001813 * @see CaptureRequest#DISTORTION_CORRECTION_MODE
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001814 * @see CaptureRequest#SCALER_CROP_REGION
Eino-Ville Talvala265b34c2014-01-16 16:18:52 -08001815 * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07001816 * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001817 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001818 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001819 @NonNull
Yin-Chia Yeh817f8932014-05-19 10:23:27 -07001820 public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS =
1821 new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.awbRegions", android.hardware.camera2.params.MeteringRectangle[].class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001822
1823 /**
Zhijun He66d065a2014-01-16 18:18:50 -08001824 * <p>Information to the camera device 3A (auto-exposure,
1825 * auto-focus, auto-white balance) routines about the purpose
1826 * of this capture, to help the camera device to decide optimal 3A
1827 * strategy.</p>
Zhijun Hee30adb72014-04-09 19:04:31 -07001828 * <p>This control (except for MANUAL) is only effective if
1829 * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} != OFF</code> and any 3A routine is active.</p>
Eino-Ville Talvalaec99efa2017-11-29 15:35:42 -08001830 * <p>All intents are supported by all devices, except that:
1831 * * ZERO_SHUTTER_LAG will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains
1832 * PRIVATE_REPROCESSING or YUV_REPROCESSING.
1833 * * MANUAL will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains
1834 * MANUAL_SENSOR.
1835 * * MOTION_TRACKING will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains
1836 * MOTION_TRACKING.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001837 * <p><b>Possible values:</b>
1838 * <ul>
1839 * <li>{@link #CONTROL_CAPTURE_INTENT_CUSTOM CUSTOM}</li>
1840 * <li>{@link #CONTROL_CAPTURE_INTENT_PREVIEW PREVIEW}</li>
1841 * <li>{@link #CONTROL_CAPTURE_INTENT_STILL_CAPTURE STILL_CAPTURE}</li>
1842 * <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_RECORD VIDEO_RECORD}</li>
1843 * <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT VIDEO_SNAPSHOT}</li>
1844 * <li>{@link #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li>
1845 * <li>{@link #CONTROL_CAPTURE_INTENT_MANUAL MANUAL}</li>
Eino-Ville Talvalaec99efa2017-11-29 15:35:42 -08001846 * <li>{@link #CONTROL_CAPTURE_INTENT_MOTION_TRACKING MOTION_TRACKING}</li>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001847 * </ul></p>
1848 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001849 *
1850 * @see CaptureRequest#CONTROL_MODE
Zhijun Hee30adb72014-04-09 19:04:31 -07001851 * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001852 * @see #CONTROL_CAPTURE_INTENT_CUSTOM
1853 * @see #CONTROL_CAPTURE_INTENT_PREVIEW
1854 * @see #CONTROL_CAPTURE_INTENT_STILL_CAPTURE
1855 * @see #CONTROL_CAPTURE_INTENT_VIDEO_RECORD
1856 * @see #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT
1857 * @see #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG
Zhijun Hee30adb72014-04-09 19:04:31 -07001858 * @see #CONTROL_CAPTURE_INTENT_MANUAL
Eino-Ville Talvalaec99efa2017-11-29 15:35:42 -08001859 * @see #CONTROL_CAPTURE_INTENT_MOTION_TRACKING
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001860 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001861 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001862 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001863 public static final Key<Integer> CONTROL_CAPTURE_INTENT =
1864 new Key<Integer>("android.control.captureIntent", int.class);
1865
1866 /**
Ruben Brunk5f1dcfe2014-01-17 16:42:51 -08001867 * <p>A special color effect to apply.</p>
1868 * <p>When this mode is set, a color effect will be applied
1869 * to images produced by the camera device. The interpretation
1870 * and implementation of these color effects is left to the
1871 * implementor of the camera device, and should not be
1872 * depended on to be consistent (or present) across all
1873 * devices.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001874 * <p><b>Possible values:</b>
1875 * <ul>
1876 * <li>{@link #CONTROL_EFFECT_MODE_OFF OFF}</li>
1877 * <li>{@link #CONTROL_EFFECT_MODE_MONO MONO}</li>
1878 * <li>{@link #CONTROL_EFFECT_MODE_NEGATIVE NEGATIVE}</li>
1879 * <li>{@link #CONTROL_EFFECT_MODE_SOLARIZE SOLARIZE}</li>
1880 * <li>{@link #CONTROL_EFFECT_MODE_SEPIA SEPIA}</li>
1881 * <li>{@link #CONTROL_EFFECT_MODE_POSTERIZE POSTERIZE}</li>
1882 * <li>{@link #CONTROL_EFFECT_MODE_WHITEBOARD WHITEBOARD}</li>
1883 * <li>{@link #CONTROL_EFFECT_MODE_BLACKBOARD BLACKBOARD}</li>
1884 * <li>{@link #CONTROL_EFFECT_MODE_AQUA AQUA}</li>
1885 * </ul></p>
1886 * <p><b>Available values for this device:</b><br>
1887 * {@link CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS android.control.availableEffects}</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001888 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001889 *
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001890 * @see CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001891 * @see #CONTROL_EFFECT_MODE_OFF
1892 * @see #CONTROL_EFFECT_MODE_MONO
1893 * @see #CONTROL_EFFECT_MODE_NEGATIVE
1894 * @see #CONTROL_EFFECT_MODE_SOLARIZE
1895 * @see #CONTROL_EFFECT_MODE_SEPIA
1896 * @see #CONTROL_EFFECT_MODE_POSTERIZE
1897 * @see #CONTROL_EFFECT_MODE_WHITEBOARD
1898 * @see #CONTROL_EFFECT_MODE_BLACKBOARD
1899 * @see #CONTROL_EFFECT_MODE_AQUA
1900 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001901 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001902 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001903 public static final Key<Integer> CONTROL_EFFECT_MODE =
1904 new Key<Integer>("android.control.effectMode", int.class);
1905
1906 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001907 * <p>Overall mode of 3A (auto-exposure, auto-white-balance, auto-focus) control
Zhijun Hecc28a412014-02-24 15:11:23 -08001908 * routines.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001909 * <p>This is a top-level 3A control switch. When set to OFF, all 3A control
Zhijun He5f2a47f2014-01-16 15:44:41 -08001910 * by the camera device is disabled. The application must set the fields for
Zhijun Hef3537422013-12-16 16:56:35 -08001911 * capture parameters itself.</p>
1912 * <p>When set to AUTO, the individual algorithm controls in
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001913 * android.control.* are in effect, such as {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}.</p>
Shuzhen Wang796863a2020-03-16 16:00:18 -07001914 * <p>When set to USE_SCENE_MODE or USE_EXTENDED_SCENE_MODE, the individual controls in
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08001915 * android.control.* are mostly disabled, and the camera device
Shuzhen Wang796863a2020-03-16 16:00:18 -07001916 * implements one of the scene mode or extended scene mode settings (such as ACTION,
1917 * SUNSET, PARTY, or BOKEH) as it wishes. The camera device scene mode
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08001918 * 3A settings are provided by {@link android.hardware.camera2.CaptureResult capture results}.</p>
Zhijun He2d5e8972014-02-07 16:13:46 -08001919 * <p>When set to OFF_KEEP_STATE, it is similar to OFF mode, the only difference
1920 * is that this frame will not be used by camera device background 3A statistics
1921 * update, as if this frame is never captured. This mode can be used in the scenario
1922 * where the application doesn't want a 3A manual control capture to affect
1923 * the subsequent auto 3A capture results.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001924 * <p><b>Possible values:</b>
1925 * <ul>
1926 * <li>{@link #CONTROL_MODE_OFF OFF}</li>
1927 * <li>{@link #CONTROL_MODE_AUTO AUTO}</li>
1928 * <li>{@link #CONTROL_MODE_USE_SCENE_MODE USE_SCENE_MODE}</li>
1929 * <li>{@link #CONTROL_MODE_OFF_KEEP_STATE OFF_KEEP_STATE}</li>
Shuzhen Wang796863a2020-03-16 16:00:18 -07001930 * <li>{@link #CONTROL_MODE_USE_EXTENDED_SCENE_MODE USE_EXTENDED_SCENE_MODE}</li>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001931 * </ul></p>
Yin-Chia Yehd9fc67c2015-01-30 10:47:22 -08001932 * <p><b>Available values for this device:</b><br>
1933 * {@link CameraCharacteristics#CONTROL_AVAILABLE_MODES android.control.availableModes}</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001934 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001935 *
1936 * @see CaptureRequest#CONTROL_AF_MODE
Yin-Chia Yehd9fc67c2015-01-30 10:47:22 -08001937 * @see CameraCharacteristics#CONTROL_AVAILABLE_MODES
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001938 * @see #CONTROL_MODE_OFF
1939 * @see #CONTROL_MODE_AUTO
1940 * @see #CONTROL_MODE_USE_SCENE_MODE
Zhijun He2d5e8972014-02-07 16:13:46 -08001941 * @see #CONTROL_MODE_OFF_KEEP_STATE
Shuzhen Wang796863a2020-03-16 16:00:18 -07001942 * @see #CONTROL_MODE_USE_EXTENDED_SCENE_MODE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001943 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07001944 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08001945 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001946 public static final Key<Integer> CONTROL_MODE =
1947 new Key<Integer>("android.control.mode", int.class);
1948
1949 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001950 * <p>Control for which scene mode is currently active.</p>
1951 * <p>Scene modes are custom camera modes optimized for a certain set of conditions and
1952 * capture settings.</p>
Ruben Brunke6679362014-01-17 17:05:54 -08001953 * <p>This is the mode that that is active when
Zhijun Heee2ebde2015-06-16 19:58:11 -07001954 * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY, these modes will
1955 * 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}
1956 * while in use.</p>
Ruben Brunke6679362014-01-17 17:05:54 -08001957 * <p>The interpretation and implementation of these scene modes is left
1958 * to the implementor of the camera device. Their behavior will not be
1959 * consistent across all devices, and any given device may only implement
1960 * a subset of these modes.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001961 * <p><b>Possible values:</b>
1962 * <ul>
1963 * <li>{@link #CONTROL_SCENE_MODE_DISABLED DISABLED}</li>
1964 * <li>{@link #CONTROL_SCENE_MODE_FACE_PRIORITY FACE_PRIORITY}</li>
1965 * <li>{@link #CONTROL_SCENE_MODE_ACTION ACTION}</li>
1966 * <li>{@link #CONTROL_SCENE_MODE_PORTRAIT PORTRAIT}</li>
1967 * <li>{@link #CONTROL_SCENE_MODE_LANDSCAPE LANDSCAPE}</li>
1968 * <li>{@link #CONTROL_SCENE_MODE_NIGHT NIGHT}</li>
1969 * <li>{@link #CONTROL_SCENE_MODE_NIGHT_PORTRAIT NIGHT_PORTRAIT}</li>
1970 * <li>{@link #CONTROL_SCENE_MODE_THEATRE THEATRE}</li>
1971 * <li>{@link #CONTROL_SCENE_MODE_BEACH BEACH}</li>
1972 * <li>{@link #CONTROL_SCENE_MODE_SNOW SNOW}</li>
1973 * <li>{@link #CONTROL_SCENE_MODE_SUNSET SUNSET}</li>
1974 * <li>{@link #CONTROL_SCENE_MODE_STEADYPHOTO STEADYPHOTO}</li>
1975 * <li>{@link #CONTROL_SCENE_MODE_FIREWORKS FIREWORKS}</li>
1976 * <li>{@link #CONTROL_SCENE_MODE_SPORTS SPORTS}</li>
1977 * <li>{@link #CONTROL_SCENE_MODE_PARTY PARTY}</li>
1978 * <li>{@link #CONTROL_SCENE_MODE_CANDLELIGHT CANDLELIGHT}</li>
1979 * <li>{@link #CONTROL_SCENE_MODE_BARCODE BARCODE}</li>
1980 * <li>{@link #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO HIGH_SPEED_VIDEO}</li>
Eino-Ville Talvalaf4eac122014-12-05 11:10:15 -08001981 * <li>{@link #CONTROL_SCENE_MODE_HDR HDR}</li>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07001982 * </ul></p>
1983 * <p><b>Available values for this device:</b><br>
1984 * {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes}</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07001985 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001986 *
Ruben Brunke6679362014-01-17 17:05:54 -08001987 * @see CaptureRequest#CONTROL_AE_MODE
1988 * @see CaptureRequest#CONTROL_AF_MODE
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07001989 * @see CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES
Ruben Brunke6679362014-01-17 17:05:54 -08001990 * @see CaptureRequest#CONTROL_AWB_MODE
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08001991 * @see CaptureRequest#CONTROL_MODE
Ruben Brunke6679362014-01-17 17:05:54 -08001992 * @see #CONTROL_SCENE_MODE_DISABLED
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07001993 * @see #CONTROL_SCENE_MODE_FACE_PRIORITY
1994 * @see #CONTROL_SCENE_MODE_ACTION
1995 * @see #CONTROL_SCENE_MODE_PORTRAIT
1996 * @see #CONTROL_SCENE_MODE_LANDSCAPE
1997 * @see #CONTROL_SCENE_MODE_NIGHT
1998 * @see #CONTROL_SCENE_MODE_NIGHT_PORTRAIT
1999 * @see #CONTROL_SCENE_MODE_THEATRE
2000 * @see #CONTROL_SCENE_MODE_BEACH
2001 * @see #CONTROL_SCENE_MODE_SNOW
2002 * @see #CONTROL_SCENE_MODE_SUNSET
2003 * @see #CONTROL_SCENE_MODE_STEADYPHOTO
2004 * @see #CONTROL_SCENE_MODE_FIREWORKS
2005 * @see #CONTROL_SCENE_MODE_SPORTS
2006 * @see #CONTROL_SCENE_MODE_PARTY
2007 * @see #CONTROL_SCENE_MODE_CANDLELIGHT
2008 * @see #CONTROL_SCENE_MODE_BARCODE
Zhijun Hee0404182014-06-26 13:17:09 -07002009 * @see #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO
Eino-Ville Talvalaf4eac122014-12-05 11:10:15 -08002010 * @see #CONTROL_SCENE_MODE_HDR
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002011 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002012 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002013 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002014 public static final Key<Integer> CONTROL_SCENE_MODE =
2015 new Key<Integer>("android.control.sceneMode", int.class);
2016
2017 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08002018 * <p>Whether video stabilization is
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07002019 * active.</p>
Jianing Wei2813b0f2015-09-29 14:24:36 -07002020 * <p>Video stabilization automatically warps images from
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002021 * the camera in order to stabilize motion between consecutive frames.</p>
Igor Murashkinace5bf02013-12-10 17:36:40 -08002022 * <p>If enabled, video stabilization can modify the
Zhijun He45fa43a12014-06-13 18:29:37 -07002023 * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to keep the video stream stabilized.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002024 * <p>Switching between different video stabilization modes may take several
2025 * frames to initialize, the camera device will report the current mode
2026 * in capture result metadata. For example, When "ON" mode is requested,
2027 * the video stabilization modes in the first several capture results may
2028 * still be "OFF", and it will become "ON" when the initialization is
2029 * done.</p>
Jianing Wei2813b0f2015-09-29 14:24:36 -07002030 * <p>In addition, not all recording sizes or frame rates may be supported for
2031 * stabilization by a device that reports stabilization support. It is guaranteed
2032 * that an output targeting a MediaRecorder or MediaCodec will be stabilized if
2033 * the recording resolution is less than or equal to 1920 x 1080 (width less than
2034 * or equal to 1920, height less than or equal to 1080), and the recording
2035 * frame rate is less than or equal to 30fps. At other sizes, the CaptureResult
2036 * {@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode} field will return
2037 * OFF if the recording output is not stabilized, or if there are no output
2038 * Surface types that can be stabilized.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002039 * <p>If a camera device supports both this mode and OIS
2040 * ({@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode}), turning both modes on may
2041 * produce undesirable interaction, so it is recommended not to enable
2042 * both at the same time.</p>
2043 * <p><b>Possible values:</b>
2044 * <ul>
2045 * <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_OFF OFF}</li>
2046 * <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_ON ON}</li>
2047 * </ul></p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002048 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08002049 *
Jianing Wei2813b0f2015-09-29 14:24:36 -07002050 * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
Zhijun He45fa43a12014-06-13 18:29:37 -07002051 * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08002052 * @see CaptureRequest#SCALER_CROP_REGION
Zhijun He4793af52014-05-05 10:39:12 -07002053 * @see #CONTROL_VIDEO_STABILIZATION_MODE_OFF
2054 * @see #CONTROL_VIDEO_STABILIZATION_MODE_ON
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002055 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002056 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002057 @NonNull
Zhijun He4793af52014-05-05 10:39:12 -07002058 public static final Key<Integer> CONTROL_VIDEO_STABILIZATION_MODE =
2059 new Key<Integer>("android.control.videoStabilizationMode", int.class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002060
2061 /**
Yin-Chia Yeh33052d32016-04-11 16:39:02 -07002062 * <p>The amount of additional sensitivity boost applied to output images
Yin-Chia Yeh1ee1a0a2016-01-18 19:13:47 -08002063 * after RAW sensor data is captured.</p>
2064 * <p>Some camera devices support additional digital sensitivity boosting in the
2065 * camera processing pipeline after sensor RAW image is captured.
2066 * Such a boost will be applied to YUV/JPEG format output images but will not
2067 * have effect on RAW output formats like RAW_SENSOR, RAW10, RAW12 or RAW_OPAQUE.</p>
Yin-Chia Yeh33052d32016-04-11 16:39:02 -07002068 * <p>This key will be <code>null</code> for devices that do not support any RAW format
2069 * outputs. For devices that do support RAW format outputs, this key will always
2070 * present, and if a device does not support post RAW sensitivity boost, it will
2071 * list <code>100</code> in this key.</p>
Yin-Chia Yeh1ee1a0a2016-01-18 19:13:47 -08002072 * <p>If the camera device cannot apply the exact boost requested, it will reduce the
2073 * boost to the nearest supported value.
2074 * The final boost value used will be available in the output capture result.</p>
2075 * <p>For devices that support post RAW sensitivity boost, the YUV/JPEG output images
2076 * of such device will have the total sensitivity of
Yin-Chia Yeh67e61b62016-01-26 13:27:35 -08002077 * <code>{@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} * {@link CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST android.control.postRawSensitivityBoost} / 100</code>
Yin-Chia Yeh1ee1a0a2016-01-18 19:13:47 -08002078 * The sensitivity of RAW format images will always be <code>{@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</code></p>
2079 * <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
2080 * OFF; otherwise the auto-exposure algorithm will override this value.</p>
2081 * <p><b>Units</b>: ISO arithmetic units, the same as {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</p>
2082 * <p><b>Range of valid values:</b><br>
2083 * {@link CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE android.control.postRawSensitivityBoostRange}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002084 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Yin-Chia Yeh1ee1a0a2016-01-18 19:13:47 -08002085 *
2086 * @see CaptureRequest#CONTROL_AE_MODE
2087 * @see CaptureRequest#CONTROL_MODE
2088 * @see CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST
2089 * @see CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE
2090 * @see CaptureRequest#SENSOR_SENSITIVITY
2091 */
2092 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002093 @NonNull
Yin-Chia Yeh1ee1a0a2016-01-18 19:13:47 -08002094 public static final Key<Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST =
2095 new Key<Integer>("android.control.postRawSensitivityBoost", int.class);
2096
2097 /**
Chien-Yu Chene4491712017-01-11 11:14:06 -08002098 * <p>Allow camera device to enable zero-shutter-lag mode for requests with
2099 * {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE.</p>
2100 * <p>If enableZsl is <code>true</code>, the camera device may enable zero-shutter-lag mode for requests with
2101 * STILL_CAPTURE capture intent. The camera device may use images captured in the past to
2102 * produce output images for a zero-shutter-lag request. The result metadata including the
2103 * {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp} reflects the source frames used to produce output images.
2104 * Therefore, the contents of the output images and the result metadata may be out of order
2105 * compared to previous regular requests. enableZsl does not affect requests with other
2106 * capture intents.</p>
2107 * <p>For example, when requests are submitted in the following order:
2108 * Request A: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is PREVIEW
2109 * Request B: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is STILL_CAPTURE</p>
2110 * <p>The output images for request B may have contents captured before the output images for
2111 * request A, and the result metadata for request B may be older than the result metadata for
2112 * request A.</p>
Chien-Yu Chen1d72ee32017-04-18 15:23:06 -07002113 * <p>Note that when enableZsl is <code>true</code>, it is not guaranteed to get output images captured in
2114 * the past for requests with STILL_CAPTURE capture intent.</p>
2115 * <p>For applications targeting SDK versions O and newer, the value of enableZsl in
2116 * TEMPLATE_STILL_CAPTURE template may be <code>true</code>. The value in other templates is always
2117 * <code>false</code> if present.</p>
2118 * <p>For applications targeting SDK versions older than O, the value of enableZsl in all
2119 * capture templates is always <code>false</code> if present.</p>
Chien-Yu Chen81026382017-05-03 12:30:58 -07002120 * <p>For application-operated ZSL, use CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG template.</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002121 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Chien-Yu Chene4491712017-01-11 11:14:06 -08002122 *
2123 * @see CaptureRequest#CONTROL_CAPTURE_INTENT
2124 * @see CaptureResult#SENSOR_TIMESTAMP
2125 */
2126 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002127 @NonNull
Chien-Yu Chene4491712017-01-11 11:14:06 -08002128 public static final Key<Boolean> CONTROL_ENABLE_ZSL =
2129 new Key<Boolean>("android.control.enableZsl", boolean.class);
2130
2131 /**
Shuzhen Wang796863a2020-03-16 16:00:18 -07002132 * <p>Whether extended scene mode is enabled for a particular capture request.</p>
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002133 * <p>With bokeh mode, the camera device may blur out the parts of scene that are not in
2134 * focus, creating a bokeh (or shallow depth of field) effect for people or objects.</p>
Shuzhen Wang796863a2020-03-16 16:00:18 -07002135 * <p>When set to BOKEH_STILL_CAPTURE mode with STILL_CAPTURE capture intent, due to the extra
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002136 * processing needed for high quality bokeh effect, the stall may be longer than when
2137 * capture intent is not STILL_CAPTURE.</p>
Shuzhen Wang796863a2020-03-16 16:00:18 -07002138 * <p>When set to BOKEH_STILL_CAPTURE mode with PREVIEW capture intent,</p>
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002139 * <ul>
2140 * <li>If the camera device has BURST_CAPTURE capability, the frame rate requirement of
2141 * BURST_CAPTURE must still be met.</li>
Shuzhen Wang796863a2020-03-16 16:00:18 -07002142 * <li>All streams not larger than the maximum streaming dimension for BOKEH_STILL_CAPTURE mode
2143 * (queried via {@link android.hardware.camera2.CameraCharacteristics#CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_CAPABILITIES })
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002144 * will have preview bokeh effect applied.</li>
2145 * </ul>
Shuzhen Wang796863a2020-03-16 16:00:18 -07002146 * <p>When set to BOKEH_CONTINUOUS mode, configured streams dimension should not exceed this mode's
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002147 * maximum streaming dimension in order to have bokeh effect applied. Bokeh effect may not
2148 * be available for streams larger than the maximum streaming dimension.</p>
Shuzhen Wang796863a2020-03-16 16:00:18 -07002149 * <p>Switching between different extended scene modes may involve reconfiguration of the camera
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002150 * pipeline, resulting in long latency. The application should check this key against the
2151 * available session keys queried via
2152 * {@link android.hardware.camera2.CameraCharacteristics#getAvailableSessionKeys }.</p>
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002153 * <p>For a logical multi-camera, bokeh may be implemented by stereo vision from sub-cameras
2154 * with different field of view. As a result, when bokeh mode is enabled, the camera device
Shuzhen Wang796863a2020-03-16 16:00:18 -07002155 * may override {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, and the field of
2156 * view may be smaller than when bokeh mode is off.</p>
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002157 * <p><b>Possible values:</b>
2158 * <ul>
Shuzhen Wang796863a2020-03-16 16:00:18 -07002159 * <li>{@link #CONTROL_EXTENDED_SCENE_MODE_DISABLED DISABLED}</li>
2160 * <li>{@link #CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE BOKEH_STILL_CAPTURE}</li>
2161 * <li>{@link #CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS BOKEH_CONTINUOUS}</li>
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002162 * </ul></p>
2163 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Eino-Ville Talvalad2d749a2020-01-06 16:10:29 -08002164 *
Shuzhen Wang796863a2020-03-16 16:00:18 -07002165 * @see CaptureRequest#CONTROL_ZOOM_RATIO
Eino-Ville Talvalad2d749a2020-01-06 16:10:29 -08002166 * @see CaptureRequest#SCALER_CROP_REGION
Shuzhen Wang796863a2020-03-16 16:00:18 -07002167 * @see #CONTROL_EXTENDED_SCENE_MODE_DISABLED
2168 * @see #CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE
2169 * @see #CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002170 */
2171 @PublicKey
2172 @NonNull
Shuzhen Wang796863a2020-03-16 16:00:18 -07002173 public static final Key<Integer> CONTROL_EXTENDED_SCENE_MODE =
2174 new Key<Integer>("android.control.extendedSceneMode", int.class);
Shuzhen Wang1ab85142019-07-08 15:14:16 -07002175
2176 /**
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08002177 * <p>The desired zoom ratio</p>
2178 * <p>Instead of using {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} with dual purposes of crop and zoom, the
2179 * application can now choose to use this tag to specify the desired zoom level. The
2180 * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} can still be used to specify the horizontal or vertical
2181 * crop to achieve aspect ratios different than the native camera sensor.</p>
2182 * <p>By using this control, the application gains a simpler way to control zoom, which can
Shuzhen Wang69cf0fd2020-03-13 09:40:58 -07002183 * be a combination of optical and digital zoom. For example, a multi-camera system may
2184 * contain more than one lens with different focal lengths, and the user can use optical
2185 * zoom by switching between lenses. Using zoomRatio has benefits in the scenarios below:
2186 * <em> Zooming in from a wide-angle lens to a telephoto lens: A floating-point ratio provides
2187 * better precision compared to an integer value of {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}.
2188 * </em> Zooming out from a wide lens to an ultrawide lens: zoomRatio supports zoom-out whereas
2189 * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} doesn't.</p>
2190 * <p>To illustrate, here are several scenarios of different zoom ratios, crop regions,
2191 * and output streams, for a hypothetical camera device with an active array of size
2192 * <code>(2000,1500)</code>.</p>
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08002193 * <ul>
Shuzhen Wang69cf0fd2020-03-13 09:40:58 -07002194 * <li>Camera Configuration:<ul>
2195 * <li>Active array size: <code>2000x1500</code> (3 MP, 4:3 aspect ratio)</li>
2196 * <li>Output stream #1: <code>640x480</code> (VGA, 4:3 aspect ratio)</li>
2197 * <li>Output stream #2: <code>1280x720</code> (720p, 16:9 aspect ratio)</li>
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08002198 * </ul>
Shuzhen Wang69cf0fd2020-03-13 09:40:58 -07002199 * </li>
2200 * <li>Case #1: 4:3 crop region with 2.0x zoom ratio<ul>
2201 * <li>Zoomed field of view: 1/4 of original field of view</li>
2202 * <li>Crop region: <code>Rect(0, 0, 2000, 1500) // (left, top, right, bottom)</code> (post zoom)</li>
2203 * </ul>
2204 * </li>
2205 * <li><img alt="4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-2-crop-43.png" /><ul>
2206 * <li><code>640x480</code> stream source area: <code>(0, 0, 2000, 1500)</code> (equal to crop region)</li>
2207 * <li><code>1280x720</code> stream source area: <code>(0, 187, 2000, 1312)</code> (letterboxed)</li>
2208 * </ul>
2209 * </li>
2210 * <li>Case #2: 16:9 crop region with 2.0x zoom.<ul>
2211 * <li>Zoomed field of view: 1/4 of original field of view</li>
2212 * <li>Crop region: <code>Rect(0, 187, 2000, 1312)</code></li>
2213 * <li><img alt="16:9 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-2-crop-169.png" /></li>
2214 * <li><code>640x480</code> stream source area: <code>(250, 187, 1750, 1312)</code> (pillarboxed)</li>
2215 * <li><code>1280x720</code> stream source area: <code>(0, 187, 2000, 1312)</code> (equal to crop region)</li>
2216 * </ul>
2217 * </li>
2218 * <li>Case #3: 1:1 crop region with 0.5x zoom out to ultrawide lens.<ul>
2219 * <li>Zoomed field of view: 4x of original field of view (switched from wide lens to ultrawide lens)</li>
2220 * <li>Crop region: <code>Rect(250, 0, 1750, 1500)</code></li>
2221 * <li><img alt="1:1 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-0.5-crop-11.png" /></li>
2222 * <li><code>640x480</code> stream source area: <code>(250, 187, 1750, 1312)</code> (letterboxed)</li>
2223 * <li><code>1280x720</code> stream source area: <code>(250, 328, 1750, 1172)</code> (letterboxed)</li>
2224 * </ul>
2225 * </li>
2226 * </ul>
2227 * <p>As seen from the graphs above, the coordinate system of cropRegion now changes to the
2228 * effective after-zoom field-of-view, and is represented by the rectangle of (0, 0,
2229 * activeArrayWith, activeArrayHeight). The same applies to AE/AWB/AF regions, and faces.
2230 * This coordinate system change isn't applicable to RAW capture and its related
2231 * metadata such as intrinsicCalibration and lensShadingMap.</p>
2232 * <p>Using the same hypothetical example above, and assuming output stream #1 (640x480) is
2233 * the viewfinder stream, the application can achieve 2.0x zoom in one of two ways:</p>
2234 * <ul>
2235 * <li>zoomRatio = 2.0, scaler.cropRegion = (0, 0, 2000, 1500)</li>
2236 * <li>zoomRatio = 1.0 (default), scaler.cropRegion = (500, 375, 1500, 1125)</li>
2237 * </ul>
2238 * <p>If the application intends to set aeRegions to be top-left quarter of the viewfinder
2239 * field-of-view, the {@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions} should be set to (0, 0, 1000, 750) with
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08002240 * zoomRatio set to 2.0. Alternatively, the application can set aeRegions to the equivalent
Shuzhen Wang69cf0fd2020-03-13 09:40:58 -07002241 * region of (500, 375, 1000, 750) for zoomRatio of 1.0. If the application doesn't
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08002242 * explicitly set {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, its value defaults to 1.0.</p>
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08002243 * <p>One limitation of controlling zoom using zoomRatio is that the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}
2244 * must only be used for letterboxing or pillarboxing of the sensor active array, and no
2245 * FREEFORM cropping can be used with {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} other than 1.0.</p>
2246 * <p><b>Range of valid values:</b><br>
2247 * {@link CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE android.control.zoomRatioRange}</p>
2248 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2249 * <p><b>Limited capability</b> -
2250 * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2251 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2252 *
2253 * @see CaptureRequest#CONTROL_AE_REGIONS
2254 * @see CaptureRequest#CONTROL_ZOOM_RATIO
2255 * @see CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE
2256 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
2257 * @see CaptureRequest#SCALER_CROP_REGION
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08002258 */
2259 @PublicKey
2260 @NonNull
2261 public static final Key<Float> CONTROL_ZOOM_RATIO =
2262 new Key<Float>("android.control.zoomRatio", float.class);
2263
2264 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08002265 * <p>Operation mode for edge
Zhijun Hecc28a412014-02-24 15:11:23 -08002266 * enhancement.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002267 * <p>Edge enhancement improves sharpness and details in the captured image. OFF means
2268 * no enhancement will be applied by the camera device.</p>
Zhijun He5f2a47f2014-01-16 15:44:41 -08002269 * <p>FAST/HIGH_QUALITY both mean camera device determined enhancement
Zhijun He28079362013-12-17 10:35:40 -08002270 * will be applied. HIGH_QUALITY mode indicates that the
Zhijun He5f2a47f2014-01-16 15:44:41 -08002271 * camera device will use the highest-quality enhancement algorithms,
2272 * even if it slows down capture rate. FAST means the camera device will
Chien-Yu Chen9c9167e2015-07-14 16:38:25 -07002273 * not slow down capture rate when applying edge enhancement. FAST may be the same as OFF if
2274 * edge enhancement will slow down capture rate. Every output stream will have a similar
2275 * amount of enhancement applied.</p>
Eino-Ville Talvala0dd17502015-07-07 10:43:07 -07002276 * <p>ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular
2277 * buffer of high-resolution images during preview and reprocess image(s) from that buffer
2278 * into a final capture when triggered by the user. In this mode, the camera device applies
2279 * edge enhancement to low-resolution streams (below maximum recording resolution) to
2280 * maximize preview quality, but does not apply edge enhancement to high-resolution streams,
2281 * since those will be reprocessed later if necessary.</p>
Zhijun He0e99c222015-01-29 15:26:05 -08002282 * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera
2283 * device will apply FAST/HIGH_QUALITY YUV-domain edge enhancement, respectively.
Chien-Yu Chen9c9167e2015-07-14 16:38:25 -07002284 * The camera device may adjust its internal edge enhancement parameters for best
Zhijun He0e99c222015-01-29 15:26:05 -08002285 * image quality based on the {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor}, if it is set.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002286 * <p><b>Possible values:</b>
2287 * <ul>
2288 * <li>{@link #EDGE_MODE_OFF OFF}</li>
2289 * <li>{@link #EDGE_MODE_FAST FAST}</li>
2290 * <li>{@link #EDGE_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
Eino-Ville Talvala0dd17502015-07-07 10:43:07 -07002291 * <li>{@link #EDGE_MODE_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002292 * </ul></p>
2293 * <p><b>Available values for this device:</b><br>
2294 * {@link CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES android.edge.availableEdgeModes}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002295 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002296 * <p><b>Full capability</b> -
2297 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2298 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Ruben Brunk6dc379c2014-03-04 15:04:00 -08002299 *
2300 * @see CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002301 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Zhijun He0e99c222015-01-29 15:26:05 -08002302 * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002303 * @see #EDGE_MODE_OFF
2304 * @see #EDGE_MODE_FAST
2305 * @see #EDGE_MODE_HIGH_QUALITY
Eino-Ville Talvala0dd17502015-07-07 10:43:07 -07002306 * @see #EDGE_MODE_ZERO_SHUTTER_LAG
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002307 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002308 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002309 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002310 public static final Key<Integer> EDGE_MODE =
2311 new Key<Integer>("android.edge.mode", int.class);
2312
2313 /**
Zhijun He66d065a2014-01-16 18:18:50 -08002314 * <p>The desired mode for for the camera device's flash control.</p>
2315 * <p>This control is only effective when flash unit is available
Zhijun He153ac102014-02-03 12:25:12 -08002316 * (<code>{@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} == true</code>).</p>
Zhijun He66d065a2014-01-16 18:18:50 -08002317 * <p>When this control is used, the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} must be set to ON or OFF.
2318 * Otherwise, the camera device auto-exposure related flash control (ON_AUTO_FLASH,
2319 * ON_ALWAYS_FLASH, or ON_AUTO_FLASH_REDEYE) will override this control.</p>
2320 * <p>When set to OFF, the camera device will not fire flash for this capture.</p>
2321 * <p>When set to SINGLE, the camera device will fire flash regardless of the camera
2322 * device's auto-exposure routine's result. When used in still capture case, this
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07002323 * control should be used along with auto-exposure (AE) precapture metering sequence
Zhijun He66d065a2014-01-16 18:18:50 -08002324 * ({@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}), otherwise, the image may be incorrectly exposed.</p>
2325 * <p>When set to TORCH, the flash will be on continuously. This mode can be used
2326 * for use cases such as preview, auto-focus assist, still capture, or video recording.</p>
Zhijun Heca1b73a2014-02-03 12:39:53 -08002327 * <p>The flash status will be reported by {@link CaptureResult#FLASH_STATE android.flash.state} in the capture result metadata.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002328 * <p><b>Possible values:</b>
2329 * <ul>
2330 * <li>{@link #FLASH_MODE_OFF OFF}</li>
2331 * <li>{@link #FLASH_MODE_SINGLE SINGLE}</li>
2332 * <li>{@link #FLASH_MODE_TORCH TORCH}</li>
2333 * </ul></p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002334 * <p>This key is available on all devices.</p>
Zhijun He66d065a2014-01-16 18:18:50 -08002335 *
2336 * @see CaptureRequest#CONTROL_AE_MODE
2337 * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
2338 * @see CameraCharacteristics#FLASH_INFO_AVAILABLE
Zhijun Heca1b73a2014-02-03 12:39:53 -08002339 * @see CaptureResult#FLASH_STATE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002340 * @see #FLASH_MODE_OFF
2341 * @see #FLASH_MODE_SINGLE
2342 * @see #FLASH_MODE_TORCH
2343 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002344 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002345 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002346 public static final Key<Integer> FLASH_MODE =
2347 new Key<Integer>("android.flash.mode", int.class);
2348
2349 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002350 * <p>Operational mode for hot pixel correction.</p>
Ruben Brunkeba1b3a2014-02-07 18:23:50 -08002351 * <p>Hotpixel correction interpolates out, or otherwise removes, pixels
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002352 * that do not accurately measure the incoming light (i.e. pixels that
2353 * are stuck at an arbitrary value or are oversensitive).</p>
2354 * <p><b>Possible values:</b>
2355 * <ul>
2356 * <li>{@link #HOT_PIXEL_MODE_OFF OFF}</li>
2357 * <li>{@link #HOT_PIXEL_MODE_FAST FAST}</li>
2358 * <li>{@link #HOT_PIXEL_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
2359 * </ul></p>
2360 * <p><b>Available values for this device:</b><br>
2361 * {@link CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES android.hotPixel.availableHotPixelModes}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002362 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Ruben Brunk9d454fd2014-03-04 14:11:52 -08002363 *
2364 * @see CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES
Ruben Brunkeba1b3a2014-02-07 18:23:50 -08002365 * @see #HOT_PIXEL_MODE_OFF
2366 * @see #HOT_PIXEL_MODE_FAST
2367 * @see #HOT_PIXEL_MODE_HIGH_QUALITY
2368 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002369 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002370 @NonNull
Ruben Brunkeba1b3a2014-02-07 18:23:50 -08002371 public static final Key<Integer> HOT_PIXEL_MODE =
2372 new Key<Integer>("android.hotPixel.mode", int.class);
2373
2374 /**
Ruben Brunk57493682014-05-27 18:58:08 -07002375 * <p>A location object to use when generating image GPS metadata.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002376 * <p>Setting a location object in a request will include the GPS coordinates of the location
2377 * into any JPEG images captured based on the request. These coordinates can then be
2378 * viewed by anyone who receives the JPEG image.</p>
Shuzhen Wangf655b1c2018-12-28 15:40:36 -08002379 * <p>This tag is also used for HEIC image capture.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002380 * <p>This key is available on all devices.</p>
Ruben Brunk57493682014-05-27 18:58:08 -07002381 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002382 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002383 @NonNull
Igor Murashkin6c76f582014-07-15 17:19:49 -07002384 @SyntheticKey
Ruben Brunk57493682014-05-27 18:58:08 -07002385 public static final Key<android.location.Location> JPEG_GPS_LOCATION =
2386 new Key<android.location.Location>("android.jpeg.gpsLocation", android.location.Location.class);
2387
2388 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08002389 * <p>GPS coordinates to include in output JPEG
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002390 * EXIF.</p>
Shuzhen Wangf655b1c2018-12-28 15:40:36 -08002391 * <p>This tag is also used for HEIC image capture.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002392 * <p><b>Range of valid values:</b><br>
2393 * (-180 - 180], [-90,90], [-inf, inf]</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002394 * <p>This key is available on all devices.</p>
Ruben Brunk57493682014-05-27 18:58:08 -07002395 * @hide
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002396 */
2397 public static final Key<double[]> JPEG_GPS_COORDINATES =
2398 new Key<double[]>("android.jpeg.gpsCoordinates", double[].class);
2399
2400 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08002401 * <p>32 characters describing GPS algorithm to
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002402 * include in EXIF.</p>
Shuzhen Wangf655b1c2018-12-28 15:40:36 -08002403 * <p>This tag is also used for HEIC image capture.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002404 * <p>This key is available on all devices.</p>
Ruben Brunk57493682014-05-27 18:58:08 -07002405 * @hide
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002406 */
2407 public static final Key<String> JPEG_GPS_PROCESSING_METHOD =
2408 new Key<String>("android.jpeg.gpsProcessingMethod", String.class);
2409
2410 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08002411 * <p>Time GPS fix was made to include in
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002412 * EXIF.</p>
Shuzhen Wangf655b1c2018-12-28 15:40:36 -08002413 * <p>This tag is also used for HEIC image capture.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002414 * <p><b>Units</b>: UTC in seconds since January 1, 1970</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002415 * <p>This key is available on all devices.</p>
Ruben Brunk57493682014-05-27 18:58:08 -07002416 * @hide
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002417 */
2418 public static final Key<Long> JPEG_GPS_TIMESTAMP =
2419 new Key<Long>("android.jpeg.gpsTimestamp", long.class);
2420
2421 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002422 * <p>The orientation for a JPEG image.</p>
2423 * <p>The clockwise rotation angle in degrees, relative to the orientation
2424 * to the camera, that the JPEG picture needs to be rotated by, to be viewed
2425 * upright.</p>
2426 * <p>Camera devices may either encode this value into the JPEG EXIF header, or
Yin-Chia Yehd49ebcc2015-03-27 13:54:04 -07002427 * rotate the image data to match this orientation. When the image data is rotated,
2428 * the thumbnail data will also be rotated.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002429 * <p>Note that this orientation is relative to the orientation of the camera sensor, given
2430 * by {@link CameraCharacteristics#SENSOR_ORIENTATION android.sensor.orientation}.</p>
Emilian Peev3abc7512018-03-28 11:22:26 +01002431 * <p>To translate from the device orientation given by the Android sensor APIs for camera
2432 * sensors which are not EXTERNAL, the following sample code may be used:</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002433 * <pre><code>private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) {
2434 * if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0;
2435 * int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION);
2436 *
2437 * // Round device orientation to a multiple of 90
2438 * deviceOrientation = (deviceOrientation + 45) / 90 * 90;
2439 *
2440 * // Reverse device orientation for front-facing cameras
2441 * boolean facingFront = c.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT;
2442 * if (facingFront) deviceOrientation = -deviceOrientation;
2443 *
2444 * // Calculate desired JPEG orientation relative to camera orientation to make
2445 * // the image upright relative to the device orientation
2446 * int jpegOrientation = (sensorOrientation + deviceOrientation + 360) % 360;
2447 *
2448 * return jpegOrientation;
2449 * }
2450 * </code></pre>
Emilian Peev3abc7512018-03-28 11:22:26 +01002451 * <p>For EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will
2452 * also be set to EXTERNAL. The above code is not relevant in such case.</p>
Shuzhen Wangf655b1c2018-12-28 15:40:36 -08002453 * <p>This tag is also used to describe the orientation of the HEIC image capture, in which
2454 * case the rotation is reflected by
2455 * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by
2456 * rotating the image data itself.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002457 * <p><b>Units</b>: Degrees in multiples of 90</p>
2458 * <p><b>Range of valid values:</b><br>
2459 * 0, 90, 180, 270</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002460 * <p>This key is available on all devices.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002461 *
2462 * @see CameraCharacteristics#SENSOR_ORIENTATION
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002463 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002464 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002465 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002466 public static final Key<Integer> JPEG_ORIENTATION =
2467 new Key<Integer>("android.jpeg.orientation", int.class);
2468
2469 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08002470 * <p>Compression quality of the final JPEG
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07002471 * image.</p>
Shuzhen Wangf655b1c2018-12-28 15:40:36 -08002472 * <p>85-95 is typical usage range. This tag is also used to describe the quality
2473 * of the HEIC image capture.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002474 * <p><b>Range of valid values:</b><br>
2475 * 1-100; larger is higher quality</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002476 * <p>This key is available on all devices.</p>
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002477 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002478 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002479 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002480 public static final Key<Byte> JPEG_QUALITY =
2481 new Key<Byte>("android.jpeg.quality", byte.class);
2482
2483 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08002484 * <p>Compression quality of JPEG
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07002485 * thumbnail.</p>
Shuzhen Wangf655b1c2018-12-28 15:40:36 -08002486 * <p>This tag is also used to describe the quality of the HEIC image capture.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002487 * <p><b>Range of valid values:</b><br>
2488 * 1-100; larger is higher quality</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002489 * <p>This key is available on all devices.</p>
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002490 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002491 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002492 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002493 public static final Key<Byte> JPEG_THUMBNAIL_QUALITY =
2494 new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
2495
2496 /**
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07002497 * <p>Resolution of embedded JPEG thumbnail.</p>
Zhijun He5f2a47f2014-01-16 15:44:41 -08002498 * <p>When set to (0, 0) value, the JPEG EXIF will not contain thumbnail,
2499 * but the captured JPEG will still be a valid image.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002500 * <p>For best results, when issuing a request for a JPEG image, the thumbnail size selected
2501 * should have the same aspect ratio as the main JPEG output.</p>
Zhijun He50f72432014-05-28 13:52:04 -07002502 * <p>If the thumbnail image aspect ratio differs from the JPEG primary image aspect
2503 * ratio, the camera device creates the thumbnail by cropping it from the primary image.
2504 * For example, if the primary image has 4:3 aspect ratio, the thumbnail image has
2505 * 16:9 aspect ratio, the primary image will be cropped vertically (letterbox) to
2506 * generate the thumbnail image. The thumbnail image will always have a smaller Field
2507 * Of View (FOV) than the primary image when aspect ratios differ.</p>
Yin-Chia Yeh59883112015-06-22 15:51:40 -07002508 * <p>When an {@link CaptureRequest#JPEG_ORIENTATION android.jpeg.orientation} of non-zero degree is requested,
2509 * the camera device will handle thumbnail rotation in one of the following ways:</p>
2510 * <ul>
2511 * <li>Set the {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}
2512 * and keep jpeg and thumbnail image data unrotated.</li>
2513 * <li>Rotate the jpeg and thumbnail image data and not set
2514 * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}. In this
2515 * case, LIMITED or FULL hardware level devices will report rotated thumnail size in
2516 * capture result, so the width and height will be interchanged if 90 or 270 degree
2517 * orientation is requested. LEGACY device will always report unrotated thumbnail
2518 * size.</li>
2519 * </ul>
Shuzhen Wangf655b1c2018-12-28 15:40:36 -08002520 * <p>The tag is also used as thumbnail size for HEIC image format capture, in which case the
2521 * the thumbnail rotation is reflected by
2522 * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by
2523 * rotating the thumbnail data itself.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002524 * <p><b>Range of valid values:</b><br>
2525 * {@link CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES android.jpeg.availableThumbnailSizes}</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002526 * <p>This key is available on all devices.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002527 *
2528 * @see CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES
Yin-Chia Yeh59883112015-06-22 15:51:40 -07002529 * @see CaptureRequest#JPEG_ORIENTATION
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002530 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002531 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002532 @NonNull
Igor Murashkin72f9f0a2014-05-14 15:46:10 -07002533 public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE =
2534 new Key<android.util.Size>("android.jpeg.thumbnailSize", android.util.Size.class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002535
2536 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002537 * <p>The desired lens aperture size, as a ratio of lens focal length to the
2538 * effective aperture diameter.</p>
2539 * <p>Setting this value is only supported on the camera devices that have a variable
2540 * aperture lens.</p>
Zhijun Hefb46c642014-01-14 17:57:23 -08002541 * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF,
2542 * this can be set along with {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
Eino-Ville Talvalad8fd6792014-02-10 12:41:04 -08002543 * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}
Zhijun Hefb46c642014-01-14 17:57:23 -08002544 * to achieve manual exposure control.</p>
2545 * <p>The requested aperture value may take several frames to reach the
2546 * requested value; the camera device will report the current (intermediate)
Zhijun Heca1b73a2014-02-03 12:39:53 -08002547 * aperture size in capture result metadata while the aperture is changing.
2548 * While the aperture is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p>
Zhijun Hefb46c642014-01-14 17:57:23 -08002549 * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is one of
2550 * the ON modes, this will be overridden by the camera device
2551 * auto-exposure algorithm, the overridden values are then provided
2552 * back to the user in the corresponding result.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002553 * <p><b>Units</b>: The f-number (f/N)</p>
2554 * <p><b>Range of valid values:</b><br>
2555 * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES android.lens.info.availableApertures}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002556 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002557 * <p><b>Full capability</b> -
2558 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2559 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Zhijun Hefb46c642014-01-14 17:57:23 -08002560 *
Zhijun He399f05d2014-01-15 11:31:30 -08002561 * @see CaptureRequest#CONTROL_AE_MODE
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002562 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Eino-Ville Talvala265b34c2014-01-16 16:18:52 -08002563 * @see CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES
Zhijun Heca1b73a2014-02-03 12:39:53 -08002564 * @see CaptureResult#LENS_STATE
Eino-Ville Talvala265b34c2014-01-16 16:18:52 -08002565 * @see CaptureRequest#SENSOR_EXPOSURE_TIME
Eino-Ville Talvalad8fd6792014-02-10 12:41:04 -08002566 * @see CaptureRequest#SENSOR_FRAME_DURATION
Eino-Ville Talvala265b34c2014-01-16 16:18:52 -08002567 * @see CaptureRequest#SENSOR_SENSITIVITY
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002568 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002569 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002570 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002571 public static final Key<Float> LENS_APERTURE =
2572 new Key<Float>("android.lens.aperture", float.class);
2573
2574 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002575 * <p>The desired setting for the lens neutral density filter(s).</p>
2576 * <p>This control will not be supported on most camera devices.</p>
Ruben Brunk855bae42014-01-17 10:30:32 -08002577 * <p>Lens filters are typically used to lower the amount of light the
2578 * sensor is exposed to (measured in steps of EV). As used here, an EV
2579 * step is the standard logarithmic representation, which are
2580 * non-negative, and inversely proportional to the amount of light
2581 * hitting the sensor. For example, setting this to 0 would result
2582 * in no reduction of the incoming light, and setting this to 2 would
2583 * mean that the filter is set to reduce incoming light by two stops
2584 * (allowing 1/4 of the prior amount of light to the sensor).</p>
Zhijun Heca1b73a2014-02-03 12:39:53 -08002585 * <p>It may take several frames before the lens filter density changes
2586 * to the requested value. While the filter density is still changing,
2587 * {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002588 * <p><b>Units</b>: Exposure Value (EV)</p>
2589 * <p><b>Range of valid values:</b><br>
2590 * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES android.lens.info.availableFilterDensities}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002591 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002592 * <p><b>Full capability</b> -
2593 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2594 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Ruben Brunk855bae42014-01-17 10:30:32 -08002595 *
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002596 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Ruben Brunk855bae42014-01-17 10:30:32 -08002597 * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES
Zhijun Heca1b73a2014-02-03 12:39:53 -08002598 * @see CaptureResult#LENS_STATE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002599 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002600 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002601 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002602 public static final Key<Float> LENS_FILTER_DENSITY =
2603 new Key<Float>("android.lens.filterDensity", float.class);
2604
2605 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002606 * <p>The desired lens focal length; used for optical zoom.</p>
Ruben Brunka20f4c22014-01-17 15:21:13 -08002607 * <p>This setting controls the physical focal length of the camera
2608 * device's lens. Changing the focal length changes the field of
2609 * view of the camera device, and is usually used for optical zoom.</p>
2610 * <p>Like {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} and {@link CaptureRequest#LENS_APERTURE android.lens.aperture}, this
2611 * setting won't be applied instantaneously, and it may take several
Zhijun Heca1b73a2014-02-03 12:39:53 -08002612 * frames before the lens can change to the requested focal length.
Ruben Brunka20f4c22014-01-17 15:21:13 -08002613 * While the focal length is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will
2614 * be set to MOVING.</p>
Shuzhen Wang69cf0fd2020-03-13 09:40:58 -07002615 * <p>Optical zoom via this control will not be supported on most devices. Starting from API
2616 * level 30, the camera device may combine optical and digital zoom through the
2617 * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} control.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002618 * <p><b>Units</b>: Millimeters</p>
2619 * <p><b>Range of valid values:</b><br>
2620 * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS android.lens.info.availableFocalLengths}</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002621 * <p>This key is available on all devices.</p>
Ruben Brunka20f4c22014-01-17 15:21:13 -08002622 *
Shuzhen Wang69cf0fd2020-03-13 09:40:58 -07002623 * @see CaptureRequest#CONTROL_ZOOM_RATIO
Ruben Brunka20f4c22014-01-17 15:21:13 -08002624 * @see CaptureRequest#LENS_APERTURE
2625 * @see CaptureRequest#LENS_FOCUS_DISTANCE
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002626 * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS
Ruben Brunka20f4c22014-01-17 15:21:13 -08002627 * @see CaptureResult#LENS_STATE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002628 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002629 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002630 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002631 public static final Key<Float> LENS_FOCAL_LENGTH =
2632 new Key<Float>("android.lens.focalLength", float.class);
2633
2634 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002635 * <p>Desired distance to plane of sharpest focus,
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07002636 * measured from frontmost surface of the lens.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002637 * <p>This control can be used for setting manual focus, on devices that support
2638 * the MANUAL_SENSOR capability and have a variable-focus lens (see
2639 * {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance}).</p>
2640 * <p>A value of <code>0.0f</code> means infinity focus. The value set will be clamped to
2641 * <code>[0.0f, {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance}]</code>.</p>
Zhijun Heca1b73a2014-02-03 12:39:53 -08002642 * <p>Like {@link CaptureRequest#LENS_FOCAL_LENGTH android.lens.focalLength}, this setting won't be applied
2643 * instantaneously, and it may take several frames before the lens
2644 * can move to the requested focus distance. While the lens is still moving,
2645 * {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002646 * <p>LEGACY devices support at most setting this to <code>0.0f</code>
2647 * for infinity focus.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002648 * <p><b>Units</b>: See {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details</p>
2649 * <p><b>Range of valid values:</b><br>
2650 * &gt;= 0</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002651 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002652 * <p><b>Full capability</b> -
2653 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2654 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Zhijun Heca1b73a2014-02-03 12:39:53 -08002655 *
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002656 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Zhijun Heca1b73a2014-02-03 12:39:53 -08002657 * @see CaptureRequest#LENS_FOCAL_LENGTH
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002658 * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
Zhijun Heca1b73a2014-02-03 12:39:53 -08002659 * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE
2660 * @see CaptureResult#LENS_STATE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002661 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002662 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002663 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002664 public static final Key<Float> LENS_FOCUS_DISTANCE =
2665 new Key<Float>("android.lens.focusDistance", float.class);
2666
2667 /**
Ruben Brunk00849b32014-01-17 18:30:23 -08002668 * <p>Sets whether the camera device uses optical image stabilization (OIS)
2669 * when capturing images.</p>
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07002670 * <p>OIS is used to compensate for motion blur due to small
2671 * movements of the camera during capture. Unlike digital image
2672 * stabilization ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), OIS
2673 * makes use of mechanical elements to stabilize the camera
2674 * sensor, and thus allows for longer exposure times before
2675 * camera shake becomes apparent.</p>
Zhijun He45fa43a12014-06-13 18:29:37 -07002676 * <p>Switching between different optical stabilization modes may take several
2677 * frames to initialize, the camera device will report the current mode in
2678 * capture result metadata. For example, When "ON" mode is requested, the
2679 * optical stabilization modes in the first several capture results may still
2680 * be "OFF", and it will become "ON" when the initialization is done.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002681 * <p>If a camera device supports both OIS and digital image stabilization
2682 * ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), turning both modes on may produce undesirable
2683 * interaction, so it is recommended not to enable both at the same time.</p>
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07002684 * <p>Not all devices will support OIS; see
2685 * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization} for
2686 * available controls.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002687 * <p><b>Possible values:</b>
2688 * <ul>
2689 * <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_OFF OFF}</li>
2690 * <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_ON ON}</li>
2691 * </ul></p>
2692 * <p><b>Available values for this device:</b><br>
2693 * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002694 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002695 * <p><b>Limited capability</b> -
2696 * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
2697 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07002698 *
2699 * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002700 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07002701 * @see CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002702 * @see #LENS_OPTICAL_STABILIZATION_MODE_OFF
2703 * @see #LENS_OPTICAL_STABILIZATION_MODE_ON
2704 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002705 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002706 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002707 public static final Key<Integer> LENS_OPTICAL_STABILIZATION_MODE =
2708 new Key<Integer>("android.lens.opticalStabilizationMode", int.class);
2709
2710 /**
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07002711 * <p>Mode of operation for the noise reduction algorithm.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002712 * <p>The noise reduction algorithm attempts to improve image quality by removing
Zhijun He0e99c222015-01-29 15:26:05 -08002713 * excessive noise added by the capture process, especially in dark conditions.</p>
2714 * <p>OFF means no noise reduction will be applied by the camera device, for both raw and
2715 * YUV domain.</p>
2716 * <p>MINIMAL means that only sensor raw domain basic noise reduction is enabled ,to remove
2717 * demosaicing or other processing artifacts. For YUV_REPROCESSING, MINIMAL is same as OFF.
2718 * This mode is optional, may not be support by all devices. The application should check
2719 * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes} before using it.</p>
Zhijun He5f2a47f2014-01-16 15:44:41 -08002720 * <p>FAST/HIGH_QUALITY both mean camera device determined noise filtering
2721 * will be applied. HIGH_QUALITY mode indicates that the camera device
2722 * will use the highest-quality noise filtering algorithms,
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07002723 * even if it slows down capture rate. FAST means the camera device will not
Chien-Yu Chen9c9167e2015-07-14 16:38:25 -07002724 * slow down capture rate when applying noise filtering. FAST may be the same as MINIMAL if
2725 * MINIMAL is listed, or the same as OFF if any noise filtering will slow down capture rate.
2726 * Every output stream will have a similar amount of enhancement applied.</p>
Eino-Ville Talvala0dd17502015-07-07 10:43:07 -07002727 * <p>ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular
2728 * buffer of high-resolution images during preview and reprocess image(s) from that buffer
2729 * into a final capture when triggered by the user. In this mode, the camera device applies
2730 * noise reduction to low-resolution streams (below maximum recording resolution) to maximize
2731 * preview quality, but does not apply noise reduction to high-resolution streams, since
2732 * those will be reprocessed later if necessary.</p>
Zhijun He0e99c222015-01-29 15:26:05 -08002733 * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera device
2734 * will apply FAST/HIGH_QUALITY YUV domain noise reduction, respectively. The camera device
2735 * may adjust the noise reduction parameters for best image quality based on the
2736 * {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor} if it is set.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002737 * <p><b>Possible values:</b>
2738 * <ul>
2739 * <li>{@link #NOISE_REDUCTION_MODE_OFF OFF}</li>
2740 * <li>{@link #NOISE_REDUCTION_MODE_FAST FAST}</li>
2741 * <li>{@link #NOISE_REDUCTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
Zhijun He0e99c222015-01-29 15:26:05 -08002742 * <li>{@link #NOISE_REDUCTION_MODE_MINIMAL MINIMAL}</li>
Eino-Ville Talvala0dd17502015-07-07 10:43:07 -07002743 * <li>{@link #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002744 * </ul></p>
2745 * <p><b>Available values for this device:</b><br>
2746 * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002747 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002748 * <p><b>Full capability</b> -
2749 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2750 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Ruben Brunk6dc379c2014-03-04 15:04:00 -08002751 *
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002752 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Ruben Brunk6dc379c2014-03-04 15:04:00 -08002753 * @see CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES
Zhijun He0e99c222015-01-29 15:26:05 -08002754 * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002755 * @see #NOISE_REDUCTION_MODE_OFF
2756 * @see #NOISE_REDUCTION_MODE_FAST
2757 * @see #NOISE_REDUCTION_MODE_HIGH_QUALITY
Zhijun He0e99c222015-01-29 15:26:05 -08002758 * @see #NOISE_REDUCTION_MODE_MINIMAL
Eino-Ville Talvala0dd17502015-07-07 10:43:07 -07002759 * @see #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002760 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002761 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002762 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002763 public static final Key<Integer> NOISE_REDUCTION_MODE =
2764 new Key<Integer>("android.noiseReduction.mode", int.class);
2765
2766 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08002767 * <p>An application-specified ID for the current
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002768 * request. Must be maintained unchanged in output
Igor Murashkinace5bf02013-12-10 17:36:40 -08002769 * frame</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002770 * <p><b>Units</b>: arbitrary integer assigned by application</p>
2771 * <p><b>Range of valid values:</b><br>
2772 * Any int</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002773 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002774 * @hide
2775 */
2776 public static final Key<Integer> REQUEST_ID =
2777 new Key<Integer>("android.request.id", int.class);
2778
2779 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002780 * <p>The desired region of the sensor to read out for this capture.</p>
2781 * <p>This control can be used to implement digital zoom.</p>
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07002782 * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate
2783 * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being
2784 * the top-left pixel of the active array.</p>
Eino-Ville Talvalad2d749a2020-01-06 16:10:29 -08002785 * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate system
2786 * depends on the mode being set. When the distortion correction mode is OFF, the
2787 * coordinate system follows {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with <code>(0,
2788 * 0)</code> being the top-left pixel of the pre-correction active array. When the distortion
2789 * correction mode is not OFF, the coordinate system follows
2790 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being the top-left pixel of the
2791 * active array.</p>
2792 * <p>Output streams use this rectangle to produce their output, cropping to a smaller region
2793 * if necessary to maintain the stream's aspect ratio, then scaling the sensor input to
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07002794 * match the output's configured resolution.</p>
Eino-Ville Talvalad2d749a2020-01-06 16:10:29 -08002795 * <p>The crop region is applied after the RAW to other color space (e.g. YUV)
2796 * conversion. Since raw streams (e.g. RAW16) don't have the conversion stage, they are not
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07002797 * croppable. The crop region will be ignored by raw streams.</p>
Eino-Ville Talvalad2d749a2020-01-06 16:10:29 -08002798 * <p>For non-raw streams, any additional per-stream cropping will be done to maximize the
2799 * final pixel area of the stream.</p>
2800 * <p>For example, if the crop region is set to a 4:3 aspect ratio, then 4:3 streams will use
2801 * the exact crop region. 16:9 streams will further crop vertically (letterbox).</p>
2802 * <p>Conversely, if the crop region is set to a 16:9, then 4:3 outputs will crop horizontally
2803 * (pillarbox), and 16:9 streams will match exactly. These additional crops will be
2804 * centered within the crop region.</p>
2805 * <p>To illustrate, here are several scenarios of different crop regions and output streams,
2806 * for a hypothetical camera device with an active array of size <code>(2000,1500)</code>. Note that
2807 * several of these examples use non-centered crop regions for ease of illustration; such
2808 * regions are only supported on devices with FREEFORM capability
2809 * ({@link CameraCharacteristics#SCALER_CROPPING_TYPE android.scaler.croppingType} <code>== FREEFORM</code>), but this does not affect the way the crop
2810 * rules work otherwise.</p>
2811 * <ul>
2812 * <li>Camera Configuration:<ul>
2813 * <li>Active array size: <code>2000x1500</code> (3 MP, 4:3 aspect ratio)</li>
2814 * <li>Output stream #1: <code>640x480</code> (VGA, 4:3 aspect ratio)</li>
2815 * <li>Output stream #2: <code>1280x720</code> (720p, 16:9 aspect ratio)</li>
2816 * </ul>
2817 * </li>
2818 * <li>Case #1: 4:3 crop region with 2x digital zoom<ul>
2819 * <li>Crop region: <code>Rect(500, 375, 1500, 1125) // (left, top, right, bottom)</code></li>
2820 * <li><img alt="4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-43-ratio.png" /></li>
2821 * <li><code>640x480</code> stream source area: <code>(500, 375, 1500, 1125)</code> (equal to crop region)</li>
2822 * <li><code>1280x720</code> stream source area: <code>(500, 469, 1500, 1031)</code> (letterboxed)</li>
2823 * </ul>
2824 * </li>
2825 * <li>Case #2: 16:9 crop region with ~1.5x digital zoom.<ul>
2826 * <li>Crop region: <code>Rect(500, 375, 1833, 1125)</code></li>
2827 * <li><img alt="16:9 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-169-ratio.png" /></li>
2828 * <li><code>640x480</code> stream source area: <code>(666, 375, 1666, 1125)</code> (pillarboxed)</li>
2829 * <li><code>1280x720</code> stream source area: <code>(500, 375, 1833, 1125)</code> (equal to crop region)</li>
2830 * </ul>
2831 * </li>
2832 * <li>Case #3: 1:1 crop region with ~2.6x digital zoom.<ul>
2833 * <li>Crop region: <code>Rect(500, 375, 1250, 1125)</code></li>
2834 * <li><img alt="1:1 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-11-ratio.png" /></li>
2835 * <li><code>640x480</code> stream source area: <code>(500, 469, 1250, 1031)</code> (letterboxed)</li>
2836 * <li><code>1280x720</code> stream source area: <code>(500, 543, 1250, 957)</code> (letterboxed)</li>
2837 * </ul>
2838 * </li>
2839 * <li>Case #4: Replace <code>640x480</code> stream with <code>1024x1024</code> stream, with 4:3 crop region:<ul>
2840 * <li>Crop region: <code>Rect(500, 375, 1500, 1125)</code></li>
2841 * <li><img alt="Square output, 4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-43-square-ratio.png" /></li>
2842 * <li><code>1024x1024</code> stream source area: <code>(625, 375, 1375, 1125)</code> (pillarboxed)</li>
2843 * <li><code>1280x720</code> stream source area: <code>(500, 469, 1500, 1031)</code> (letterboxed)</li>
2844 * <li>Note that in this case, neither of the two outputs is a subset of the other, with
2845 * each containing image data the other doesn't have.</li>
2846 * </ul>
2847 * </li>
2848 * </ul>
Eino-Ville Talvala08bd1632018-08-01 17:23:09 -07002849 * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, the width and height
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07002850 * of the crop region cannot be set to be smaller than
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07002851 * <code>floor( activeArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> and
2852 * <code>floor( activeArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, respectively.</p>
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07002853 * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, the width
2854 * and height of the crop region cannot be set to be smaller than
2855 * <code>floor( preCorrectionActiveArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>
2856 * and
2857 * <code>floor( preCorrectionActiveArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>,
2858 * respectively.</p>
Eino-Ville Talvalad2d749a2020-01-06 16:10:29 -08002859 * <p>The camera device may adjust the crop region to account for rounding and other hardware
2860 * requirements; the final crop region used will be included in the output capture result.</p>
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08002861 * <p>Starting from API level 30, it's strongly recommended to use {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}
2862 * to take advantage of better support for zoom with logical multi-camera. The benefits
2863 * include better precision with optical-digital zoom combination, and ability to do
2864 * zoom-out from 1.0x. When using {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for zoom, the crop region in
2865 * the capture request must be either letterboxing or pillarboxing (but not both). The
2866 * coordinate system is post-zoom, meaning that the activeArraySize or
Eino-Ville Talvalad2d749a2020-01-06 16:10:29 -08002867 * preCorrectionActiveArraySize covers the camera device's field of view "after" zoom. See
2868 * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002869 * <p><b>Units</b>: Pixel coordinates relative to
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07002870 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or
2871 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on distortion correction
2872 * capability and mode</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002873 * <p>This key is available on all devices.</p>
Eino-Ville Talvalad8fd6792014-02-10 12:41:04 -08002874 *
Shuzhen Wang55c1c3f2019-11-13 11:25:20 -08002875 * @see CaptureRequest#CONTROL_ZOOM_RATIO
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07002876 * @see CaptureRequest#DISTORTION_CORRECTION_MODE
Eino-Ville Talvalad8fd6792014-02-10 12:41:04 -08002877 * @see CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM
Eino-Ville Talvalad2d749a2020-01-06 16:10:29 -08002878 * @see CameraCharacteristics#SCALER_CROPPING_TYPE
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07002879 * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07002880 * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002881 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002882 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002883 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002884 public static final Key<android.graphics.Rect> SCALER_CROP_REGION =
2885 new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class);
2886
2887 /**
Eino-Ville Talvalaa9b1d602020-01-06 13:10:22 -08002888 * <p>Whether a rotation-and-crop operation is applied to processed
2889 * outputs from the camera.</p>
2890 * <p>This control is primarily intended to help camera applications with no support for
2891 * multi-window modes to work correctly on devices where multi-window scenarios are
2892 * unavoidable, such as foldables or other devices with variable display geometry or more
2893 * free-form window placement (such as laptops, which often place portrait-orientation apps
2894 * in landscape with pillarboxing).</p>
2895 * <p>If supported, the default value is <code>ROTATE_AND_CROP_AUTO</code>, which allows the camera API
2896 * to enable backwards-compatibility support for applications that do not support resizing
2897 * / multi-window modes, when the device is in fact in a multi-window mode (such as inset
2898 * portrait on laptops, or on a foldable device in some fold states). In addition,
2899 * <code>ROTATE_AND_CROP_NONE</code> and <code>ROTATE_AND_CROP_90</code> will always be available if this control
2900 * is supported by the device. If not supported, devices API level 30 or higher will always
2901 * list only <code>ROTATE_AND_CROP_NONE</code>.</p>
2902 * <p>When <code>CROP_AUTO</code> is in use, and the camera API activates backward-compatibility mode,
2903 * several metadata fields will also be parsed differently to ensure that coordinates are
2904 * correctly handled for features like drawing face detection boxes or passing in
2905 * tap-to-focus coordinates. The camera API will convert positions in the active array
2906 * coordinate system to/from the cropped-and-rotated coordinate system to make the
2907 * operation transparent for applications. The following controls are affected:</p>
2908 * <ul>
2909 * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li>
2910 * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li>
2911 * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li>
2912 * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li>
2913 * </ul>
2914 * <p>Capture results will contain the actual value selected by the API;
2915 * <code>ROTATE_AND_CROP_AUTO</code> will never be seen in a capture result.</p>
2916 * <p>Applications can also select their preferred cropping mode, either to opt out of the
2917 * backwards-compatibility treatment, or to use the cropping feature themselves as needed.
2918 * In this case, no coordinate translation will be done automatically, and all controls
2919 * will continue to use the normal active array coordinates.</p>
2920 * <p>Cropping and rotating is done after the application of digital zoom (via either
2921 * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}), but before each individual
2922 * output is further cropped and scaled. It only affects processed outputs such as
2923 * YUV, PRIVATE, and JPEG. It has no effect on RAW outputs.</p>
2924 * <p>When <code>CROP_90</code> or <code>CROP_270</code> are selected, there is a significant loss to the field of
2925 * view. For example, with a 4:3 aspect ratio output of 1600x1200, <code>CROP_90</code> will still
2926 * produce 1600x1200 output, but these buffers are cropped from a vertical 3:4 slice at the
2927 * center of the 4:3 area, then rotated to be 4:3, and then upscaled to 1600x1200. Only
2928 * 56.25% of the original FOV is still visible. In general, for an aspect ratio of <code>w:h</code>,
2929 * the crop and rotate operation leaves <code>(h/w)^2</code> of the field of view visible. For 16:9,
2930 * this is ~31.6%.</p>
2931 * <p>As a visual example, the figure below shows the effect of <code>ROTATE_AND_CROP_90</code> on the
2932 * outputs for the following parameters:</p>
2933 * <ul>
2934 * <li>Sensor active array: <code>2000x1500</code></li>
2935 * <li>Crop region: top-left: <code>(500, 375)</code>, size: <code>(1000, 750)</code> (4:3 aspect ratio)</li>
2936 * <li>Output streams: YUV <code>640x480</code> and YUV <code>1280x720</code></li>
2937 * <li><code>ROTATE_AND_CROP_90</code></li>
2938 * </ul>
2939 * <p><img alt="Effect of ROTATE_AND_CROP_90" src="/reference/images/camera2/metadata/android.scaler.rotateAndCrop/crop-region-rotate-90-43-ratio.png" /></p>
2940 * <p>With these settings, the regions of the active array covered by the output streams are:</p>
2941 * <ul>
2942 * <li>640x480 stream crop: top-left: <code>(219, 375)</code>, size: <code>(562, 750)</code></li>
2943 * <li>1280x720 stream crop: top-left: <code>(289, 375)</code>, size: <code>(422, 750)</code></li>
2944 * </ul>
2945 * <p>Since the buffers are rotated, the buffers as seen by the application are:</p>
2946 * <ul>
2947 * <li>640x480 stream: top-left: <code>(781, 375)</code> on active array, size: <code>(640, 480)</code>, downscaled 1.17x from sensor pixels</li>
2948 * <li>1280x720 stream: top-left: <code>(711, 375)</code> on active array, size: <code>(1280, 720)</code>, upscaled 1.71x from sensor pixels</li>
2949 * </ul>
2950 * <p><b>Possible values:</b>
2951 * <ul>
2952 * <li>{@link #SCALER_ROTATE_AND_CROP_NONE NONE}</li>
2953 * <li>{@link #SCALER_ROTATE_AND_CROP_90 90}</li>
2954 * <li>{@link #SCALER_ROTATE_AND_CROP_180 180}</li>
2955 * <li>{@link #SCALER_ROTATE_AND_CROP_270 270}</li>
2956 * <li>{@link #SCALER_ROTATE_AND_CROP_AUTO AUTO}</li>
2957 * </ul></p>
2958 * <p><b>Available values for this device:</b><br>
Eino-Ville Talvala9f9bb3b2020-03-18 13:31:03 -07002959 * android.scaler.availableRotateAndCropModes</p>
Eino-Ville Talvalaa9b1d602020-01-06 13:10:22 -08002960 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
2961 *
2962 * @see CaptureRequest#CONTROL_AE_REGIONS
2963 * @see CaptureRequest#CONTROL_AF_REGIONS
2964 * @see CaptureRequest#CONTROL_AWB_REGIONS
2965 * @see CaptureRequest#CONTROL_ZOOM_RATIO
Eino-Ville Talvalaa9b1d602020-01-06 13:10:22 -08002966 * @see CaptureRequest#SCALER_CROP_REGION
2967 * @see CaptureResult#STATISTICS_FACES
2968 * @see #SCALER_ROTATE_AND_CROP_NONE
2969 * @see #SCALER_ROTATE_AND_CROP_90
2970 * @see #SCALER_ROTATE_AND_CROP_180
2971 * @see #SCALER_ROTATE_AND_CROP_270
2972 * @see #SCALER_ROTATE_AND_CROP_AUTO
Eino-Ville Talvala9f9bb3b2020-03-18 13:31:03 -07002973 * @hide
Eino-Ville Talvalaa9b1d602020-01-06 13:10:22 -08002974 */
Eino-Ville Talvalaa9b1d602020-01-06 13:10:22 -08002975 public static final Key<Integer> SCALER_ROTATE_AND_CROP =
2976 new Key<Integer>("android.scaler.rotateAndCrop", int.class);
2977
2978 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08002979 * <p>Duration each pixel is exposed to
2980 * light.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002981 * <p>If the sensor can't expose this exact duration, it will shorten the
2982 * duration exposed to the nearest possible value (rather than expose longer).
2983 * The final exposure time used will be available in the output capture result.</p>
2984 * <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
2985 * OFF; otherwise the auto-exposure algorithm will override this value.</p>
2986 * <p><b>Units</b>: Nanoseconds</p>
2987 * <p><b>Range of valid values:</b><br>
2988 * {@link CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE android.sensor.info.exposureTimeRange}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08002989 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002990 * <p><b>Full capability</b> -
2991 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
2992 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
2993 *
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002994 * @see CaptureRequest#CONTROL_AE_MODE
2995 * @see CaptureRequest#CONTROL_MODE
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07002996 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07002997 * @see CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07002998 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07002999 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003000 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003001 public static final Key<Long> SENSOR_EXPOSURE_TIME =
3002 new Key<Long>("android.sensor.exposureTime", long.class);
3003
3004 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08003005 * <p>Duration from start of frame exposure to
Igor Murashkin143aa0b2014-01-17 15:02:34 -08003006 * start of next frame exposure.</p>
3007 * <p>The maximum frame rate that can be supported by a camera subsystem is
3008 * a function of many factors:</p>
3009 * <ul>
3010 * <li>Requested resolutions of output image streams</li>
3011 * <li>Availability of binning / skipping modes on the imager</li>
3012 * <li>The bandwidth of the imager interface</li>
3013 * <li>The bandwidth of the various ISP processing blocks</li>
3014 * </ul>
3015 * <p>Since these factors can vary greatly between different ISPs and
3016 * sensors, the camera abstraction tries to represent the bandwidth
3017 * restrictions with as simple a model as possible.</p>
3018 * <p>The model presented has the following characteristics:</p>
3019 * <ul>
3020 * <li>The image sensor is always configured to output the smallest
3021 * resolution possible given the application's requested output stream
3022 * sizes. The smallest resolution is defined as being at least as large
3023 * as the largest requested output stream size; the camera pipeline must
3024 * never digitally upsample sensor data when the crop region covers the
3025 * whole sensor. In general, this means that if only small output stream
3026 * resolutions are configured, the sensor can provide a higher frame
3027 * rate.</li>
3028 * <li>Since any request may use any or all the currently configured
3029 * output streams, the sensor and ISP must be configured to support
3030 * scaling a single capture to all the streams at the same time. This
3031 * means the camera pipeline must be ready to produce the largest
3032 * requested output size without any delay. Therefore, the overall
3033 * frame rate of a given configured stream set is governed only by the
3034 * largest requested stream resolution.</li>
3035 * <li>Using more than one output stream in a request does not affect the
3036 * frame duration.</li>
Igor Murashkina23ffb52014-02-07 18:52:34 -08003037 * <li>Certain format-streams may need to do additional background processing
3038 * before data is consumed/produced by that stream. These processors
3039 * can run concurrently to the rest of the camera pipeline, but
3040 * cannot process more than 1 capture at a time.</li>
Igor Murashkin143aa0b2014-01-17 15:02:34 -08003041 * </ul>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003042 * <p>The necessary information for the application, given the model above, is provided via
Eino-Ville Talvalab6eb52f2015-04-16 16:39:45 -07003043 * {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputMinFrameDuration }.
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003044 * These are used to determine the maximum frame rate / minimum frame duration that is
3045 * possible for a given stream configuration.</p>
Igor Murashkin143aa0b2014-01-17 15:02:34 -08003046 * <p>Specifically, the application can use the following rules to
Igor Murashkina23ffb52014-02-07 18:52:34 -08003047 * determine the minimum frame duration it can request from the camera
Igor Murashkin143aa0b2014-01-17 15:02:34 -08003048 * device:</p>
3049 * <ol>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003050 * <li>Let the set of currently configured input/output streams be called <code>S</code>.</li>
3051 * <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 }
3052 * (with its respective size/format). Let this set of frame durations be called <code>F</code>.</li>
3053 * <li>For any given request <code>R</code>, the minimum frame duration allowed for <code>R</code> is the maximum
3054 * out of all values in <code>F</code>. Let the streams used in <code>R</code> be called <code>S_r</code>.</li>
Igor Murashkin143aa0b2014-01-17 15:02:34 -08003055 * </ol>
Eino-Ville Talvalab6eb52f2015-04-16 16:39:45 -07003056 * <p>If none of the streams in <code>S_r</code> have a stall time (listed in {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputStallDuration }
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003057 * using its respective size/format), then the frame duration in <code>F</code> determines the steady
3058 * state frame rate that the application will get if it uses <code>R</code> as a repeating request. Let
3059 * this special kind of request be called <code>Rsimple</code>.</p>
3060 * <p>A repeating request <code>Rsimple</code> can be <em>occasionally</em> interleaved by a single capture of a
3061 * new request <code>Rstall</code> (which has at least one in-use stream with a non-0 stall time) and if
3062 * <code>Rstall</code> has the same minimum frame duration this will not cause a frame rate loss if all
3063 * buffers from the previous <code>Rstall</code> have already been delivered.</p>
3064 * <p>For more details about stalling, see {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputStallDuration }.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003065 * <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
3066 * OFF; otherwise the auto-exposure algorithm will override this value.</p>
3067 * <p><b>Units</b>: Nanoseconds</p>
3068 * <p><b>Range of valid values:</b><br>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003069 * See {@link CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION android.sensor.info.maxFrameDuration}, {@link android.hardware.camera2.params.StreamConfigurationMap }.
3070 * The duration is capped to <code>max(duration, exposureTime + overhead)</code>.</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003071 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003072 * <p><b>Full capability</b> -
3073 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3074 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Igor Murashkin143aa0b2014-01-17 15:02:34 -08003075 *
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003076 * @see CaptureRequest#CONTROL_AE_MODE
3077 * @see CaptureRequest#CONTROL_MODE
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003078 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003079 * @see CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003080 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003081 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003082 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003083 public static final Key<Long> SENSOR_FRAME_DURATION =
3084 new Key<Long>("android.sensor.frameDuration", long.class);
3085
3086 /**
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07003087 * <p>The amount of gain applied to sensor data
3088 * before processing.</p>
3089 * <p>The sensitivity is the standard ISO sensitivity value,
3090 * as defined in ISO 12232:2006.</p>
3091 * <p>The sensitivity must be within {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}, and
3092 * if if it less than {@link CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY android.sensor.maxAnalogSensitivity}, the camera device
3093 * is guaranteed to use only analog amplification for applying the gain.</p>
3094 * <p>If the camera device cannot apply the exact sensitivity
3095 * requested, it will reduce the gain to the nearest supported
3096 * value. The final sensitivity used will be available in the
3097 * output capture result.</p>
Yin-Chia Yeh1ee1a0a2016-01-18 19:13:47 -08003098 * <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
3099 * OFF; otherwise the auto-exposure algorithm will override this value.</p>
Shuzhen Wang252fa532019-07-08 15:14:16 -07003100 * <p>Note that for devices supporting postRawSensitivityBoost, the total sensitivity applied
3101 * to the final processed image is the combination of {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} and
3102 * {@link CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST android.control.postRawSensitivityBoost}. In case the application uses the sensor
3103 * sensitivity from last capture result of an auto request for a manual request, in order
3104 * to achieve the same brightness in the output image, the application should also
3105 * set postRawSensitivityBoost.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003106 * <p><b>Units</b>: ISO arithmetic units</p>
3107 * <p><b>Range of valid values:</b><br>
3108 * {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003109 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003110 * <p><b>Full capability</b> -
3111 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3112 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07003113 *
Yin-Chia Yeh1ee1a0a2016-01-18 19:13:47 -08003114 * @see CaptureRequest#CONTROL_AE_MODE
3115 * @see CaptureRequest#CONTROL_MODE
Shuzhen Wang252fa532019-07-08 15:14:16 -07003116 * @see CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003117 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07003118 * @see CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE
3119 * @see CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY
Shuzhen Wang252fa532019-07-08 15:14:16 -07003120 * @see CaptureRequest#SENSOR_SENSITIVITY
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003121 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003122 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003123 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003124 public static final Key<Integer> SENSOR_SENSITIVITY =
3125 new Key<Integer>("android.sensor.sensitivity", int.class);
3126
3127 /**
Igor Murashkinc127f052014-01-17 18:06:02 -08003128 * <p>A pixel <code>[R, G_even, G_odd, B]</code> that supplies the test pattern
3129 * when {@link CaptureRequest#SENSOR_TEST_PATTERN_MODE android.sensor.testPatternMode} is SOLID_COLOR.</p>
3130 * <p>Each color channel is treated as an unsigned 32-bit integer.
3131 * The camera device then uses the most significant X bits
3132 * that correspond to how many bits are in its Bayer raw sensor
3133 * output.</p>
3134 * <p>For example, a sensor with RAW10 Bayer output would use the
3135 * 10 most significant bits from each color channel.</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003136 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkinc127f052014-01-17 18:06:02 -08003137 *
3138 * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE
3139 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003140 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003141 @NonNull
Igor Murashkinc127f052014-01-17 18:06:02 -08003142 public static final Key<int[]> SENSOR_TEST_PATTERN_DATA =
3143 new Key<int[]>("android.sensor.testPatternData", int[].class);
3144
3145 /**
3146 * <p>When enabled, the sensor sends a test pattern instead of
3147 * doing a real exposure from the camera.</p>
3148 * <p>When a test pattern is enabled, all manual sensor controls specified
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07003149 * by android.sensor.* will be ignored. All other controls should
Igor Murashkinc127f052014-01-17 18:06:02 -08003150 * work as normal.</p>
3151 * <p>For example, if manual flash is enabled, flash firing should still
3152 * occur (and that the test pattern remain unmodified, since the flash
3153 * would not actually affect it).</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003154 * <p>Defaults to OFF.</p>
3155 * <p><b>Possible values:</b>
3156 * <ul>
3157 * <li>{@link #SENSOR_TEST_PATTERN_MODE_OFF OFF}</li>
3158 * <li>{@link #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR SOLID_COLOR}</li>
3159 * <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS COLOR_BARS}</li>
3160 * <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY COLOR_BARS_FADE_TO_GRAY}</li>
3161 * <li>{@link #SENSOR_TEST_PATTERN_MODE_PN9 PN9}</li>
3162 * <li>{@link #SENSOR_TEST_PATTERN_MODE_CUSTOM1 CUSTOM1}</li>
3163 * </ul></p>
3164 * <p><b>Available values for this device:</b><br>
3165 * {@link CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES android.sensor.availableTestPatternModes}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003166 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003167 *
3168 * @see CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES
Igor Murashkinc127f052014-01-17 18:06:02 -08003169 * @see #SENSOR_TEST_PATTERN_MODE_OFF
3170 * @see #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR
3171 * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS
3172 * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY
3173 * @see #SENSOR_TEST_PATTERN_MODE_PN9
3174 * @see #SENSOR_TEST_PATTERN_MODE_CUSTOM1
3175 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003176 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003177 @NonNull
Igor Murashkinc127f052014-01-17 18:06:02 -08003178 public static final Key<Integer> SENSOR_TEST_PATTERN_MODE =
3179 new Key<Integer>("android.sensor.testPatternMode", int.class);
3180
3181 /**
Zhijun Heba93fe62014-01-17 16:43:05 -08003182 * <p>Quality of lens shading correction applied
3183 * to the image data.</p>
3184 * <p>When set to OFF mode, no lens shading correction will be applied by the
3185 * camera device, and an identity lens shading map data will be provided
3186 * if <code>{@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} == ON</code>. For example, for lens
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003187 * shading map with size of <code>[ 4, 3 ]</code>,
3188 * the output {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap} for this case will be an identity
3189 * map shown below:</p>
Zhijun Heba93fe62014-01-17 16:43:05 -08003190 * <pre><code>[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003191 * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
3192 * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
3193 * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
3194 * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
3195 * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]
Zhijun Heba93fe62014-01-17 16:43:05 -08003196 * </code></pre>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003197 * <p>When set to other modes, lens shading correction will be applied by the camera
3198 * device. Applications can request lens shading map data by setting
3199 * {@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} to ON, and then the camera device will provide lens
3200 * shading map data in {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap}; the returned shading map
3201 * data will be the one applied by the camera device for this capture request.</p>
3202 * <p>The shading map data may depend on the auto-exposure (AE) and AWB statistics, therefore
3203 * the reliability of the map data may be affected by the AE and AWB algorithms. When AE and
3204 * 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>
3205 * OFF), to get best results, it is recommended that the applications wait for the AE and AWB
3206 * to be converged before using the returned shading map data.</p>
3207 * <p><b>Possible values:</b>
3208 * <ul>
3209 * <li>{@link #SHADING_MODE_OFF OFF}</li>
3210 * <li>{@link #SHADING_MODE_FAST FAST}</li>
3211 * <li>{@link #SHADING_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
3212 * </ul></p>
Yin-Chia Yehe4aa2832015-02-06 15:15:53 -08003213 * <p><b>Available values for this device:</b><br>
3214 * {@link CameraCharacteristics#SHADING_AVAILABLE_MODES android.shading.availableModes}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003215 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003216 * <p><b>Full capability</b> -
3217 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3218 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Zhijun Heba93fe62014-01-17 16:43:05 -08003219 *
Zhijun Hefa7c7552014-05-22 16:36:02 -07003220 * @see CaptureRequest#CONTROL_AE_MODE
3221 * @see CaptureRequest#CONTROL_AWB_MODE
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003222 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Yin-Chia Yehe4aa2832015-02-06 15:15:53 -08003223 * @see CameraCharacteristics#SHADING_AVAILABLE_MODES
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003224 * @see CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP
Zhijun Heba93fe62014-01-17 16:43:05 -08003225 * @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE
3226 * @see #SHADING_MODE_OFF
3227 * @see #SHADING_MODE_FAST
3228 * @see #SHADING_MODE_HIGH_QUALITY
Zhijun Heba93fe62014-01-17 16:43:05 -08003229 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003230 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003231 @NonNull
Zhijun Heba93fe62014-01-17 16:43:05 -08003232 public static final Key<Integer> SHADING_MODE =
3233 new Key<Integer>("android.shading.mode", int.class);
3234
3235 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003236 * <p>Operating mode for the face detector
Eino-Ville Talvalab67a3b32014-06-06 13:07:20 -07003237 * unit.</p>
Igor Murashkinace5bf02013-12-10 17:36:40 -08003238 * <p>Whether face detection is enabled, and whether it
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003239 * should output just the basic fields or the full set of
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003240 * fields.</p>
3241 * <p><b>Possible values:</b>
3242 * <ul>
3243 * <li>{@link #STATISTICS_FACE_DETECT_MODE_OFF OFF}</li>
3244 * <li>{@link #STATISTICS_FACE_DETECT_MODE_SIMPLE SIMPLE}</li>
3245 * <li>{@link #STATISTICS_FACE_DETECT_MODE_FULL FULL}</li>
3246 * </ul></p>
3247 * <p><b>Available values for this device:</b><br>
3248 * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES android.statistics.info.availableFaceDetectModes}</p>
3249 * <p>This key is available on all devices.</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08003250 *
3251 * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003252 * @see #STATISTICS_FACE_DETECT_MODE_OFF
3253 * @see #STATISTICS_FACE_DETECT_MODE_SIMPLE
3254 * @see #STATISTICS_FACE_DETECT_MODE_FULL
3255 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003256 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003257 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003258 public static final Key<Integer> STATISTICS_FACE_DETECT_MODE =
3259 new Key<Integer>("android.statistics.faceDetectMode", int.class);
3260
3261 /**
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003262 * <p>Operating mode for hot pixel map generation.</p>
3263 * <p>If set to <code>true</code>, a hot pixel map is returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.
3264 * If set to <code>false</code>, no hot pixel map will be returned.</p>
3265 * <p><b>Range of valid values:</b><br>
3266 * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003267 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Ruben Brunk9d454fd2014-03-04 14:11:52 -08003268 *
3269 * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
3270 * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES
3271 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003272 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003273 @NonNull
Ruben Brunk9d454fd2014-03-04 14:11:52 -08003274 public static final Key<Boolean> STATISTICS_HOT_PIXEL_MAP_MODE =
3275 new Key<Boolean>("android.statistics.hotPixelMapMode", boolean.class);
3276
3277 /**
Zhijun Hecc28a412014-02-24 15:11:23 -08003278 * <p>Whether the camera device will output the lens
3279 * shading map in output result metadata.</p>
Igor Murashkinace5bf02013-12-10 17:36:40 -08003280 * <p>When set to ON,
Eino-Ville Talvalae600d6a2014-06-09 14:25:50 -07003281 * android.statistics.lensShadingMap will be provided in
Igor Murashkin7a9b30e2013-12-11 13:31:38 -08003282 * the output result metadata.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003283 * <p>ON is always supported on devices with the RAW capability.</p>
3284 * <p><b>Possible values:</b>
3285 * <ul>
3286 * <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_OFF OFF}</li>
3287 * <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_ON ON}</li>
3288 * </ul></p>
Yin-Chia Yehe4aa2832015-02-06 15:15:53 -08003289 * <p><b>Available values for this device:</b><br>
3290 * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES android.statistics.info.availableLensShadingMapModes}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003291 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003292 * <p><b>Full capability</b> -
3293 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3294 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3295 *
3296 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Yin-Chia Yehe4aa2832015-02-06 15:15:53 -08003297 * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES
Eino-Ville Talvalad96748b2013-09-12 11:11:27 -07003298 * @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF
3299 * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON
3300 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003301 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003302 @NonNull
Eino-Ville Talvalad96748b2013-09-12 11:11:27 -07003303 public static final Key<Integer> STATISTICS_LENS_SHADING_MAP_MODE =
3304 new Key<Integer>("android.statistics.lensShadingMapMode", int.class);
3305
3306 /**
Eino-Ville Talvala08bd1632018-08-01 17:23:09 -07003307 * <p>A control for selecting whether optical stabilization (OIS) position
3308 * information is included in output result metadata.</p>
3309 * <p>Since optical image stabilization generally involves motion much faster than the duration
3310 * of individualq image exposure, multiple OIS samples can be included for a single capture
3311 * result. For example, if the OIS reporting operates at 200 Hz, a typical camera operating
3312 * at 30fps may have 6-7 OIS samples per capture result. This information can be combined
3313 * with the rolling shutter skew to account for lens motion during image exposure in
3314 * post-processing algorithms.</p>
Chien-Yu Chenc9cf5b92018-01-18 12:24:40 -08003315 * <p><b>Possible values:</b>
3316 * <ul>
3317 * <li>{@link #STATISTICS_OIS_DATA_MODE_OFF OFF}</li>
3318 * <li>{@link #STATISTICS_OIS_DATA_MODE_ON ON}</li>
3319 * </ul></p>
3320 * <p><b>Available values for this device:</b><br>
Eino-Ville Talvala915f5042018-03-13 19:08:01 -07003321 * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES android.statistics.info.availableOisDataModes}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003322 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Eino-Ville Talvala915f5042018-03-13 19:08:01 -07003323 *
3324 * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES
Chien-Yu Chenc9cf5b92018-01-18 12:24:40 -08003325 * @see #STATISTICS_OIS_DATA_MODE_OFF
3326 * @see #STATISTICS_OIS_DATA_MODE_ON
3327 */
3328 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003329 @NonNull
Chien-Yu Chenc9cf5b92018-01-18 12:24:40 -08003330 public static final Key<Integer> STATISTICS_OIS_DATA_MODE =
3331 new Key<Integer>("android.statistics.oisDataMode", int.class);
3332
3333 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08003334 * <p>Tonemapping / contrast / gamma curve for the blue
Igor Murashkine0060932014-01-17 17:24:11 -08003335 * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3336 * CONTRAST_CURVE.</p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003337 * <p>See android.tonemap.curveRed for more details.</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003338 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003339 * <p><b>Full capability</b> -
3340 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3341 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08003342 *
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003343 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Zhijun He5f2a47f2014-01-16 15:44:41 -08003344 * @see CaptureRequest#TONEMAP_MODE
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003345 * @hide
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003346 */
Zhijun He3ffd7052013-08-19 15:45:08 -07003347 public static final Key<float[]> TONEMAP_CURVE_BLUE =
3348 new Key<float[]>("android.tonemap.curveBlue", float[].class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003349
3350 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08003351 * <p>Tonemapping / contrast / gamma curve for the green
Igor Murashkine0060932014-01-17 17:24:11 -08003352 * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3353 * CONTRAST_CURVE.</p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003354 * <p>See android.tonemap.curveRed for more details.</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003355 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003356 * <p><b>Full capability</b> -
3357 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3358 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08003359 *
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003360 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Zhijun He5f2a47f2014-01-16 15:44:41 -08003361 * @see CaptureRequest#TONEMAP_MODE
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003362 * @hide
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003363 */
Zhijun He3ffd7052013-08-19 15:45:08 -07003364 public static final Key<float[]> TONEMAP_CURVE_GREEN =
3365 new Key<float[]>("android.tonemap.curveGreen", float[].class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003366
3367 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08003368 * <p>Tonemapping / contrast / gamma curve for the red
Igor Murashkine0060932014-01-17 17:24:11 -08003369 * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3370 * CONTRAST_CURVE.</p>
3371 * <p>Each channel's curve is defined by an array of control points:</p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003372 * <pre><code>android.tonemap.curveRed =
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003373 * [ P0in, P0out, P1in, P1out, P2in, P2out, P3in, P3out, ..., PNin, PNout ]
Zhijun He870922b2014-02-15 21:47:51 -08003374 * 2 &lt;= N &lt;= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003375 * <p>These are sorted in order of increasing <code>Pin</code>; it is
3376 * required that input values 0.0 and 1.0 are included in the list to
Igor Murashkine0060932014-01-17 17:24:11 -08003377 * define a complete mapping. For input values between control points,
3378 * the camera device must linearly interpolate between the control
3379 * points.</p>
3380 * <p>Each curve can have an independent number of points, and the number
3381 * of points can be less than max (that is, the request doesn't have to
3382 * always provide a curve with number of points equivalent to
3383 * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p>
Shuzhen Wanga8d36032018-10-15 12:01:53 -07003384 * <p>For devices with MONOCHROME capability, all three channels must have the same set of
3385 * control points.</p>
Igor Murashkine0060932014-01-17 17:24:11 -08003386 * <p>A few examples, and their corresponding graphical mappings; these
3387 * only specify the red channel and the precision is limited to 4
3388 * digits, for conciseness.</p>
3389 * <p>Linear mapping:</p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003390 * <pre><code>android.tonemap.curveRed = [ 0, 0, 1.0, 1.0 ]
Igor Murashkine0060932014-01-17 17:24:11 -08003391 * </code></pre>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003392 * <p><img alt="Linear mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p>
Igor Murashkine0060932014-01-17 17:24:11 -08003393 * <p>Invert mapping:</p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003394 * <pre><code>android.tonemap.curveRed = [ 0, 1.0, 1.0, 0 ]
Igor Murashkine0060932014-01-17 17:24:11 -08003395 * </code></pre>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003396 * <p><img alt="Inverting mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p>
Igor Murashkine0060932014-01-17 17:24:11 -08003397 * <p>Gamma 1/2.2 mapping, with 16 control points:</p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003398 * <pre><code>android.tonemap.curveRed = [
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003399 * 0.0000, 0.0000, 0.0667, 0.2920, 0.1333, 0.4002, 0.2000, 0.4812,
3400 * 0.2667, 0.5484, 0.3333, 0.6069, 0.4000, 0.6594, 0.4667, 0.7072,
3401 * 0.5333, 0.7515, 0.6000, 0.7928, 0.6667, 0.8317, 0.7333, 0.8685,
3402 * 0.8000, 0.9035, 0.8667, 0.9370, 0.9333, 0.9691, 1.0000, 1.0000 ]
Igor Murashkine0060932014-01-17 17:24:11 -08003403 * </code></pre>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003404 * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p>
Igor Murashkine0060932014-01-17 17:24:11 -08003405 * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003406 * <pre><code>android.tonemap.curveRed = [
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003407 * 0.0000, 0.0000, 0.0667, 0.2864, 0.1333, 0.4007, 0.2000, 0.4845,
3408 * 0.2667, 0.5532, 0.3333, 0.6125, 0.4000, 0.6652, 0.4667, 0.7130,
3409 * 0.5333, 0.7569, 0.6000, 0.7977, 0.6667, 0.8360, 0.7333, 0.8721,
3410 * 0.8000, 0.9063, 0.8667, 0.9389, 0.9333, 0.9701, 1.0000, 1.0000 ]
Igor Murashkine0060932014-01-17 17:24:11 -08003411 * </code></pre>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003412 * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003413 * <p><b>Range of valid values:</b><br>
3414 * 0-1 on both input and output coordinates, normalized
3415 * as a floating-point value such that 0 == black and 1 == white.</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003416 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003417 * <p><b>Full capability</b> -
3418 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3419 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08003420 *
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003421 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Igor Murashkine0060932014-01-17 17:24:11 -08003422 * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS
Eino-Ville Talvala0da8bf52014-01-08 16:18:35 -08003423 * @see CaptureRequest#TONEMAP_MODE
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003424 * @hide
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003425 */
3426 public static final Key<float[]> TONEMAP_CURVE_RED =
3427 new Key<float[]>("android.tonemap.curveRed", float[].class);
3428
3429 /**
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003430 * <p>Tonemapping / contrast / gamma curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode}
3431 * is CONTRAST_CURVE.</p>
3432 * <p>The tonemapCurve consist of three curves for each of red, green, and blue
3433 * channels respectively. The following example uses the red channel as an
3434 * example. The same logic applies to green and blue channel.
3435 * Each channel's curve is defined by an array of control points:</p>
3436 * <pre><code>curveRed =
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003437 * [ P0(in, out), P1(in, out), P2(in, out), P3(in, out), ..., PN(in, out) ]
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003438 * 2 &lt;= N &lt;= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
3439 * <p>These are sorted in order of increasing <code>Pin</code>; it is always
3440 * guaranteed that input values 0.0 and 1.0 are included in the list to
3441 * define a complete mapping. For input values between control points,
3442 * the camera device must linearly interpolate between the control
3443 * points.</p>
3444 * <p>Each curve can have an independent number of points, and the number
3445 * of points can be less than max (that is, the request doesn't have to
3446 * always provide a curve with number of points equivalent to
3447 * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p>
Shuzhen Wanga8d36032018-10-15 12:01:53 -07003448 * <p>For devices with MONOCHROME capability, all three channels must have the same set of
3449 * control points.</p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003450 * <p>A few examples, and their corresponding graphical mappings; these
3451 * only specify the red channel and the precision is limited to 4
3452 * digits, for conciseness.</p>
3453 * <p>Linear mapping:</p>
3454 * <pre><code>curveRed = [ (0, 0), (1.0, 1.0) ]
3455 * </code></pre>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003456 * <p><img alt="Linear mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003457 * <p>Invert mapping:</p>
3458 * <pre><code>curveRed = [ (0, 1.0), (1.0, 0) ]
3459 * </code></pre>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003460 * <p><img alt="Inverting mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003461 * <p>Gamma 1/2.2 mapping, with 16 control points:</p>
3462 * <pre><code>curveRed = [
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003463 * (0.0000, 0.0000), (0.0667, 0.2920), (0.1333, 0.4002), (0.2000, 0.4812),
3464 * (0.2667, 0.5484), (0.3333, 0.6069), (0.4000, 0.6594), (0.4667, 0.7072),
3465 * (0.5333, 0.7515), (0.6000, 0.7928), (0.6667, 0.8317), (0.7333, 0.8685),
3466 * (0.8000, 0.9035), (0.8667, 0.9370), (0.9333, 0.9691), (1.0000, 1.0000) ]
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003467 * </code></pre>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003468 * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003469 * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p>
3470 * <pre><code>curveRed = [
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003471 * (0.0000, 0.0000), (0.0667, 0.2864), (0.1333, 0.4007), (0.2000, 0.4845),
3472 * (0.2667, 0.5532), (0.3333, 0.6125), (0.4000, 0.6652), (0.4667, 0.7130),
3473 * (0.5333, 0.7569), (0.6000, 0.7977), (0.6667, 0.8360), (0.7333, 0.8721),
3474 * (0.8000, 0.9063), (0.8667, 0.9389), (0.9333, 0.9701), (1.0000, 1.0000) ]
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003475 * </code></pre>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003476 * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003477 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003478 * <p><b>Full capability</b> -
3479 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3480 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003481 *
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003482 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003483 * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS
3484 * @see CaptureRequest#TONEMAP_MODE
3485 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003486 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003487 @NonNull
Igor Murashkin6c76f582014-07-15 17:19:49 -07003488 @SyntheticKey
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003489 public static final Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE =
3490 new Key<android.hardware.camera2.params.TonemapCurve>("android.tonemap.curve", android.hardware.camera2.params.TonemapCurve.class);
3491
3492 /**
Igor Murashkine0060932014-01-17 17:24:11 -08003493 * <p>High-level global contrast/gamma/tonemapping control.</p>
3494 * <p>When switching to an application-defined contrast curve by setting
3495 * {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} to CONTRAST_CURVE, the curve is defined
3496 * per-channel with a set of <code>(in, out)</code> points that specify the
3497 * mapping from input high-bit-depth pixel value to the output
3498 * low-bit-depth value. Since the actual pixel ranges of both input
3499 * and output may change depending on the camera pipeline, the values
3500 * are specified by normalized floating-point numbers.</p>
3501 * <p>More-complex color mapping operations such as 3D color look-up
3502 * tables, selective chroma enhancement, or other non-linear color
3503 * transforms will be disabled when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3504 * CONTRAST_CURVE.</p>
3505 * <p>When using either FAST or HIGH_QUALITY, the camera device will
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003506 * emit its own tonemap curve in {@link CaptureRequest#TONEMAP_CURVE android.tonemap.curve}.
Igor Murashkine0060932014-01-17 17:24:11 -08003507 * These values are always available, and as close as possible to the
3508 * actually used nonlinear/nonglobal transforms.</p>
Zhijun Hefa7c7552014-05-22 16:36:02 -07003509 * <p>If a request is sent with CONTRAST_CURVE with the camera device's
Igor Murashkine0060932014-01-17 17:24:11 -08003510 * provided curve in FAST or HIGH_QUALITY, the image's tonemap will be
3511 * roughly the same.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003512 * <p><b>Possible values:</b>
3513 * <ul>
3514 * <li>{@link #TONEMAP_MODE_CONTRAST_CURVE CONTRAST_CURVE}</li>
3515 * <li>{@link #TONEMAP_MODE_FAST FAST}</li>
3516 * <li>{@link #TONEMAP_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
Yin-Chia Yeh956c52b2015-02-06 11:23:25 -08003517 * <li>{@link #TONEMAP_MODE_GAMMA_VALUE GAMMA_VALUE}</li>
3518 * <li>{@link #TONEMAP_MODE_PRESET_CURVE PRESET_CURVE}</li>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003519 * </ul></p>
3520 * <p><b>Available values for this device:</b><br>
3521 * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003522 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003523 * <p><b>Full capability</b> -
3524 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3525 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Igor Murashkin3242f4f2014-01-15 12:27:41 -08003526 *
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003527 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Ruben Brunk6dc379c2014-03-04 15:04:00 -08003528 * @see CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES
Yin-Chia Yeh8490ace2014-05-27 10:04:54 -07003529 * @see CaptureRequest#TONEMAP_CURVE
Igor Murashkine0060932014-01-17 17:24:11 -08003530 * @see CaptureRequest#TONEMAP_MODE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003531 * @see #TONEMAP_MODE_CONTRAST_CURVE
3532 * @see #TONEMAP_MODE_FAST
3533 * @see #TONEMAP_MODE_HIGH_QUALITY
Yin-Chia Yeh956c52b2015-02-06 11:23:25 -08003534 * @see #TONEMAP_MODE_GAMMA_VALUE
3535 * @see #TONEMAP_MODE_PRESET_CURVE
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003536 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003537 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003538 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003539 public static final Key<Integer> TONEMAP_MODE =
3540 new Key<Integer>("android.tonemap.mode", int.class);
3541
3542 /**
Yin-Chia Yeh956c52b2015-02-06 11:23:25 -08003543 * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3544 * GAMMA_VALUE</p>
3545 * <p>The tonemap curve will be defined the following formula:
3546 * * OUT = pow(IN, 1.0 / gamma)
3547 * where IN and OUT is the input pixel value scaled to range [0.0, 1.0],
3548 * pow is the power function and gamma is the gamma value specified by this
3549 * key.</p>
3550 * <p>The same curve will be applied to all color channels. The camera device
3551 * may clip the input gamma value to its supported range. The actual applied
3552 * value will be returned in capture result.</p>
3553 * <p>The valid range of gamma value varies on different devices, but values
3554 * within [1.0, 5.0] are guaranteed not to be clipped.</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003555 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Yin-Chia Yeh956c52b2015-02-06 11:23:25 -08003556 *
3557 * @see CaptureRequest#TONEMAP_MODE
3558 */
3559 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003560 @NonNull
Yin-Chia Yeh956c52b2015-02-06 11:23:25 -08003561 public static final Key<Float> TONEMAP_GAMMA =
3562 new Key<Float>("android.tonemap.gamma", float.class);
3563
3564 /**
3565 * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
3566 * PRESET_CURVE</p>
3567 * <p>The tonemap curve will be defined by specified standard.</p>
3568 * <p>sRGB (approximated by 16 control points):</p>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003569 * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
Yin-Chia Yeh956c52b2015-02-06 11:23:25 -08003570 * <p>Rec. 709 (approximated by 16 control points):</p>
Eino-Ville Talvala9dc7ec12017-11-10 15:23:00 -08003571 * <p><img alt="Rec. 709 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png" /></p>
Yin-Chia Yeh956c52b2015-02-06 11:23:25 -08003572 * <p>Note that above figures show a 16 control points approximation of preset
3573 * curves. Camera devices may apply a different approximation to the curve.</p>
3574 * <p><b>Possible values:</b>
3575 * <ul>
3576 * <li>{@link #TONEMAP_PRESET_CURVE_SRGB SRGB}</li>
3577 * <li>{@link #TONEMAP_PRESET_CURVE_REC709 REC709}</li>
3578 * </ul></p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003579 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Yin-Chia Yeh956c52b2015-02-06 11:23:25 -08003580 *
3581 * @see CaptureRequest#TONEMAP_MODE
3582 * @see #TONEMAP_PRESET_CURVE_SRGB
3583 * @see #TONEMAP_PRESET_CURVE_REC709
3584 */
3585 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003586 @NonNull
Yin-Chia Yeh956c52b2015-02-06 11:23:25 -08003587 public static final Key<Integer> TONEMAP_PRESET_CURVE =
3588 new Key<Integer>("android.tonemap.presetCurve", int.class);
3589
3590 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08003591 * <p>This LED is nominally used to indicate to the user
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003592 * that the camera is powered on and may be streaming images back to the
3593 * Application Processor. In certain rare circumstances, the OS may
3594 * disable this when video is processed locally and not transmitted to
Igor Murashkinace5bf02013-12-10 17:36:40 -08003595 * any untrusted applications.</p>
3596 * <p>In particular, the LED <em>must</em> always be on when the data could be
3597 * transmitted off the device. The LED <em>should</em> always be on whenever
3598 * data is stored locally on the device.</p>
3599 * <p>The LED <em>may</em> be off if a trusted application is using the data that
3600 * doesn't violate the above rules.</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003601 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003602 * @hide
3603 */
3604 public static final Key<Boolean> LED_TRANSMIT =
3605 new Key<Boolean>("android.led.transmit", boolean.class);
3606
3607 /**
Igor Murashkinace5bf02013-12-10 17:36:40 -08003608 * <p>Whether black-level compensation is locked
Eino-Ville Talvala0956af52013-12-26 13:19:10 -08003609 * to its current values, or is free to vary.</p>
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003610 * <p>When set to <code>true</code> (ON), the values used for black-level
Eino-Ville Talvala0956af52013-12-26 13:19:10 -08003611 * compensation will not change until the lock is set to
Eino-Ville Talvalafd3e2892014-10-06 10:23:55 -07003612 * <code>false</code> (OFF).</p>
Igor Murashkinace5bf02013-12-10 17:36:40 -08003613 * <p>Since changes to certain capture parameters (such as
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003614 * exposure time) may require resetting of black level
Eino-Ville Talvala0956af52013-12-26 13:19:10 -08003615 * compensation, the camera device must report whether setting
3616 * the black level lock was successful in the output result
Igor Murashkinace5bf02013-12-10 17:36:40 -08003617 * metadata.</p>
3618 * <p>For example, if a sequence of requests is as follows:</p>
3619 * <ul>
3620 * <li>Request 1: Exposure = 10ms, Black level lock = OFF</li>
3621 * <li>Request 2: Exposure = 10ms, Black level lock = ON</li>
3622 * <li>Request 3: Exposure = 10ms, Black level lock = ON</li>
3623 * <li>Request 4: Exposure = 20ms, Black level lock = ON</li>
3624 * <li>Request 5: Exposure = 20ms, Black level lock = ON</li>
3625 * <li>Request 6: Exposure = 20ms, Black level lock = ON</li>
3626 * </ul>
Eino-Ville Talvala0956af52013-12-26 13:19:10 -08003627 * <p>And the exposure change in Request 4 requires the camera
3628 * device to reset the black level offsets, then the output
3629 * result metadata is expected to be:</p>
Igor Murashkinace5bf02013-12-10 17:36:40 -08003630 * <ul>
3631 * <li>Result 1: Exposure = 10ms, Black level lock = OFF</li>
3632 * <li>Result 2: Exposure = 10ms, Black level lock = ON</li>
3633 * <li>Result 3: Exposure = 10ms, Black level lock = ON</li>
3634 * <li>Result 4: Exposure = 20ms, Black level lock = OFF</li>
3635 * <li>Result 5: Exposure = 20ms, Black level lock = ON</li>
3636 * <li>Result 6: Exposure = 20ms, Black level lock = ON</li>
3637 * </ul>
Eino-Ville Talvala0956af52013-12-26 13:19:10 -08003638 * <p>This indicates to the application that on frame 4, black
3639 * levels were reset due to exposure value changes, and pixel
3640 * values may not be consistent across captures.</p>
3641 * <p>The camera device will maintain the lock to the extent
3642 * possible, only overriding the lock to OFF when changes to
3643 * other request parameters require a black level recalculation
3644 * or reset.</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003645 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003646 * <p><b>Full capability</b> -
3647 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
3648 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
3649 *
3650 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003651 */
Igor Murashkin6c76f582014-07-15 17:19:49 -07003652 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003653 @NonNull
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003654 public static final Key<Boolean> BLACK_LEVEL_LOCK =
3655 new Key<Boolean>("android.blackLevel.lock", boolean.class);
3656
Zhijun He0e99c222015-01-29 15:26:05 -08003657 /**
3658 * <p>The amount of exposure time increase factor applied to the original output
3659 * frame by the application processing before sending for reprocessing.</p>
3660 * <p>This is optional, and will be supported if the camera device supports YUV_REPROCESSING
3661 * capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains YUV_REPROCESSING).</p>
3662 * <p>For some YUV reprocessing use cases, the application may choose to filter the original
3663 * output frames to effectively reduce the noise to the same level as a frame that was
3664 * captured with longer exposure time. To be more specific, assuming the original captured
3665 * images were captured with a sensitivity of S and an exposure time of T, the model in
3666 * the camera device is that the amount of noise in the image would be approximately what
3667 * would be expected if the original capture parameters had been a sensitivity of
3668 * S/effectiveExposureFactor and an exposure time of T*effectiveExposureFactor, rather
3669 * than S and T respectively. If the captured images were processed by the application
3670 * before being sent for reprocessing, then the application may have used image processing
3671 * algorithms and/or multi-frame image fusion to reduce the noise in the
3672 * application-processed images (input images). By using the effectiveExposureFactor
3673 * control, the application can communicate to the camera device the actual noise level
3674 * improvement in the application-processed image. With this information, the camera
3675 * device can select appropriate noise reduction and edge enhancement parameters to avoid
3676 * excessive noise reduction ({@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode}) and insufficient edge
3677 * enhancement ({@link CaptureRequest#EDGE_MODE android.edge.mode}) being applied to the reprocessed frames.</p>
3678 * <p>For example, for multi-frame image fusion use case, the application may fuse
3679 * multiple output frames together to a final frame for reprocessing. When N image are
3680 * fused into 1 image for reprocessing, the exposure time increase factor could be up to
3681 * square root of N (based on a simple photon shot noise model). The camera device will
3682 * adjust the reprocessing noise reduction and edge enhancement parameters accordingly to
3683 * produce the best quality images.</p>
3684 * <p>This is relative factor, 1.0 indicates the application hasn't processed the input
3685 * buffer in a way that affects its effective exposure time.</p>
3686 * <p>This control is only effective for YUV reprocessing capture request. For noise
3687 * reduction reprocessing, it is only effective when <code>{@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode} != OFF</code>.
3688 * Similarly, for edge enhancement reprocessing, it is only effective when
3689 * <code>{@link CaptureRequest#EDGE_MODE android.edge.mode} != OFF</code>.</p>
3690 * <p><b>Units</b>: Relative exposure time increase factor.</p>
3691 * <p><b>Range of valid values:</b><br>
3692 * &gt;= 1.0</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003693 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Zhijun He513f7c32015-04-24 18:23:54 -07003694 * <p><b>Limited capability</b> -
3695 * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
3696 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
Zhijun He0e99c222015-01-29 15:26:05 -08003697 *
3698 * @see CaptureRequest#EDGE_MODE
Zhijun He513f7c32015-04-24 18:23:54 -07003699 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
Zhijun He0e99c222015-01-29 15:26:05 -08003700 * @see CaptureRequest#NOISE_REDUCTION_MODE
3701 * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
3702 */
3703 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003704 @NonNull
Zhijun He0e99c222015-01-29 15:26:05 -08003705 public static final Key<Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR =
3706 new Key<Float>("android.reprocess.effectiveExposureFactor", float.class);
3707
Eino-Ville Talvala41670722018-03-13 19:43:07 -07003708 /**
3709 * <p>Mode of operation for the lens distortion correction block.</p>
3710 * <p>The lens distortion correction block attempts to improve image quality by fixing
3711 * radial, tangential, or other geometric aberrations in the camera device's optics. If
3712 * available, the {@link CameraCharacteristics#LENS_DISTORTION android.lens.distortion} field documents the lens's distortion parameters.</p>
3713 * <p>OFF means no distortion correction is done.</p>
3714 * <p>FAST/HIGH_QUALITY both mean camera device determined distortion correction will be
3715 * applied. HIGH_QUALITY mode indicates that the camera device will use the highest-quality
3716 * correction algorithms, even if it slows down capture rate. FAST means the camera device
3717 * will not slow down capture rate when applying correction. FAST may be the same as OFF if
3718 * any correction at all would slow down capture rate. Every output stream will have a
3719 * similar amount of enhancement applied.</p>
Shuzhen Wangec5e8d22018-09-28 09:28:48 -07003720 * <p>The correction only applies to processed outputs such as YUV, Y8, JPEG, or DEPTH16; it is
3721 * not applied to any RAW output.</p>
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07003722 * <p>This control will be on by default on devices that support this control. Applications
3723 * disabling distortion correction need to pay extra attention with the coordinate system of
3724 * metering regions, crop region, and face rectangles. When distortion correction is OFF,
3725 * metadata coordinates follow the coordinate system of
3726 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}. When distortion is not OFF, metadata
Eino-Ville Talvala08bd1632018-08-01 17:23:09 -07003727 * coordinates follow the coordinate system of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}. The
3728 * camera device will map these metadata fields to match the corrected image produced by the
3729 * camera device, for both capture requests and results. However, this mapping is not very
3730 * precise, since rectangles do not generally map to rectangles when corrected. Only linear
3731 * scaling between the active array and precorrection active array coordinates is
3732 * performed. Applications that require precise correction of metadata need to undo that
3733 * linear scaling, and apply a more complete correction that takes into the account the app's
3734 * own requirements.</p>
3735 * <p>The full list of metadata that is affected in this way by distortion correction is:</p>
3736 * <ul>
3737 * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li>
3738 * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li>
3739 * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li>
3740 * <li>{@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}</li>
3741 * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li>
3742 * </ul>
Eino-Ville Talvala41670722018-03-13 19:43:07 -07003743 * <p><b>Possible values:</b>
3744 * <ul>
3745 * <li>{@link #DISTORTION_CORRECTION_MODE_OFF OFF}</li>
3746 * <li>{@link #DISTORTION_CORRECTION_MODE_FAST FAST}</li>
3747 * <li>{@link #DISTORTION_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
3748 * </ul></p>
3749 * <p><b>Available values for this device:</b><br>
3750 * {@link CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES android.distortionCorrection.availableModes}</p>
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003751 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
Eino-Ville Talvala41670722018-03-13 19:43:07 -07003752 *
Eino-Ville Talvala08bd1632018-08-01 17:23:09 -07003753 * @see CaptureRequest#CONTROL_AE_REGIONS
3754 * @see CaptureRequest#CONTROL_AF_REGIONS
3755 * @see CaptureRequest#CONTROL_AWB_REGIONS
Eino-Ville Talvala41670722018-03-13 19:43:07 -07003756 * @see CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES
3757 * @see CameraCharacteristics#LENS_DISTORTION
Eino-Ville Talvala08bd1632018-08-01 17:23:09 -07003758 * @see CaptureRequest#SCALER_CROP_REGION
Yin-Chia Yeh6c73e402018-06-15 15:37:08 -07003759 * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
3760 * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
Eino-Ville Talvala08bd1632018-08-01 17:23:09 -07003761 * @see CaptureResult#STATISTICS_FACES
Eino-Ville Talvala41670722018-03-13 19:43:07 -07003762 * @see #DISTORTION_CORRECTION_MODE_OFF
3763 * @see #DISTORTION_CORRECTION_MODE_FAST
3764 * @see #DISTORTION_CORRECTION_MODE_HIGH_QUALITY
3765 */
3766 @PublicKey
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003767 @NonNull
Eino-Ville Talvala41670722018-03-13 19:43:07 -07003768 public static final Key<Integer> DISTORTION_CORRECTION_MODE =
3769 new Key<Integer>("android.distortionCorrection.mode", int.class);
3770
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003771 /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
3772 * End generated code
3773 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/
Igor Murashkin6c76f582014-07-15 17:19:49 -07003774
Igor Murashkin4b8cd6b2014-10-02 16:00:52 -07003775
3776
Shuzhen Wang1484a21e2019-02-28 10:01:00 -08003777
3778
3779
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -07003780}