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