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 sanity check when a constrained high speed capture 481 * 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 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 * type to the key. 888 */ setPhysicalCameraKey(@onNull Key<T> key, T value, @NonNull String physicalCameraId)889 public <T> Builder setPhysicalCameraKey(@NonNull Key<T> key, T value, 890 @NonNull String physicalCameraId) { 891 if (!mRequest.mPhysicalCameraSettings.containsKey(physicalCameraId)) { 892 throw new IllegalArgumentException("Physical camera id: " + physicalCameraId + 893 " is not valid!"); 894 } 895 896 mRequest.mPhysicalCameraSettings.get(physicalCameraId).set(key, value); 897 898 return this; 899 } 900 901 /** 902 * Get a capture request field value for a specific physical camera Id. The field 903 * definitions can be found in {@link CaptureRequest}. 904 * 905 *<p>This method can be called for logical camera devices, which are devices that have 906 * REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA capability and calls to 907 * {@link CameraCharacteristics#getPhysicalCameraIds} return a non-empty list of 908 * physical devices that are backing the logical camera. The camera Id included in the 909 * 'physicalCameraId' argument selects an individual physical device and returns 910 * its specific capture request field.</p> 911 * 912 * @throws IllegalArgumentException if the key or physical camera id were not valid 913 * 914 * @param key The metadata field to read. 915 * @param physicalCameraId A valid physical camera Id. The valid camera Ids can be obtained 916 * via calls to {@link CameraCharacteristics#getPhysicalCameraIds}. 917 * @return The value of that key, or {@code null} if the field is not set. 918 */ 919 @Nullable getPhysicalCameraKey(Key<T> key,@NonNull String physicalCameraId)920 public <T> T getPhysicalCameraKey(Key<T> key,@NonNull String physicalCameraId) { 921 if (!mRequest.mPhysicalCameraSettings.containsKey(physicalCameraId)) { 922 throw new IllegalArgumentException("Physical camera id: " + physicalCameraId + 923 " is not valid!"); 924 } 925 926 return mRequest.mPhysicalCameraSettings.get(physicalCameraId).get(key); 927 } 928 929 /** 930 * Set a tag for this request. 931 * 932 * <p>This tag is not used for anything by the camera device, but can be 933 * used by an application to easily identify a CaptureRequest when it is 934 * returned by 935 * {@link CameraCaptureSession.CaptureCallback#onCaptureCompleted CaptureCallback.onCaptureCompleted} 936 * 937 * @param tag an arbitrary Object to store with this request 938 * @see CaptureRequest#getTag 939 */ setTag(@ullable Object tag)940 public void setTag(@Nullable Object tag) { 941 mRequest.mUserTag = tag; 942 } 943 944 /** 945 * <p>Mark this request as part of a constrained high speed request list created by 946 * {@link android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList}. 947 * A constrained high speed request list contains some constrained high speed capture 948 * requests with certain interleaved pattern that is suitable for high speed preview/video 949 * streaming.</p> 950 * 951 * @hide 952 */ 953 @UnsupportedAppUsage setPartOfCHSRequestList(boolean partOfCHSList)954 public void setPartOfCHSRequestList(boolean partOfCHSList) { 955 mRequest.mIsPartOfCHSRequestList = partOfCHSList; 956 } 957 958 /** 959 * Build a request using the current target Surfaces and settings. 960 * <p>Note that, although it is possible to create a {@code CaptureRequest} with no target 961 * {@link Surface}s, passing such a request into {@link CameraCaptureSession#capture}, 962 * {@link CameraCaptureSession#captureBurst}, 963 * {@link CameraCaptureSession#setRepeatingBurst}, or 964 * {@link CameraCaptureSession#setRepeatingRequest} will cause that method to throw an 965 * {@link IllegalArgumentException}.</p> 966 * 967 * @return A new capture request instance, ready for submission to the 968 * camera device. 969 */ 970 @NonNull build()971 public CaptureRequest build() { 972 return new CaptureRequest(mRequest); 973 } 974 975 /** 976 * @hide 977 */ isEmpty()978 public boolean isEmpty() { 979 return mRequest.mLogicalCameraSettings.isEmpty(); 980 } 981 982 } 983 984 /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ 985 * The key entries below this point are generated from metadata 986 * definitions in /system/media/camera/docs. Do not modify by hand or 987 * modify the comment blocks at the start or end. 988 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/ 989 990 /** 991 * <p>The mode control selects how the image data is converted from the 992 * sensor's native color into linear sRGB color.</p> 993 * <p>When auto-white balance (AWB) is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this 994 * control is overridden by the AWB routine. When AWB is disabled, the 995 * application controls how the color mapping is performed.</p> 996 * <p>We define the expected processing pipeline below. For consistency 997 * across devices, this is always the case with TRANSFORM_MATRIX.</p> 998 * <p>When either FULL or HIGH_QUALITY is used, the camera device may 999 * do additional processing but {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and 1000 * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} will still be provided by the 1001 * camera device (in the results) and be roughly correct.</p> 1002 * <p>Switching to TRANSFORM_MATRIX and using the data provided from 1003 * FAST or HIGH_QUALITY will yield a picture with the same white point 1004 * as what was produced by the camera device in the earlier frame.</p> 1005 * <p>The expected processing pipeline is as follows:</p> 1006 * <p><img alt="White balance processing pipeline" src="/reference/images/camera2/metadata/android.colorCorrection.mode/processing_pipeline.png" /></p> 1007 * <p>The white balance is encoded by two values, a 4-channel white-balance 1008 * gain vector (applied in the Bayer domain), and a 3x3 color transform 1009 * matrix (applied after demosaic).</p> 1010 * <p>The 4-channel white-balance gains are defined as:</p> 1011 * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} = [ R G_even G_odd B ] 1012 * </code></pre> 1013 * <p>where <code>G_even</code> is the gain for green pixels on even rows of the 1014 * output, and <code>G_odd</code> is the gain for green pixels on the odd rows. 1015 * These may be identical for a given camera device implementation; if 1016 * the camera device does not support a separate gain for even/odd green 1017 * channels, it will use the <code>G_even</code> value, and write <code>G_odd</code> equal to 1018 * <code>G_even</code> in the output result metadata.</p> 1019 * <p>The matrices for color transforms are defined as a 9-entry vector:</p> 1020 * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} = [ I0 I1 I2 I3 I4 I5 I6 I7 I8 ] 1021 * </code></pre> 1022 * <p>which define a transform from input sensor colors, <code>P_in = [ r g b ]</code>, 1023 * to output linear sRGB, <code>P_out = [ r' g' b' ]</code>,</p> 1024 * <p>with colors as follows:</p> 1025 * <pre><code>r' = I0r + I1g + I2b 1026 * g' = I3r + I4g + I5b 1027 * b' = I6r + I7g + I8b 1028 * </code></pre> 1029 * <p>Both the input and output value ranges must match. Overflow/underflow 1030 * values are clipped to fit within the range.</p> 1031 * <p><b>Possible values:</b> 1032 * <ul> 1033 * <li>{@link #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX TRANSFORM_MATRIX}</li> 1034 * <li>{@link #COLOR_CORRECTION_MODE_FAST FAST}</li> 1035 * <li>{@link #COLOR_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li> 1036 * </ul></p> 1037 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 1038 * <p><b>Full capability</b> - 1039 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 1040 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 1041 * 1042 * @see CaptureRequest#COLOR_CORRECTION_GAINS 1043 * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM 1044 * @see CaptureRequest#CONTROL_AWB_MODE 1045 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 1046 * @see #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX 1047 * @see #COLOR_CORRECTION_MODE_FAST 1048 * @see #COLOR_CORRECTION_MODE_HIGH_QUALITY 1049 */ 1050 @PublicKey 1051 @NonNull 1052 public static final Key<Integer> COLOR_CORRECTION_MODE = 1053 new Key<Integer>("android.colorCorrection.mode", int.class); 1054 1055 /** 1056 * <p>A color transform matrix to use to transform 1057 * from sensor RGB color space to output linear sRGB color space.</p> 1058 * <p>This matrix is either set by the camera device when the request 1059 * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not TRANSFORM_MATRIX, or 1060 * directly by the application in the request when the 1061 * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is TRANSFORM_MATRIX.</p> 1062 * <p>In the latter case, the camera device may round the matrix to account 1063 * for precision issues; the final rounded matrix should be reported back 1064 * in this matrix result metadata. The transform should keep the magnitude 1065 * of the output color values within <code>[0, 1.0]</code> (assuming input color 1066 * values is within the normalized range <code>[0, 1.0]</code>), or clipping may occur.</p> 1067 * <p>The valid range of each matrix element varies on different devices, but 1068 * values within [-1.5, 3.0] are guaranteed not to be clipped.</p> 1069 * <p><b>Units</b>: Unitless scale factors</p> 1070 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 1071 * <p><b>Full capability</b> - 1072 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 1073 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 1074 * 1075 * @see CaptureRequest#COLOR_CORRECTION_MODE 1076 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 1077 */ 1078 @PublicKey 1079 @NonNull 1080 public static final Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM = 1081 new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.colorCorrection.transform", android.hardware.camera2.params.ColorSpaceTransform.class); 1082 1083 /** 1084 * <p>Gains applying to Bayer raw color channels for 1085 * white-balance.</p> 1086 * <p>These per-channel gains are either set by the camera device 1087 * when the request {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not 1088 * TRANSFORM_MATRIX, or directly by the application in the 1089 * request when the {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is 1090 * TRANSFORM_MATRIX.</p> 1091 * <p>The gains in the result metadata are the gains actually 1092 * applied by the camera device to the current frame.</p> 1093 * <p>The valid range of gains varies on different devices, but gains 1094 * between [1.0, 3.0] are guaranteed not to be clipped. Even if a given 1095 * device allows gains below 1.0, this is usually not recommended because 1096 * this can create color artifacts.</p> 1097 * <p><b>Units</b>: Unitless gain factors</p> 1098 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 1099 * <p><b>Full capability</b> - 1100 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 1101 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 1102 * 1103 * @see CaptureRequest#COLOR_CORRECTION_MODE 1104 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 1105 */ 1106 @PublicKey 1107 @NonNull 1108 public static final Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS = 1109 new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class); 1110 1111 /** 1112 * <p>Mode of operation for the chromatic aberration correction algorithm.</p> 1113 * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light 1114 * can not focus on the same point after exiting from the lens. This metadata defines 1115 * the high level control of chromatic aberration correction algorithm, which aims to 1116 * minimize the chromatic artifacts that may occur along the object boundaries in an 1117 * image.</p> 1118 * <p>FAST/HIGH_QUALITY both mean that camera device determined aberration 1119 * correction will be applied. HIGH_QUALITY mode indicates that the camera device will 1120 * use the highest-quality aberration correction algorithms, even if it slows down 1121 * capture rate. FAST means the camera device will not slow down capture rate when 1122 * applying aberration correction.</p> 1123 * <p>LEGACY devices will always be in FAST mode.</p> 1124 * <p><b>Possible values:</b> 1125 * <ul> 1126 * <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_OFF OFF}</li> 1127 * <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_FAST FAST}</li> 1128 * <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY HIGH_QUALITY}</li> 1129 * </ul></p> 1130 * <p><b>Available values for this device:</b><br> 1131 * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES android.colorCorrection.availableAberrationModes}</p> 1132 * <p>This key is available on all devices.</p> 1133 * 1134 * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES 1135 * @see #COLOR_CORRECTION_ABERRATION_MODE_OFF 1136 * @see #COLOR_CORRECTION_ABERRATION_MODE_FAST 1137 * @see #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY 1138 */ 1139 @PublicKey 1140 @NonNull 1141 public static final Key<Integer> COLOR_CORRECTION_ABERRATION_MODE = 1142 new Key<Integer>("android.colorCorrection.aberrationMode", int.class); 1143 1144 /** 1145 * <p>The desired setting for the camera device's auto-exposure 1146 * algorithm's antibanding compensation.</p> 1147 * <p>Some kinds of lighting fixtures, such as some fluorescent 1148 * lights, flicker at the rate of the power supply frequency 1149 * (60Hz or 50Hz, depending on country). While this is 1150 * typically not noticeable to a person, it can be visible to 1151 * a camera device. If a camera sets its exposure time to the 1152 * wrong value, the flicker may become visible in the 1153 * viewfinder as flicker or in a final captured image, as a 1154 * set of variable-brightness bands across the image.</p> 1155 * <p>Therefore, the auto-exposure routines of camera devices 1156 * include antibanding routines that ensure that the chosen 1157 * exposure value will not cause such banding. The choice of 1158 * exposure time depends on the rate of flicker, which the 1159 * camera device can detect automatically, or the expected 1160 * rate can be selected by the application using this 1161 * control.</p> 1162 * <p>A given camera device may not support all of the possible 1163 * options for the antibanding mode. The 1164 * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes} key contains 1165 * the available modes for a given camera device.</p> 1166 * <p>AUTO mode is the default if it is available on given 1167 * camera device. When AUTO mode is not available, the 1168 * default will be either 50HZ or 60HZ, and both 50HZ 1169 * and 60HZ will be available.</p> 1170 * <p>If manual exposure control is enabled (by setting 1171 * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} to OFF), 1172 * then this setting has no effect, and the application must 1173 * ensure it selects exposure times that do not cause banding 1174 * issues. The {@link CaptureResult#STATISTICS_SCENE_FLICKER android.statistics.sceneFlicker} key can assist 1175 * the application in this.</p> 1176 * <p><b>Possible values:</b> 1177 * <ul> 1178 * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_OFF OFF}</li> 1179 * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_50HZ 50HZ}</li> 1180 * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_60HZ 60HZ}</li> 1181 * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_AUTO AUTO}</li> 1182 * </ul></p> 1183 * <p><b>Available values for this device:</b><br></p> 1184 * <p>{@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes}</p> 1185 * <p>This key is available on all devices.</p> 1186 * 1187 * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES 1188 * @see CaptureRequest#CONTROL_AE_MODE 1189 * @see CaptureRequest#CONTROL_MODE 1190 * @see CaptureResult#STATISTICS_SCENE_FLICKER 1191 * @see #CONTROL_AE_ANTIBANDING_MODE_OFF 1192 * @see #CONTROL_AE_ANTIBANDING_MODE_50HZ 1193 * @see #CONTROL_AE_ANTIBANDING_MODE_60HZ 1194 * @see #CONTROL_AE_ANTIBANDING_MODE_AUTO 1195 */ 1196 @PublicKey 1197 @NonNull 1198 public static final Key<Integer> CONTROL_AE_ANTIBANDING_MODE = 1199 new Key<Integer>("android.control.aeAntibandingMode", int.class); 1200 1201 /** 1202 * <p>Adjustment to auto-exposure (AE) target image 1203 * brightness.</p> 1204 * <p>The adjustment is measured as a count of steps, with the 1205 * step size defined by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP android.control.aeCompensationStep} and the 1206 * allowed range by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}.</p> 1207 * <p>For example, if the exposure value (EV) step is 0.333, '6' 1208 * will mean an exposure compensation of +2 EV; -3 will mean an 1209 * exposure compensation of -1 EV. One EV represents a doubling 1210 * of image brightness. Note that this control will only be 1211 * effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF. This control 1212 * will take effect even when {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} <code>== true</code>.</p> 1213 * <p>In the event of exposure compensation value being changed, camera device 1214 * may take several frames to reach the newly requested exposure target. 1215 * During that time, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} field will be in the SEARCHING 1216 * state. Once the new exposure target is reached, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} will 1217 * change from SEARCHING to either CONVERGED, LOCKED (if AE lock is enabled), or 1218 * FLASH_REQUIRED (if the scene is too dark for still capture).</p> 1219 * <p><b>Units</b>: Compensation steps</p> 1220 * <p><b>Range of valid values:</b><br> 1221 * {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}</p> 1222 * <p>This key is available on all devices.</p> 1223 * 1224 * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE 1225 * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP 1226 * @see CaptureRequest#CONTROL_AE_LOCK 1227 * @see CaptureRequest#CONTROL_AE_MODE 1228 * @see CaptureResult#CONTROL_AE_STATE 1229 */ 1230 @PublicKey 1231 @NonNull 1232 public static final Key<Integer> CONTROL_AE_EXPOSURE_COMPENSATION = 1233 new Key<Integer>("android.control.aeExposureCompensation", int.class); 1234 1235 /** 1236 * <p>Whether auto-exposure (AE) is currently locked to its latest 1237 * calculated values.</p> 1238 * <p>When set to <code>true</code> (ON), the AE algorithm is locked to its latest parameters, 1239 * and will not change exposure settings until the lock is set to <code>false</code> (OFF).</p> 1240 * <p>Note that even when AE is locked, the flash may be fired if 1241 * the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_AUTO_FLASH / 1242 * ON_ALWAYS_FLASH / ON_AUTO_FLASH_REDEYE.</p> 1243 * <p>When {@link CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION android.control.aeExposureCompensation} is changed, even if the AE lock 1244 * is ON, the camera device will still adjust its exposure value.</p> 1245 * <p>If AE precapture is triggered (see {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}) 1246 * when AE is already locked, the camera device will not change the exposure time 1247 * ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}) and sensitivity ({@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}) 1248 * parameters. The flash may be fired if the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} 1249 * is ON_AUTO_FLASH/ON_AUTO_FLASH_REDEYE and the scene is too dark. If the 1250 * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_ALWAYS_FLASH, the scene may become overexposed. 1251 * Similarly, AE precapture trigger CANCEL has no effect when AE is already locked.</p> 1252 * <p>When an AE precapture sequence is triggered, AE unlock will not be able to unlock 1253 * the AE if AE is locked by the camera device internally during precapture metering 1254 * sequence In other words, submitting requests with AE unlock has no effect for an 1255 * ongoing precapture metering sequence. Otherwise, the precapture metering sequence 1256 * will never succeed in a sequence of preview requests where AE lock is always set 1257 * to <code>false</code>.</p> 1258 * <p>Since the camera device has a pipeline of in-flight requests, the settings that 1259 * get locked do not necessarily correspond to the settings that were present in the 1260 * latest capture result received from the camera device, since additional captures 1261 * and AE updates may have occurred even before the result was sent out. If an 1262 * application is switching between automatic and manual control and wishes to eliminate 1263 * any flicker during the switch, the following procedure is recommended:</p> 1264 * <ol> 1265 * <li>Starting in auto-AE mode:</li> 1266 * <li>Lock AE</li> 1267 * <li>Wait for the first result to be output that has the AE locked</li> 1268 * <li>Copy exposure settings from that result into a request, set the request to manual AE</li> 1269 * <li>Submit the capture request, proceed to run manual AE as desired.</li> 1270 * </ol> 1271 * <p>See {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE lock related state transition details.</p> 1272 * <p>This key is available on all devices.</p> 1273 * 1274 * @see CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION 1275 * @see CaptureRequest#CONTROL_AE_MODE 1276 * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER 1277 * @see CaptureResult#CONTROL_AE_STATE 1278 * @see CaptureRequest#SENSOR_EXPOSURE_TIME 1279 * @see CaptureRequest#SENSOR_SENSITIVITY 1280 */ 1281 @PublicKey 1282 @NonNull 1283 public static final Key<Boolean> CONTROL_AE_LOCK = 1284 new Key<Boolean>("android.control.aeLock", boolean.class); 1285 1286 /** 1287 * <p>The desired mode for the camera device's 1288 * auto-exposure routine.</p> 1289 * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is 1290 * AUTO.</p> 1291 * <p>When set to any of the ON modes, the camera device's 1292 * auto-exposure routine is enabled, overriding the 1293 * application's selected exposure time, sensor sensitivity, 1294 * and frame duration ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}, 1295 * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and 1296 * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}). If one of the FLASH modes 1297 * is selected, the camera device's flash unit controls are 1298 * also overridden.</p> 1299 * <p>The FLASH modes are only available if the camera device 1300 * has a flash unit ({@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} is <code>true</code>).</p> 1301 * <p>If flash TORCH mode is desired, this field must be set to 1302 * ON or OFF, and {@link CaptureRequest#FLASH_MODE android.flash.mode} set to TORCH.</p> 1303 * <p>When set to any of the ON modes, the values chosen by the 1304 * camera device auto-exposure routine for the overridden 1305 * fields for a given capture will be available in its 1306 * CaptureResult.</p> 1307 * <p><b>Possible values:</b> 1308 * <ul> 1309 * <li>{@link #CONTROL_AE_MODE_OFF OFF}</li> 1310 * <li>{@link #CONTROL_AE_MODE_ON ON}</li> 1311 * <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH ON_AUTO_FLASH}</li> 1312 * <li>{@link #CONTROL_AE_MODE_ON_ALWAYS_FLASH ON_ALWAYS_FLASH}</li> 1313 * <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE ON_AUTO_FLASH_REDEYE}</li> 1314 * <li>{@link #CONTROL_AE_MODE_ON_EXTERNAL_FLASH ON_EXTERNAL_FLASH}</li> 1315 * </ul></p> 1316 * <p><b>Available values for this device:</b><br> 1317 * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES android.control.aeAvailableModes}</p> 1318 * <p>This key is available on all devices.</p> 1319 * 1320 * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES 1321 * @see CaptureRequest#CONTROL_MODE 1322 * @see CameraCharacteristics#FLASH_INFO_AVAILABLE 1323 * @see CaptureRequest#FLASH_MODE 1324 * @see CaptureRequest#SENSOR_EXPOSURE_TIME 1325 * @see CaptureRequest#SENSOR_FRAME_DURATION 1326 * @see CaptureRequest#SENSOR_SENSITIVITY 1327 * @see #CONTROL_AE_MODE_OFF 1328 * @see #CONTROL_AE_MODE_ON 1329 * @see #CONTROL_AE_MODE_ON_AUTO_FLASH 1330 * @see #CONTROL_AE_MODE_ON_ALWAYS_FLASH 1331 * @see #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE 1332 * @see #CONTROL_AE_MODE_ON_EXTERNAL_FLASH 1333 */ 1334 @PublicKey 1335 @NonNull 1336 public static final Key<Integer> CONTROL_AE_MODE = 1337 new Key<Integer>("android.control.aeMode", int.class); 1338 1339 /** 1340 * <p>List of metering areas to use for auto-exposure adjustment.</p> 1341 * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe} is 0. 1342 * Otherwise will always be present.</p> 1343 * <p>The maximum number of regions supported by the device is determined by the value 1344 * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe}.</p> 1345 * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate 1346 * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being 1347 * the top-left pixel in the active pixel array, and 1348 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, 1349 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the 1350 * active pixel array.</p> 1351 * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate 1352 * system depends on the mode being set. 1353 * When the distortion correction mode is OFF, the coordinate system follows 1354 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with 1355 * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and 1356 * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1, 1357 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right 1358 * pixel in the pre-correction active pixel array. 1359 * When the distortion correction mode is not OFF, the coordinate system follows 1360 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with 1361 * <code>(0, 0)</code> being the top-left pixel of the active array, and 1362 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, 1363 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the 1364 * active pixel array.</p> 1365 * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight 1366 * for every pixel in the area. This means that a large metering area 1367 * with the same weight as a smaller area will have more effect in 1368 * the metering result. Metering areas can partially overlap and the 1369 * camera device will add the weights in the overlap region.</p> 1370 * <p>The weights are relative to weights of other exposure metering regions, so if only one 1371 * region is used, all non-zero weights will have the same effect. A region with 0 1372 * weight is ignored.</p> 1373 * <p>If all regions have 0 weight, then no specific metering area needs to be used by the 1374 * camera device.</p> 1375 * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in 1376 * capture result metadata, the camera device will ignore the sections outside the crop 1377 * region and output only the intersection rectangle as the metering region in the result 1378 * metadata. If the region is entirely outside the crop region, it will be ignored and 1379 * not reported in the result metadata.</p> 1380 * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or 1381 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on 1382 * distortion correction capability and mode</p> 1383 * <p><b>Range of valid values:</b><br> 1384 * Coordinates must be between <code>[(0,0), (width, height))</code> of 1385 * {@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} 1386 * depending on distortion correction capability and mode</p> 1387 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 1388 * 1389 * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE 1390 * @see CaptureRequest#DISTORTION_CORRECTION_MODE 1391 * @see CaptureRequest#SCALER_CROP_REGION 1392 * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE 1393 * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE 1394 */ 1395 @PublicKey 1396 @NonNull 1397 public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS = 1398 new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.aeRegions", android.hardware.camera2.params.MeteringRectangle[].class); 1399 1400 /** 1401 * <p>Range over which the auto-exposure routine can 1402 * adjust the capture frame rate to maintain good 1403 * exposure.</p> 1404 * <p>Only constrains auto-exposure (AE) algorithm, not 1405 * manual control of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime} and 1406 * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}.</p> 1407 * <p><b>Units</b>: Frames per second (FPS)</p> 1408 * <p><b>Range of valid values:</b><br> 1409 * Any of the entries in {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES android.control.aeAvailableTargetFpsRanges}</p> 1410 * <p>This key is available on all devices.</p> 1411 * 1412 * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES 1413 * @see CaptureRequest#SENSOR_EXPOSURE_TIME 1414 * @see CaptureRequest#SENSOR_FRAME_DURATION 1415 */ 1416 @PublicKey 1417 @NonNull 1418 public static final Key<android.util.Range<Integer>> CONTROL_AE_TARGET_FPS_RANGE = 1419 new Key<android.util.Range<Integer>>("android.control.aeTargetFpsRange", new TypeReference<android.util.Range<Integer>>() {{ }}); 1420 1421 /** 1422 * <p>Whether the camera device will trigger a precapture 1423 * metering sequence when it processes this request.</p> 1424 * <p>This entry is normally set to IDLE, or is not 1425 * included at all in the request settings. When included and 1426 * set to START, the camera device will trigger the auto-exposure (AE) 1427 * precapture metering sequence.</p> 1428 * <p>When set to CANCEL, the camera device will cancel any active 1429 * precapture metering trigger, and return to its initial AE state. 1430 * If a precapture metering sequence is already completed, and the camera 1431 * device has implicitly locked the AE for subsequent still capture, the 1432 * CANCEL trigger will unlock the AE and return to its initial AE state.</p> 1433 * <p>The precapture sequence should be triggered before starting a 1434 * high-quality still capture for final metering decisions to 1435 * be made, and for firing pre-capture flash pulses to estimate 1436 * scene brightness and required final capture flash power, when 1437 * the flash is enabled.</p> 1438 * <p>Normally, this entry should be set to START for only a 1439 * single request, and the application should wait until the 1440 * sequence completes before starting a new one.</p> 1441 * <p>When a precapture metering sequence is finished, the camera device 1442 * may lock the auto-exposure routine internally to be able to accurately expose the 1443 * subsequent still capture image (<code>{@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE</code>). 1444 * For this case, the AE may not resume normal scan if no subsequent still capture is 1445 * submitted. To ensure that the AE routine restarts normal scan, the application should 1446 * submit a request with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == true</code>, followed by a request 1447 * with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == false</code>, if the application decides not to submit a 1448 * still capture request after the precapture sequence completes. Alternatively, for 1449 * API level 23 or newer devices, the CANCEL can be used to unlock the camera device 1450 * internally locked AE if the application doesn't submit a still capture request after 1451 * the AE precapture trigger. Note that, the CANCEL was added in API level 23, and must not 1452 * be used in devices that have earlier API levels.</p> 1453 * <p>The exact effect of auto-exposure (AE) precapture trigger 1454 * depends on the current AE mode and state; see 1455 * {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture state transition 1456 * details.</p> 1457 * <p>On LEGACY-level devices, the precapture trigger is not supported; 1458 * capturing a high-resolution JPEG image will automatically trigger a 1459 * precapture sequence before the high-resolution capture, including 1460 * potentially firing a pre-capture flash.</p> 1461 * <p>Using the precapture trigger and the auto-focus trigger {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger} 1462 * simultaneously is allowed. However, since these triggers often require cooperation between 1463 * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a 1464 * focus sweep), the camera device may delay acting on a later trigger until the previous 1465 * trigger has been fully handled. This may lead to longer intervals between the trigger and 1466 * changes to {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} indicating the start of the precapture sequence, for 1467 * example.</p> 1468 * <p>If both the precapture and the auto-focus trigger are activated on the same request, then 1469 * the camera device will complete them in the optimal order for that device.</p> 1470 * <p><b>Possible values:</b> 1471 * <ul> 1472 * <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE IDLE}</li> 1473 * <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_START START}</li> 1474 * <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL CANCEL}</li> 1475 * </ul></p> 1476 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 1477 * <p><b>Limited capability</b> - 1478 * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the 1479 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 1480 * 1481 * @see CaptureRequest#CONTROL_AE_LOCK 1482 * @see CaptureResult#CONTROL_AE_STATE 1483 * @see CaptureRequest#CONTROL_AF_TRIGGER 1484 * @see CaptureRequest#CONTROL_CAPTURE_INTENT 1485 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 1486 * @see #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE 1487 * @see #CONTROL_AE_PRECAPTURE_TRIGGER_START 1488 * @see #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL 1489 */ 1490 @PublicKey 1491 @NonNull 1492 public static final Key<Integer> CONTROL_AE_PRECAPTURE_TRIGGER = 1493 new Key<Integer>("android.control.aePrecaptureTrigger", int.class); 1494 1495 /** 1496 * <p>Whether auto-focus (AF) is currently enabled, and what 1497 * mode it is set to.</p> 1498 * <p>Only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} = AUTO and the lens is not fixed focus 1499 * (i.e. <code>{@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} > 0</code>). Also note that 1500 * when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF, the behavior of AF is device 1501 * dependent. It is recommended to lock AF by using {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger} before 1502 * setting {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} to OFF, or set AF mode to OFF when AE is OFF.</p> 1503 * <p>If the lens is controlled by the camera device auto-focus algorithm, 1504 * the camera device will report the current AF status in {@link CaptureResult#CONTROL_AF_STATE android.control.afState} 1505 * in result metadata.</p> 1506 * <p><b>Possible values:</b> 1507 * <ul> 1508 * <li>{@link #CONTROL_AF_MODE_OFF OFF}</li> 1509 * <li>{@link #CONTROL_AF_MODE_AUTO AUTO}</li> 1510 * <li>{@link #CONTROL_AF_MODE_MACRO MACRO}</li> 1511 * <li>{@link #CONTROL_AF_MODE_CONTINUOUS_VIDEO CONTINUOUS_VIDEO}</li> 1512 * <li>{@link #CONTROL_AF_MODE_CONTINUOUS_PICTURE CONTINUOUS_PICTURE}</li> 1513 * <li>{@link #CONTROL_AF_MODE_EDOF EDOF}</li> 1514 * </ul></p> 1515 * <p><b>Available values for this device:</b><br> 1516 * {@link CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES android.control.afAvailableModes}</p> 1517 * <p>This key is available on all devices.</p> 1518 * 1519 * @see CaptureRequest#CONTROL_AE_MODE 1520 * @see CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES 1521 * @see CaptureResult#CONTROL_AF_STATE 1522 * @see CaptureRequest#CONTROL_AF_TRIGGER 1523 * @see CaptureRequest#CONTROL_MODE 1524 * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE 1525 * @see #CONTROL_AF_MODE_OFF 1526 * @see #CONTROL_AF_MODE_AUTO 1527 * @see #CONTROL_AF_MODE_MACRO 1528 * @see #CONTROL_AF_MODE_CONTINUOUS_VIDEO 1529 * @see #CONTROL_AF_MODE_CONTINUOUS_PICTURE 1530 * @see #CONTROL_AF_MODE_EDOF 1531 */ 1532 @PublicKey 1533 @NonNull 1534 public static final Key<Integer> CONTROL_AF_MODE = 1535 new Key<Integer>("android.control.afMode", int.class); 1536 1537 /** 1538 * <p>List of metering areas to use for auto-focus.</p> 1539 * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf} is 0. 1540 * Otherwise will always be present.</p> 1541 * <p>The maximum number of focus areas supported by the device is determined by the value 1542 * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf}.</p> 1543 * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate 1544 * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being 1545 * the top-left pixel in the active pixel array, and 1546 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, 1547 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the 1548 * active pixel array.</p> 1549 * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate 1550 * system depends on the mode being set. 1551 * When the distortion correction mode is OFF, the coordinate system follows 1552 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with 1553 * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and 1554 * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1, 1555 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right 1556 * pixel in the pre-correction active pixel array. 1557 * When the distortion correction mode is not OFF, the coordinate system follows 1558 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with 1559 * <code>(0, 0)</code> being the top-left pixel of the active array, and 1560 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, 1561 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the 1562 * active pixel array.</p> 1563 * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight 1564 * for every pixel in the area. This means that a large metering area 1565 * with the same weight as a smaller area will have more effect in 1566 * the metering result. Metering areas can partially overlap and the 1567 * camera device will add the weights in the overlap region.</p> 1568 * <p>The weights are relative to weights of other metering regions, so if only one region 1569 * is used, all non-zero weights will have the same effect. A region with 0 weight is 1570 * ignored.</p> 1571 * <p>If all regions have 0 weight, then no specific metering area needs to be used by the 1572 * camera device. The capture result will either be a zero weight region as well, or 1573 * the region selected by the camera device as the focus area of interest.</p> 1574 * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in 1575 * capture result metadata, the camera device will ignore the sections outside the crop 1576 * region and output only the intersection rectangle as the metering region in the result 1577 * metadata. If the region is entirely outside the crop region, it will be ignored and 1578 * not reported in the result metadata.</p> 1579 * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or 1580 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on 1581 * distortion correction capability and mode</p> 1582 * <p><b>Range of valid values:</b><br> 1583 * Coordinates must be between <code>[(0,0), (width, height))</code> of 1584 * {@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} 1585 * depending on distortion correction capability and mode</p> 1586 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 1587 * 1588 * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF 1589 * @see CaptureRequest#DISTORTION_CORRECTION_MODE 1590 * @see CaptureRequest#SCALER_CROP_REGION 1591 * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE 1592 * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE 1593 */ 1594 @PublicKey 1595 @NonNull 1596 public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS = 1597 new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.afRegions", android.hardware.camera2.params.MeteringRectangle[].class); 1598 1599 /** 1600 * <p>Whether the camera device will trigger autofocus for this request.</p> 1601 * <p>This entry is normally set to IDLE, or is not 1602 * included at all in the request settings.</p> 1603 * <p>When included and set to START, the camera device will trigger the 1604 * autofocus algorithm. If autofocus is disabled, this trigger has no effect.</p> 1605 * <p>When set to CANCEL, the camera device will cancel any active trigger, 1606 * and return to its initial AF state.</p> 1607 * <p>Generally, applications should set this entry to START or CANCEL for only a 1608 * single capture, and then return it to IDLE (or not set at all). Specifying 1609 * START for multiple captures in a row means restarting the AF operation over 1610 * and over again.</p> 1611 * <p>See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what the trigger means for each AF mode.</p> 1612 * <p>Using the autofocus trigger and the precapture trigger {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} 1613 * simultaneously is allowed. However, since these triggers often require cooperation between 1614 * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a 1615 * focus sweep), the camera device may delay acting on a later trigger until the previous 1616 * trigger has been fully handled. This may lead to longer intervals between the trigger and 1617 * changes to {@link CaptureResult#CONTROL_AF_STATE android.control.afState}, for example.</p> 1618 * <p><b>Possible values:</b> 1619 * <ul> 1620 * <li>{@link #CONTROL_AF_TRIGGER_IDLE IDLE}</li> 1621 * <li>{@link #CONTROL_AF_TRIGGER_START START}</li> 1622 * <li>{@link #CONTROL_AF_TRIGGER_CANCEL CANCEL}</li> 1623 * </ul></p> 1624 * <p>This key is available on all devices.</p> 1625 * 1626 * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER 1627 * @see CaptureResult#CONTROL_AF_STATE 1628 * @see #CONTROL_AF_TRIGGER_IDLE 1629 * @see #CONTROL_AF_TRIGGER_START 1630 * @see #CONTROL_AF_TRIGGER_CANCEL 1631 */ 1632 @PublicKey 1633 @NonNull 1634 public static final Key<Integer> CONTROL_AF_TRIGGER = 1635 new Key<Integer>("android.control.afTrigger", int.class); 1636 1637 /** 1638 * <p>Whether auto-white balance (AWB) is currently locked to its 1639 * latest calculated values.</p> 1640 * <p>When set to <code>true</code> (ON), the AWB algorithm is locked to its latest parameters, 1641 * and will not change color balance settings until the lock is set to <code>false</code> (OFF).</p> 1642 * <p>Since the camera device has a pipeline of in-flight requests, the settings that 1643 * get locked do not necessarily correspond to the settings that were present in the 1644 * latest capture result received from the camera device, since additional captures 1645 * and AWB updates may have occurred even before the result was sent out. If an 1646 * application is switching between automatic and manual control and wishes to eliminate 1647 * any flicker during the switch, the following procedure is recommended:</p> 1648 * <ol> 1649 * <li>Starting in auto-AWB mode:</li> 1650 * <li>Lock AWB</li> 1651 * <li>Wait for the first result to be output that has the AWB locked</li> 1652 * <li>Copy AWB settings from that result into a request, set the request to manual AWB</li> 1653 * <li>Submit the capture request, proceed to run manual AWB as desired.</li> 1654 * </ol> 1655 * <p>Note that AWB lock is only meaningful when 1656 * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} is in the AUTO mode; in other modes, 1657 * AWB is already fixed to a specific setting.</p> 1658 * <p>Some LEGACY devices may not support ON; the value is then overridden to OFF.</p> 1659 * <p>This key is available on all devices.</p> 1660 * 1661 * @see CaptureRequest#CONTROL_AWB_MODE 1662 */ 1663 @PublicKey 1664 @NonNull 1665 public static final Key<Boolean> CONTROL_AWB_LOCK = 1666 new Key<Boolean>("android.control.awbLock", boolean.class); 1667 1668 /** 1669 * <p>Whether auto-white balance (AWB) is currently setting the color 1670 * transform fields, and what its illumination target 1671 * is.</p> 1672 * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is AUTO.</p> 1673 * <p>When set to the ON mode, the camera device's auto-white balance 1674 * routine is enabled, overriding the application's selected 1675 * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and 1676 * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}. Note that when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} 1677 * is OFF, the behavior of AWB is device dependent. It is recommened to 1678 * also set AWB mode to OFF or lock AWB by using {@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} before 1679 * setting AE mode to OFF.</p> 1680 * <p>When set to the OFF mode, the camera device's auto-white balance 1681 * routine is disabled. The application manually controls the white 1682 * balance by {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} 1683 * and {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p> 1684 * <p>When set to any other modes, the camera device's auto-white 1685 * balance routine is disabled. The camera device uses each 1686 * particular illumination target for white balance 1687 * adjustment. The application's values for 1688 * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, 1689 * {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and 1690 * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} are ignored.</p> 1691 * <p><b>Possible values:</b> 1692 * <ul> 1693 * <li>{@link #CONTROL_AWB_MODE_OFF OFF}</li> 1694 * <li>{@link #CONTROL_AWB_MODE_AUTO AUTO}</li> 1695 * <li>{@link #CONTROL_AWB_MODE_INCANDESCENT INCANDESCENT}</li> 1696 * <li>{@link #CONTROL_AWB_MODE_FLUORESCENT FLUORESCENT}</li> 1697 * <li>{@link #CONTROL_AWB_MODE_WARM_FLUORESCENT WARM_FLUORESCENT}</li> 1698 * <li>{@link #CONTROL_AWB_MODE_DAYLIGHT DAYLIGHT}</li> 1699 * <li>{@link #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT CLOUDY_DAYLIGHT}</li> 1700 * <li>{@link #CONTROL_AWB_MODE_TWILIGHT TWILIGHT}</li> 1701 * <li>{@link #CONTROL_AWB_MODE_SHADE SHADE}</li> 1702 * </ul></p> 1703 * <p><b>Available values for this device:</b><br> 1704 * {@link CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES android.control.awbAvailableModes}</p> 1705 * <p>This key is available on all devices.</p> 1706 * 1707 * @see CaptureRequest#COLOR_CORRECTION_GAINS 1708 * @see CaptureRequest#COLOR_CORRECTION_MODE 1709 * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM 1710 * @see CaptureRequest#CONTROL_AE_MODE 1711 * @see CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES 1712 * @see CaptureRequest#CONTROL_AWB_LOCK 1713 * @see CaptureRequest#CONTROL_MODE 1714 * @see #CONTROL_AWB_MODE_OFF 1715 * @see #CONTROL_AWB_MODE_AUTO 1716 * @see #CONTROL_AWB_MODE_INCANDESCENT 1717 * @see #CONTROL_AWB_MODE_FLUORESCENT 1718 * @see #CONTROL_AWB_MODE_WARM_FLUORESCENT 1719 * @see #CONTROL_AWB_MODE_DAYLIGHT 1720 * @see #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT 1721 * @see #CONTROL_AWB_MODE_TWILIGHT 1722 * @see #CONTROL_AWB_MODE_SHADE 1723 */ 1724 @PublicKey 1725 @NonNull 1726 public static final Key<Integer> CONTROL_AWB_MODE = 1727 new Key<Integer>("android.control.awbMode", int.class); 1728 1729 /** 1730 * <p>List of metering areas to use for auto-white-balance illuminant 1731 * estimation.</p> 1732 * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb} is 0. 1733 * Otherwise will always be present.</p> 1734 * <p>The maximum number of regions supported by the device is determined by the value 1735 * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb}.</p> 1736 * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate 1737 * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being 1738 * the top-left pixel in the active pixel array, and 1739 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, 1740 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the 1741 * active pixel array.</p> 1742 * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate 1743 * system depends on the mode being set. 1744 * When the distortion correction mode is OFF, the coordinate system follows 1745 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with 1746 * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and 1747 * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1, 1748 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right 1749 * pixel in the pre-correction active pixel array. 1750 * When the distortion correction mode is not OFF, the coordinate system follows 1751 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with 1752 * <code>(0, 0)</code> being the top-left pixel of the active array, and 1753 * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, 1754 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the 1755 * active pixel array.</p> 1756 * <p>The weight must range from 0 to 1000, and represents a weight 1757 * for every pixel in the area. This means that a large metering area 1758 * with the same weight as a smaller area will have more effect in 1759 * the metering result. Metering areas can partially overlap and the 1760 * camera device will add the weights in the overlap region.</p> 1761 * <p>The weights are relative to weights of other white balance metering regions, so if 1762 * only one region is used, all non-zero weights will have the same effect. A region with 1763 * 0 weight is ignored.</p> 1764 * <p>If all regions have 0 weight, then no specific metering area needs to be used by the 1765 * camera device.</p> 1766 * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in 1767 * capture result metadata, the camera device will ignore the sections outside the crop 1768 * region and output only the intersection rectangle as the metering region in the result 1769 * metadata. If the region is entirely outside the crop region, it will be ignored and 1770 * not reported in the result metadata.</p> 1771 * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or 1772 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on 1773 * distortion correction capability and mode</p> 1774 * <p><b>Range of valid values:</b><br> 1775 * Coordinates must be between <code>[(0,0), (width, height))</code> of 1776 * {@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} 1777 * depending on distortion correction capability and mode</p> 1778 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 1779 * 1780 * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB 1781 * @see CaptureRequest#DISTORTION_CORRECTION_MODE 1782 * @see CaptureRequest#SCALER_CROP_REGION 1783 * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE 1784 * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE 1785 */ 1786 @PublicKey 1787 @NonNull 1788 public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS = 1789 new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.awbRegions", android.hardware.camera2.params.MeteringRectangle[].class); 1790 1791 /** 1792 * <p>Information to the camera device 3A (auto-exposure, 1793 * auto-focus, auto-white balance) routines about the purpose 1794 * of this capture, to help the camera device to decide optimal 3A 1795 * strategy.</p> 1796 * <p>This control (except for MANUAL) is only effective if 1797 * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} != OFF</code> and any 3A routine is active.</p> 1798 * <p>All intents are supported by all devices, except that: 1799 * * ZERO_SHUTTER_LAG will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains 1800 * PRIVATE_REPROCESSING or YUV_REPROCESSING. 1801 * * MANUAL will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains 1802 * MANUAL_SENSOR. 1803 * * MOTION_TRACKING will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains 1804 * MOTION_TRACKING.</p> 1805 * <p><b>Possible values:</b> 1806 * <ul> 1807 * <li>{@link #CONTROL_CAPTURE_INTENT_CUSTOM CUSTOM}</li> 1808 * <li>{@link #CONTROL_CAPTURE_INTENT_PREVIEW PREVIEW}</li> 1809 * <li>{@link #CONTROL_CAPTURE_INTENT_STILL_CAPTURE STILL_CAPTURE}</li> 1810 * <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_RECORD VIDEO_RECORD}</li> 1811 * <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT VIDEO_SNAPSHOT}</li> 1812 * <li>{@link #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li> 1813 * <li>{@link #CONTROL_CAPTURE_INTENT_MANUAL MANUAL}</li> 1814 * <li>{@link #CONTROL_CAPTURE_INTENT_MOTION_TRACKING MOTION_TRACKING}</li> 1815 * </ul></p> 1816 * <p>This key is available on all devices.</p> 1817 * 1818 * @see CaptureRequest#CONTROL_MODE 1819 * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES 1820 * @see #CONTROL_CAPTURE_INTENT_CUSTOM 1821 * @see #CONTROL_CAPTURE_INTENT_PREVIEW 1822 * @see #CONTROL_CAPTURE_INTENT_STILL_CAPTURE 1823 * @see #CONTROL_CAPTURE_INTENT_VIDEO_RECORD 1824 * @see #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT 1825 * @see #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG 1826 * @see #CONTROL_CAPTURE_INTENT_MANUAL 1827 * @see #CONTROL_CAPTURE_INTENT_MOTION_TRACKING 1828 */ 1829 @PublicKey 1830 @NonNull 1831 public static final Key<Integer> CONTROL_CAPTURE_INTENT = 1832 new Key<Integer>("android.control.captureIntent", int.class); 1833 1834 /** 1835 * <p>A special color effect to apply.</p> 1836 * <p>When this mode is set, a color effect will be applied 1837 * to images produced by the camera device. The interpretation 1838 * and implementation of these color effects is left to the 1839 * implementor of the camera device, and should not be 1840 * depended on to be consistent (or present) across all 1841 * devices.</p> 1842 * <p><b>Possible values:</b> 1843 * <ul> 1844 * <li>{@link #CONTROL_EFFECT_MODE_OFF OFF}</li> 1845 * <li>{@link #CONTROL_EFFECT_MODE_MONO MONO}</li> 1846 * <li>{@link #CONTROL_EFFECT_MODE_NEGATIVE NEGATIVE}</li> 1847 * <li>{@link #CONTROL_EFFECT_MODE_SOLARIZE SOLARIZE}</li> 1848 * <li>{@link #CONTROL_EFFECT_MODE_SEPIA SEPIA}</li> 1849 * <li>{@link #CONTROL_EFFECT_MODE_POSTERIZE POSTERIZE}</li> 1850 * <li>{@link #CONTROL_EFFECT_MODE_WHITEBOARD WHITEBOARD}</li> 1851 * <li>{@link #CONTROL_EFFECT_MODE_BLACKBOARD BLACKBOARD}</li> 1852 * <li>{@link #CONTROL_EFFECT_MODE_AQUA AQUA}</li> 1853 * </ul></p> 1854 * <p><b>Available values for this device:</b><br> 1855 * {@link CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS android.control.availableEffects}</p> 1856 * <p>This key is available on all devices.</p> 1857 * 1858 * @see CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS 1859 * @see #CONTROL_EFFECT_MODE_OFF 1860 * @see #CONTROL_EFFECT_MODE_MONO 1861 * @see #CONTROL_EFFECT_MODE_NEGATIVE 1862 * @see #CONTROL_EFFECT_MODE_SOLARIZE 1863 * @see #CONTROL_EFFECT_MODE_SEPIA 1864 * @see #CONTROL_EFFECT_MODE_POSTERIZE 1865 * @see #CONTROL_EFFECT_MODE_WHITEBOARD 1866 * @see #CONTROL_EFFECT_MODE_BLACKBOARD 1867 * @see #CONTROL_EFFECT_MODE_AQUA 1868 */ 1869 @PublicKey 1870 @NonNull 1871 public static final Key<Integer> CONTROL_EFFECT_MODE = 1872 new Key<Integer>("android.control.effectMode", int.class); 1873 1874 /** 1875 * <p>Overall mode of 3A (auto-exposure, auto-white-balance, auto-focus) control 1876 * routines.</p> 1877 * <p>This is a top-level 3A control switch. When set to OFF, all 3A control 1878 * by the camera device is disabled. The application must set the fields for 1879 * capture parameters itself.</p> 1880 * <p>When set to AUTO, the individual algorithm controls in 1881 * android.control.* are in effect, such as {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}.</p> 1882 * <p>When set to USE_SCENE_MODE, the individual controls in 1883 * android.control.* are mostly disabled, and the camera device 1884 * implements one of the scene mode settings (such as ACTION, 1885 * SUNSET, or PARTY) as it wishes. The camera device scene mode 1886 * 3A settings are provided by {@link android.hardware.camera2.CaptureResult capture results}.</p> 1887 * <p>When set to OFF_KEEP_STATE, it is similar to OFF mode, the only difference 1888 * is that this frame will not be used by camera device background 3A statistics 1889 * update, as if this frame is never captured. This mode can be used in the scenario 1890 * where the application doesn't want a 3A manual control capture to affect 1891 * the subsequent auto 3A capture results.</p> 1892 * <p><b>Possible values:</b> 1893 * <ul> 1894 * <li>{@link #CONTROL_MODE_OFF OFF}</li> 1895 * <li>{@link #CONTROL_MODE_AUTO AUTO}</li> 1896 * <li>{@link #CONTROL_MODE_USE_SCENE_MODE USE_SCENE_MODE}</li> 1897 * <li>{@link #CONTROL_MODE_OFF_KEEP_STATE OFF_KEEP_STATE}</li> 1898 * </ul></p> 1899 * <p><b>Available values for this device:</b><br> 1900 * {@link CameraCharacteristics#CONTROL_AVAILABLE_MODES android.control.availableModes}</p> 1901 * <p>This key is available on all devices.</p> 1902 * 1903 * @see CaptureRequest#CONTROL_AF_MODE 1904 * @see CameraCharacteristics#CONTROL_AVAILABLE_MODES 1905 * @see #CONTROL_MODE_OFF 1906 * @see #CONTROL_MODE_AUTO 1907 * @see #CONTROL_MODE_USE_SCENE_MODE 1908 * @see #CONTROL_MODE_OFF_KEEP_STATE 1909 */ 1910 @PublicKey 1911 @NonNull 1912 public static final Key<Integer> CONTROL_MODE = 1913 new Key<Integer>("android.control.mode", int.class); 1914 1915 /** 1916 * <p>Control for which scene mode is currently active.</p> 1917 * <p>Scene modes are custom camera modes optimized for a certain set of conditions and 1918 * capture settings.</p> 1919 * <p>This is the mode that that is active when 1920 * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY, these modes will 1921 * 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} 1922 * while in use.</p> 1923 * <p>The interpretation and implementation of these scene modes is left 1924 * to the implementor of the camera device. Their behavior will not be 1925 * consistent across all devices, and any given device may only implement 1926 * a subset of these modes.</p> 1927 * <p><b>Possible values:</b> 1928 * <ul> 1929 * <li>{@link #CONTROL_SCENE_MODE_DISABLED DISABLED}</li> 1930 * <li>{@link #CONTROL_SCENE_MODE_FACE_PRIORITY FACE_PRIORITY}</li> 1931 * <li>{@link #CONTROL_SCENE_MODE_ACTION ACTION}</li> 1932 * <li>{@link #CONTROL_SCENE_MODE_PORTRAIT PORTRAIT}</li> 1933 * <li>{@link #CONTROL_SCENE_MODE_LANDSCAPE LANDSCAPE}</li> 1934 * <li>{@link #CONTROL_SCENE_MODE_NIGHT NIGHT}</li> 1935 * <li>{@link #CONTROL_SCENE_MODE_NIGHT_PORTRAIT NIGHT_PORTRAIT}</li> 1936 * <li>{@link #CONTROL_SCENE_MODE_THEATRE THEATRE}</li> 1937 * <li>{@link #CONTROL_SCENE_MODE_BEACH BEACH}</li> 1938 * <li>{@link #CONTROL_SCENE_MODE_SNOW SNOW}</li> 1939 * <li>{@link #CONTROL_SCENE_MODE_SUNSET SUNSET}</li> 1940 * <li>{@link #CONTROL_SCENE_MODE_STEADYPHOTO STEADYPHOTO}</li> 1941 * <li>{@link #CONTROL_SCENE_MODE_FIREWORKS FIREWORKS}</li> 1942 * <li>{@link #CONTROL_SCENE_MODE_SPORTS SPORTS}</li> 1943 * <li>{@link #CONTROL_SCENE_MODE_PARTY PARTY}</li> 1944 * <li>{@link #CONTROL_SCENE_MODE_CANDLELIGHT CANDLELIGHT}</li> 1945 * <li>{@link #CONTROL_SCENE_MODE_BARCODE BARCODE}</li> 1946 * <li>{@link #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO HIGH_SPEED_VIDEO}</li> 1947 * <li>{@link #CONTROL_SCENE_MODE_HDR HDR}</li> 1948 * </ul></p> 1949 * <p><b>Available values for this device:</b><br> 1950 * {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes}</p> 1951 * <p>This key is available on all devices.</p> 1952 * 1953 * @see CaptureRequest#CONTROL_AE_MODE 1954 * @see CaptureRequest#CONTROL_AF_MODE 1955 * @see CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES 1956 * @see CaptureRequest#CONTROL_AWB_MODE 1957 * @see CaptureRequest#CONTROL_MODE 1958 * @see #CONTROL_SCENE_MODE_DISABLED 1959 * @see #CONTROL_SCENE_MODE_FACE_PRIORITY 1960 * @see #CONTROL_SCENE_MODE_ACTION 1961 * @see #CONTROL_SCENE_MODE_PORTRAIT 1962 * @see #CONTROL_SCENE_MODE_LANDSCAPE 1963 * @see #CONTROL_SCENE_MODE_NIGHT 1964 * @see #CONTROL_SCENE_MODE_NIGHT_PORTRAIT 1965 * @see #CONTROL_SCENE_MODE_THEATRE 1966 * @see #CONTROL_SCENE_MODE_BEACH 1967 * @see #CONTROL_SCENE_MODE_SNOW 1968 * @see #CONTROL_SCENE_MODE_SUNSET 1969 * @see #CONTROL_SCENE_MODE_STEADYPHOTO 1970 * @see #CONTROL_SCENE_MODE_FIREWORKS 1971 * @see #CONTROL_SCENE_MODE_SPORTS 1972 * @see #CONTROL_SCENE_MODE_PARTY 1973 * @see #CONTROL_SCENE_MODE_CANDLELIGHT 1974 * @see #CONTROL_SCENE_MODE_BARCODE 1975 * @see #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO 1976 * @see #CONTROL_SCENE_MODE_HDR 1977 */ 1978 @PublicKey 1979 @NonNull 1980 public static final Key<Integer> CONTROL_SCENE_MODE = 1981 new Key<Integer>("android.control.sceneMode", int.class); 1982 1983 /** 1984 * <p>Whether video stabilization is 1985 * active.</p> 1986 * <p>Video stabilization automatically warps images from 1987 * the camera in order to stabilize motion between consecutive frames.</p> 1988 * <p>If enabled, video stabilization can modify the 1989 * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to keep the video stream stabilized.</p> 1990 * <p>Switching between different video stabilization modes may take several 1991 * frames to initialize, the camera device will report the current mode 1992 * in capture result metadata. For example, When "ON" mode is requested, 1993 * the video stabilization modes in the first several capture results may 1994 * still be "OFF", and it will become "ON" when the initialization is 1995 * done.</p> 1996 * <p>In addition, not all recording sizes or frame rates may be supported for 1997 * stabilization by a device that reports stabilization support. It is guaranteed 1998 * that an output targeting a MediaRecorder or MediaCodec will be stabilized if 1999 * the recording resolution is less than or equal to 1920 x 1080 (width less than 2000 * or equal to 1920, height less than or equal to 1080), and the recording 2001 * frame rate is less than or equal to 30fps. At other sizes, the CaptureResult 2002 * {@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode} field will return 2003 * OFF if the recording output is not stabilized, or if there are no output 2004 * Surface types that can be stabilized.</p> 2005 * <p>If a camera device supports both this mode and OIS 2006 * ({@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode}), turning both modes on may 2007 * produce undesirable interaction, so it is recommended not to enable 2008 * both at the same time.</p> 2009 * <p><b>Possible values:</b> 2010 * <ul> 2011 * <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_OFF OFF}</li> 2012 * <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_ON ON}</li> 2013 * </ul></p> 2014 * <p>This key is available on all devices.</p> 2015 * 2016 * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE 2017 * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE 2018 * @see CaptureRequest#SCALER_CROP_REGION 2019 * @see #CONTROL_VIDEO_STABILIZATION_MODE_OFF 2020 * @see #CONTROL_VIDEO_STABILIZATION_MODE_ON 2021 */ 2022 @PublicKey 2023 @NonNull 2024 public static final Key<Integer> CONTROL_VIDEO_STABILIZATION_MODE = 2025 new Key<Integer>("android.control.videoStabilizationMode", int.class); 2026 2027 /** 2028 * <p>The amount of additional sensitivity boost applied to output images 2029 * after RAW sensor data is captured.</p> 2030 * <p>Some camera devices support additional digital sensitivity boosting in the 2031 * camera processing pipeline after sensor RAW image is captured. 2032 * Such a boost will be applied to YUV/JPEG format output images but will not 2033 * have effect on RAW output formats like RAW_SENSOR, RAW10, RAW12 or RAW_OPAQUE.</p> 2034 * <p>This key will be <code>null</code> for devices that do not support any RAW format 2035 * outputs. For devices that do support RAW format outputs, this key will always 2036 * present, and if a device does not support post RAW sensitivity boost, it will 2037 * list <code>100</code> in this key.</p> 2038 * <p>If the camera device cannot apply the exact boost requested, it will reduce the 2039 * boost to the nearest supported value. 2040 * The final boost value used will be available in the output capture result.</p> 2041 * <p>For devices that support post RAW sensitivity boost, the YUV/JPEG output images 2042 * of such device will have the total sensitivity of 2043 * <code>{@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} * {@link CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST android.control.postRawSensitivityBoost} / 100</code> 2044 * The sensitivity of RAW format images will always be <code>{@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</code></p> 2045 * <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 2046 * OFF; otherwise the auto-exposure algorithm will override this value.</p> 2047 * <p><b>Units</b>: ISO arithmetic units, the same as {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</p> 2048 * <p><b>Range of valid values:</b><br> 2049 * {@link CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE android.control.postRawSensitivityBoostRange}</p> 2050 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2051 * 2052 * @see CaptureRequest#CONTROL_AE_MODE 2053 * @see CaptureRequest#CONTROL_MODE 2054 * @see CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST 2055 * @see CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE 2056 * @see CaptureRequest#SENSOR_SENSITIVITY 2057 */ 2058 @PublicKey 2059 @NonNull 2060 public static final Key<Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST = 2061 new Key<Integer>("android.control.postRawSensitivityBoost", int.class); 2062 2063 /** 2064 * <p>Allow camera device to enable zero-shutter-lag mode for requests with 2065 * {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE.</p> 2066 * <p>If enableZsl is <code>true</code>, the camera device may enable zero-shutter-lag mode for requests with 2067 * STILL_CAPTURE capture intent. The camera device may use images captured in the past to 2068 * produce output images for a zero-shutter-lag request. The result metadata including the 2069 * {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp} reflects the source frames used to produce output images. 2070 * Therefore, the contents of the output images and the result metadata may be out of order 2071 * compared to previous regular requests. enableZsl does not affect requests with other 2072 * capture intents.</p> 2073 * <p>For example, when requests are submitted in the following order: 2074 * Request A: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is PREVIEW 2075 * Request B: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is STILL_CAPTURE</p> 2076 * <p>The output images for request B may have contents captured before the output images for 2077 * request A, and the result metadata for request B may be older than the result metadata for 2078 * request A.</p> 2079 * <p>Note that when enableZsl is <code>true</code>, it is not guaranteed to get output images captured in 2080 * the past for requests with STILL_CAPTURE capture intent.</p> 2081 * <p>For applications targeting SDK versions O and newer, the value of enableZsl in 2082 * TEMPLATE_STILL_CAPTURE template may be <code>true</code>. The value in other templates is always 2083 * <code>false</code> if present.</p> 2084 * <p>For applications targeting SDK versions older than O, the value of enableZsl in all 2085 * capture templates is always <code>false</code> if present.</p> 2086 * <p>For application-operated ZSL, use CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG template.</p> 2087 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2088 * 2089 * @see CaptureRequest#CONTROL_CAPTURE_INTENT 2090 * @see CaptureResult#SENSOR_TIMESTAMP 2091 */ 2092 @PublicKey 2093 @NonNull 2094 public static final Key<Boolean> CONTROL_ENABLE_ZSL = 2095 new Key<Boolean>("android.control.enableZsl", boolean.class); 2096 2097 /** 2098 * <p>Operation mode for edge 2099 * enhancement.</p> 2100 * <p>Edge enhancement improves sharpness and details in the captured image. OFF means 2101 * no enhancement will be applied by the camera device.</p> 2102 * <p>FAST/HIGH_QUALITY both mean camera device determined enhancement 2103 * will be applied. HIGH_QUALITY mode indicates that the 2104 * camera device will use the highest-quality enhancement algorithms, 2105 * even if it slows down capture rate. FAST means the camera device will 2106 * not slow down capture rate when applying edge enhancement. FAST may be the same as OFF if 2107 * edge enhancement will slow down capture rate. Every output stream will have a similar 2108 * amount of enhancement applied.</p> 2109 * <p>ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular 2110 * buffer of high-resolution images during preview and reprocess image(s) from that buffer 2111 * into a final capture when triggered by the user. In this mode, the camera device applies 2112 * edge enhancement to low-resolution streams (below maximum recording resolution) to 2113 * maximize preview quality, but does not apply edge enhancement to high-resolution streams, 2114 * since those will be reprocessed later if necessary.</p> 2115 * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera 2116 * device will apply FAST/HIGH_QUALITY YUV-domain edge enhancement, respectively. 2117 * The camera device may adjust its internal edge enhancement parameters for best 2118 * image quality based on the {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor}, if it is set.</p> 2119 * <p><b>Possible values:</b> 2120 * <ul> 2121 * <li>{@link #EDGE_MODE_OFF OFF}</li> 2122 * <li>{@link #EDGE_MODE_FAST FAST}</li> 2123 * <li>{@link #EDGE_MODE_HIGH_QUALITY HIGH_QUALITY}</li> 2124 * <li>{@link #EDGE_MODE_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li> 2125 * </ul></p> 2126 * <p><b>Available values for this device:</b><br> 2127 * {@link CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES android.edge.availableEdgeModes}</p> 2128 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2129 * <p><b>Full capability</b> - 2130 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 2131 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2132 * 2133 * @see CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES 2134 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2135 * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR 2136 * @see #EDGE_MODE_OFF 2137 * @see #EDGE_MODE_FAST 2138 * @see #EDGE_MODE_HIGH_QUALITY 2139 * @see #EDGE_MODE_ZERO_SHUTTER_LAG 2140 */ 2141 @PublicKey 2142 @NonNull 2143 public static final Key<Integer> EDGE_MODE = 2144 new Key<Integer>("android.edge.mode", int.class); 2145 2146 /** 2147 * <p>The desired mode for for the camera device's flash control.</p> 2148 * <p>This control is only effective when flash unit is available 2149 * (<code>{@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} == true</code>).</p> 2150 * <p>When this control is used, the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} must be set to ON or OFF. 2151 * Otherwise, the camera device auto-exposure related flash control (ON_AUTO_FLASH, 2152 * ON_ALWAYS_FLASH, or ON_AUTO_FLASH_REDEYE) will override this control.</p> 2153 * <p>When set to OFF, the camera device will not fire flash for this capture.</p> 2154 * <p>When set to SINGLE, the camera device will fire flash regardless of the camera 2155 * device's auto-exposure routine's result. When used in still capture case, this 2156 * control should be used along with auto-exposure (AE) precapture metering sequence 2157 * ({@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}), otherwise, the image may be incorrectly exposed.</p> 2158 * <p>When set to TORCH, the flash will be on continuously. This mode can be used 2159 * for use cases such as preview, auto-focus assist, still capture, or video recording.</p> 2160 * <p>The flash status will be reported by {@link CaptureResult#FLASH_STATE android.flash.state} in the capture result metadata.</p> 2161 * <p><b>Possible values:</b> 2162 * <ul> 2163 * <li>{@link #FLASH_MODE_OFF OFF}</li> 2164 * <li>{@link #FLASH_MODE_SINGLE SINGLE}</li> 2165 * <li>{@link #FLASH_MODE_TORCH TORCH}</li> 2166 * </ul></p> 2167 * <p>This key is available on all devices.</p> 2168 * 2169 * @see CaptureRequest#CONTROL_AE_MODE 2170 * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER 2171 * @see CameraCharacteristics#FLASH_INFO_AVAILABLE 2172 * @see CaptureResult#FLASH_STATE 2173 * @see #FLASH_MODE_OFF 2174 * @see #FLASH_MODE_SINGLE 2175 * @see #FLASH_MODE_TORCH 2176 */ 2177 @PublicKey 2178 @NonNull 2179 public static final Key<Integer> FLASH_MODE = 2180 new Key<Integer>("android.flash.mode", int.class); 2181 2182 /** 2183 * <p>Operational mode for hot pixel correction.</p> 2184 * <p>Hotpixel correction interpolates out, or otherwise removes, pixels 2185 * that do not accurately measure the incoming light (i.e. pixels that 2186 * are stuck at an arbitrary value or are oversensitive).</p> 2187 * <p><b>Possible values:</b> 2188 * <ul> 2189 * <li>{@link #HOT_PIXEL_MODE_OFF OFF}</li> 2190 * <li>{@link #HOT_PIXEL_MODE_FAST FAST}</li> 2191 * <li>{@link #HOT_PIXEL_MODE_HIGH_QUALITY HIGH_QUALITY}</li> 2192 * </ul></p> 2193 * <p><b>Available values for this device:</b><br> 2194 * {@link CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES android.hotPixel.availableHotPixelModes}</p> 2195 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2196 * 2197 * @see CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES 2198 * @see #HOT_PIXEL_MODE_OFF 2199 * @see #HOT_PIXEL_MODE_FAST 2200 * @see #HOT_PIXEL_MODE_HIGH_QUALITY 2201 */ 2202 @PublicKey 2203 @NonNull 2204 public static final Key<Integer> HOT_PIXEL_MODE = 2205 new Key<Integer>("android.hotPixel.mode", int.class); 2206 2207 /** 2208 * <p>A location object to use when generating image GPS metadata.</p> 2209 * <p>Setting a location object in a request will include the GPS coordinates of the location 2210 * into any JPEG images captured based on the request. These coordinates can then be 2211 * viewed by anyone who receives the JPEG image.</p> 2212 * <p>This tag is also used for HEIC image capture.</p> 2213 * <p>This key is available on all devices.</p> 2214 */ 2215 @PublicKey 2216 @NonNull 2217 @SyntheticKey 2218 public static final Key<android.location.Location> JPEG_GPS_LOCATION = 2219 new Key<android.location.Location>("android.jpeg.gpsLocation", android.location.Location.class); 2220 2221 /** 2222 * <p>GPS coordinates to include in output JPEG 2223 * EXIF.</p> 2224 * <p>This tag is also used for HEIC image capture.</p> 2225 * <p><b>Range of valid values:</b><br> 2226 * (-180 - 180], [-90,90], [-inf, inf]</p> 2227 * <p>This key is available on all devices.</p> 2228 * @hide 2229 */ 2230 public static final Key<double[]> JPEG_GPS_COORDINATES = 2231 new Key<double[]>("android.jpeg.gpsCoordinates", double[].class); 2232 2233 /** 2234 * <p>32 characters describing GPS algorithm to 2235 * include in EXIF.</p> 2236 * <p>This tag is also used for HEIC image capture.</p> 2237 * <p>This key is available on all devices.</p> 2238 * @hide 2239 */ 2240 public static final Key<String> JPEG_GPS_PROCESSING_METHOD = 2241 new Key<String>("android.jpeg.gpsProcessingMethod", String.class); 2242 2243 /** 2244 * <p>Time GPS fix was made to include in 2245 * EXIF.</p> 2246 * <p>This tag is also used for HEIC image capture.</p> 2247 * <p><b>Units</b>: UTC in seconds since January 1, 1970</p> 2248 * <p>This key is available on all devices.</p> 2249 * @hide 2250 */ 2251 public static final Key<Long> JPEG_GPS_TIMESTAMP = 2252 new Key<Long>("android.jpeg.gpsTimestamp", long.class); 2253 2254 /** 2255 * <p>The orientation for a JPEG image.</p> 2256 * <p>The clockwise rotation angle in degrees, relative to the orientation 2257 * to the camera, that the JPEG picture needs to be rotated by, to be viewed 2258 * upright.</p> 2259 * <p>Camera devices may either encode this value into the JPEG EXIF header, or 2260 * rotate the image data to match this orientation. When the image data is rotated, 2261 * the thumbnail data will also be rotated.</p> 2262 * <p>Note that this orientation is relative to the orientation of the camera sensor, given 2263 * by {@link CameraCharacteristics#SENSOR_ORIENTATION android.sensor.orientation}.</p> 2264 * <p>To translate from the device orientation given by the Android sensor APIs for camera 2265 * sensors which are not EXTERNAL, the following sample code may be used:</p> 2266 * <pre><code>private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) { 2267 * if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0; 2268 * int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION); 2269 * 2270 * // Round device orientation to a multiple of 90 2271 * deviceOrientation = (deviceOrientation + 45) / 90 * 90; 2272 * 2273 * // Reverse device orientation for front-facing cameras 2274 * boolean facingFront = c.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT; 2275 * if (facingFront) deviceOrientation = -deviceOrientation; 2276 * 2277 * // Calculate desired JPEG orientation relative to camera orientation to make 2278 * // the image upright relative to the device orientation 2279 * int jpegOrientation = (sensorOrientation + deviceOrientation + 360) % 360; 2280 * 2281 * return jpegOrientation; 2282 * } 2283 * </code></pre> 2284 * <p>For EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will 2285 * also be set to EXTERNAL. The above code is not relevant in such case.</p> 2286 * <p>This tag is also used to describe the orientation of the HEIC image capture, in which 2287 * case the rotation is reflected by 2288 * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by 2289 * rotating the image data itself.</p> 2290 * <p><b>Units</b>: Degrees in multiples of 90</p> 2291 * <p><b>Range of valid values:</b><br> 2292 * 0, 90, 180, 270</p> 2293 * <p>This key is available on all devices.</p> 2294 * 2295 * @see CameraCharacteristics#SENSOR_ORIENTATION 2296 */ 2297 @PublicKey 2298 @NonNull 2299 public static final Key<Integer> JPEG_ORIENTATION = 2300 new Key<Integer>("android.jpeg.orientation", int.class); 2301 2302 /** 2303 * <p>Compression quality of the final JPEG 2304 * image.</p> 2305 * <p>85-95 is typical usage range. This tag is also used to describe the quality 2306 * of the HEIC image capture.</p> 2307 * <p><b>Range of valid values:</b><br> 2308 * 1-100; larger is higher quality</p> 2309 * <p>This key is available on all devices.</p> 2310 */ 2311 @PublicKey 2312 @NonNull 2313 public static final Key<Byte> JPEG_QUALITY = 2314 new Key<Byte>("android.jpeg.quality", byte.class); 2315 2316 /** 2317 * <p>Compression quality of JPEG 2318 * thumbnail.</p> 2319 * <p>This tag is also used to describe the quality of the HEIC image capture.</p> 2320 * <p><b>Range of valid values:</b><br> 2321 * 1-100; larger is higher quality</p> 2322 * <p>This key is available on all devices.</p> 2323 */ 2324 @PublicKey 2325 @NonNull 2326 public static final Key<Byte> JPEG_THUMBNAIL_QUALITY = 2327 new Key<Byte>("android.jpeg.thumbnailQuality", byte.class); 2328 2329 /** 2330 * <p>Resolution of embedded JPEG thumbnail.</p> 2331 * <p>When set to (0, 0) value, the JPEG EXIF will not contain thumbnail, 2332 * but the captured JPEG will still be a valid image.</p> 2333 * <p>For best results, when issuing a request for a JPEG image, the thumbnail size selected 2334 * should have the same aspect ratio as the main JPEG output.</p> 2335 * <p>If the thumbnail image aspect ratio differs from the JPEG primary image aspect 2336 * ratio, the camera device creates the thumbnail by cropping it from the primary image. 2337 * For example, if the primary image has 4:3 aspect ratio, the thumbnail image has 2338 * 16:9 aspect ratio, the primary image will be cropped vertically (letterbox) to 2339 * generate the thumbnail image. The thumbnail image will always have a smaller Field 2340 * Of View (FOV) than the primary image when aspect ratios differ.</p> 2341 * <p>When an {@link CaptureRequest#JPEG_ORIENTATION android.jpeg.orientation} of non-zero degree is requested, 2342 * the camera device will handle thumbnail rotation in one of the following ways:</p> 2343 * <ul> 2344 * <li>Set the {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag} 2345 * and keep jpeg and thumbnail image data unrotated.</li> 2346 * <li>Rotate the jpeg and thumbnail image data and not set 2347 * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}. In this 2348 * case, LIMITED or FULL hardware level devices will report rotated thumnail size in 2349 * capture result, so the width and height will be interchanged if 90 or 270 degree 2350 * orientation is requested. LEGACY device will always report unrotated thumbnail 2351 * size.</li> 2352 * </ul> 2353 * <p>The tag is also used as thumbnail size for HEIC image format capture, in which case the 2354 * the thumbnail rotation is reflected by 2355 * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by 2356 * rotating the thumbnail data itself.</p> 2357 * <p><b>Range of valid values:</b><br> 2358 * {@link CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES android.jpeg.availableThumbnailSizes}</p> 2359 * <p>This key is available on all devices.</p> 2360 * 2361 * @see CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES 2362 * @see CaptureRequest#JPEG_ORIENTATION 2363 */ 2364 @PublicKey 2365 @NonNull 2366 public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE = 2367 new Key<android.util.Size>("android.jpeg.thumbnailSize", android.util.Size.class); 2368 2369 /** 2370 * <p>The desired lens aperture size, as a ratio of lens focal length to the 2371 * effective aperture diameter.</p> 2372 * <p>Setting this value is only supported on the camera devices that have a variable 2373 * aperture lens.</p> 2374 * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF, 2375 * this can be set along with {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}, 2376 * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration} 2377 * to achieve manual exposure control.</p> 2378 * <p>The requested aperture value may take several frames to reach the 2379 * requested value; the camera device will report the current (intermediate) 2380 * aperture size in capture result metadata while the aperture is changing. 2381 * While the aperture is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p> 2382 * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is one of 2383 * the ON modes, this will be overridden by the camera device 2384 * auto-exposure algorithm, the overridden values are then provided 2385 * back to the user in the corresponding result.</p> 2386 * <p><b>Units</b>: The f-number (f/N)</p> 2387 * <p><b>Range of valid values:</b><br> 2388 * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES android.lens.info.availableApertures}</p> 2389 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2390 * <p><b>Full capability</b> - 2391 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 2392 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2393 * 2394 * @see CaptureRequest#CONTROL_AE_MODE 2395 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2396 * @see CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES 2397 * @see CaptureResult#LENS_STATE 2398 * @see CaptureRequest#SENSOR_EXPOSURE_TIME 2399 * @see CaptureRequest#SENSOR_FRAME_DURATION 2400 * @see CaptureRequest#SENSOR_SENSITIVITY 2401 */ 2402 @PublicKey 2403 @NonNull 2404 public static final Key<Float> LENS_APERTURE = 2405 new Key<Float>("android.lens.aperture", float.class); 2406 2407 /** 2408 * <p>The desired setting for the lens neutral density filter(s).</p> 2409 * <p>This control will not be supported on most camera devices.</p> 2410 * <p>Lens filters are typically used to lower the amount of light the 2411 * sensor is exposed to (measured in steps of EV). As used here, an EV 2412 * step is the standard logarithmic representation, which are 2413 * non-negative, and inversely proportional to the amount of light 2414 * hitting the sensor. For example, setting this to 0 would result 2415 * in no reduction of the incoming light, and setting this to 2 would 2416 * mean that the filter is set to reduce incoming light by two stops 2417 * (allowing 1/4 of the prior amount of light to the sensor).</p> 2418 * <p>It may take several frames before the lens filter density changes 2419 * to the requested value. While the filter density is still changing, 2420 * {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p> 2421 * <p><b>Units</b>: Exposure Value (EV)</p> 2422 * <p><b>Range of valid values:</b><br> 2423 * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES android.lens.info.availableFilterDensities}</p> 2424 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2425 * <p><b>Full capability</b> - 2426 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 2427 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2428 * 2429 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2430 * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES 2431 * @see CaptureResult#LENS_STATE 2432 */ 2433 @PublicKey 2434 @NonNull 2435 public static final Key<Float> LENS_FILTER_DENSITY = 2436 new Key<Float>("android.lens.filterDensity", float.class); 2437 2438 /** 2439 * <p>The desired lens focal length; used for optical zoom.</p> 2440 * <p>This setting controls the physical focal length of the camera 2441 * device's lens. Changing the focal length changes the field of 2442 * view of the camera device, and is usually used for optical zoom.</p> 2443 * <p>Like {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} and {@link CaptureRequest#LENS_APERTURE android.lens.aperture}, this 2444 * setting won't be applied instantaneously, and it may take several 2445 * frames before the lens can change to the requested focal length. 2446 * While the focal length is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will 2447 * be set to MOVING.</p> 2448 * <p>Optical zoom will not be supported on most devices.</p> 2449 * <p><b>Units</b>: Millimeters</p> 2450 * <p><b>Range of valid values:</b><br> 2451 * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS android.lens.info.availableFocalLengths}</p> 2452 * <p>This key is available on all devices.</p> 2453 * 2454 * @see CaptureRequest#LENS_APERTURE 2455 * @see CaptureRequest#LENS_FOCUS_DISTANCE 2456 * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS 2457 * @see CaptureResult#LENS_STATE 2458 */ 2459 @PublicKey 2460 @NonNull 2461 public static final Key<Float> LENS_FOCAL_LENGTH = 2462 new Key<Float>("android.lens.focalLength", float.class); 2463 2464 /** 2465 * <p>Desired distance to plane of sharpest focus, 2466 * measured from frontmost surface of the lens.</p> 2467 * <p>This control can be used for setting manual focus, on devices that support 2468 * the MANUAL_SENSOR capability and have a variable-focus lens (see 2469 * {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance}).</p> 2470 * <p>A value of <code>0.0f</code> means infinity focus. The value set will be clamped to 2471 * <code>[0.0f, {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance}]</code>.</p> 2472 * <p>Like {@link CaptureRequest#LENS_FOCAL_LENGTH android.lens.focalLength}, this setting won't be applied 2473 * instantaneously, and it may take several frames before the lens 2474 * can move to the requested focus distance. While the lens is still moving, 2475 * {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p> 2476 * <p>LEGACY devices support at most setting this to <code>0.0f</code> 2477 * for infinity focus.</p> 2478 * <p><b>Units</b>: See {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details</p> 2479 * <p><b>Range of valid values:</b><br> 2480 * >= 0</p> 2481 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2482 * <p><b>Full capability</b> - 2483 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 2484 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2485 * 2486 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2487 * @see CaptureRequest#LENS_FOCAL_LENGTH 2488 * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION 2489 * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE 2490 * @see CaptureResult#LENS_STATE 2491 */ 2492 @PublicKey 2493 @NonNull 2494 public static final Key<Float> LENS_FOCUS_DISTANCE = 2495 new Key<Float>("android.lens.focusDistance", float.class); 2496 2497 /** 2498 * <p>Sets whether the camera device uses optical image stabilization (OIS) 2499 * when capturing images.</p> 2500 * <p>OIS is used to compensate for motion blur due to small 2501 * movements of the camera during capture. Unlike digital image 2502 * stabilization ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), OIS 2503 * makes use of mechanical elements to stabilize the camera 2504 * sensor, and thus allows for longer exposure times before 2505 * camera shake becomes apparent.</p> 2506 * <p>Switching between different optical stabilization modes may take several 2507 * frames to initialize, the camera device will report the current mode in 2508 * capture result metadata. For example, When "ON" mode is requested, the 2509 * optical stabilization modes in the first several capture results may still 2510 * be "OFF", and it will become "ON" when the initialization is done.</p> 2511 * <p>If a camera device supports both OIS and digital image stabilization 2512 * ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), turning both modes on may produce undesirable 2513 * interaction, so it is recommended not to enable both at the same time.</p> 2514 * <p>Not all devices will support OIS; see 2515 * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization} for 2516 * available controls.</p> 2517 * <p><b>Possible values:</b> 2518 * <ul> 2519 * <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_OFF OFF}</li> 2520 * <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_ON ON}</li> 2521 * </ul></p> 2522 * <p><b>Available values for this device:</b><br> 2523 * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization}</p> 2524 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2525 * <p><b>Limited capability</b> - 2526 * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the 2527 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2528 * 2529 * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE 2530 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2531 * @see CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION 2532 * @see #LENS_OPTICAL_STABILIZATION_MODE_OFF 2533 * @see #LENS_OPTICAL_STABILIZATION_MODE_ON 2534 */ 2535 @PublicKey 2536 @NonNull 2537 public static final Key<Integer> LENS_OPTICAL_STABILIZATION_MODE = 2538 new Key<Integer>("android.lens.opticalStabilizationMode", int.class); 2539 2540 /** 2541 * <p>Mode of operation for the noise reduction algorithm.</p> 2542 * <p>The noise reduction algorithm attempts to improve image quality by removing 2543 * excessive noise added by the capture process, especially in dark conditions.</p> 2544 * <p>OFF means no noise reduction will be applied by the camera device, for both raw and 2545 * YUV domain.</p> 2546 * <p>MINIMAL means that only sensor raw domain basic noise reduction is enabled ,to remove 2547 * demosaicing or other processing artifacts. For YUV_REPROCESSING, MINIMAL is same as OFF. 2548 * This mode is optional, may not be support by all devices. The application should check 2549 * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes} before using it.</p> 2550 * <p>FAST/HIGH_QUALITY both mean camera device determined noise filtering 2551 * will be applied. HIGH_QUALITY mode indicates that the camera device 2552 * will use the highest-quality noise filtering algorithms, 2553 * even if it slows down capture rate. FAST means the camera device will not 2554 * slow down capture rate when applying noise filtering. FAST may be the same as MINIMAL if 2555 * MINIMAL is listed, or the same as OFF if any noise filtering will slow down capture rate. 2556 * Every output stream will have a similar amount of enhancement applied.</p> 2557 * <p>ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular 2558 * buffer of high-resolution images during preview and reprocess image(s) from that buffer 2559 * into a final capture when triggered by the user. In this mode, the camera device applies 2560 * noise reduction to low-resolution streams (below maximum recording resolution) to maximize 2561 * preview quality, but does not apply noise reduction to high-resolution streams, since 2562 * those will be reprocessed later if necessary.</p> 2563 * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera device 2564 * will apply FAST/HIGH_QUALITY YUV domain noise reduction, respectively. The camera device 2565 * may adjust the noise reduction parameters for best image quality based on the 2566 * {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor} if it is set.</p> 2567 * <p><b>Possible values:</b> 2568 * <ul> 2569 * <li>{@link #NOISE_REDUCTION_MODE_OFF OFF}</li> 2570 * <li>{@link #NOISE_REDUCTION_MODE_FAST FAST}</li> 2571 * <li>{@link #NOISE_REDUCTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li> 2572 * <li>{@link #NOISE_REDUCTION_MODE_MINIMAL MINIMAL}</li> 2573 * <li>{@link #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li> 2574 * </ul></p> 2575 * <p><b>Available values for this device:</b><br> 2576 * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}</p> 2577 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2578 * <p><b>Full capability</b> - 2579 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 2580 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2581 * 2582 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2583 * @see CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES 2584 * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR 2585 * @see #NOISE_REDUCTION_MODE_OFF 2586 * @see #NOISE_REDUCTION_MODE_FAST 2587 * @see #NOISE_REDUCTION_MODE_HIGH_QUALITY 2588 * @see #NOISE_REDUCTION_MODE_MINIMAL 2589 * @see #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG 2590 */ 2591 @PublicKey 2592 @NonNull 2593 public static final Key<Integer> NOISE_REDUCTION_MODE = 2594 new Key<Integer>("android.noiseReduction.mode", int.class); 2595 2596 /** 2597 * <p>An application-specified ID for the current 2598 * request. Must be maintained unchanged in output 2599 * frame</p> 2600 * <p><b>Units</b>: arbitrary integer assigned by application</p> 2601 * <p><b>Range of valid values:</b><br> 2602 * Any int</p> 2603 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2604 * @hide 2605 */ 2606 public static final Key<Integer> REQUEST_ID = 2607 new Key<Integer>("android.request.id", int.class); 2608 2609 /** 2610 * <p>The desired region of the sensor to read out for this capture.</p> 2611 * <p>This control can be used to implement digital zoom.</p> 2612 * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate 2613 * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being 2614 * the top-left pixel of the active array.</p> 2615 * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate 2616 * system depends on the mode being set. 2617 * When the distortion correction mode is OFF, the coordinate system follows 2618 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with 2619 * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array. 2620 * When the distortion correction mode is not OFF, the coordinate system follows 2621 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with 2622 * <code>(0, 0)</code> being the top-left pixel of the active array.</p> 2623 * <p>Output streams use this rectangle to produce their output, 2624 * cropping to a smaller region if necessary to maintain the 2625 * stream's aspect ratio, then scaling the sensor input to 2626 * match the output's configured resolution.</p> 2627 * <p>The crop region is applied after the RAW to other color 2628 * space (e.g. YUV) conversion. Since raw streams 2629 * (e.g. RAW16) don't have the conversion stage, they are not 2630 * croppable. The crop region will be ignored by raw streams.</p> 2631 * <p>For non-raw streams, any additional per-stream cropping will 2632 * be done to maximize the final pixel area of the stream.</p> 2633 * <p>For example, if the crop region is set to a 4:3 aspect 2634 * ratio, then 4:3 streams will use the exact crop 2635 * region. 16:9 streams will further crop vertically 2636 * (letterbox).</p> 2637 * <p>Conversely, if the crop region is set to a 16:9, then 4:3 2638 * outputs will crop horizontally (pillarbox), and 16:9 2639 * streams will match exactly. These additional crops will 2640 * be centered within the crop region.</p> 2641 * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, the width and height 2642 * of the crop region cannot be set to be smaller than 2643 * <code>floor( activeArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> and 2644 * <code>floor( activeArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, respectively.</p> 2645 * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, the width 2646 * and height of the crop region cannot be set to be smaller than 2647 * <code>floor( preCorrectionActiveArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> 2648 * and 2649 * <code>floor( preCorrectionActiveArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, 2650 * respectively.</p> 2651 * <p>The camera device may adjust the crop region to account 2652 * for rounding and other hardware requirements; the final 2653 * crop region used will be included in the output capture 2654 * result.</p> 2655 * <p><b>Units</b>: Pixel coordinates relative to 2656 * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or 2657 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on distortion correction 2658 * capability and mode</p> 2659 * <p>This key is available on all devices.</p> 2660 * 2661 * @see CaptureRequest#DISTORTION_CORRECTION_MODE 2662 * @see CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM 2663 * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE 2664 * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE 2665 */ 2666 @PublicKey 2667 @NonNull 2668 public static final Key<android.graphics.Rect> SCALER_CROP_REGION = 2669 new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class); 2670 2671 /** 2672 * <p>Duration each pixel is exposed to 2673 * light.</p> 2674 * <p>If the sensor can't expose this exact duration, it will shorten the 2675 * duration exposed to the nearest possible value (rather than expose longer). 2676 * The final exposure time used will be available in the output capture result.</p> 2677 * <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 2678 * OFF; otherwise the auto-exposure algorithm will override this value.</p> 2679 * <p><b>Units</b>: Nanoseconds</p> 2680 * <p><b>Range of valid values:</b><br> 2681 * {@link CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE android.sensor.info.exposureTimeRange}</p> 2682 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2683 * <p><b>Full capability</b> - 2684 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 2685 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2686 * 2687 * @see CaptureRequest#CONTROL_AE_MODE 2688 * @see CaptureRequest#CONTROL_MODE 2689 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2690 * @see CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE 2691 */ 2692 @PublicKey 2693 @NonNull 2694 public static final Key<Long> SENSOR_EXPOSURE_TIME = 2695 new Key<Long>("android.sensor.exposureTime", long.class); 2696 2697 /** 2698 * <p>Duration from start of frame exposure to 2699 * start of next frame exposure.</p> 2700 * <p>The maximum frame rate that can be supported by a camera subsystem is 2701 * a function of many factors:</p> 2702 * <ul> 2703 * <li>Requested resolutions of output image streams</li> 2704 * <li>Availability of binning / skipping modes on the imager</li> 2705 * <li>The bandwidth of the imager interface</li> 2706 * <li>The bandwidth of the various ISP processing blocks</li> 2707 * </ul> 2708 * <p>Since these factors can vary greatly between different ISPs and 2709 * sensors, the camera abstraction tries to represent the bandwidth 2710 * restrictions with as simple a model as possible.</p> 2711 * <p>The model presented has the following characteristics:</p> 2712 * <ul> 2713 * <li>The image sensor is always configured to output the smallest 2714 * resolution possible given the application's requested output stream 2715 * sizes. The smallest resolution is defined as being at least as large 2716 * as the largest requested output stream size; the camera pipeline must 2717 * never digitally upsample sensor data when the crop region covers the 2718 * whole sensor. In general, this means that if only small output stream 2719 * resolutions are configured, the sensor can provide a higher frame 2720 * rate.</li> 2721 * <li>Since any request may use any or all the currently configured 2722 * output streams, the sensor and ISP must be configured to support 2723 * scaling a single capture to all the streams at the same time. This 2724 * means the camera pipeline must be ready to produce the largest 2725 * requested output size without any delay. Therefore, the overall 2726 * frame rate of a given configured stream set is governed only by the 2727 * largest requested stream resolution.</li> 2728 * <li>Using more than one output stream in a request does not affect the 2729 * frame duration.</li> 2730 * <li>Certain format-streams may need to do additional background processing 2731 * before data is consumed/produced by that stream. These processors 2732 * can run concurrently to the rest of the camera pipeline, but 2733 * cannot process more than 1 capture at a time.</li> 2734 * </ul> 2735 * <p>The necessary information for the application, given the model above, is provided via 2736 * {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputMinFrameDuration }. 2737 * These are used to determine the maximum frame rate / minimum frame duration that is 2738 * possible for a given stream configuration.</p> 2739 * <p>Specifically, the application can use the following rules to 2740 * determine the minimum frame duration it can request from the camera 2741 * device:</p> 2742 * <ol> 2743 * <li>Let the set of currently configured input/output streams be called <code>S</code>.</li> 2744 * <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 } 2745 * (with its respective size/format). Let this set of frame durations be called <code>F</code>.</li> 2746 * <li>For any given request <code>R</code>, the minimum frame duration allowed for <code>R</code> is the maximum 2747 * out of all values in <code>F</code>. Let the streams used in <code>R</code> be called <code>S_r</code>.</li> 2748 * </ol> 2749 * <p>If none of the streams in <code>S_r</code> have a stall time (listed in {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputStallDuration } 2750 * using its respective size/format), then the frame duration in <code>F</code> determines the steady 2751 * state frame rate that the application will get if it uses <code>R</code> as a repeating request. Let 2752 * this special kind of request be called <code>Rsimple</code>.</p> 2753 * <p>A repeating request <code>Rsimple</code> can be <em>occasionally</em> interleaved by a single capture of a 2754 * new request <code>Rstall</code> (which has at least one in-use stream with a non-0 stall time) and if 2755 * <code>Rstall</code> has the same minimum frame duration this will not cause a frame rate loss if all 2756 * buffers from the previous <code>Rstall</code> have already been delivered.</p> 2757 * <p>For more details about stalling, see {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputStallDuration }.</p> 2758 * <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 2759 * OFF; otherwise the auto-exposure algorithm will override this value.</p> 2760 * <p><b>Units</b>: Nanoseconds</p> 2761 * <p><b>Range of valid values:</b><br> 2762 * See {@link CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION android.sensor.info.maxFrameDuration}, {@link android.hardware.camera2.params.StreamConfigurationMap }. 2763 * The duration is capped to <code>max(duration, exposureTime + overhead)</code>.</p> 2764 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2765 * <p><b>Full capability</b> - 2766 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 2767 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2768 * 2769 * @see CaptureRequest#CONTROL_AE_MODE 2770 * @see CaptureRequest#CONTROL_MODE 2771 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2772 * @see CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION 2773 */ 2774 @PublicKey 2775 @NonNull 2776 public static final Key<Long> SENSOR_FRAME_DURATION = 2777 new Key<Long>("android.sensor.frameDuration", long.class); 2778 2779 /** 2780 * <p>The amount of gain applied to sensor data 2781 * before processing.</p> 2782 * <p>The sensitivity is the standard ISO sensitivity value, 2783 * as defined in ISO 12232:2006.</p> 2784 * <p>The sensitivity must be within {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}, and 2785 * if if it less than {@link CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY android.sensor.maxAnalogSensitivity}, the camera device 2786 * is guaranteed to use only analog amplification for applying the gain.</p> 2787 * <p>If the camera device cannot apply the exact sensitivity 2788 * requested, it will reduce the gain to the nearest supported 2789 * value. The final sensitivity used will be available in the 2790 * output capture result.</p> 2791 * <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 2792 * OFF; otherwise the auto-exposure algorithm will override this value.</p> 2793 * <p><b>Units</b>: ISO arithmetic units</p> 2794 * <p><b>Range of valid values:</b><br> 2795 * {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}</p> 2796 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2797 * <p><b>Full capability</b> - 2798 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 2799 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2800 * 2801 * @see CaptureRequest#CONTROL_AE_MODE 2802 * @see CaptureRequest#CONTROL_MODE 2803 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2804 * @see CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE 2805 * @see CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY 2806 */ 2807 @PublicKey 2808 @NonNull 2809 public static final Key<Integer> SENSOR_SENSITIVITY = 2810 new Key<Integer>("android.sensor.sensitivity", int.class); 2811 2812 /** 2813 * <p>A pixel <code>[R, G_even, G_odd, B]</code> that supplies the test pattern 2814 * when {@link CaptureRequest#SENSOR_TEST_PATTERN_MODE android.sensor.testPatternMode} is SOLID_COLOR.</p> 2815 * <p>Each color channel is treated as an unsigned 32-bit integer. 2816 * The camera device then uses the most significant X bits 2817 * that correspond to how many bits are in its Bayer raw sensor 2818 * output.</p> 2819 * <p>For example, a sensor with RAW10 Bayer output would use the 2820 * 10 most significant bits from each color channel.</p> 2821 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2822 * 2823 * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE 2824 */ 2825 @PublicKey 2826 @NonNull 2827 public static final Key<int[]> SENSOR_TEST_PATTERN_DATA = 2828 new Key<int[]>("android.sensor.testPatternData", int[].class); 2829 2830 /** 2831 * <p>When enabled, the sensor sends a test pattern instead of 2832 * doing a real exposure from the camera.</p> 2833 * <p>When a test pattern is enabled, all manual sensor controls specified 2834 * by android.sensor.* will be ignored. All other controls should 2835 * work as normal.</p> 2836 * <p>For example, if manual flash is enabled, flash firing should still 2837 * occur (and that the test pattern remain unmodified, since the flash 2838 * would not actually affect it).</p> 2839 * <p>Defaults to OFF.</p> 2840 * <p><b>Possible values:</b> 2841 * <ul> 2842 * <li>{@link #SENSOR_TEST_PATTERN_MODE_OFF OFF}</li> 2843 * <li>{@link #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR SOLID_COLOR}</li> 2844 * <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS COLOR_BARS}</li> 2845 * <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY COLOR_BARS_FADE_TO_GRAY}</li> 2846 * <li>{@link #SENSOR_TEST_PATTERN_MODE_PN9 PN9}</li> 2847 * <li>{@link #SENSOR_TEST_PATTERN_MODE_CUSTOM1 CUSTOM1}</li> 2848 * </ul></p> 2849 * <p><b>Available values for this device:</b><br> 2850 * {@link CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES android.sensor.availableTestPatternModes}</p> 2851 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2852 * 2853 * @see CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES 2854 * @see #SENSOR_TEST_PATTERN_MODE_OFF 2855 * @see #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR 2856 * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS 2857 * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY 2858 * @see #SENSOR_TEST_PATTERN_MODE_PN9 2859 * @see #SENSOR_TEST_PATTERN_MODE_CUSTOM1 2860 */ 2861 @PublicKey 2862 @NonNull 2863 public static final Key<Integer> SENSOR_TEST_PATTERN_MODE = 2864 new Key<Integer>("android.sensor.testPatternMode", int.class); 2865 2866 /** 2867 * <p>Quality of lens shading correction applied 2868 * to the image data.</p> 2869 * <p>When set to OFF mode, no lens shading correction will be applied by the 2870 * camera device, and an identity lens shading map data will be provided 2871 * if <code>{@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} == ON</code>. For example, for lens 2872 * shading map with size of <code>[ 4, 3 ]</code>, 2873 * the output {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap} for this case will be an identity 2874 * map shown below:</p> 2875 * <pre><code>[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2876 * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2877 * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2878 * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2879 * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2880 * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] 2881 * </code></pre> 2882 * <p>When set to other modes, lens shading correction will be applied by the camera 2883 * device. Applications can request lens shading map data by setting 2884 * {@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} to ON, and then the camera device will provide lens 2885 * shading map data in {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap}; the returned shading map 2886 * data will be the one applied by the camera device for this capture request.</p> 2887 * <p>The shading map data may depend on the auto-exposure (AE) and AWB statistics, therefore 2888 * the reliability of the map data may be affected by the AE and AWB algorithms. When AE and 2889 * 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> 2890 * OFF), to get best results, it is recommended that the applications wait for the AE and AWB 2891 * to be converged before using the returned shading map data.</p> 2892 * <p><b>Possible values:</b> 2893 * <ul> 2894 * <li>{@link #SHADING_MODE_OFF OFF}</li> 2895 * <li>{@link #SHADING_MODE_FAST FAST}</li> 2896 * <li>{@link #SHADING_MODE_HIGH_QUALITY HIGH_QUALITY}</li> 2897 * </ul></p> 2898 * <p><b>Available values for this device:</b><br> 2899 * {@link CameraCharacteristics#SHADING_AVAILABLE_MODES android.shading.availableModes}</p> 2900 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2901 * <p><b>Full capability</b> - 2902 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 2903 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2904 * 2905 * @see CaptureRequest#CONTROL_AE_MODE 2906 * @see CaptureRequest#CONTROL_AWB_MODE 2907 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2908 * @see CameraCharacteristics#SHADING_AVAILABLE_MODES 2909 * @see CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP 2910 * @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE 2911 * @see #SHADING_MODE_OFF 2912 * @see #SHADING_MODE_FAST 2913 * @see #SHADING_MODE_HIGH_QUALITY 2914 */ 2915 @PublicKey 2916 @NonNull 2917 public static final Key<Integer> SHADING_MODE = 2918 new Key<Integer>("android.shading.mode", int.class); 2919 2920 /** 2921 * <p>Operating mode for the face detector 2922 * unit.</p> 2923 * <p>Whether face detection is enabled, and whether it 2924 * should output just the basic fields or the full set of 2925 * fields.</p> 2926 * <p><b>Possible values:</b> 2927 * <ul> 2928 * <li>{@link #STATISTICS_FACE_DETECT_MODE_OFF OFF}</li> 2929 * <li>{@link #STATISTICS_FACE_DETECT_MODE_SIMPLE SIMPLE}</li> 2930 * <li>{@link #STATISTICS_FACE_DETECT_MODE_FULL FULL}</li> 2931 * </ul></p> 2932 * <p><b>Available values for this device:</b><br> 2933 * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES android.statistics.info.availableFaceDetectModes}</p> 2934 * <p>This key is available on all devices.</p> 2935 * 2936 * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES 2937 * @see #STATISTICS_FACE_DETECT_MODE_OFF 2938 * @see #STATISTICS_FACE_DETECT_MODE_SIMPLE 2939 * @see #STATISTICS_FACE_DETECT_MODE_FULL 2940 */ 2941 @PublicKey 2942 @NonNull 2943 public static final Key<Integer> STATISTICS_FACE_DETECT_MODE = 2944 new Key<Integer>("android.statistics.faceDetectMode", int.class); 2945 2946 /** 2947 * <p>Operating mode for hot pixel map generation.</p> 2948 * <p>If set to <code>true</code>, a hot pixel map is returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}. 2949 * If set to <code>false</code>, no hot pixel map will be returned.</p> 2950 * <p><b>Range of valid values:</b><br> 2951 * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}</p> 2952 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2953 * 2954 * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP 2955 * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES 2956 */ 2957 @PublicKey 2958 @NonNull 2959 public static final Key<Boolean> STATISTICS_HOT_PIXEL_MAP_MODE = 2960 new Key<Boolean>("android.statistics.hotPixelMapMode", boolean.class); 2961 2962 /** 2963 * <p>Whether the camera device will output the lens 2964 * shading map in output result metadata.</p> 2965 * <p>When set to ON, 2966 * android.statistics.lensShadingMap will be provided in 2967 * the output result metadata.</p> 2968 * <p>ON is always supported on devices with the RAW capability.</p> 2969 * <p><b>Possible values:</b> 2970 * <ul> 2971 * <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_OFF OFF}</li> 2972 * <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_ON ON}</li> 2973 * </ul></p> 2974 * <p><b>Available values for this device:</b><br> 2975 * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES android.statistics.info.availableLensShadingMapModes}</p> 2976 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 2977 * <p><b>Full capability</b> - 2978 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 2979 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 2980 * 2981 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 2982 * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES 2983 * @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF 2984 * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON 2985 */ 2986 @PublicKey 2987 @NonNull 2988 public static final Key<Integer> STATISTICS_LENS_SHADING_MAP_MODE = 2989 new Key<Integer>("android.statistics.lensShadingMapMode", int.class); 2990 2991 /** 2992 * <p>A control for selecting whether optical stabilization (OIS) position 2993 * information is included in output result metadata.</p> 2994 * <p>Since optical image stabilization generally involves motion much faster than the duration 2995 * of individualq image exposure, multiple OIS samples can be included for a single capture 2996 * result. For example, if the OIS reporting operates at 200 Hz, a typical camera operating 2997 * at 30fps may have 6-7 OIS samples per capture result. This information can be combined 2998 * with the rolling shutter skew to account for lens motion during image exposure in 2999 * post-processing algorithms.</p> 3000 * <p><b>Possible values:</b> 3001 * <ul> 3002 * <li>{@link #STATISTICS_OIS_DATA_MODE_OFF OFF}</li> 3003 * <li>{@link #STATISTICS_OIS_DATA_MODE_ON ON}</li> 3004 * </ul></p> 3005 * <p><b>Available values for this device:</b><br> 3006 * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES android.statistics.info.availableOisDataModes}</p> 3007 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3008 * 3009 * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES 3010 * @see #STATISTICS_OIS_DATA_MODE_OFF 3011 * @see #STATISTICS_OIS_DATA_MODE_ON 3012 */ 3013 @PublicKey 3014 @NonNull 3015 public static final Key<Integer> STATISTICS_OIS_DATA_MODE = 3016 new Key<Integer>("android.statistics.oisDataMode", int.class); 3017 3018 /** 3019 * <p>Tonemapping / contrast / gamma curve for the blue 3020 * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is 3021 * CONTRAST_CURVE.</p> 3022 * <p>See android.tonemap.curveRed for more details.</p> 3023 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3024 * <p><b>Full capability</b> - 3025 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 3026 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 3027 * 3028 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 3029 * @see CaptureRequest#TONEMAP_MODE 3030 * @hide 3031 */ 3032 public static final Key<float[]> TONEMAP_CURVE_BLUE = 3033 new Key<float[]>("android.tonemap.curveBlue", float[].class); 3034 3035 /** 3036 * <p>Tonemapping / contrast / gamma curve for the green 3037 * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is 3038 * CONTRAST_CURVE.</p> 3039 * <p>See android.tonemap.curveRed for more details.</p> 3040 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3041 * <p><b>Full capability</b> - 3042 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 3043 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 3044 * 3045 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 3046 * @see CaptureRequest#TONEMAP_MODE 3047 * @hide 3048 */ 3049 public static final Key<float[]> TONEMAP_CURVE_GREEN = 3050 new Key<float[]>("android.tonemap.curveGreen", float[].class); 3051 3052 /** 3053 * <p>Tonemapping / contrast / gamma curve for the red 3054 * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is 3055 * CONTRAST_CURVE.</p> 3056 * <p>Each channel's curve is defined by an array of control points:</p> 3057 * <pre><code>android.tonemap.curveRed = 3058 * [ P0in, P0out, P1in, P1out, P2in, P2out, P3in, P3out, ..., PNin, PNout ] 3059 * 2 <= N <= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre> 3060 * <p>These are sorted in order of increasing <code>Pin</code>; it is 3061 * required that input values 0.0 and 1.0 are included in the list to 3062 * define a complete mapping. For input values between control points, 3063 * the camera device must linearly interpolate between the control 3064 * points.</p> 3065 * <p>Each curve can have an independent number of points, and the number 3066 * of points can be less than max (that is, the request doesn't have to 3067 * always provide a curve with number of points equivalent to 3068 * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p> 3069 * <p>For devices with MONOCHROME capability, all three channels must have the same set of 3070 * control points.</p> 3071 * <p>A few examples, and their corresponding graphical mappings; these 3072 * only specify the red channel and the precision is limited to 4 3073 * digits, for conciseness.</p> 3074 * <p>Linear mapping:</p> 3075 * <pre><code>android.tonemap.curveRed = [ 0, 0, 1.0, 1.0 ] 3076 * </code></pre> 3077 * <p><img alt="Linear mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p> 3078 * <p>Invert mapping:</p> 3079 * <pre><code>android.tonemap.curveRed = [ 0, 1.0, 1.0, 0 ] 3080 * </code></pre> 3081 * <p><img alt="Inverting mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p> 3082 * <p>Gamma 1/2.2 mapping, with 16 control points:</p> 3083 * <pre><code>android.tonemap.curveRed = [ 3084 * 0.0000, 0.0000, 0.0667, 0.2920, 0.1333, 0.4002, 0.2000, 0.4812, 3085 * 0.2667, 0.5484, 0.3333, 0.6069, 0.4000, 0.6594, 0.4667, 0.7072, 3086 * 0.5333, 0.7515, 0.6000, 0.7928, 0.6667, 0.8317, 0.7333, 0.8685, 3087 * 0.8000, 0.9035, 0.8667, 0.9370, 0.9333, 0.9691, 1.0000, 1.0000 ] 3088 * </code></pre> 3089 * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p> 3090 * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p> 3091 * <pre><code>android.tonemap.curveRed = [ 3092 * 0.0000, 0.0000, 0.0667, 0.2864, 0.1333, 0.4007, 0.2000, 0.4845, 3093 * 0.2667, 0.5532, 0.3333, 0.6125, 0.4000, 0.6652, 0.4667, 0.7130, 3094 * 0.5333, 0.7569, 0.6000, 0.7977, 0.6667, 0.8360, 0.7333, 0.8721, 3095 * 0.8000, 0.9063, 0.8667, 0.9389, 0.9333, 0.9701, 1.0000, 1.0000 ] 3096 * </code></pre> 3097 * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p> 3098 * <p><b>Range of valid values:</b><br> 3099 * 0-1 on both input and output coordinates, normalized 3100 * as a floating-point value such that 0 == black and 1 == white.</p> 3101 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3102 * <p><b>Full capability</b> - 3103 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 3104 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 3105 * 3106 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 3107 * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS 3108 * @see CaptureRequest#TONEMAP_MODE 3109 * @hide 3110 */ 3111 public static final Key<float[]> TONEMAP_CURVE_RED = 3112 new Key<float[]>("android.tonemap.curveRed", float[].class); 3113 3114 /** 3115 * <p>Tonemapping / contrast / gamma curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} 3116 * is CONTRAST_CURVE.</p> 3117 * <p>The tonemapCurve consist of three curves for each of red, green, and blue 3118 * channels respectively. The following example uses the red channel as an 3119 * example. The same logic applies to green and blue channel. 3120 * Each channel's curve is defined by an array of control points:</p> 3121 * <pre><code>curveRed = 3122 * [ P0(in, out), P1(in, out), P2(in, out), P3(in, out), ..., PN(in, out) ] 3123 * 2 <= N <= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre> 3124 * <p>These are sorted in order of increasing <code>Pin</code>; it is always 3125 * guaranteed that input values 0.0 and 1.0 are included in the list to 3126 * define a complete mapping. For input values between control points, 3127 * the camera device must linearly interpolate between the control 3128 * points.</p> 3129 * <p>Each curve can have an independent number of points, and the number 3130 * of points can be less than max (that is, the request doesn't have to 3131 * always provide a curve with number of points equivalent to 3132 * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p> 3133 * <p>For devices with MONOCHROME capability, all three channels must have the same set of 3134 * control points.</p> 3135 * <p>A few examples, and their corresponding graphical mappings; these 3136 * only specify the red channel and the precision is limited to 4 3137 * digits, for conciseness.</p> 3138 * <p>Linear mapping:</p> 3139 * <pre><code>curveRed = [ (0, 0), (1.0, 1.0) ] 3140 * </code></pre> 3141 * <p><img alt="Linear mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p> 3142 * <p>Invert mapping:</p> 3143 * <pre><code>curveRed = [ (0, 1.0), (1.0, 0) ] 3144 * </code></pre> 3145 * <p><img alt="Inverting mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p> 3146 * <p>Gamma 1/2.2 mapping, with 16 control points:</p> 3147 * <pre><code>curveRed = [ 3148 * (0.0000, 0.0000), (0.0667, 0.2920), (0.1333, 0.4002), (0.2000, 0.4812), 3149 * (0.2667, 0.5484), (0.3333, 0.6069), (0.4000, 0.6594), (0.4667, 0.7072), 3150 * (0.5333, 0.7515), (0.6000, 0.7928), (0.6667, 0.8317), (0.7333, 0.8685), 3151 * (0.8000, 0.9035), (0.8667, 0.9370), (0.9333, 0.9691), (1.0000, 1.0000) ] 3152 * </code></pre> 3153 * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p> 3154 * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p> 3155 * <pre><code>curveRed = [ 3156 * (0.0000, 0.0000), (0.0667, 0.2864), (0.1333, 0.4007), (0.2000, 0.4845), 3157 * (0.2667, 0.5532), (0.3333, 0.6125), (0.4000, 0.6652), (0.4667, 0.7130), 3158 * (0.5333, 0.7569), (0.6000, 0.7977), (0.6667, 0.8360), (0.7333, 0.8721), 3159 * (0.8000, 0.9063), (0.8667, 0.9389), (0.9333, 0.9701), (1.0000, 1.0000) ] 3160 * </code></pre> 3161 * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p> 3162 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3163 * <p><b>Full capability</b> - 3164 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 3165 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 3166 * 3167 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 3168 * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS 3169 * @see CaptureRequest#TONEMAP_MODE 3170 */ 3171 @PublicKey 3172 @NonNull 3173 @SyntheticKey 3174 public static final Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE = 3175 new Key<android.hardware.camera2.params.TonemapCurve>("android.tonemap.curve", android.hardware.camera2.params.TonemapCurve.class); 3176 3177 /** 3178 * <p>High-level global contrast/gamma/tonemapping control.</p> 3179 * <p>When switching to an application-defined contrast curve by setting 3180 * {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} to CONTRAST_CURVE, the curve is defined 3181 * per-channel with a set of <code>(in, out)</code> points that specify the 3182 * mapping from input high-bit-depth pixel value to the output 3183 * low-bit-depth value. Since the actual pixel ranges of both input 3184 * and output may change depending on the camera pipeline, the values 3185 * are specified by normalized floating-point numbers.</p> 3186 * <p>More-complex color mapping operations such as 3D color look-up 3187 * tables, selective chroma enhancement, or other non-linear color 3188 * transforms will be disabled when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is 3189 * CONTRAST_CURVE.</p> 3190 * <p>When using either FAST or HIGH_QUALITY, the camera device will 3191 * emit its own tonemap curve in {@link CaptureRequest#TONEMAP_CURVE android.tonemap.curve}. 3192 * These values are always available, and as close as possible to the 3193 * actually used nonlinear/nonglobal transforms.</p> 3194 * <p>If a request is sent with CONTRAST_CURVE with the camera device's 3195 * provided curve in FAST or HIGH_QUALITY, the image's tonemap will be 3196 * roughly the same.</p> 3197 * <p><b>Possible values:</b> 3198 * <ul> 3199 * <li>{@link #TONEMAP_MODE_CONTRAST_CURVE CONTRAST_CURVE}</li> 3200 * <li>{@link #TONEMAP_MODE_FAST FAST}</li> 3201 * <li>{@link #TONEMAP_MODE_HIGH_QUALITY HIGH_QUALITY}</li> 3202 * <li>{@link #TONEMAP_MODE_GAMMA_VALUE GAMMA_VALUE}</li> 3203 * <li>{@link #TONEMAP_MODE_PRESET_CURVE PRESET_CURVE}</li> 3204 * </ul></p> 3205 * <p><b>Available values for this device:</b><br> 3206 * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}</p> 3207 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3208 * <p><b>Full capability</b> - 3209 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 3210 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 3211 * 3212 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 3213 * @see CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES 3214 * @see CaptureRequest#TONEMAP_CURVE 3215 * @see CaptureRequest#TONEMAP_MODE 3216 * @see #TONEMAP_MODE_CONTRAST_CURVE 3217 * @see #TONEMAP_MODE_FAST 3218 * @see #TONEMAP_MODE_HIGH_QUALITY 3219 * @see #TONEMAP_MODE_GAMMA_VALUE 3220 * @see #TONEMAP_MODE_PRESET_CURVE 3221 */ 3222 @PublicKey 3223 @NonNull 3224 public static final Key<Integer> TONEMAP_MODE = 3225 new Key<Integer>("android.tonemap.mode", int.class); 3226 3227 /** 3228 * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is 3229 * GAMMA_VALUE</p> 3230 * <p>The tonemap curve will be defined the following formula: 3231 * * OUT = pow(IN, 1.0 / gamma) 3232 * where IN and OUT is the input pixel value scaled to range [0.0, 1.0], 3233 * pow is the power function and gamma is the gamma value specified by this 3234 * key.</p> 3235 * <p>The same curve will be applied to all color channels. The camera device 3236 * may clip the input gamma value to its supported range. The actual applied 3237 * value will be returned in capture result.</p> 3238 * <p>The valid range of gamma value varies on different devices, but values 3239 * within [1.0, 5.0] are guaranteed not to be clipped.</p> 3240 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3241 * 3242 * @see CaptureRequest#TONEMAP_MODE 3243 */ 3244 @PublicKey 3245 @NonNull 3246 public static final Key<Float> TONEMAP_GAMMA = 3247 new Key<Float>("android.tonemap.gamma", float.class); 3248 3249 /** 3250 * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is 3251 * PRESET_CURVE</p> 3252 * <p>The tonemap curve will be defined by specified standard.</p> 3253 * <p>sRGB (approximated by 16 control points):</p> 3254 * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p> 3255 * <p>Rec. 709 (approximated by 16 control points):</p> 3256 * <p><img alt="Rec. 709 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png" /></p> 3257 * <p>Note that above figures show a 16 control points approximation of preset 3258 * curves. Camera devices may apply a different approximation to the curve.</p> 3259 * <p><b>Possible values:</b> 3260 * <ul> 3261 * <li>{@link #TONEMAP_PRESET_CURVE_SRGB SRGB}</li> 3262 * <li>{@link #TONEMAP_PRESET_CURVE_REC709 REC709}</li> 3263 * </ul></p> 3264 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3265 * 3266 * @see CaptureRequest#TONEMAP_MODE 3267 * @see #TONEMAP_PRESET_CURVE_SRGB 3268 * @see #TONEMAP_PRESET_CURVE_REC709 3269 */ 3270 @PublicKey 3271 @NonNull 3272 public static final Key<Integer> TONEMAP_PRESET_CURVE = 3273 new Key<Integer>("android.tonemap.presetCurve", int.class); 3274 3275 /** 3276 * <p>This LED is nominally used to indicate to the user 3277 * that the camera is powered on and may be streaming images back to the 3278 * Application Processor. In certain rare circumstances, the OS may 3279 * disable this when video is processed locally and not transmitted to 3280 * any untrusted applications.</p> 3281 * <p>In particular, the LED <em>must</em> always be on when the data could be 3282 * transmitted off the device. The LED <em>should</em> always be on whenever 3283 * data is stored locally on the device.</p> 3284 * <p>The LED <em>may</em> be off if a trusted application is using the data that 3285 * doesn't violate the above rules.</p> 3286 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3287 * @hide 3288 */ 3289 public static final Key<Boolean> LED_TRANSMIT = 3290 new Key<Boolean>("android.led.transmit", boolean.class); 3291 3292 /** 3293 * <p>Whether black-level compensation is locked 3294 * to its current values, or is free to vary.</p> 3295 * <p>When set to <code>true</code> (ON), the values used for black-level 3296 * compensation will not change until the lock is set to 3297 * <code>false</code> (OFF).</p> 3298 * <p>Since changes to certain capture parameters (such as 3299 * exposure time) may require resetting of black level 3300 * compensation, the camera device must report whether setting 3301 * the black level lock was successful in the output result 3302 * metadata.</p> 3303 * <p>For example, if a sequence of requests is as follows:</p> 3304 * <ul> 3305 * <li>Request 1: Exposure = 10ms, Black level lock = OFF</li> 3306 * <li>Request 2: Exposure = 10ms, Black level lock = ON</li> 3307 * <li>Request 3: Exposure = 10ms, Black level lock = ON</li> 3308 * <li>Request 4: Exposure = 20ms, Black level lock = ON</li> 3309 * <li>Request 5: Exposure = 20ms, Black level lock = ON</li> 3310 * <li>Request 6: Exposure = 20ms, Black level lock = ON</li> 3311 * </ul> 3312 * <p>And the exposure change in Request 4 requires the camera 3313 * device to reset the black level offsets, then the output 3314 * result metadata is expected to be:</p> 3315 * <ul> 3316 * <li>Result 1: Exposure = 10ms, Black level lock = OFF</li> 3317 * <li>Result 2: Exposure = 10ms, Black level lock = ON</li> 3318 * <li>Result 3: Exposure = 10ms, Black level lock = ON</li> 3319 * <li>Result 4: Exposure = 20ms, Black level lock = OFF</li> 3320 * <li>Result 5: Exposure = 20ms, Black level lock = ON</li> 3321 * <li>Result 6: Exposure = 20ms, Black level lock = ON</li> 3322 * </ul> 3323 * <p>This indicates to the application that on frame 4, black 3324 * levels were reset due to exposure value changes, and pixel 3325 * values may not be consistent across captures.</p> 3326 * <p>The camera device will maintain the lock to the extent 3327 * possible, only overriding the lock to OFF when changes to 3328 * other request parameters require a black level recalculation 3329 * or reset.</p> 3330 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3331 * <p><b>Full capability</b> - 3332 * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the 3333 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 3334 * 3335 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 3336 */ 3337 @PublicKey 3338 @NonNull 3339 public static final Key<Boolean> BLACK_LEVEL_LOCK = 3340 new Key<Boolean>("android.blackLevel.lock", boolean.class); 3341 3342 /** 3343 * <p>The amount of exposure time increase factor applied to the original output 3344 * frame by the application processing before sending for reprocessing.</p> 3345 * <p>This is optional, and will be supported if the camera device supports YUV_REPROCESSING 3346 * capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains YUV_REPROCESSING).</p> 3347 * <p>For some YUV reprocessing use cases, the application may choose to filter the original 3348 * output frames to effectively reduce the noise to the same level as a frame that was 3349 * captured with longer exposure time. To be more specific, assuming the original captured 3350 * images were captured with a sensitivity of S and an exposure time of T, the model in 3351 * the camera device is that the amount of noise in the image would be approximately what 3352 * would be expected if the original capture parameters had been a sensitivity of 3353 * S/effectiveExposureFactor and an exposure time of T*effectiveExposureFactor, rather 3354 * than S and T respectively. If the captured images were processed by the application 3355 * before being sent for reprocessing, then the application may have used image processing 3356 * algorithms and/or multi-frame image fusion to reduce the noise in the 3357 * application-processed images (input images). By using the effectiveExposureFactor 3358 * control, the application can communicate to the camera device the actual noise level 3359 * improvement in the application-processed image. With this information, the camera 3360 * device can select appropriate noise reduction and edge enhancement parameters to avoid 3361 * excessive noise reduction ({@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode}) and insufficient edge 3362 * enhancement ({@link CaptureRequest#EDGE_MODE android.edge.mode}) being applied to the reprocessed frames.</p> 3363 * <p>For example, for multi-frame image fusion use case, the application may fuse 3364 * multiple output frames together to a final frame for reprocessing. When N image are 3365 * fused into 1 image for reprocessing, the exposure time increase factor could be up to 3366 * square root of N (based on a simple photon shot noise model). The camera device will 3367 * adjust the reprocessing noise reduction and edge enhancement parameters accordingly to 3368 * produce the best quality images.</p> 3369 * <p>This is relative factor, 1.0 indicates the application hasn't processed the input 3370 * buffer in a way that affects its effective exposure time.</p> 3371 * <p>This control is only effective for YUV reprocessing capture request. For noise 3372 * reduction reprocessing, it is only effective when <code>{@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode} != OFF</code>. 3373 * Similarly, for edge enhancement reprocessing, it is only effective when 3374 * <code>{@link CaptureRequest#EDGE_MODE android.edge.mode} != OFF</code>.</p> 3375 * <p><b>Units</b>: Relative exposure time increase factor.</p> 3376 * <p><b>Range of valid values:</b><br> 3377 * >= 1.0</p> 3378 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3379 * <p><b>Limited capability</b> - 3380 * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the 3381 * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> 3382 * 3383 * @see CaptureRequest#EDGE_MODE 3384 * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 3385 * @see CaptureRequest#NOISE_REDUCTION_MODE 3386 * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES 3387 */ 3388 @PublicKey 3389 @NonNull 3390 public static final Key<Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR = 3391 new Key<Float>("android.reprocess.effectiveExposureFactor", float.class); 3392 3393 /** 3394 * <p>Mode of operation for the lens distortion correction block.</p> 3395 * <p>The lens distortion correction block attempts to improve image quality by fixing 3396 * radial, tangential, or other geometric aberrations in the camera device's optics. If 3397 * available, the {@link CameraCharacteristics#LENS_DISTORTION android.lens.distortion} field documents the lens's distortion parameters.</p> 3398 * <p>OFF means no distortion correction is done.</p> 3399 * <p>FAST/HIGH_QUALITY both mean camera device determined distortion correction will be 3400 * applied. HIGH_QUALITY mode indicates that the camera device will use the highest-quality 3401 * correction algorithms, even if it slows down capture rate. FAST means the camera device 3402 * will not slow down capture rate when applying correction. FAST may be the same as OFF if 3403 * any correction at all would slow down capture rate. Every output stream will have a 3404 * similar amount of enhancement applied.</p> 3405 * <p>The correction only applies to processed outputs such as YUV, Y8, JPEG, or DEPTH16; it is 3406 * not applied to any RAW output.</p> 3407 * <p>This control will be on by default on devices that support this control. Applications 3408 * disabling distortion correction need to pay extra attention with the coordinate system of 3409 * metering regions, crop region, and face rectangles. When distortion correction is OFF, 3410 * metadata coordinates follow the coordinate system of 3411 * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}. When distortion is not OFF, metadata 3412 * coordinates follow the coordinate system of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}. The 3413 * camera device will map these metadata fields to match the corrected image produced by the 3414 * camera device, for both capture requests and results. However, this mapping is not very 3415 * precise, since rectangles do not generally map to rectangles when corrected. Only linear 3416 * scaling between the active array and precorrection active array coordinates is 3417 * performed. Applications that require precise correction of metadata need to undo that 3418 * linear scaling, and apply a more complete correction that takes into the account the app's 3419 * own requirements.</p> 3420 * <p>The full list of metadata that is affected in this way by distortion correction is:</p> 3421 * <ul> 3422 * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li> 3423 * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li> 3424 * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li> 3425 * <li>{@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}</li> 3426 * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li> 3427 * </ul> 3428 * <p><b>Possible values:</b> 3429 * <ul> 3430 * <li>{@link #DISTORTION_CORRECTION_MODE_OFF OFF}</li> 3431 * <li>{@link #DISTORTION_CORRECTION_MODE_FAST FAST}</li> 3432 * <li>{@link #DISTORTION_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li> 3433 * </ul></p> 3434 * <p><b>Available values for this device:</b><br> 3435 * {@link CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES android.distortionCorrection.availableModes}</p> 3436 * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> 3437 * 3438 * @see CaptureRequest#CONTROL_AE_REGIONS 3439 * @see CaptureRequest#CONTROL_AF_REGIONS 3440 * @see CaptureRequest#CONTROL_AWB_REGIONS 3441 * @see CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES 3442 * @see CameraCharacteristics#LENS_DISTORTION 3443 * @see CaptureRequest#SCALER_CROP_REGION 3444 * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE 3445 * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE 3446 * @see CaptureResult#STATISTICS_FACES 3447 * @see #DISTORTION_CORRECTION_MODE_OFF 3448 * @see #DISTORTION_CORRECTION_MODE_FAST 3449 * @see #DISTORTION_CORRECTION_MODE_HIGH_QUALITY 3450 */ 3451 @PublicKey 3452 @NonNull 3453 public static final Key<Integer> DISTORTION_CORRECTION_MODE = 3454 new Key<Integer>("android.distortionCorrection.mode", int.class); 3455 3456 /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ 3457 * End generated code 3458 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ 3459 3460 3461 3462 3463 3464 3465 } 3466