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