Debian Codegraph @

core/java/android/hardware/camera2/CaptureRequest.java

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