CameraMetadata.java revision ed255a09ec7260a587e2007b92599a67add4ae10
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 17package android.hardware.camera2; 18 19import android.hardware.camera2.impl.MetadataMarshalClass; 20import android.hardware.camera2.impl.MetadataMarshalRect; 21import android.hardware.camera2.impl.MetadataMarshalSize; 22import android.hardware.camera2.impl.MetadataMarshalString; 23import android.os.Parcelable; 24import android.os.Parcel; 25import android.util.Log; 26 27import java.lang.reflect.Array; 28import java.nio.ByteBuffer; 29import java.nio.ByteOrder; 30import java.util.ArrayList; 31import java.util.HashMap; 32import java.util.Map; 33 34/** 35 * The base class for camera controls and information. 36 * 37 * This class defines the basic key/value map used for querying for camera 38 * characteristics or capture results, and for setting camera request 39 * parameters. 40 * 41 * @see CameraDevice 42 * @see CameraManager 43 * @see CameraProperties 44 **/ 45public class CameraMetadata implements Parcelable, AutoCloseable { 46 47 public CameraMetadata() { 48 mMetadataMap = new HashMap<Key<?>, Object>(); 49 50 mMetadataPtr = nativeAllocate(); 51 if (mMetadataPtr == 0) { 52 throw new OutOfMemoryError("Failed to allocate native CameraMetadata"); 53 } 54 } 55 56 public static final Parcelable.Creator<CameraMetadata> CREATOR = 57 new Parcelable.Creator<CameraMetadata>() { 58 @Override 59 public CameraMetadata createFromParcel(Parcel in) { 60 CameraMetadata metadata = new CameraMetadata(); 61 metadata.readFromParcel(in); 62 return metadata; 63 } 64 65 @Override 66 public CameraMetadata[] newArray(int size) { 67 return new CameraMetadata[size]; 68 } 69 }; 70 71 private static final String TAG = "CameraMetadataJV"; 72 73 /** 74 * Set a camera metadata field to a value. The field definitions can be 75 * found in {@link CameraProperties}, {@link CaptureResult}, and 76 * {@link CaptureRequest}. 77 * 78 * @param key The metadata field to write. 79 * @param value The value to set the field to, which must be of a matching 80 * type to the key. 81 */ 82 public <T> void set(Key<T> key, T value) { 83 int tag = key.getTag(); 84 85 if (value == null) { 86 writeValues(tag, null); 87 return; 88 } 89 90 int nativeType = getNativeType(tag); 91 92 int size = packSingle(value, null, key.mType, nativeType, /* sizeOnly */true); 93 94 // TODO: Optimization. Cache the byte[] and reuse if the size is big enough. 95 byte[] values = new byte[size]; 96 97 ByteBuffer buffer = ByteBuffer.wrap(values).order(ByteOrder.nativeOrder()); 98 packSingle(value, buffer, key.mType, nativeType, /*sizeOnly*/false); 99 100 writeValues(tag, values); 101 } 102 103 /** 104 * Get a camera metadata field value. The field definitions can be 105 * found in {@link CameraProperties}, {@link CaptureResult}, and 106 * {@link CaptureRequest}. 107 * 108 * @throws IllegalArgumentException if the key was not valid 109 * 110 * @param key The metadata field to read. 111 * @return The value of that key, or {@code null} if the field is not set. 112 */ 113 @SuppressWarnings("unchecked") 114 public <T> T get(Key<T> key) { 115 int tag = key.getTag(); 116 byte[] values = readValues(tag); 117 if (values == null) { 118 return null; 119 } 120 121 int nativeType = getNativeType(tag); 122 123 ByteBuffer buffer = ByteBuffer.wrap(values).order(ByteOrder.nativeOrder()); 124 return unpackSingle(buffer, key.mType, nativeType); 125 } 126 127 // Keep up-to-date with camera_metadata.h 128 /** 129 * @hide 130 */ 131 public static final int TYPE_BYTE = 0; 132 /** 133 * @hide 134 */ 135 public static final int TYPE_INT32 = 1; 136 /** 137 * @hide 138 */ 139 public static final int TYPE_FLOAT = 2; 140 /** 141 * @hide 142 */ 143 public static final int TYPE_INT64 = 3; 144 /** 145 * @hide 146 */ 147 public static final int TYPE_DOUBLE = 4; 148 /** 149 * @hide 150 */ 151 public static final int TYPE_RATIONAL = 5; 152 /** 153 * @hide 154 */ 155 public static final int NUM_TYPES = 6; 156 157 private static int getTypeSize(int nativeType) { 158 switch(nativeType) { 159 case TYPE_BYTE: 160 return 1; 161 case TYPE_INT32: 162 case TYPE_FLOAT: 163 return 4; 164 case TYPE_INT64: 165 case TYPE_DOUBLE: 166 case TYPE_RATIONAL: 167 return 8; 168 } 169 170 throw new UnsupportedOperationException("Unknown type, can't get size " 171 + nativeType); 172 } 173 174 private static Class<?> getExpectedType(int nativeType) { 175 switch(nativeType) { 176 case TYPE_BYTE: 177 return Byte.TYPE; 178 case TYPE_INT32: 179 return Integer.TYPE; 180 case TYPE_FLOAT: 181 return Float.TYPE; 182 case TYPE_INT64: 183 return Long.TYPE; 184 case TYPE_DOUBLE: 185 return Double.TYPE; 186 case TYPE_RATIONAL: 187 return Rational.class; 188 } 189 190 throw new UnsupportedOperationException("Unknown type, can't map to Java type " 191 + nativeType); 192 } 193 194 @SuppressWarnings("unchecked") 195 private static <T> int packSingleNative(T value, ByteBuffer buffer, Class<T> type, 196 int nativeType, boolean sizeOnly) { 197 198 if (!sizeOnly) { 199 /** 200 * Rewrite types when the native type doesn't match the managed type 201 * - Boolean -> Byte 202 * - Integer -> Byte 203 */ 204 205 if (nativeType == TYPE_BYTE && type == Boolean.TYPE) { 206 // Since a boolean can't be cast to byte, and we don't want to use putBoolean 207 boolean asBool = (Boolean) value; 208 byte asByte = (byte) (asBool ? 1 : 0); 209 value = (T) (Byte) asByte; 210 } else if (nativeType == TYPE_BYTE && type == Integer.TYPE) { 211 int asInt = (Integer) value; 212 byte asByte = (byte) asInt; 213 value = (T) (Byte) asByte; 214 } else if (type != getExpectedType(nativeType)) { 215 throw new UnsupportedOperationException("Tried to pack a type of " + type + 216 " but we expected the type to be " + getExpectedType(nativeType)); 217 } 218 219 if (nativeType == TYPE_BYTE) { 220 buffer.put((Byte) value); 221 } else if (nativeType == TYPE_INT32) { 222 buffer.putInt((Integer) value); 223 } else if (nativeType == TYPE_FLOAT) { 224 buffer.putFloat((Float) value); 225 } else if (nativeType == TYPE_INT64) { 226 buffer.putLong((Long) value); 227 } else if (nativeType == TYPE_DOUBLE) { 228 buffer.putDouble((Double) value); 229 } else if (nativeType == TYPE_RATIONAL) { 230 Rational r = (Rational) value; 231 buffer.putInt(r.getNumerator()); 232 buffer.putInt(r.getDenominator()); 233 } 234 235 } 236 237 return getTypeSize(nativeType); 238 } 239 240 @SuppressWarnings({"unchecked", "rawtypes"}) 241 private static <T> int packSingle(T value, ByteBuffer buffer, Class<T> type, int nativeType, 242 boolean sizeOnly) { 243 244 int size = 0; 245 246 if (type.isPrimitive() || type == Rational.class) { 247 size = packSingleNative(value, buffer, type, nativeType, sizeOnly); 248 } else if (type.isEnum()) { 249 size = packEnum((Enum)value, buffer, (Class<Enum>)type, nativeType, sizeOnly); 250 } else if (type.isArray()) { 251 size = packArray(value, buffer, type, nativeType, sizeOnly); 252 } else { 253 size = packClass(value, buffer, type, nativeType, sizeOnly); 254 } 255 256 return size; 257 } 258 259 private static <T extends Enum<T>> int packEnum(T value, ByteBuffer buffer, Class<T> type, 260 int nativeType, boolean sizeOnly) { 261 262 // TODO: add support for enums with their own values. 263 return packSingleNative(getEnumValue(value), buffer, Integer.TYPE, nativeType, sizeOnly); 264 } 265 266 @SuppressWarnings("unchecked") 267 private static <T> int packClass(T value, ByteBuffer buffer, Class<T> type, int nativeType, 268 boolean sizeOnly) { 269 270 MetadataMarshalClass<T> marshaler = getMarshaler(type, nativeType); 271 if (marshaler == null) { 272 throw new IllegalArgumentException(String.format("Unknown Key type: %s", type)); 273 } 274 275 return marshaler.marshal(value, buffer, nativeType, sizeOnly); 276 } 277 278 private static <T> int packArray(T value, ByteBuffer buffer, Class<T> type, int nativeType, 279 boolean sizeOnly) { 280 281 int size = 0; 282 int arrayLength = Array.getLength(value); 283 284 @SuppressWarnings("unchecked") 285 Class<Object> componentType = (Class<Object>)type.getComponentType(); 286 287 for (int i = 0; i < arrayLength; ++i) { 288 size += packSingle(Array.get(value, i), buffer, componentType, nativeType, sizeOnly); 289 } 290 291 return size; 292 } 293 294 @SuppressWarnings("unchecked") 295 private static <T> T unpackSingleNative(ByteBuffer buffer, Class<T> type, int nativeType) { 296 297 T val; 298 299 if (nativeType == TYPE_BYTE) { 300 val = (T) (Byte) buffer.get(); 301 } else if (nativeType == TYPE_INT32) { 302 val = (T) (Integer) buffer.getInt(); 303 } else if (nativeType == TYPE_FLOAT) { 304 val = (T) (Float) buffer.getFloat(); 305 } else if (nativeType == TYPE_INT64) { 306 val = (T) (Long) buffer.getLong(); 307 } else if (nativeType == TYPE_DOUBLE) { 308 val = (T) (Double) buffer.getDouble(); 309 } else if (nativeType == TYPE_RATIONAL) { 310 val = (T) new Rational(buffer.getInt(), buffer.getInt()); 311 } else { 312 throw new UnsupportedOperationException("Unknown type, can't unpack a native type " 313 + nativeType); 314 } 315 316 /** 317 * Rewrite types when the native type doesn't match the managed type 318 * - Byte -> Boolean 319 * - Byte -> Integer 320 */ 321 322 if (nativeType == TYPE_BYTE && type == Boolean.TYPE) { 323 // Since a boolean can't be cast to byte, and we don't want to use getBoolean 324 byte asByte = (Byte) val; 325 boolean asBool = asByte != 0; 326 val = (T) (Boolean) asBool; 327 } else if (nativeType == TYPE_BYTE && type == Integer.TYPE) { 328 byte asByte = (Byte) val; 329 int asInt = asByte; 330 val = (T) (Integer) asInt; 331 } else if (type != getExpectedType(nativeType)) { 332 throw new UnsupportedOperationException("Tried to unpack a type of " + type + 333 " but we expected the type to be " + getExpectedType(nativeType)); 334 } 335 336 return val; 337 } 338 339 @SuppressWarnings({"unchecked", "rawtypes"}) 340 private static <T> T unpackSingle(ByteBuffer buffer, Class<T> type, int nativeType) { 341 342 if (type.isPrimitive() || type == Rational.class) { 343 return unpackSingleNative(buffer, type, nativeType); 344 } 345 346 if (type.isEnum()) { 347 return (T) unpackEnum(buffer, (Class<Enum>)type, nativeType); 348 } 349 350 if (type.isArray()) { 351 return unpackArray(buffer, type, nativeType); 352 } 353 354 T instance = unpackClass(buffer, type, nativeType); 355 356 return instance; 357 } 358 359 private static <T extends Enum<T>> T unpackEnum(ByteBuffer buffer, Class<T> type, 360 int nativeType) { 361 int ordinal = unpackSingleNative(buffer, Integer.TYPE, nativeType); 362 return getEnumFromValue(type, ordinal); 363 } 364 365 private static <T> T unpackClass(ByteBuffer buffer, Class<T> type, int nativeType) { 366 367 MetadataMarshalClass<T> marshaler = getMarshaler(type, nativeType); 368 if (marshaler == null) { 369 throw new IllegalArgumentException("Unknown class type: " + type); 370 } 371 372 return marshaler.unmarshal(buffer, nativeType); 373 } 374 375 @SuppressWarnings("unchecked") 376 private static <T> T unpackArray(ByteBuffer buffer, Class<T> type, int nativeType) { 377 378 Class<?> componentType = type.getComponentType(); 379 Object array; 380 381 int elementSize = getTypeSize(nativeType); 382 383 MetadataMarshalClass<?> marshaler = getMarshaler(componentType, nativeType); 384 if (marshaler != null) { 385 elementSize = marshaler.getNativeSize(nativeType); 386 } 387 388 if (elementSize != MetadataMarshalClass.NATIVE_SIZE_DYNAMIC) { 389 int remaining = buffer.remaining(); 390 int arraySize = remaining / elementSize; 391 392 Log.v(TAG, 393 String.format( 394 "Attempting to unpack array (count = %d, element size = %d, bytes " + 395 "remaining = %d) for type %s", 396 arraySize, elementSize, remaining, type)); 397 398 array = Array.newInstance(componentType, arraySize); 399 for (int i = 0; i < arraySize; ++i) { 400 Object elem = unpackSingle(buffer, componentType, nativeType); 401 Array.set(array, i, elem); 402 } 403 } else { 404 // Dynamic size, use an array list. 405 ArrayList<Object> arrayList = new ArrayList<Object>(); 406 407 int primitiveSize = getTypeSize(nativeType); 408 while (buffer.remaining() >= primitiveSize) { 409 Object elem = unpackSingle(buffer, componentType, nativeType); 410 arrayList.add(elem); 411 } 412 413 array = arrayList.toArray((T[]) Array.newInstance(componentType, 0)); 414 } 415 416 if (buffer.remaining() != 0) { 417 Log.e(TAG, "Trailing bytes (" + buffer.remaining() + ") left over after unpacking " 418 + type); 419 } 420 421 return (T) array; 422 } 423 424 @Override 425 public int describeContents() { 426 return 0; 427 } 428 429 @Override 430 public void writeToParcel(Parcel dest, int flags) { 431 nativeWriteToParcel(dest); 432 } 433 434 /** 435 * Expand this object from a Parcel. 436 * @param in The Parcel from which the object should be read 437 */ 438 public void readFromParcel(Parcel in) { 439 nativeReadFromParcel(in); 440 } 441 442 public static class Key<T> { 443 444 private boolean mHasTag; 445 private int mTag; 446 private final Class<T> mType; 447 448 /* 449 * @hide 450 */ 451 public Key(String name, Class<T> type) { 452 if (name == null) { 453 throw new NullPointerException("Key needs a valid name"); 454 } else if (type == null) { 455 throw new NullPointerException("Type needs to be non-null"); 456 } 457 mName = name; 458 mType = type; 459 } 460 461 public final String getName() { 462 return mName; 463 } 464 465 @Override 466 public final int hashCode() { 467 return mName.hashCode(); 468 } 469 470 @Override 471 @SuppressWarnings("unchecked") 472 public final boolean equals(Object o) { 473 if (this == o) { 474 return true; 475 } 476 477 if (!(o instanceof Key)) { 478 return false; 479 } 480 481 Key lhs = (Key) o; 482 483 return mName.equals(lhs.mName); 484 } 485 486 private final String mName; 487 488 /** 489 * <p> 490 * Get the tag corresponding to this key. This enables insertion into the 491 * native metadata. 492 * </p> 493 * 494 * <p>This value is looked up the first time, and cached subsequently.</p> 495 * 496 * @return The tag numeric value corresponding to the string 497 * 498 * @hide 499 */ 500 public final int getTag() { 501 if (!mHasTag) { 502 mTag = CameraMetadata.getTag(mName); 503 mHasTag = true; 504 } 505 return mTag; 506 } 507 } 508 509 private final Map<Key<?>, Object> mMetadataMap; 510 511 private long mMetadataPtr; // native CameraMetadata* 512 513 private native long nativeAllocate(); 514 private native synchronized void nativeWriteToParcel(Parcel dest); 515 private native synchronized void nativeReadFromParcel(Parcel source); 516 private native synchronized void nativeSwap(CameraMetadata other) throws NullPointerException; 517 private native synchronized void nativeClose(); 518 private native synchronized boolean nativeIsEmpty(); 519 private native synchronized int nativeGetEntryCount(); 520 521 private native synchronized byte[] nativeReadValues(int tag); 522 private native synchronized void nativeWriteValues(int tag, byte[] src); 523 524 private static native int nativeGetTagFromKey(String keyName) 525 throws IllegalArgumentException; 526 private static native int nativeGetTypeFromTag(int tag) 527 throws IllegalArgumentException; 528 private static native void nativeClassInit(); 529 530 /** 531 * <p>Perform a 0-copy swap of the internal metadata with another object.</p> 532 * 533 * <p>Useful to convert a CameraMetadata into e.g. a CaptureRequest.</p> 534 * 535 * @param other Metadata to swap with 536 * @throws NullPointerException if other was null 537 * @hide 538 */ 539 public void swap(CameraMetadata other) { 540 nativeSwap(other); 541 } 542 543 /** 544 * @hide 545 */ 546 public int getEntryCount() { 547 return nativeGetEntryCount(); 548 } 549 550 /** 551 * Does this metadata contain at least 1 entry? 552 * 553 * @hide 554 */ 555 public boolean isEmpty() { 556 return nativeIsEmpty(); 557 } 558 559 /** 560 * <p>Closes this object, and releases all native resources associated with it.</p> 561 * 562 * <p>Calling any other public method after this will result in an IllegalStateException 563 * being thrown.</p> 564 */ 565 @Override 566 public void close() throws Exception { 567 // this sets mMetadataPtr to 0 568 nativeClose(); 569 mMetadataPtr = 0; // set it to 0 again to prevent eclipse from making this field final 570 } 571 572 /** 573 * Whether or not {@link #close} has already been called (at least once) on this object. 574 * @hide 575 */ 576 public boolean isClosed() { 577 synchronized (this) { 578 return mMetadataPtr == 0; 579 } 580 } 581 582 /** 583 * Convert a key string into the equivalent native tag. 584 * 585 * @throws IllegalArgumentException if the key was not recognized 586 * @throws NullPointerException if the key was null 587 * 588 * @hide 589 */ 590 public static int getTag(String key) { 591 return nativeGetTagFromKey(key); 592 } 593 594 /** 595 * Get the underlying native type for a tag. 596 * 597 * @param tag An integer tag, see e.g. {@link #getTag} 598 * @return An int enum for the metadata type, see e.g. {@link #TYPE_BYTE} 599 * 600 * @hide 601 */ 602 public static int getNativeType(int tag) { 603 return nativeGetTypeFromTag(tag); 604 } 605 606 /** 607 * <p>Updates the existing entry for tag with the new bytes pointed by src, erasing 608 * the entry if src was null.</p> 609 * 610 * <p>An empty array can be passed in to update the entry to 0 elements.</p> 611 * 612 * @param tag An integer tag, see e.g. {@link #getTag} 613 * @param src An array of bytes, or null to erase the entry 614 * 615 * @hide 616 */ 617 public void writeValues(int tag, byte[] src) { 618 nativeWriteValues(tag, src); 619 } 620 621 /** 622 * <p>Returns a byte[] of data corresponding to this tag. Use a wrapped bytebuffer to unserialize 623 * the data properly.</p> 624 * 625 * <p>An empty array can be returned to denote an existing entry with 0 elements.</p> 626 * 627 * @param tag An integer tag, see e.g. {@link #getTag} 628 * 629 * @return {@code null} if there were 0 entries for this tag, a byte[] otherwise. 630 * @hide 631 */ 632 public byte[] readValues(int tag) { 633 // TODO: Optimization. Native code returns a ByteBuffer instead. 634 return nativeReadValues(tag); 635 } 636 637 @Override 638 protected void finalize() throws Throwable { 639 try { 640 close(); 641 } finally { 642 super.finalize(); 643 } 644 } 645 646 private static final HashMap<Class<? extends Enum>, int[]> sEnumValues = 647 new HashMap<Class<? extends Enum>, int[]>(); 648 /** 649 * Register a non-sequential set of values to be used with the pack/unpack functions. 650 * This enables get/set to correctly marshal the enum into a value that is C-compatible. 651 * 652 * @param enumType The class for an enum 653 * @param values A list of values mapping to the ordinals of the enum 654 * 655 * @hide 656 */ 657 public static <T extends Enum<T>> void registerEnumValues(Class<T> enumType, int[] values) { 658 if (enumType.getEnumConstants().length != values.length) { 659 throw new IllegalArgumentException( 660 "Expected values array to be the same size as the enumTypes values " 661 + values.length + " for type " + enumType); 662 } 663 664 Log.v(TAG, "Registered enum values for type " + enumType + " values"); 665 666 sEnumValues.put(enumType, values); 667 } 668 669 /** 670 * Get the numeric value from an enum. This is usually the same as the ordinal value for 671 * enums that have fully sequential values, although for C-style enums the range of values 672 * may not map 1:1. 673 * 674 * @param enumValue Enum instance 675 * @return Int guaranteed to be ABI-compatible with the C enum equivalent 676 */ 677 private static <T extends Enum<T>> int getEnumValue(T enumValue) { 678 int[] values; 679 values = sEnumValues.get(enumValue.getClass()); 680 681 int ordinal = enumValue.ordinal(); 682 if (values != null) { 683 return values[ordinal]; 684 } 685 686 return ordinal; 687 } 688 689 /** 690 * Finds the enum corresponding to it's numeric value. Opposite of {@link #getEnumValue} method. 691 * 692 * @param enumType Class of the enum we want to find 693 * @param value The numeric value of the enum 694 * @return An instance of the enum 695 */ 696 private static <T extends Enum<T>> T getEnumFromValue(Class<T> enumType, int value) { 697 int ordinal; 698 699 int[] registeredValues = sEnumValues.get(enumType); 700 if (registeredValues != null) { 701 ordinal = -1; 702 703 for (int i = 0; i < registeredValues.length; ++i) { 704 if (registeredValues[i] == value) { 705 ordinal = i; 706 break; 707 } 708 } 709 } else { 710 ordinal = value; 711 } 712 713 T[] values = enumType.getEnumConstants(); 714 715 if (ordinal < 0 || ordinal >= values.length) { 716 throw new IllegalArgumentException( 717 String.format( 718 "Argument 'value' (%d) was not a valid enum value for type %s " 719 + "(registered? %b)", 720 value, 721 enumType, (registeredValues != null))); 722 } 723 724 return values[ordinal]; 725 } 726 727 static HashMap<Class<?>, MetadataMarshalClass<?>> sMarshalerMap = new 728 HashMap<Class<?>, MetadataMarshalClass<?>>(); 729 730 private static <T> void registerMarshaler(MetadataMarshalClass<T> marshaler) { 731 sMarshalerMap.put(marshaler.getMarshalingClass(), marshaler); 732 } 733 734 @SuppressWarnings("unchecked") 735 private static <T> MetadataMarshalClass<T> getMarshaler(Class<T> type, int nativeType) { 736 MetadataMarshalClass<T> marshaler = (MetadataMarshalClass<T>) sMarshalerMap.get(type); 737 738 if (marshaler != null && !marshaler.isNativeTypeSupported(nativeType)) { 739 throw new UnsupportedOperationException("Unsupported type " + nativeType + 740 " to be marshalled to/from a " + type); 741 } 742 743 return marshaler; 744 } 745 746 /** 747 * We use a class initializer to allow the native code to cache some field offsets 748 */ 749 static { 750 System.loadLibrary("media_jni"); 751 nativeClassInit(); 752 753 Log.v(TAG, "Shall register metadata marshalers"); 754 755 // load built-in marshallers 756 registerMarshaler(new MetadataMarshalRect()); 757 registerMarshaler(new MetadataMarshalSize()); 758 registerMarshaler(new MetadataMarshalString()); 759 760 Log.v(TAG, "Registered metadata marshalers"); 761 } 762 763 /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ 764 * The enum values below this point are generated from metadata 765 * definitions in /system/media/camera/docs. Do not modify by hand or 766 * modify the comment blocks at the start or end. 767 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/ 768 769 // 770 // Enumeration values for CameraProperties#LENS_FACING 771 // 772 773 /** 774 * @see CameraProperties#LENS_FACING 775 */ 776 public static final int LENS_FACING_FRONT = 0; 777 778 /** 779 * @see CameraProperties#LENS_FACING 780 */ 781 public static final int LENS_FACING_BACK = 1; 782 783 // 784 // Enumeration values for CameraProperties#LED_AVAILABLE_LEDS 785 // 786 787 /** 788 * <p> 789 * android.led.transmit control is used 790 * </p> 791 * @see CameraProperties#LED_AVAILABLE_LEDS 792 * @hide 793 */ 794 public static final int LED_AVAILABLE_LEDS_TRANSMIT = 0; 795 796 // 797 // Enumeration values for CameraProperties#INFO_SUPPORTED_HARDWARE_LEVEL 798 // 799 800 /** 801 * @see CameraProperties#INFO_SUPPORTED_HARDWARE_LEVEL 802 */ 803 public static final int INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED = 0; 804 805 /** 806 * @see CameraProperties#INFO_SUPPORTED_HARDWARE_LEVEL 807 */ 808 public static final int INFO_SUPPORTED_HARDWARE_LEVEL_FULL = 1; 809 810 // 811 // Enumeration values for CaptureRequest#COLOR_CORRECTION_MODE 812 // 813 814 /** 815 * <p> 816 * Use the android.colorCorrection.transform matrix 817 * and android.colorCorrection.gains to do color conversion 818 * </p> 819 * @see CaptureRequest#COLOR_CORRECTION_MODE 820 */ 821 public static final int COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0; 822 823 /** 824 * <p> 825 * Must not slow down frame rate relative to raw 826 * bayer output 827 * </p> 828 * @see CaptureRequest#COLOR_CORRECTION_MODE 829 */ 830 public static final int COLOR_CORRECTION_MODE_FAST = 1; 831 832 /** 833 * <p> 834 * Frame rate may be reduced by high 835 * quality 836 * </p> 837 * @see CaptureRequest#COLOR_CORRECTION_MODE 838 */ 839 public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2; 840 841 // 842 // Enumeration values for CaptureRequest#CONTROL_AE_ANTIBANDING_MODE 843 // 844 845 /** 846 * @see CaptureRequest#CONTROL_AE_ANTIBANDING_MODE 847 */ 848 public static final int CONTROL_AE_ANTIBANDING_MODE_OFF = 0; 849 850 /** 851 * @see CaptureRequest#CONTROL_AE_ANTIBANDING_MODE 852 */ 853 public static final int CONTROL_AE_ANTIBANDING_MODE_50HZ = 1; 854 855 /** 856 * @see CaptureRequest#CONTROL_AE_ANTIBANDING_MODE 857 */ 858 public static final int CONTROL_AE_ANTIBANDING_MODE_60HZ = 2; 859 860 /** 861 * @see CaptureRequest#CONTROL_AE_ANTIBANDING_MODE 862 */ 863 public static final int CONTROL_AE_ANTIBANDING_MODE_AUTO = 3; 864 865 // 866 // Enumeration values for CaptureRequest#CONTROL_AE_MODE 867 // 868 869 /** 870 * <p> 871 * Autoexposure is disabled; sensor.exposureTime, 872 * sensor.sensitivity and sensor.frameDuration are used 873 * </p> 874 * @see CaptureRequest#CONTROL_AE_MODE 875 */ 876 public static final int CONTROL_AE_MODE_OFF = 0; 877 878 /** 879 * <p> 880 * Autoexposure is active, no flash 881 * control 882 * </p> 883 * @see CaptureRequest#CONTROL_AE_MODE 884 */ 885 public static final int CONTROL_AE_MODE_ON = 1; 886 887 /** 888 * <p> 889 * if flash exists Autoexposure is active, auto 890 * flash control; flash may be fired when precapture 891 * trigger is activated, and for captures for which 892 * captureIntent = STILL_CAPTURE 893 * </p> 894 * @see CaptureRequest#CONTROL_AE_MODE 895 */ 896 public static final int CONTROL_AE_MODE_ON_AUTO_FLASH = 2; 897 898 /** 899 * <p> 900 * if flash exists Autoexposure is active, auto 901 * flash control for precapture trigger and always flash 902 * when captureIntent = STILL_CAPTURE 903 * </p> 904 * @see CaptureRequest#CONTROL_AE_MODE 905 */ 906 public static final int CONTROL_AE_MODE_ON_ALWAYS_FLASH = 3; 907 908 /** 909 * <p> 910 * optional Automatic red eye reduction with flash. 911 * If deemed necessary, red eye reduction sequence should 912 * fire when precapture trigger is activated, and final 913 * flash should fire when captureIntent = 914 * STILL_CAPTURE 915 * </p> 916 * @see CaptureRequest#CONTROL_AE_MODE 917 */ 918 public static final int CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE = 4; 919 920 // 921 // Enumeration values for CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER 922 // 923 924 /** 925 * <p> 926 * The trigger is idle. 927 * </p> 928 * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER 929 */ 930 public static final int CONTROL_AE_PRECAPTURE_TRIGGER_IDLE = 0; 931 932 /** 933 * <p> 934 * The precapture metering sequence 935 * must be started. The exact effect of the precapture 936 * trigger depends on the current AE mode and 937 * state. 938 * </p> 939 * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER 940 */ 941 public static final int CONTROL_AE_PRECAPTURE_TRIGGER_START = 1; 942 943 // 944 // Enumeration values for CaptureRequest#CONTROL_AF_MODE 945 // 946 947 /** 948 * <p> 949 * The 3A routines do not control the lens; 950 * android.lens.focusDistance is controlled by the 951 * application 952 * </p> 953 * @see CaptureRequest#CONTROL_AF_MODE 954 */ 955 public static final int CONTROL_AF_MODE_OFF = 0; 956 957 /** 958 * <p> 959 * if lens is not fixed focus. 960 * </p><p> 961 * Use android.lens.minimumFocusDistance to determine if lens 962 * is fixed focus In this mode, the lens does not move unless 963 * the autofocus trigger action is called. When that trigger 964 * is activated, AF must transition to ACTIVE_SCAN, then to 965 * the outcome of the scan (FOCUSED or 966 * NOT_FOCUSED). 967 * </p><p> 968 * Triggering cancel AF resets the lens position to default, 969 * and sets the AF state to INACTIVE. 970 * </p> 971 * @see CaptureRequest#CONTROL_AF_MODE 972 */ 973 public static final int CONTROL_AF_MODE_AUTO = 1; 974 975 /** 976 * <p> 977 * In this mode, the lens does not move unless the 978 * autofocus trigger action is called. 979 * </p><p> 980 * When that trigger is activated, AF must transition to 981 * ACTIVE_SCAN, then to the outcome of the scan (FOCUSED or 982 * NOT_FOCUSED). Triggering cancel AF resets the lens 983 * position to default, and sets the AF state to 984 * INACTIVE. 985 * </p> 986 * @see CaptureRequest#CONTROL_AF_MODE 987 */ 988 public static final int CONTROL_AF_MODE_MACRO = 2; 989 990 /** 991 * <p> 992 * In this mode, the AF algorithm modifies the lens 993 * position continually to attempt to provide a 994 * constantly-in-focus image stream. 995 * </p><p> 996 * The focusing behavior should be suitable for good quality 997 * video recording; typically this means slower focus 998 * movement and no overshoots. When the AF trigger is not 999 * involved, the AF algorithm should start in INACTIVE state, 1000 * and then transition into PASSIVE_SCAN and PASSIVE_FOCUSED 1001 * states as appropriate. When the AF trigger is activated, 1002 * the algorithm should immediately transition into 1003 * AF_FOCUSED or AF_NOT_FOCUSED as appropriate, and lock the 1004 * lens position until a cancel AF trigger is received. 1005 * </p><p> 1006 * Once cancel is received, the algorithm should transition 1007 * back to INACTIVE and resume passive scan. Note that this 1008 * behavior is not identical to CONTINUOUS_PICTURE, since an 1009 * ongoing PASSIVE_SCAN must immediately be 1010 * canceled. 1011 * </p> 1012 * @see CaptureRequest#CONTROL_AF_MODE 1013 */ 1014 public static final int CONTROL_AF_MODE_CONTINUOUS_VIDEO = 3; 1015 1016 /** 1017 * <p> 1018 * In this mode, the AF algorithm modifies the lens 1019 * position continually to attempt to provide a 1020 * constantly-in-focus image stream. 1021 * </p><p> 1022 * The focusing behavior should be suitable for still image 1023 * capture; typically this means focusing as fast as 1024 * possible. When the AF trigger is not involved, the AF 1025 * algorithm should start in INACTIVE state, and then 1026 * transition into PASSIVE_SCAN and PASSIVE_FOCUSED states as 1027 * appropriate as it attempts to maintain focus. When the AF 1028 * trigger is activated, the algorithm should finish its 1029 * PASSIVE_SCAN if active, and then transition into 1030 * AF_FOCUSED or AF_NOT_FOCUSED as appropriate, and lock the 1031 * lens position until a cancel AF trigger is received. 1032 * </p><p> 1033 * When the AF cancel trigger is activated, the algorithm 1034 * should transition back to INACTIVE and then act as if it 1035 * has just been started. 1036 * </p> 1037 * @see CaptureRequest#CONTROL_AF_MODE 1038 */ 1039 public static final int CONTROL_AF_MODE_CONTINUOUS_PICTURE = 4; 1040 1041 /** 1042 * <p> 1043 * Extended depth of field (digital focus). AF 1044 * trigger is ignored, AF state should always be 1045 * INACTIVE. 1046 * </p> 1047 * @see CaptureRequest#CONTROL_AF_MODE 1048 */ 1049 public static final int CONTROL_AF_MODE_EDOF = 5; 1050 1051 // 1052 // Enumeration values for CaptureRequest#CONTROL_AF_TRIGGER 1053 // 1054 1055 /** 1056 * <p> 1057 * The trigger is idle. 1058 * </p> 1059 * @see CaptureRequest#CONTROL_AF_TRIGGER 1060 */ 1061 public static final int CONTROL_AF_TRIGGER_IDLE = 0; 1062 1063 /** 1064 * <p> 1065 * Autofocus must trigger now. 1066 * </p> 1067 * @see CaptureRequest#CONTROL_AF_TRIGGER 1068 */ 1069 public static final int CONTROL_AF_TRIGGER_START = 1; 1070 1071 /** 1072 * <p> 1073 * Autofocus must return to initial 1074 * state, and cancel any active trigger. 1075 * </p> 1076 * @see CaptureRequest#CONTROL_AF_TRIGGER 1077 */ 1078 public static final int CONTROL_AF_TRIGGER_CANCEL = 2; 1079 1080 // 1081 // Enumeration values for CaptureRequest#CONTROL_AWB_MODE 1082 // 1083 1084 /** 1085 * @see CaptureRequest#CONTROL_AWB_MODE 1086 */ 1087 public static final int CONTROL_AWB_MODE_OFF = 0; 1088 1089 /** 1090 * @see CaptureRequest#CONTROL_AWB_MODE 1091 */ 1092 public static final int CONTROL_AWB_MODE_AUTO = 1; 1093 1094 /** 1095 * @see CaptureRequest#CONTROL_AWB_MODE 1096 */ 1097 public static final int CONTROL_AWB_MODE_INCANDESCENT = 2; 1098 1099 /** 1100 * @see CaptureRequest#CONTROL_AWB_MODE 1101 */ 1102 public static final int CONTROL_AWB_MODE_FLUORESCENT = 3; 1103 1104 /** 1105 * @see CaptureRequest#CONTROL_AWB_MODE 1106 */ 1107 public static final int CONTROL_AWB_MODE_WARM_FLUORESCENT = 4; 1108 1109 /** 1110 * @see CaptureRequest#CONTROL_AWB_MODE 1111 */ 1112 public static final int CONTROL_AWB_MODE_DAYLIGHT = 5; 1113 1114 /** 1115 * @see CaptureRequest#CONTROL_AWB_MODE 1116 */ 1117 public static final int CONTROL_AWB_MODE_CLOUDY_DAYLIGHT = 6; 1118 1119 /** 1120 * @see CaptureRequest#CONTROL_AWB_MODE 1121 */ 1122 public static final int CONTROL_AWB_MODE_TWILIGHT = 7; 1123 1124 /** 1125 * @see CaptureRequest#CONTROL_AWB_MODE 1126 */ 1127 public static final int CONTROL_AWB_MODE_SHADE = 8; 1128 1129 // 1130 // Enumeration values for CaptureRequest#CONTROL_CAPTURE_INTENT 1131 // 1132 1133 /** 1134 * <p> 1135 * This request doesn't fall into the other 1136 * categories. Default to preview-like 1137 * behavior. 1138 * </p> 1139 * @see CaptureRequest#CONTROL_CAPTURE_INTENT 1140 */ 1141 public static final int CONTROL_CAPTURE_INTENT_CUSTOM = 0; 1142 1143 /** 1144 * <p> 1145 * This request is for a preview-like usecase. The 1146 * precapture trigger may be used to start off a metering 1147 * w/flash sequence 1148 * </p> 1149 * @see CaptureRequest#CONTROL_CAPTURE_INTENT 1150 */ 1151 public static final int CONTROL_CAPTURE_INTENT_PREVIEW = 1; 1152 1153 /** 1154 * <p> 1155 * This request is for a still capture-type 1156 * usecase. 1157 * </p> 1158 * @see CaptureRequest#CONTROL_CAPTURE_INTENT 1159 */ 1160 public static final int CONTROL_CAPTURE_INTENT_STILL_CAPTURE = 2; 1161 1162 /** 1163 * <p> 1164 * This request is for a video recording 1165 * usecase. 1166 * </p> 1167 * @see CaptureRequest#CONTROL_CAPTURE_INTENT 1168 */ 1169 public static final int CONTROL_CAPTURE_INTENT_VIDEO_RECORD = 3; 1170 1171 /** 1172 * <p> 1173 * This request is for a video snapshot (still 1174 * image while recording video) usecase 1175 * </p> 1176 * @see CaptureRequest#CONTROL_CAPTURE_INTENT 1177 */ 1178 public static final int CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT = 4; 1179 1180 /** 1181 * <p> 1182 * This request is for a ZSL usecase; the 1183 * application will stream full-resolution images and 1184 * reprocess one or several later for a final 1185 * capture 1186 * </p> 1187 * @see CaptureRequest#CONTROL_CAPTURE_INTENT 1188 */ 1189 public static final int CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG = 5; 1190 1191 // 1192 // Enumeration values for CaptureRequest#CONTROL_EFFECT_MODE 1193 // 1194 1195 /** 1196 * @see CaptureRequest#CONTROL_EFFECT_MODE 1197 */ 1198 public static final int CONTROL_EFFECT_MODE_OFF = 0; 1199 1200 /** 1201 * @see CaptureRequest#CONTROL_EFFECT_MODE 1202 */ 1203 public static final int CONTROL_EFFECT_MODE_MONO = 1; 1204 1205 /** 1206 * @see CaptureRequest#CONTROL_EFFECT_MODE 1207 */ 1208 public static final int CONTROL_EFFECT_MODE_NEGATIVE = 2; 1209 1210 /** 1211 * @see CaptureRequest#CONTROL_EFFECT_MODE 1212 */ 1213 public static final int CONTROL_EFFECT_MODE_SOLARIZE = 3; 1214 1215 /** 1216 * @see CaptureRequest#CONTROL_EFFECT_MODE 1217 */ 1218 public static final int CONTROL_EFFECT_MODE_SEPIA = 4; 1219 1220 /** 1221 * @see CaptureRequest#CONTROL_EFFECT_MODE 1222 */ 1223 public static final int CONTROL_EFFECT_MODE_POSTERIZE = 5; 1224 1225 /** 1226 * @see CaptureRequest#CONTROL_EFFECT_MODE 1227 */ 1228 public static final int CONTROL_EFFECT_MODE_WHITEBOARD = 6; 1229 1230 /** 1231 * @see CaptureRequest#CONTROL_EFFECT_MODE 1232 */ 1233 public static final int CONTROL_EFFECT_MODE_BLACKBOARD = 7; 1234 1235 /** 1236 * @see CaptureRequest#CONTROL_EFFECT_MODE 1237 */ 1238 public static final int CONTROL_EFFECT_MODE_AQUA = 8; 1239 1240 // 1241 // Enumeration values for CaptureRequest#CONTROL_MODE 1242 // 1243 1244 /** 1245 * <p> 1246 * Full application control of pipeline. All 3A 1247 * routines are disabled, no other settings in 1248 * android.control.* have any effect 1249 * </p> 1250 * @see CaptureRequest#CONTROL_MODE 1251 */ 1252 public static final int CONTROL_MODE_OFF = 0; 1253 1254 /** 1255 * <p> 1256 * Use settings for each individual 3A routine. 1257 * Manual control of capture parameters is disabled. All 1258 * controls in android.control.* besides sceneMode take 1259 * effect 1260 * </p> 1261 * @see CaptureRequest#CONTROL_MODE 1262 */ 1263 public static final int CONTROL_MODE_AUTO = 1; 1264 1265 /** 1266 * <p> 1267 * Use specific scene mode. Enabling this disables 1268 * control.aeMode, control.awbMode and control.afMode 1269 * controls; the HAL must ignore those settings while 1270 * USE_SCENE_MODE is active (except for FACE_PRIORITY 1271 * scene mode). Other control entries are still active. 1272 * This setting can only be used if availableSceneModes != 1273 * UNSUPPORTED 1274 * </p> 1275 * @see CaptureRequest#CONTROL_MODE 1276 */ 1277 public static final int CONTROL_MODE_USE_SCENE_MODE = 2; 1278 1279 // 1280 // Enumeration values for CaptureRequest#CONTROL_SCENE_MODE 1281 // 1282 1283 /** 1284 * @see CaptureRequest#CONTROL_SCENE_MODE 1285 */ 1286 public static final int CONTROL_SCENE_MODE_UNSUPPORTED = 0; 1287 1288 /** 1289 * <p> 1290 * if face detection support exists Use face 1291 * detection data to drive 3A routines. If face detection 1292 * statistics are disabled, should still operate correctly 1293 * (but not return face detection statistics to the 1294 * framework). 1295 * </p><p> 1296 * Unlike the other scene modes, aeMode, awbMode, and afMode 1297 * remain active when FACE_PRIORITY is set. This is due to 1298 * compatibility concerns with the old camera 1299 * API 1300 * </p> 1301 * @see CaptureRequest#CONTROL_SCENE_MODE 1302 */ 1303 public static final int CONTROL_SCENE_MODE_FACE_PRIORITY = 1; 1304 1305 /** 1306 * @see CaptureRequest#CONTROL_SCENE_MODE 1307 */ 1308 public static final int CONTROL_SCENE_MODE_ACTION = 2; 1309 1310 /** 1311 * @see CaptureRequest#CONTROL_SCENE_MODE 1312 */ 1313 public static final int CONTROL_SCENE_MODE_PORTRAIT = 3; 1314 1315 /** 1316 * @see CaptureRequest#CONTROL_SCENE_MODE 1317 */ 1318 public static final int CONTROL_SCENE_MODE_LANDSCAPE = 4; 1319 1320 /** 1321 * @see CaptureRequest#CONTROL_SCENE_MODE 1322 */ 1323 public static final int CONTROL_SCENE_MODE_NIGHT = 5; 1324 1325 /** 1326 * @see CaptureRequest#CONTROL_SCENE_MODE 1327 */ 1328 public static final int CONTROL_SCENE_MODE_NIGHT_PORTRAIT = 6; 1329 1330 /** 1331 * @see CaptureRequest#CONTROL_SCENE_MODE 1332 */ 1333 public static final int CONTROL_SCENE_MODE_THEATRE = 7; 1334 1335 /** 1336 * @see CaptureRequest#CONTROL_SCENE_MODE 1337 */ 1338 public static final int CONTROL_SCENE_MODE_BEACH = 8; 1339 1340 /** 1341 * @see CaptureRequest#CONTROL_SCENE_MODE 1342 */ 1343 public static final int CONTROL_SCENE_MODE_SNOW = 9; 1344 1345 /** 1346 * @see CaptureRequest#CONTROL_SCENE_MODE 1347 */ 1348 public static final int CONTROL_SCENE_MODE_SUNSET = 10; 1349 1350 /** 1351 * @see CaptureRequest#CONTROL_SCENE_MODE 1352 */ 1353 public static final int CONTROL_SCENE_MODE_STEADYPHOTO = 11; 1354 1355 /** 1356 * @see CaptureRequest#CONTROL_SCENE_MODE 1357 */ 1358 public static final int CONTROL_SCENE_MODE_FIREWORKS = 12; 1359 1360 /** 1361 * @see CaptureRequest#CONTROL_SCENE_MODE 1362 */ 1363 public static final int CONTROL_SCENE_MODE_SPORTS = 13; 1364 1365 /** 1366 * @see CaptureRequest#CONTROL_SCENE_MODE 1367 */ 1368 public static final int CONTROL_SCENE_MODE_PARTY = 14; 1369 1370 /** 1371 * @see CaptureRequest#CONTROL_SCENE_MODE 1372 */ 1373 public static final int CONTROL_SCENE_MODE_CANDLELIGHT = 15; 1374 1375 /** 1376 * @see CaptureRequest#CONTROL_SCENE_MODE 1377 */ 1378 public static final int CONTROL_SCENE_MODE_BARCODE = 16; 1379 1380 // 1381 // Enumeration values for CaptureRequest#EDGE_MODE 1382 // 1383 1384 /** 1385 * <p> 1386 * No edge enhancement is applied 1387 * </p> 1388 * @see CaptureRequest#EDGE_MODE 1389 */ 1390 public static final int EDGE_MODE_OFF = 0; 1391 1392 /** 1393 * <p> 1394 * Must not slow down frame rate relative to raw 1395 * bayer output 1396 * </p> 1397 * @see CaptureRequest#EDGE_MODE 1398 */ 1399 public static final int EDGE_MODE_FAST = 1; 1400 1401 /** 1402 * <p> 1403 * Frame rate may be reduced by high 1404 * quality 1405 * </p> 1406 * @see CaptureRequest#EDGE_MODE 1407 */ 1408 public static final int EDGE_MODE_HIGH_QUALITY = 2; 1409 1410 // 1411 // Enumeration values for CaptureRequest#FLASH_MODE 1412 // 1413 1414 /** 1415 * <p> 1416 * Do not fire the flash for this 1417 * capture 1418 * </p> 1419 * @see CaptureRequest#FLASH_MODE 1420 */ 1421 public static final int FLASH_MODE_OFF = 0; 1422 1423 /** 1424 * <p> 1425 * if android.flash.available is true Fire flash 1426 * for this capture based on firingPower, 1427 * firingTime. 1428 * </p> 1429 * @see CaptureRequest#FLASH_MODE 1430 */ 1431 public static final int FLASH_MODE_SINGLE = 1; 1432 1433 /** 1434 * <p> 1435 * if android.flash.available is true Flash 1436 * continuously on, power set by 1437 * firingPower 1438 * </p> 1439 * @see CaptureRequest#FLASH_MODE 1440 */ 1441 public static final int FLASH_MODE_TORCH = 2; 1442 1443 // 1444 // Enumeration values for CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE 1445 // 1446 1447 /** 1448 * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE 1449 */ 1450 public static final int LENS_OPTICAL_STABILIZATION_MODE_OFF = 0; 1451 1452 /** 1453 * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE 1454 */ 1455 public static final int LENS_OPTICAL_STABILIZATION_MODE_ON = 1; 1456 1457 // 1458 // Enumeration values for CaptureRequest#NOISE_REDUCTION_MODE 1459 // 1460 1461 /** 1462 * <p> 1463 * No noise reduction is applied 1464 * </p> 1465 * @see CaptureRequest#NOISE_REDUCTION_MODE 1466 */ 1467 public static final int NOISE_REDUCTION_MODE_OFF = 0; 1468 1469 /** 1470 * <p> 1471 * Must not slow down frame rate relative to raw 1472 * bayer output 1473 * </p> 1474 * @see CaptureRequest#NOISE_REDUCTION_MODE 1475 */ 1476 public static final int NOISE_REDUCTION_MODE_FAST = 1; 1477 1478 /** 1479 * <p> 1480 * May slow down frame rate to provide highest 1481 * quality 1482 * </p> 1483 * @see CaptureRequest#NOISE_REDUCTION_MODE 1484 */ 1485 public static final int NOISE_REDUCTION_MODE_HIGH_QUALITY = 2; 1486 1487 // 1488 // Enumeration values for CaptureRequest#STATISTICS_FACE_DETECT_MODE 1489 // 1490 1491 /** 1492 * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE 1493 */ 1494 public static final int STATISTICS_FACE_DETECT_MODE_OFF = 0; 1495 1496 /** 1497 * <p> 1498 * Optional Return rectangle and confidence 1499 * only 1500 * </p> 1501 * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE 1502 */ 1503 public static final int STATISTICS_FACE_DETECT_MODE_SIMPLE = 1; 1504 1505 /** 1506 * <p> 1507 * Optional Return all face 1508 * metadata 1509 * </p> 1510 * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE 1511 */ 1512 public static final int STATISTICS_FACE_DETECT_MODE_FULL = 2; 1513 1514 // 1515 // Enumeration values for CaptureRequest#TONEMAP_MODE 1516 // 1517 1518 /** 1519 * <p> 1520 * Use the tone mapping curve specified in 1521 * android.tonemap.curve 1522 * </p> 1523 * @see CaptureRequest#TONEMAP_MODE 1524 */ 1525 public static final int TONEMAP_MODE_CONTRAST_CURVE = 0; 1526 1527 /** 1528 * <p> 1529 * Must not slow down frame rate relative to raw 1530 * bayer output 1531 * </p> 1532 * @see CaptureRequest#TONEMAP_MODE 1533 */ 1534 public static final int TONEMAP_MODE_FAST = 1; 1535 1536 /** 1537 * <p> 1538 * Frame rate may be reduced by high 1539 * quality 1540 * </p> 1541 * @see CaptureRequest#TONEMAP_MODE 1542 */ 1543 public static final int TONEMAP_MODE_HIGH_QUALITY = 2; 1544 1545 // 1546 // Enumeration values for CaptureResult#CONTROL_AE_STATE 1547 // 1548 1549 /** 1550 * <p> 1551 * AE is off. When a camera device is opened, it starts in 1552 * this state. 1553 * </p> 1554 * @see CaptureResult#CONTROL_AE_STATE 1555 */ 1556 public static final int CONTROL_AE_STATE_INACTIVE = 0; 1557 1558 /** 1559 * <p> 1560 * AE doesn't yet have a good set of control values 1561 * for the current scene 1562 * </p> 1563 * @see CaptureResult#CONTROL_AE_STATE 1564 */ 1565 public static final int CONTROL_AE_STATE_SEARCHING = 1; 1566 1567 /** 1568 * <p> 1569 * AE has a good set of control values for the 1570 * current scene 1571 * </p> 1572 * @see CaptureResult#CONTROL_AE_STATE 1573 */ 1574 public static final int CONTROL_AE_STATE_CONVERGED = 2; 1575 1576 /** 1577 * <p> 1578 * AE has been locked (aeMode = 1579 * LOCKED) 1580 * </p> 1581 * @see CaptureResult#CONTROL_AE_STATE 1582 */ 1583 public static final int CONTROL_AE_STATE_LOCKED = 3; 1584 1585 /** 1586 * <p> 1587 * AE has a good set of control values, but flash 1588 * needs to be fired for good quality still 1589 * capture 1590 * </p> 1591 * @see CaptureResult#CONTROL_AE_STATE 1592 */ 1593 public static final int CONTROL_AE_STATE_FLASH_REQUIRED = 4; 1594 1595 /** 1596 * <p> 1597 * AE has been asked to do a precapture sequence 1598 * (through the 1599 * trigger_action(CAMERA2_TRIGGER_PRECAPTURE_METERING) 1600 * call), and is currently executing it. Once PRECAPTURE 1601 * completes, AE will transition to CONVERGED or 1602 * FLASH_REQUIRED as appropriate 1603 * </p> 1604 * @see CaptureResult#CONTROL_AE_STATE 1605 */ 1606 public static final int CONTROL_AE_STATE_PRECAPTURE = 5; 1607 1608 // 1609 // Enumeration values for CaptureResult#CONTROL_AF_STATE 1610 // 1611 1612 /** 1613 * <p> 1614 * AF off or has not yet tried to scan/been asked 1615 * to scan. When a camera device is opened, it starts in 1616 * this state. 1617 * </p> 1618 * @see CaptureResult#CONTROL_AF_STATE 1619 */ 1620 public static final int CONTROL_AF_STATE_INACTIVE = 0; 1621 1622 /** 1623 * <p> 1624 * if CONTINUOUS_* modes are supported AF is 1625 * currently doing an AF scan initiated by a continuous 1626 * autofocus mode 1627 * </p> 1628 * @see CaptureResult#CONTROL_AF_STATE 1629 */ 1630 public static final int CONTROL_AF_STATE_PASSIVE_SCAN = 1; 1631 1632 /** 1633 * <p> 1634 * if CONTINUOUS_* modes are supported AF currently 1635 * believes it is in focus, but may restart scanning at 1636 * any time. 1637 * </p> 1638 * @see CaptureResult#CONTROL_AF_STATE 1639 */ 1640 public static final int CONTROL_AF_STATE_PASSIVE_FOCUSED = 2; 1641 1642 /** 1643 * <p> 1644 * if AUTO or MACRO modes are supported AF is doing 1645 * an AF scan because it was triggered by AF 1646 * trigger 1647 * </p> 1648 * @see CaptureResult#CONTROL_AF_STATE 1649 */ 1650 public static final int CONTROL_AF_STATE_ACTIVE_SCAN = 3; 1651 1652 /** 1653 * <p> 1654 * if any AF mode besides OFF is supported AF 1655 * believes it is focused correctly and is 1656 * locked 1657 * </p> 1658 * @see CaptureResult#CONTROL_AF_STATE 1659 */ 1660 public static final int CONTROL_AF_STATE_FOCUSED_LOCKED = 4; 1661 1662 /** 1663 * <p> 1664 * if any AF mode besides OFF is supported AF has 1665 * failed to focus successfully and is 1666 * locked 1667 * </p> 1668 * @see CaptureResult#CONTROL_AF_STATE 1669 */ 1670 public static final int CONTROL_AF_STATE_NOT_FOCUSED_LOCKED = 5; 1671 1672 // 1673 // Enumeration values for CaptureResult#CONTROL_AWB_STATE 1674 // 1675 1676 /** 1677 * <p> 1678 * AWB is not in auto mode. When a camera device is opened, it 1679 * starts in this state. 1680 * </p> 1681 * @see CaptureResult#CONTROL_AWB_STATE 1682 */ 1683 public static final int CONTROL_AWB_STATE_INACTIVE = 0; 1684 1685 /** 1686 * <p> 1687 * AWB doesn't yet have a good set of control 1688 * values for the current scene 1689 * </p> 1690 * @see CaptureResult#CONTROL_AWB_STATE 1691 */ 1692 public static final int CONTROL_AWB_STATE_SEARCHING = 1; 1693 1694 /** 1695 * <p> 1696 * AWB has a good set of control values for the 1697 * current scene 1698 * </p> 1699 * @see CaptureResult#CONTROL_AWB_STATE 1700 */ 1701 public static final int CONTROL_AWB_STATE_CONVERGED = 2; 1702 1703 /** 1704 * <p> 1705 * AE has been locked (aeMode = 1706 * LOCKED) 1707 * </p> 1708 * @see CaptureResult#CONTROL_AWB_STATE 1709 */ 1710 public static final int CONTROL_AWB_STATE_LOCKED = 3; 1711 1712 // 1713 // Enumeration values for CaptureResult#FLASH_STATE 1714 // 1715 1716 /** 1717 * <p> 1718 * No flash on camera 1719 * </p> 1720 * @see CaptureResult#FLASH_STATE 1721 */ 1722 public static final int FLASH_STATE_UNAVAILABLE = 0; 1723 1724 /** 1725 * <p> 1726 * if android.flash.available is true Flash is 1727 * charging and cannot be fired 1728 * </p> 1729 * @see CaptureResult#FLASH_STATE 1730 */ 1731 public static final int FLASH_STATE_CHARGING = 1; 1732 1733 /** 1734 * <p> 1735 * if android.flash.available is true Flash is 1736 * ready to fire 1737 * </p> 1738 * @see CaptureResult#FLASH_STATE 1739 */ 1740 public static final int FLASH_STATE_READY = 2; 1741 1742 /** 1743 * <p> 1744 * if android.flash.available is true Flash fired 1745 * for this capture 1746 * </p> 1747 * @see CaptureResult#FLASH_STATE 1748 */ 1749 public static final int FLASH_STATE_FIRED = 3; 1750 1751 // 1752 // Enumeration values for CaptureResult#LENS_STATE 1753 // 1754 1755 /** 1756 * @see CaptureResult#LENS_STATE 1757 */ 1758 public static final int LENS_STATE_STATIONARY = 0; 1759 1760 // 1761 // Enumeration values for CaptureResult#STATISTICS_SCENE_FLICKER 1762 // 1763 1764 /** 1765 * @see CaptureResult#STATISTICS_SCENE_FLICKER 1766 */ 1767 public static final int STATISTICS_SCENE_FLICKER_NONE = 0; 1768 1769 /** 1770 * @see CaptureResult#STATISTICS_SCENE_FLICKER 1771 */ 1772 public static final int STATISTICS_SCENE_FLICKER_50HZ = 1; 1773 1774 /** 1775 * @see CaptureResult#STATISTICS_SCENE_FLICKER 1776 */ 1777 public static final int STATISTICS_SCENE_FLICKER_60HZ = 2; 1778 1779 /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ 1780 * End generated code 1781 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ 1782 1783} 1784