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