summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Igor Murashkin <iam@google.com> 2013-07-13 01:14:46 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2013-07-13 01:14:46 +0000
commite1bc8d4eb8247416746116a80b0bc48dbb82b1df (patch)
tree18ed20f5c5e18c90dca995669cf46dee9b413afc
parentf9ad937d7a9676f463695a289cec8b3f3324cfbd (diff)
parentb9dd637f830e6bd4f257ffb2c807c3ea27f8feee (diff)
Merge "camera2 api: Generate metadata keys and enums from XML"
-rw-r--r--core/java/android/hardware/photography/CameraMetadata.java92
-rw-r--r--core/java/android/hardware/photography/CameraPropertiesKeys.java429
-rw-r--r--core/java/android/hardware/photography/CaptureRequestKeys.java829
-rw-r--r--core/java/android/hardware/photography/CaptureResultKeys.java620
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java70
5 files changed, 2027 insertions, 13 deletions
diff --git a/core/java/android/hardware/photography/CameraMetadata.java b/core/java/android/hardware/photography/CameraMetadata.java
index 1988967d7f2e..a1416cc2cd6e 100644
--- a/core/java/android/hardware/photography/CameraMetadata.java
+++ b/core/java/android/hardware/photography/CameraMetadata.java
@@ -258,7 +258,7 @@ public class CameraMetadata implements Parcelable, AutoCloseable {
int nativeType, boolean sizeOnly) {
// TODO: add support for enums with their own values.
- return packSingleNative(value.ordinal(), buffer, Integer.TYPE, nativeType, sizeOnly);
+ return packSingleNative(getEnumValue(value), buffer, Integer.TYPE, nativeType, sizeOnly);
}
@SuppressWarnings("unchecked")
@@ -552,19 +552,8 @@ public class CameraMetadata implements Parcelable, AutoCloseable {
private static <T extends Enum<T>> T unpackEnum(ByteBuffer buffer, Class<T> type,
int nativeType) {
-
- // TODO: add support for enums with their own values.
-
- T[] values = type.getEnumConstants();
int ordinal = unpackSingleNative(buffer, Integer.TYPE, nativeType);
-
- if (ordinal < 0 || ordinal >= values.length) {
- Log.e(TAG, String.format("Got invalid enum value %d for type %s, assuming it's 0",
- ordinal, type));
- ordinal = 0;
- }
-
- return values[ordinal];
+ return getEnumFromValue(type, ordinal);
}
private static <T> T unpackClass(ByteBuffer buffer, Class<T> type, int nativeType) {
@@ -857,6 +846,83 @@ public class CameraMetadata implements Parcelable, AutoCloseable {
}
}
+ private static final HashMap<Class<? extends Enum>, int[]> sEnumValues =
+ new HashMap<Class<? extends Enum>, int[]>();
+ /**
+ * Register a non-sequential set of values to be used with the pack/unpack functions.
+ * This enables get/set to correctly marshal the enum into a value that is C-compatible.
+ *
+ * @param enumType the class for an enum
+ * @param values a list of values mapping to the ordinals of the enum
+ *
+ * @hide
+ */
+ public static <T extends Enum<T>> void registerEnumValues(Class<T> enumType, int[] values) {
+ if (enumType.getEnumConstants().length != values.length) {
+ throw new IllegalArgumentException(
+ "Expected values array to be the same size as the enumTypes values "
+ + values.length + " for type " + enumType);
+ }
+
+ sEnumValues.put(enumType, values);
+ }
+
+ /**
+ * Get the numeric value from an enum. This is usually the same as the ordinal value for
+ * enums that have fully sequential values, although for C-style enums the range of values
+ * may not map 1:1.
+ *
+ * @param enumValue enum instance
+ * @return int guaranteed to be ABI-compatible with the C enum equivalent
+ */
+ private static <T extends Enum<T>> int getEnumValue(T enumValue) {
+ int[] values;
+ values = sEnumValues.get(enumValue.getClass());
+
+ int ordinal = enumValue.ordinal();
+ if (values != null) {
+ return values[ordinal];
+ }
+
+ return ordinal;
+ }
+
+ /**
+ * Finds the enum corresponding to it's numeric value. Opposite of {@link #getEnumValue} method.
+ *
+ * @param enumType class of the enum we want to find
+ * @param value the numeric value of the enum
+ * @return an instance of the enum
+ */
+ private static <T extends Enum<T>> T getEnumFromValue(Class<T> enumType, int value) {
+ int ordinal;
+
+ int[] registeredValues = sEnumValues.get(enumType);
+ if (registeredValues != null) {
+ ordinal = -1;
+
+ for (int i = 0; i < registeredValues.length; ++i) {
+ if (registeredValues[i] == value) {
+ ordinal = i;
+ break;
+ }
+ }
+ } else {
+ ordinal = value;
+ }
+
+ T[] values = enumType.getEnumConstants();
+
+ if (ordinal < 0 || ordinal >= values.length) {
+ throw new IllegalArgumentException(
+ String.format(
+ "Argument 'value' (%d) was not a valid enum value for type %s", value,
+ enumType));
+ }
+
+ return values[ordinal];
+ }
+
/**
* We use a class initializer to allow the native code to cache some field offsets
*/
diff --git a/core/java/android/hardware/photography/CameraPropertiesKeys.java b/core/java/android/hardware/photography/CameraPropertiesKeys.java
new file mode 100644
index 000000000000..2bf50afaa0e8
--- /dev/null
+++ b/core/java/android/hardware/photography/CameraPropertiesKeys.java
@@ -0,0 +1,429 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.photography;
+
+import static android.hardware.photography.CameraMetadata.Key;
+
+/**
+ * ! Do not edit this file directly !
+ *
+ * Generated automatically from CameraPropertiesKeys.mako
+ *
+ * TODO: Include a hash of the input files here that the build can check.
+ */
+
+/**
+ * The base class for camera controls and information.
+ *
+ * This class defines the basic key/value map used for querying for camera
+ * characteristics or capture results, and for setting camera request
+ * parameters.
+ *
+ * @see CameraProperties
+ * @see CameraMetadata
+ * @hide
+ **/
+public final class CameraPropertiesKeys {
+ public static final class Control {
+
+ public static final Key<byte[]> AE_AVAILABLE_ANTIBANDING_MODES =
+ new Key<byte[]>("android.control.aeAvailableAntibandingModes", byte[].class);
+ public static final Key<byte[]> AE_AVAILABLE_MODES =
+ new Key<byte[]>("android.control.aeAvailableModes", byte[].class);
+ public static final Key<int[]> AE_AVAILABLE_TARGET_FPS_RANGES =
+ new Key<int[]>("android.control.aeAvailableTargetFpsRanges", int[].class);
+ public static final Key<int[]> AE_COMPENSATION_RANGE =
+ new Key<int[]>("android.control.aeCompensationRange", int[].class);
+ public static final Key<Rational> AE_COMPENSATION_STEP =
+ new Key<Rational>("android.control.aeCompensationStep", Rational.class);
+ public static final Key<byte[]> AF_AVAILABLE_MODES =
+ new Key<byte[]>("android.control.afAvailableModes", byte[].class);
+ public static final Key<byte[]> AVAILABLE_EFFECTS =
+ new Key<byte[]>("android.control.availableEffects", byte[].class);
+ public static final Key<byte[]> AVAILABLE_SCENE_MODES =
+ new Key<byte[]>("android.control.availableSceneModes", byte[].class);
+ public static final Key<byte[]> AVAILABLE_VIDEO_STABILIZATION_MODES =
+ new Key<byte[]>("android.control.availableVideoStabilizationModes", byte[].class);
+ public static final Key<byte[]> AWB_AVAILABLE_MODES =
+ new Key<byte[]>("android.control.awbAvailableModes", byte[].class);
+ public static final Key<Integer> MAX_REGIONS =
+ new Key<Integer>("android.control.maxRegions", int.class);
+ public static final Key<byte[]> SCENE_MODE_OVERRIDES =
+ new Key<byte[]>("android.control.sceneModeOverrides", byte[].class);
+
+ }
+ public static final class Flash {
+ public static final class Info {
+ public static final Key<Byte> AVAILABLE =
+ new Key<Byte>("android.flash.info.available", byte.class);
+ public static final Key<Long> CHARGE_DURATION =
+ new Key<Long>("android.flash.info.chargeDuration", long.class);
+ }
+
+ public static final Key<Byte> COLOR_TEMPERATURE =
+ new Key<Byte>("android.flash.colorTemperature", byte.class);
+ public static final Key<Byte> MAX_ENERGY =
+ new Key<Byte>("android.flash.maxEnergy", byte.class);
+
+ }
+ public static final class HotPixel {
+ public static final class Info {
+ public static final Key<int[]> MAP =
+ new Key<int[]>("android.hotPixel.info.map", int[].class);
+ }
+
+
+ }
+ public static final class Jpeg {
+
+ public static final Key<int[]> AVAILABLE_THUMBNAIL_SIZES =
+ new Key<int[]>("android.jpeg.availableThumbnailSizes", int[].class);
+ public static final Key<Integer> MAX_SIZE =
+ new Key<Integer>("android.jpeg.maxSize", int.class);
+
+ }
+ public static final class Lens {
+ public static final class Info {
+ public static final Key<float[]> AVAILABLE_APERTURES =
+ new Key<float[]>("android.lens.info.availableApertures", float[].class);
+ public static final Key<float[]> AVAILABLE_FILTER_DENSITIES =
+ new Key<float[]>("android.lens.info.availableFilterDensities", float[].class);
+ public static final Key<float[]> AVAILABLE_FOCAL_LENGTHS =
+ new Key<float[]>("android.lens.info.availableFocalLengths", float[].class);
+ public static final Key<byte[]> AVAILABLE_OPTICAL_STABILIZATION =
+ new Key<byte[]>("android.lens.info.availableOpticalStabilization", byte[].class);
+ public static final Key<float[]> GEOMETRIC_CORRECTION_MAP =
+ new Key<float[]>("android.lens.info.geometricCorrectionMap", float[].class);
+ public static final Key<int[]> GEOMETRIC_CORRECTION_MAP_SIZE =
+ new Key<int[]>("android.lens.info.geometricCorrectionMapSize", int[].class);
+ public static final Key<Float> HYPERFOCAL_DISTANCE =
+ new Key<Float>("android.lens.info.hyperfocalDistance", float.class);
+ public static final Key<Float> MINIMUM_FOCUS_DISTANCE =
+ new Key<Float>("android.lens.info.minimumFocusDistance", float.class);
+ public static final Key<float[]> SHADING_MAP =
+ new Key<float[]>("android.lens.info.shadingMap", float[].class);
+ public static final Key<int[]> SHADING_MAP_SIZE =
+ new Key<int[]>("android.lens.info.shadingMapSize", int[].class);
+ }
+
+
+ public static final class FacingKey extends Key<Lens.FacingKey.Enum> {
+ public enum Enum {
+ FRONT,
+ BACK;
+ }
+
+ public static final Enum FRONT = Enum.FRONT;
+ public static final Enum BACK = Enum.BACK;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private FacingKey(String name) {
+ super(name, Lens.FacingKey.Enum.class);
+ }
+ }
+
+ public static final Key<Lens.FacingKey.Enum> FACING =
+ new FacingKey("android.lens.facing");
+ public static final Key<float[]> OPTICAL_AXIS_ANGLE =
+ new Key<float[]>("android.lens.opticalAxisAngle", float[].class);
+ public static final Key<float[]> POSITION =
+ new Key<float[]>("android.lens.position", float[].class);
+
+ }
+ public static final class Quirks {
+
+ public static final Key<Byte> METERING_CROP_REGION =
+ new Key<Byte>("android.quirks.meteringCropRegion", byte.class);
+ public static final Key<Byte> TRIGGER_AF_WITH_AUTO =
+ new Key<Byte>("android.quirks.triggerAfWithAuto", byte.class);
+ public static final Key<Byte> USE_ZSL_FORMAT =
+ new Key<Byte>("android.quirks.useZslFormat", byte.class);
+
+ }
+ public static final class Request {
+
+ public static final Key<int[]> MAX_NUM_OUTPUT_STREAMS =
+ new Key<int[]>("android.request.maxNumOutputStreams", int[].class);
+ public static final Key<int[]> MAX_NUM_REPROCESS_STREAMS =
+ new Key<int[]>("android.request.maxNumReprocessStreams", int[].class);
+
+ }
+ public static final class Scaler {
+
+
+ public static final class AvailableFormatsKey extends Key<Scaler.AvailableFormatsKey.Enum[]> {
+ public enum Enum {
+ RAW_SENSOR,
+ YV12,
+ YCrCb_420_SP,
+ IMPLEMENTATION_DEFINED,
+ YCbCr_420_888,
+ BLOB;
+ }
+
+ public static final Enum RAW_SENSOR = Enum.RAW_SENSOR;
+ public static final Enum YV12 = Enum.YV12;
+ public static final Enum YCrCb_420_SP = Enum.YCrCb_420_SP;
+ public static final Enum IMPLEMENTATION_DEFINED = Enum.IMPLEMENTATION_DEFINED;
+ public static final Enum YCbCr_420_888 = Enum.YCbCr_420_888;
+ public static final Enum BLOB = Enum.BLOB;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AvailableFormatsKey(String name) {
+ super(name, Scaler.AvailableFormatsKey.Enum[].class);
+ }
+ }
+
+ public static final Key<Scaler.AvailableFormatsKey.Enum[]> AVAILABLE_FORMATS =
+ new AvailableFormatsKey("android.scaler.availableFormats");
+ public static final Key<long[]> AVAILABLE_JPEG_MIN_DURATIONS =
+ new Key<long[]>("android.scaler.availableJpegMinDurations", long[].class);
+ public static final Key<int[]> AVAILABLE_JPEG_SIZES =
+ new Key<int[]>("android.scaler.availableJpegSizes", int[].class);
+ public static final Key<Float> AVAILABLE_MAX_DIGITAL_ZOOM =
+ new Key<Float>("android.scaler.availableMaxDigitalZoom", float.class);
+ public static final Key<long[]> AVAILABLE_PROCESSED_MIN_DURATIONS =
+ new Key<long[]>("android.scaler.availableProcessedMinDurations", long[].class);
+ public static final Key<int[]> AVAILABLE_PROCESSED_SIZES =
+ new Key<int[]>("android.scaler.availableProcessedSizes", int[].class);
+ public static final Key<long[]> AVAILABLE_RAW_MIN_DURATIONS =
+ new Key<long[]>("android.scaler.availableRawMinDurations", long[].class);
+ public static final Key<int[]> AVAILABLE_RAW_SIZES =
+ new Key<int[]>("android.scaler.availableRawSizes", int[].class);
+
+ }
+ public static final class Sensor {
+ public static final class Info {
+ public static final Key<int[]> ACTIVE_ARRAY_SIZE =
+ new Key<int[]>("android.sensor.info.activeArraySize", int[].class);
+ public static final Key<int[]> AVAILABLE_SENSITIVITIES =
+ new Key<int[]>("android.sensor.info.availableSensitivities", int[].class);
+
+ public static final class ColorFilterArrangementKey extends Key<Sensor.Info.ColorFilterArrangementKey.Enum> {
+ public enum Enum {
+ RGGB,
+ GRBG,
+ GBRG,
+ BGGR,
+ RGB;
+ }
+
+ public static final Enum RGGB = Enum.RGGB;
+ public static final Enum GRBG = Enum.GRBG;
+ public static final Enum GBRG = Enum.GBRG;
+ public static final Enum BGGR = Enum.BGGR;
+ public static final Enum RGB = Enum.RGB;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ColorFilterArrangementKey(String name) {
+ super(name, Sensor.Info.ColorFilterArrangementKey.Enum.class);
+ }
+ }
+
+ public static final Key<Sensor.Info.ColorFilterArrangementKey.Enum> COLOR_FILTER_ARRANGEMENT =
+ new ColorFilterArrangementKey("android.sensor.info.colorFilterArrangement");
+ public static final Key<long[]> EXPOSURE_TIME_RANGE =
+ new Key<long[]>("android.sensor.info.exposureTimeRange", long[].class);
+ public static final Key<Long> MAX_FRAME_DURATION =
+ new Key<Long>("android.sensor.info.maxFrameDuration", long.class);
+ public static final Key<float[]> PHYSICAL_SIZE =
+ new Key<float[]>("android.sensor.info.physicalSize", float[].class);
+ public static final Key<int[]> PIXEL_ARRAY_SIZE =
+ new Key<int[]>("android.sensor.info.pixelArraySize", int[].class);
+ public static final Key<Integer> WHITE_LEVEL =
+ new Key<Integer>("android.sensor.info.whiteLevel", int.class);
+ }
+
+ public static final Key<Rational> BASE_GAIN_FACTOR =
+ new Key<Rational>("android.sensor.baseGainFactor", Rational.class);
+ public static final Key<int[]> BLACK_LEVEL_PATTERN =
+ new Key<int[]>("android.sensor.blackLevelPattern", int[].class);
+ public static final Key<Rational[]> CALIBRATION_TRANSFORM1 =
+ new Key<Rational[]>("android.sensor.calibrationTransform1", Rational[].class);
+ public static final Key<Rational[]> CALIBRATION_TRANSFORM2 =
+ new Key<Rational[]>("android.sensor.calibrationTransform2", Rational[].class);
+ public static final Key<Rational[]> COLOR_TRANSFORM1 =
+ new Key<Rational[]>("android.sensor.colorTransform1", Rational[].class);
+ public static final Key<Rational[]> COLOR_TRANSFORM2 =
+ new Key<Rational[]>("android.sensor.colorTransform2", Rational[].class);
+ public static final Key<Rational[]> FORWARD_MATRIX1 =
+ new Key<Rational[]>("android.sensor.forwardMatrix1", Rational[].class);
+ public static final Key<Rational[]> FORWARD_MATRIX2 =
+ new Key<Rational[]>("android.sensor.forwardMatrix2", Rational[].class);
+ public static final Key<Integer> MAX_ANALOG_SENSITIVITY =
+ new Key<Integer>("android.sensor.maxAnalogSensitivity", int.class);
+ public static final Key<float[]> NOISE_MODEL_COEFFICIENTS =
+ new Key<float[]>("android.sensor.noiseModelCoefficients", float[].class);
+ public static final Key<Integer> ORIENTATION =
+ new Key<Integer>("android.sensor.orientation", int.class);
+
+ public static final class ReferenceIlluminant1Key extends Key<Sensor.ReferenceIlluminant1Key.Enum> {
+ public enum Enum {
+ DAYLIGHT,
+ FLUORESCENT,
+ TUNGSTEN,
+ FLASH,
+ FINE_WEATHER,
+ CLOUDY_WEATHER,
+ SHADE,
+ DAYLIGHT_FLUORESCENT,
+ DAY_WHITE_FLUORESCENT,
+ COOL_WHITE_FLUORESCENT,
+ WHITE_FLUORESCENT,
+ STANDARD_A,
+ STANDARD_B,
+ STANDARD_C,
+ D55,
+ D65,
+ D75,
+ D50,
+ ISO_STUDIO_TUNGSTEN;
+ }
+
+ public static final Enum DAYLIGHT = Enum.DAYLIGHT;
+ public static final Enum FLUORESCENT = Enum.FLUORESCENT;
+ public static final Enum TUNGSTEN = Enum.TUNGSTEN;
+ public static final Enum FLASH = Enum.FLASH;
+ public static final Enum FINE_WEATHER = Enum.FINE_WEATHER;
+ public static final Enum CLOUDY_WEATHER = Enum.CLOUDY_WEATHER;
+ public static final Enum SHADE = Enum.SHADE;
+ public static final Enum DAYLIGHT_FLUORESCENT = Enum.DAYLIGHT_FLUORESCENT;
+ public static final Enum DAY_WHITE_FLUORESCENT = Enum.DAY_WHITE_FLUORESCENT;
+ public static final Enum COOL_WHITE_FLUORESCENT = Enum.COOL_WHITE_FLUORESCENT;
+ public static final Enum WHITE_FLUORESCENT = Enum.WHITE_FLUORESCENT;
+ public static final Enum STANDARD_A = Enum.STANDARD_A;
+ public static final Enum STANDARD_B = Enum.STANDARD_B;
+ public static final Enum STANDARD_C = Enum.STANDARD_C;
+ public static final Enum D55 = Enum.D55;
+ public static final Enum D65 = Enum.D65;
+ public static final Enum D75 = Enum.D75;
+ public static final Enum D50 = Enum.D50;
+ public static final Enum ISO_STUDIO_TUNGSTEN = Enum.ISO_STUDIO_TUNGSTEN;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ReferenceIlluminant1Key(String name) {
+ super(name, Sensor.ReferenceIlluminant1Key.Enum.class);
+ }
+ }
+
+ public static final Key<Sensor.ReferenceIlluminant1Key.Enum> REFERENCE_ILLUMINANT1 =
+ new ReferenceIlluminant1Key("android.sensor.referenceIlluminant1");
+ public static final Key<Byte> REFERENCE_ILLUMINANT2 =
+ new Key<Byte>("android.sensor.referenceIlluminant2", byte.class);
+
+ }
+ public static final class Statistics {
+ public static final class Info {
+ public static final Key<byte[]> AVAILABLE_FACE_DETECT_MODES =
+ new Key<byte[]>("android.statistics.info.availableFaceDetectModes", byte[].class);
+ public static final Key<Integer> HISTOGRAM_BUCKET_COUNT =
+ new Key<Integer>("android.statistics.info.histogramBucketCount", int.class);
+ public static final Key<Integer> MAX_FACE_COUNT =
+ new Key<Integer>("android.statistics.info.maxFaceCount", int.class);
+ public static final Key<Integer> MAX_HISTOGRAM_COUNT =
+ new Key<Integer>("android.statistics.info.maxHistogramCount", int.class);
+ public static final Key<Integer> MAX_SHARPNESS_MAP_VALUE =
+ new Key<Integer>("android.statistics.info.maxSharpnessMapValue", int.class);
+ public static final Key<int[]> SHARPNESS_MAP_SIZE =
+ new Key<int[]>("android.statistics.info.sharpnessMapSize", int[].class);
+ }
+
+
+ }
+ public static final class Tonemap {
+
+ public static final Key<Integer> MAX_CURVE_POINTS =
+ new Key<Integer>("android.tonemap.maxCurvePoints", int.class);
+
+ }
+ public static final class Led {
+
+
+ public static final class AvailableLedsKey extends Key<Led.AvailableLedsKey.Enum[]> {
+ public enum Enum {
+ TRANSMIT;
+ }
+
+ public static final Enum TRANSMIT = Enum.TRANSMIT;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AvailableLedsKey(String name) {
+ super(name, Led.AvailableLedsKey.Enum[].class);
+ }
+ }
+
+ public static final Key<Led.AvailableLedsKey.Enum[]> AVAILABLE_LEDS =
+ new AvailableLedsKey("android.led.availableLeds");
+
+ }
+ public static final class Info {
+
+
+ public static final class SupportedHardwareLevelKey extends Key<Info.SupportedHardwareLevelKey.Enum> {
+ public enum Enum {
+ LIMITED,
+ FULL;
+ }
+
+ public static final Enum LIMITED = Enum.LIMITED;
+ public static final Enum FULL = Enum.FULL;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private SupportedHardwareLevelKey(String name) {
+ super(name, Info.SupportedHardwareLevelKey.Enum.class);
+ }
+ }
+
+ public static final Key<Info.SupportedHardwareLevelKey.Enum> SUPPORTED_HARDWARE_LEVEL =
+ new SupportedHardwareLevelKey("android.info.supportedHardwareLevel");
+
+ }
+
+ static {
+ CameraMetadata.registerEnumValues(Scaler.AvailableFormatsKey.Enum.class, new int[] {
+ 0x20, // RAW_SENSOR
+ 0x32315659, // YV12
+ 0x11, // YCrCb_420_SP
+ 0x22, // IMPLEMENTATION_DEFINED
+ 0x23, // YCbCr_420_888
+ 0x21, // BLOB
+ });
+ CameraMetadata.registerEnumValues(Sensor.ReferenceIlluminant1Key.Enum.class, new int[] {
+ 1, // DAYLIGHT
+ 2, // FLUORESCENT
+ 3, // TUNGSTEN
+ 4, // FLASH
+ 9, // FINE_WEATHER
+ 10, // CLOUDY_WEATHER
+ 11, // SHADE
+ 12, // DAYLIGHT_FLUORESCENT
+ 13, // DAY_WHITE_FLUORESCENT
+ 14, // COOL_WHITE_FLUORESCENT
+ 15, // WHITE_FLUORESCENT
+ 17, // STANDARD_A
+ 18, // STANDARD_B
+ 19, // STANDARD_C
+ 20, // D55
+ 21, // D65
+ 22, // D75
+ 23, // D50
+ 24, // ISO_STUDIO_TUNGSTEN
+ });
+ }
+}
+
+
diff --git a/core/java/android/hardware/photography/CaptureRequestKeys.java b/core/java/android/hardware/photography/CaptureRequestKeys.java
new file mode 100644
index 000000000000..579ab14078ff
--- /dev/null
+++ b/core/java/android/hardware/photography/CaptureRequestKeys.java
@@ -0,0 +1,829 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.photography;
+
+import static android.hardware.photography.CameraMetadata.Key;
+
+/**
+ * ! Do not edit this file directly !
+ *
+ * Generated automatically from CaptureRequestKeys.mako
+ *
+ * TODO: Include a hash of the input files here that the build can check.
+ */
+
+/**
+ * The base class for camera controls and information.
+ *
+ * This class defines the basic key/value map used for querying for camera
+ * characteristics or capture results, and for setting camera request
+ * parameters.
+ *
+ * @see CaptureRequest
+ * @see CameraMetadata
+ * @hide
+ **/
+public final class CaptureRequestKeys {
+ public static final class ColorCorrection {
+
+
+ public static final class ModeKey extends Key<ColorCorrection.ModeKey.Enum> {
+ public enum Enum {
+ TRANSFORM_MATRIX,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum TRANSFORM_MATRIX = Enum.TRANSFORM_MATRIX;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, ColorCorrection.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<ColorCorrection.ModeKey.Enum> MODE =
+ new ModeKey("android.colorCorrection.mode");
+ public static final Key<float[]> TRANSFORM =
+ new Key<float[]>("android.colorCorrection.transform", float[].class);
+
+ }
+ public static final class Control {
+
+
+ public static final class AeAntibandingModeKey extends Key<Control.AeAntibandingModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ _50HZ,
+ _60HZ,
+ AUTO;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum _50HZ = Enum._50HZ;
+ public static final Enum _60HZ = Enum._60HZ;
+ public static final Enum AUTO = Enum.AUTO;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AeAntibandingModeKey(String name) {
+ super(name, Control.AeAntibandingModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AeAntibandingModeKey.Enum> AE_ANTIBANDING_MODE =
+ new AeAntibandingModeKey("android.control.aeAntibandingMode");
+ public static final Key<Integer> AE_EXPOSURE_COMPENSATION =
+ new Key<Integer>("android.control.aeExposureCompensation", int.class);
+
+ public static final class AeLockKey extends Key<Control.AeLockKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AeLockKey(String name) {
+ super(name, Control.AeLockKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AeLockKey.Enum> AE_LOCK =
+ new AeLockKey("android.control.aeLock");
+
+ public static final class AeModeKey extends Key<Control.AeModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON,
+ ON_AUTO_FLASH,
+ ON_ALWAYS_FLASH,
+ ON_AUTO_FLASH_REDEYE;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+ public static final Enum ON_AUTO_FLASH = Enum.ON_AUTO_FLASH;
+ public static final Enum ON_ALWAYS_FLASH = Enum.ON_ALWAYS_FLASH;
+ public static final Enum ON_AUTO_FLASH_REDEYE = Enum.ON_AUTO_FLASH_REDEYE;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AeModeKey(String name) {
+ super(name, Control.AeModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AeModeKey.Enum> AE_MODE =
+ new AeModeKey("android.control.aeMode");
+ public static final Key<int[]> AE_REGIONS =
+ new Key<int[]>("android.control.aeRegions", int[].class);
+ public static final Key<int[]> AE_TARGET_FPS_RANGE =
+ new Key<int[]>("android.control.aeTargetFpsRange", int[].class);
+
+ public static final class AePrecaptureTriggerKey extends Key<Control.AePrecaptureTriggerKey.Enum> {
+ public enum Enum {
+ IDLE,
+ START;
+ }
+
+ public static final Enum IDLE = Enum.IDLE;
+ public static final Enum START = Enum.START;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AePrecaptureTriggerKey(String name) {
+ super(name, Control.AePrecaptureTriggerKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AePrecaptureTriggerKey.Enum> AE_PRECAPTURE_TRIGGER =
+ new AePrecaptureTriggerKey("android.control.aePrecaptureTrigger");
+
+ public static final class AfModeKey extends Key<Control.AfModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ AUTO,
+ MACRO,
+ CONTINUOUS_VIDEO,
+ CONTINUOUS_PICTURE,
+ EDOF;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum AUTO = Enum.AUTO;
+ public static final Enum MACRO = Enum.MACRO;
+ public static final Enum CONTINUOUS_VIDEO = Enum.CONTINUOUS_VIDEO;
+ public static final Enum CONTINUOUS_PICTURE = Enum.CONTINUOUS_PICTURE;
+ public static final Enum EDOF = Enum.EDOF;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AfModeKey(String name) {
+ super(name, Control.AfModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AfModeKey.Enum> AF_MODE =
+ new AfModeKey("android.control.afMode");
+ public static final Key<int[]> AF_REGIONS =
+ new Key<int[]>("android.control.afRegions", int[].class);
+
+ public static final class AfTriggerKey extends Key<Control.AfTriggerKey.Enum> {
+ public enum Enum {
+ IDLE,
+ START,
+ CANCEL;
+ }
+
+ public static final Enum IDLE = Enum.IDLE;
+ public static final Enum START = Enum.START;
+ public static final Enum CANCEL = Enum.CANCEL;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AfTriggerKey(String name) {
+ super(name, Control.AfTriggerKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AfTriggerKey.Enum> AF_TRIGGER =
+ new AfTriggerKey("android.control.afTrigger");
+
+ public static final class AwbLockKey extends Key<Control.AwbLockKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AwbLockKey(String name) {
+ super(name, Control.AwbLockKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AwbLockKey.Enum> AWB_LOCK =
+ new AwbLockKey("android.control.awbLock");
+
+ public static final class AwbModeKey extends Key<Control.AwbModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ AUTO,
+ INCANDESCENT,
+ FLUORESCENT,
+ WARM_FLUORESCENT,
+ DAYLIGHT,
+ CLOUDY_DAYLIGHT,
+ TWILIGHT,
+ SHADE;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum AUTO = Enum.AUTO;
+ public static final Enum INCANDESCENT = Enum.INCANDESCENT;
+ public static final Enum FLUORESCENT = Enum.FLUORESCENT;
+ public static final Enum WARM_FLUORESCENT = Enum.WARM_FLUORESCENT;
+ public static final Enum DAYLIGHT = Enum.DAYLIGHT;
+ public static final Enum CLOUDY_DAYLIGHT = Enum.CLOUDY_DAYLIGHT;
+ public static final Enum TWILIGHT = Enum.TWILIGHT;
+ public static final Enum SHADE = Enum.SHADE;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AwbModeKey(String name) {
+ super(name, Control.AwbModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AwbModeKey.Enum> AWB_MODE =
+ new AwbModeKey("android.control.awbMode");
+ public static final Key<int[]> AWB_REGIONS =
+ new Key<int[]>("android.control.awbRegions", int[].class);
+
+ public static final class CaptureIntentKey extends Key<Control.CaptureIntentKey.Enum> {
+ public enum Enum {
+ CUSTOM,
+ PREVIEW,
+ STILL_CAPTURE,
+ VIDEO_RECORD,
+ VIDEO_SNAPSHOT,
+ ZERO_SHUTTER_LAG;
+ }
+
+ public static final Enum CUSTOM = Enum.CUSTOM;
+ public static final Enum PREVIEW = Enum.PREVIEW;
+ public static final Enum STILL_CAPTURE = Enum.STILL_CAPTURE;
+ public static final Enum VIDEO_RECORD = Enum.VIDEO_RECORD;
+ public static final Enum VIDEO_SNAPSHOT = Enum.VIDEO_SNAPSHOT;
+ public static final Enum ZERO_SHUTTER_LAG = Enum.ZERO_SHUTTER_LAG;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private CaptureIntentKey(String name) {
+ super(name, Control.CaptureIntentKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.CaptureIntentKey.Enum> CAPTURE_INTENT =
+ new CaptureIntentKey("android.control.captureIntent");
+
+ public static final class EffectModeKey extends Key<Control.EffectModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ MONO,
+ NEGATIVE,
+ SOLARIZE,
+ SEPIA,
+ POSTERIZE,
+ WHITEBOARD,
+ BLACKBOARD,
+ AQUA;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum MONO = Enum.MONO;
+ public static final Enum NEGATIVE = Enum.NEGATIVE;
+ public static final Enum SOLARIZE = Enum.SOLARIZE;
+ public static final Enum SEPIA = Enum.SEPIA;
+ public static final Enum POSTERIZE = Enum.POSTERIZE;
+ public static final Enum WHITEBOARD = Enum.WHITEBOARD;
+ public static final Enum BLACKBOARD = Enum.BLACKBOARD;
+ public static final Enum AQUA = Enum.AQUA;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private EffectModeKey(String name) {
+ super(name, Control.EffectModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.EffectModeKey.Enum> EFFECT_MODE =
+ new EffectModeKey("android.control.effectMode");
+
+ public static final class ModeKey extends Key<Control.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ AUTO,
+ USE_SCENE_MODE;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum AUTO = Enum.AUTO;
+ public static final Enum USE_SCENE_MODE = Enum.USE_SCENE_MODE;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Control.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.ModeKey.Enum> MODE =
+ new ModeKey("android.control.mode");
+
+ public static final class SceneModeKey extends Key<Control.SceneModeKey.Enum> {
+ public enum Enum {
+ UNSUPPORTED,
+ FACE_PRIORITY,
+ ACTION,
+ PORTRAIT,
+ LANDSCAPE,
+ NIGHT,
+ NIGHT_PORTRAIT,
+ THEATRE,
+ BEACH,
+ SNOW,
+ SUNSET,
+ STEADYPHOTO,
+ FIREWORKS,
+ SPORTS,
+ PARTY,
+ CANDLELIGHT,
+ BARCODE;
+ }
+
+ public static final Enum UNSUPPORTED = Enum.UNSUPPORTED;
+ public static final Enum FACE_PRIORITY = Enum.FACE_PRIORITY;
+ public static final Enum ACTION = Enum.ACTION;
+ public static final Enum PORTRAIT = Enum.PORTRAIT;
+ public static final Enum LANDSCAPE = Enum.LANDSCAPE;
+ public static final Enum NIGHT = Enum.NIGHT;
+ public static final Enum NIGHT_PORTRAIT = Enum.NIGHT_PORTRAIT;
+ public static final Enum THEATRE = Enum.THEATRE;
+ public static final Enum BEACH = Enum.BEACH;
+ public static final Enum SNOW = Enum.SNOW;
+ public static final Enum SUNSET = Enum.SUNSET;
+ public static final Enum STEADYPHOTO = Enum.STEADYPHOTO;
+ public static final Enum FIREWORKS = Enum.FIREWORKS;
+ public static final Enum SPORTS = Enum.SPORTS;
+ public static final Enum PARTY = Enum.PARTY;
+ public static final Enum CANDLELIGHT = Enum.CANDLELIGHT;
+ public static final Enum BARCODE = Enum.BARCODE;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private SceneModeKey(String name) {
+ super(name, Control.SceneModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.SceneModeKey.Enum> SCENE_MODE =
+ new SceneModeKey("android.control.sceneMode");
+
+ public static final class VideoStabilizationModeKey extends Key<Control.VideoStabilizationModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private VideoStabilizationModeKey(String name) {
+ super(name, Control.VideoStabilizationModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.VideoStabilizationModeKey.Enum> VIDEO_STABILIZATION_MODE =
+ new VideoStabilizationModeKey("android.control.videoStabilizationMode");
+
+ }
+ public static final class Demosaic {
+
+
+ public static final class ModeKey extends Key<Demosaic.ModeKey.Enum> {
+ public enum Enum {
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Demosaic.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Demosaic.ModeKey.Enum> MODE =
+ new ModeKey("android.demosaic.mode");
+
+ }
+ public static final class Edge {
+
+
+ public static final class ModeKey extends Key<Edge.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Edge.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Edge.ModeKey.Enum> MODE =
+ new ModeKey("android.edge.mode");
+ public static final Key<Byte> STRENGTH =
+ new Key<Byte>("android.edge.strength", byte.class);
+
+ }
+ public static final class Flash {
+
+ public static final Key<Byte> FIRING_POWER =
+ new Key<Byte>("android.flash.firingPower", byte.class);
+ public static final Key<Long> FIRING_TIME =
+ new Key<Long>("android.flash.firingTime", long.class);
+
+ public static final class ModeKey extends Key<Flash.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ SINGLE,
+ TORCH;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum SINGLE = Enum.SINGLE;
+ public static final Enum TORCH = Enum.TORCH;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Flash.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Flash.ModeKey.Enum> MODE =
+ new ModeKey("android.flash.mode");
+
+ }
+ public static final class Geometric {
+
+
+ public static final class ModeKey extends Key<Geometric.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Geometric.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Geometric.ModeKey.Enum> MODE =
+ new ModeKey("android.geometric.mode");
+ public static final Key<Byte> STRENGTH =
+ new Key<Byte>("android.geometric.strength", byte.class);
+
+ }
+ public static final class HotPixel {
+
+
+ public static final class ModeKey extends Key<HotPixel.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, HotPixel.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<HotPixel.ModeKey.Enum> MODE =
+ new ModeKey("android.hotPixel.mode");
+
+ }
+ public static final class Jpeg {
+
+ public static final Key<double[]> GPS_COORDINATES =
+ new Key<double[]>("android.jpeg.gpsCoordinates", double[].class);
+ public static final Key<Byte> GPS_PROCESSING_METHOD =
+ new Key<Byte>("android.jpeg.gpsProcessingMethod", byte.class);
+ public static final Key<Long> GPS_TIMESTAMP =
+ new Key<Long>("android.jpeg.gpsTimestamp", long.class);
+ public static final Key<Integer> ORIENTATION =
+ new Key<Integer>("android.jpeg.orientation", int.class);
+ public static final Key<Byte> QUALITY =
+ new Key<Byte>("android.jpeg.quality", byte.class);
+ public static final Key<Byte> THUMBNAIL_QUALITY =
+ new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
+ public static final Key<int[]> THUMBNAIL_SIZE =
+ new Key<int[]>("android.jpeg.thumbnailSize", int[].class);
+
+ }
+ public static final class Lens {
+
+ public static final Key<Float> APERTURE =
+ new Key<Float>("android.lens.aperture", float.class);
+ public static final Key<Float> FILTER_DENSITY =
+ new Key<Float>("android.lens.filterDensity", float.class);
+ public static final Key<Float> FOCAL_LENGTH =
+ new Key<Float>("android.lens.focalLength", float.class);
+ public static final Key<Float> FOCUS_DISTANCE =
+ new Key<Float>("android.lens.focusDistance", float.class);
+
+ public static final class OpticalStabilizationModeKey extends Key<Lens.OpticalStabilizationModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private OpticalStabilizationModeKey(String name) {
+ super(name, Lens.OpticalStabilizationModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Lens.OpticalStabilizationModeKey.Enum> OPTICAL_STABILIZATION_MODE =
+ new OpticalStabilizationModeKey("android.lens.opticalStabilizationMode");
+
+ }
+ public static final class NoiseReduction {
+
+
+ public static final class ModeKey extends Key<NoiseReduction.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, NoiseReduction.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<NoiseReduction.ModeKey.Enum> MODE =
+ new ModeKey("android.noiseReduction.mode");
+ public static final Key<Byte> STRENGTH =
+ new Key<Byte>("android.noiseReduction.strength", byte.class);
+
+ }
+ public static final class Request {
+
+ public static final Key<Integer> FRAME_COUNT =
+ new Key<Integer>("android.request.frameCount", int.class);
+ public static final Key<Integer> ID =
+ new Key<Integer>("android.request.id", int.class);
+ public static final Key<Byte> INPUT_STREAMS =
+ new Key<Byte>("android.request.inputStreams", byte.class);
+
+ public static final class MetadataModeKey extends Key<Request.MetadataModeKey.Enum> {
+ public enum Enum {
+ NONE,
+ FULL;
+ }
+
+ public static final Enum NONE = Enum.NONE;
+ public static final Enum FULL = Enum.FULL;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private MetadataModeKey(String name) {
+ super(name, Request.MetadataModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Request.MetadataModeKey.Enum> METADATA_MODE =
+ new MetadataModeKey("android.request.metadataMode");
+ public static final Key<Byte> OUTPUT_STREAMS =
+ new Key<Byte>("android.request.outputStreams", byte.class);
+
+ public static final class TypeKey extends Key<Request.TypeKey.Enum> {
+ public enum Enum {
+ CAPTURE,
+ REPROCESS;
+ }
+
+ public static final Enum CAPTURE = Enum.CAPTURE;
+ public static final Enum REPROCESS = Enum.REPROCESS;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private TypeKey(String name) {
+ super(name, Request.TypeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Request.TypeKey.Enum> TYPE =
+ new TypeKey("android.request.type");
+
+ }
+ public static final class Scaler {
+
+ public static final Key<int[]> CROP_REGION =
+ new Key<int[]>("android.scaler.cropRegion", int[].class);
+
+ }
+ public static final class Sensor {
+
+ public static final Key<Long> EXPOSURE_TIME =
+ new Key<Long>("android.sensor.exposureTime", long.class);
+ public static final Key<Long> FRAME_DURATION =
+ new Key<Long>("android.sensor.frameDuration", long.class);
+ public static final Key<Integer> SENSITIVITY =
+ new Key<Integer>("android.sensor.sensitivity", int.class);
+
+ }
+ public static final class Shading {
+
+
+ public static final class ModeKey extends Key<Shading.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Shading.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Shading.ModeKey.Enum> MODE =
+ new ModeKey("android.shading.mode");
+ public static final Key<Byte> STRENGTH =
+ new Key<Byte>("android.shading.strength", byte.class);
+
+ }
+ public static final class Statistics {
+
+
+ public static final class FaceDetectModeKey extends Key<Statistics.FaceDetectModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ SIMPLE,
+ FULL;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum SIMPLE = Enum.SIMPLE;
+ public static final Enum FULL = Enum.FULL;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private FaceDetectModeKey(String name) {
+ super(name, Statistics.FaceDetectModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Statistics.FaceDetectModeKey.Enum> FACE_DETECT_MODE =
+ new FaceDetectModeKey("android.statistics.faceDetectMode");
+
+ public static final class HistogramModeKey extends Key<Statistics.HistogramModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private HistogramModeKey(String name) {
+ super(name, Statistics.HistogramModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Statistics.HistogramModeKey.Enum> HISTOGRAM_MODE =
+ new HistogramModeKey("android.statistics.histogramMode");
+
+ public static final class SharpnessMapModeKey extends Key<Statistics.SharpnessMapModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private SharpnessMapModeKey(String name) {
+ super(name, Statistics.SharpnessMapModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Statistics.SharpnessMapModeKey.Enum> SHARPNESS_MAP_MODE =
+ new SharpnessMapModeKey("android.statistics.sharpnessMapMode");
+
+ }
+ public static final class Tonemap {
+
+ public static final Key<Float> CURVE_BLUE =
+ new Key<Float>("android.tonemap.curveBlue", float.class);
+ public static final Key<Float> CURVE_GREEN =
+ new Key<Float>("android.tonemap.curveGreen", float.class);
+ public static final Key<float[]> CURVE_RED =
+ new Key<float[]>("android.tonemap.curveRed", float[].class);
+
+ public static final class ModeKey extends Key<Tonemap.ModeKey.Enum> {
+ public enum Enum {
+ CONTRAST_CURVE,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum CONTRAST_CURVE = Enum.CONTRAST_CURVE;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Tonemap.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Tonemap.ModeKey.Enum> MODE =
+ new ModeKey("android.tonemap.mode");
+
+ }
+ public static final class Led {
+
+
+ public static final class TransmitKey extends Key<Led.TransmitKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private TransmitKey(String name) {
+ super(name, Led.TransmitKey.Enum.class);
+ }
+ }
+
+ public static final Key<Led.TransmitKey.Enum> TRANSMIT =
+ new TransmitKey("android.led.transmit");
+
+ }
+
+ static {
+ CameraMetadata.registerEnumValues(Control.SceneModeKey.Enum.class, new int[] {
+ 0, // UNSUPPORTED
+ 1, // FACE_PRIORITY
+ 2, // ACTION
+ 3, // PORTRAIT
+ 4, // LANDSCAPE
+ 5, // NIGHT
+ 6, // NIGHT_PORTRAIT
+ 7, // THEATRE
+ 8, // BEACH
+ 9, // SNOW
+ 10, // SUNSET
+ 11, // STEADYPHOTO
+ 12, // FIREWORKS
+ 13, // SPORTS
+ 14, // PARTY
+ 15, // CANDLELIGHT
+ 16, // BARCODE
+ });
+ }
+}
+
+
diff --git a/core/java/android/hardware/photography/CaptureResultKeys.java b/core/java/android/hardware/photography/CaptureResultKeys.java
new file mode 100644
index 000000000000..8b5b16b2c08e
--- /dev/null
+++ b/core/java/android/hardware/photography/CaptureResultKeys.java
@@ -0,0 +1,620 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.photography;
+
+import static android.hardware.photography.CameraMetadata.Key;
+
+/**
+ * ! Do not edit this file directly !
+ *
+ * Generated automatically from CaptureResultKeys.mako
+ *
+ * TODO: Include a hash of the input files here that the build can check.
+ */
+
+/**
+ * The base class for camera controls and information.
+ *
+ * This class defines the basic key/value map used for querying for camera
+ * characteristics or capture results, and for setting camera request
+ * parameters.
+ *
+ * @see CaptureResult
+ * @see CameraMetadata
+ * @hide
+ **/
+public final class CaptureResultKeys {
+ public static final class ColorCorrection {
+
+
+ public static final class ModeKey extends Key<ColorCorrection.ModeKey.Enum> {
+ public enum Enum {
+ TRANSFORM_MATRIX,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum TRANSFORM_MATRIX = Enum.TRANSFORM_MATRIX;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, ColorCorrection.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<ColorCorrection.ModeKey.Enum> MODE =
+ new ModeKey("android.colorCorrection.mode");
+
+ }
+ public static final class Control {
+
+ public static final Key<Integer> AE_PRECAPTURE_ID =
+ new Key<Integer>("android.control.aePrecaptureId", int.class);
+ public static final Key<int[]> AE_REGIONS =
+ new Key<int[]>("android.control.aeRegions", int[].class);
+
+ public static final class AeStateKey extends Key<Control.AeStateKey.Enum> {
+ public enum Enum {
+ INACTIVE,
+ SEARCHING,
+ CONVERGED,
+ LOCKED,
+ FLASH_REQUIRED,
+ PRECAPTURE;
+ }
+
+ public static final Enum INACTIVE = Enum.INACTIVE;
+ public static final Enum SEARCHING = Enum.SEARCHING;
+ public static final Enum CONVERGED = Enum.CONVERGED;
+ public static final Enum LOCKED = Enum.LOCKED;
+ public static final Enum FLASH_REQUIRED = Enum.FLASH_REQUIRED;
+ public static final Enum PRECAPTURE = Enum.PRECAPTURE;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AeStateKey(String name) {
+ super(name, Control.AeStateKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AeStateKey.Enum> AE_STATE =
+ new AeStateKey("android.control.aeState");
+
+ public static final class AfModeKey extends Key<Control.AfModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ AUTO,
+ MACRO,
+ CONTINUOUS_VIDEO,
+ CONTINUOUS_PICTURE,
+ EDOF;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum AUTO = Enum.AUTO;
+ public static final Enum MACRO = Enum.MACRO;
+ public static final Enum CONTINUOUS_VIDEO = Enum.CONTINUOUS_VIDEO;
+ public static final Enum CONTINUOUS_PICTURE = Enum.CONTINUOUS_PICTURE;
+ public static final Enum EDOF = Enum.EDOF;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AfModeKey(String name) {
+ super(name, Control.AfModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AfModeKey.Enum> AF_MODE =
+ new AfModeKey("android.control.afMode");
+ public static final Key<int[]> AF_REGIONS =
+ new Key<int[]>("android.control.afRegions", int[].class);
+
+ public static final class AfStateKey extends Key<Control.AfStateKey.Enum> {
+ public enum Enum {
+ INACTIVE,
+ PASSIVE_SCAN,
+ PASSIVE_FOCUSED,
+ ACTIVE_SCAN,
+ FOCUSED_LOCKED,
+ NOT_FOCUSED_LOCKED;
+ }
+
+ public static final Enum INACTIVE = Enum.INACTIVE;
+ public static final Enum PASSIVE_SCAN = Enum.PASSIVE_SCAN;
+ public static final Enum PASSIVE_FOCUSED = Enum.PASSIVE_FOCUSED;
+ public static final Enum ACTIVE_SCAN = Enum.ACTIVE_SCAN;
+ public static final Enum FOCUSED_LOCKED = Enum.FOCUSED_LOCKED;
+ public static final Enum NOT_FOCUSED_LOCKED = Enum.NOT_FOCUSED_LOCKED;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AfStateKey(String name) {
+ super(name, Control.AfStateKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AfStateKey.Enum> AF_STATE =
+ new AfStateKey("android.control.afState");
+ public static final Key<Integer> AF_TRIGGER_ID =
+ new Key<Integer>("android.control.afTriggerId", int.class);
+
+ public static final class AwbModeKey extends Key<Control.AwbModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ AUTO,
+ INCANDESCENT,
+ FLUORESCENT,
+ WARM_FLUORESCENT,
+ DAYLIGHT,
+ CLOUDY_DAYLIGHT,
+ TWILIGHT,
+ SHADE;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum AUTO = Enum.AUTO;
+ public static final Enum INCANDESCENT = Enum.INCANDESCENT;
+ public static final Enum FLUORESCENT = Enum.FLUORESCENT;
+ public static final Enum WARM_FLUORESCENT = Enum.WARM_FLUORESCENT;
+ public static final Enum DAYLIGHT = Enum.DAYLIGHT;
+ public static final Enum CLOUDY_DAYLIGHT = Enum.CLOUDY_DAYLIGHT;
+ public static final Enum TWILIGHT = Enum.TWILIGHT;
+ public static final Enum SHADE = Enum.SHADE;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AwbModeKey(String name) {
+ super(name, Control.AwbModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AwbModeKey.Enum> AWB_MODE =
+ new AwbModeKey("android.control.awbMode");
+ public static final Key<int[]> AWB_REGIONS =
+ new Key<int[]>("android.control.awbRegions", int[].class);
+
+ public static final class AwbStateKey extends Key<Control.AwbStateKey.Enum> {
+ public enum Enum {
+ INACTIVE,
+ SEARCHING,
+ CONVERGED,
+ LOCKED;
+ }
+
+ public static final Enum INACTIVE = Enum.INACTIVE;
+ public static final Enum SEARCHING = Enum.SEARCHING;
+ public static final Enum CONVERGED = Enum.CONVERGED;
+ public static final Enum LOCKED = Enum.LOCKED;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private AwbStateKey(String name) {
+ super(name, Control.AwbStateKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.AwbStateKey.Enum> AWB_STATE =
+ new AwbStateKey("android.control.awbState");
+
+ public static final class ModeKey extends Key<Control.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ AUTO,
+ USE_SCENE_MODE;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum AUTO = Enum.AUTO;
+ public static final Enum USE_SCENE_MODE = Enum.USE_SCENE_MODE;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Control.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Control.ModeKey.Enum> MODE =
+ new ModeKey("android.control.mode");
+
+ }
+ public static final class Edge {
+
+
+ public static final class ModeKey extends Key<Edge.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Edge.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Edge.ModeKey.Enum> MODE =
+ new ModeKey("android.edge.mode");
+
+ }
+ public static final class Flash {
+
+ public static final Key<Byte> FIRING_POWER =
+ new Key<Byte>("android.flash.firingPower", byte.class);
+ public static final Key<Long> FIRING_TIME =
+ new Key<Long>("android.flash.firingTime", long.class);
+
+ public static final class ModeKey extends Key<Flash.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ SINGLE,
+ TORCH;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum SINGLE = Enum.SINGLE;
+ public static final Enum TORCH = Enum.TORCH;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Flash.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Flash.ModeKey.Enum> MODE =
+ new ModeKey("android.flash.mode");
+
+ public static final class StateKey extends Key<Flash.StateKey.Enum> {
+ public enum Enum {
+ UNAVAILABLE,
+ CHARGING,
+ READY,
+ FIRED;
+ }
+
+ public static final Enum UNAVAILABLE = Enum.UNAVAILABLE;
+ public static final Enum CHARGING = Enum.CHARGING;
+ public static final Enum READY = Enum.READY;
+ public static final Enum FIRED = Enum.FIRED;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private StateKey(String name) {
+ super(name, Flash.StateKey.Enum.class);
+ }
+ }
+
+ public static final Key<Flash.StateKey.Enum> STATE =
+ new StateKey("android.flash.state");
+
+ }
+ public static final class HotPixel {
+
+
+ public static final class ModeKey extends Key<HotPixel.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, HotPixel.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<HotPixel.ModeKey.Enum> MODE =
+ new ModeKey("android.hotPixel.mode");
+
+ }
+ public static final class Jpeg {
+
+ public static final Key<double[]> GPS_COORDINATES =
+ new Key<double[]>("android.jpeg.gpsCoordinates", double[].class);
+ public static final Key<Byte> GPS_PROCESSING_METHOD =
+ new Key<Byte>("android.jpeg.gpsProcessingMethod", byte.class);
+ public static final Key<Long> GPS_TIMESTAMP =
+ new Key<Long>("android.jpeg.gpsTimestamp", long.class);
+ public static final Key<Integer> ORIENTATION =
+ new Key<Integer>("android.jpeg.orientation", int.class);
+ public static final Key<Byte> QUALITY =
+ new Key<Byte>("android.jpeg.quality", byte.class);
+ public static final Key<Integer> SIZE =
+ new Key<Integer>("android.jpeg.size", int.class);
+ public static final Key<Byte> THUMBNAIL_QUALITY =
+ new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
+ public static final Key<int[]> THUMBNAIL_SIZE =
+ new Key<int[]>("android.jpeg.thumbnailSize", int[].class);
+
+ }
+ public static final class Lens {
+
+ public static final Key<Float> APERTURE =
+ new Key<Float>("android.lens.aperture", float.class);
+ public static final Key<Float> FILTER_DENSITY =
+ new Key<Float>("android.lens.filterDensity", float.class);
+ public static final Key<Float> FOCAL_LENGTH =
+ new Key<Float>("android.lens.focalLength", float.class);
+ public static final Key<Float> FOCUS_DISTANCE =
+ new Key<Float>("android.lens.focusDistance", float.class);
+ public static final Key<Float> FOCUS_RANGE =
+ new Key<Float>("android.lens.focusRange", float.class);
+
+ public static final class OpticalStabilizationModeKey extends Key<Lens.OpticalStabilizationModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private OpticalStabilizationModeKey(String name) {
+ super(name, Lens.OpticalStabilizationModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Lens.OpticalStabilizationModeKey.Enum> OPTICAL_STABILIZATION_MODE =
+ new OpticalStabilizationModeKey("android.lens.opticalStabilizationMode");
+
+ public static final class StateKey extends Key<Lens.StateKey.Enum> {
+ public enum Enum {
+ STATIONARY;
+ }
+
+ public static final Enum STATIONARY = Enum.STATIONARY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private StateKey(String name) {
+ super(name, Lens.StateKey.Enum.class);
+ }
+ }
+
+ public static final Key<Lens.StateKey.Enum> STATE =
+ new StateKey("android.lens.state");
+
+ }
+ public static final class NoiseReduction {
+
+
+ public static final class ModeKey extends Key<NoiseReduction.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, NoiseReduction.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<NoiseReduction.ModeKey.Enum> MODE =
+ new ModeKey("android.noiseReduction.mode");
+
+ }
+ public static final class Request {
+
+ public static final Key<Integer> FRAME_COUNT =
+ new Key<Integer>("android.request.frameCount", int.class);
+ public static final Key<Integer> ID =
+ new Key<Integer>("android.request.id", int.class);
+
+ public static final class MetadataModeKey extends Key<Request.MetadataModeKey.Enum> {
+ public enum Enum {
+ NONE,
+ FULL;
+ }
+
+ public static final Enum NONE = Enum.NONE;
+ public static final Enum FULL = Enum.FULL;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private MetadataModeKey(String name) {
+ super(name, Request.MetadataModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Request.MetadataModeKey.Enum> METADATA_MODE =
+ new MetadataModeKey("android.request.metadataMode");
+ public static final Key<Byte> OUTPUT_STREAMS =
+ new Key<Byte>("android.request.outputStreams", byte.class);
+
+ }
+ public static final class Scaler {
+
+ public static final Key<int[]> CROP_REGION =
+ new Key<int[]>("android.scaler.cropRegion", int[].class);
+
+ }
+ public static final class Sensor {
+
+ public static final Key<Long> EXPOSURE_TIME =
+ new Key<Long>("android.sensor.exposureTime", long.class);
+ public static final Key<Long> FRAME_DURATION =
+ new Key<Long>("android.sensor.frameDuration", long.class);
+ public static final Key<Integer> SENSITIVITY =
+ new Key<Integer>("android.sensor.sensitivity", int.class);
+ public static final Key<Long> TIMESTAMP =
+ new Key<Long>("android.sensor.timestamp", long.class);
+
+ }
+ public static final class Shading {
+
+
+ public static final class ModeKey extends Key<Shading.ModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Shading.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Shading.ModeKey.Enum> MODE =
+ new ModeKey("android.shading.mode");
+
+ }
+ public static final class Statistics {
+
+
+ public static final class FaceDetectModeKey extends Key<Statistics.FaceDetectModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ SIMPLE,
+ FULL;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum SIMPLE = Enum.SIMPLE;
+ public static final Enum FULL = Enum.FULL;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private FaceDetectModeKey(String name) {
+ super(name, Statistics.FaceDetectModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Statistics.FaceDetectModeKey.Enum> FACE_DETECT_MODE =
+ new FaceDetectModeKey("android.statistics.faceDetectMode");
+ public static final Key<int[]> FACE_IDS =
+ new Key<int[]>("android.statistics.faceIds", int[].class);
+ public static final Key<int[]> FACE_LANDMARKS =
+ new Key<int[]>("android.statistics.faceLandmarks", int[].class);
+ public static final Key<int[]> FACE_RECTANGLES =
+ new Key<int[]>("android.statistics.faceRectangles", int[].class);
+ public static final Key<byte[]> FACE_SCORES =
+ new Key<byte[]>("android.statistics.faceScores", byte[].class);
+ public static final Key<int[]> HISTOGRAM =
+ new Key<int[]>("android.statistics.histogram", int[].class);
+
+ public static final class HistogramModeKey extends Key<Statistics.HistogramModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private HistogramModeKey(String name) {
+ super(name, Statistics.HistogramModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Statistics.HistogramModeKey.Enum> HISTOGRAM_MODE =
+ new HistogramModeKey("android.statistics.histogramMode");
+ public static final Key<int[]> SHARPNESS_MAP =
+ new Key<int[]>("android.statistics.sharpnessMap", int[].class);
+
+ public static final class SharpnessMapModeKey extends Key<Statistics.SharpnessMapModeKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private SharpnessMapModeKey(String name) {
+ super(name, Statistics.SharpnessMapModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Statistics.SharpnessMapModeKey.Enum> SHARPNESS_MAP_MODE =
+ new SharpnessMapModeKey("android.statistics.sharpnessMapMode");
+
+ }
+ public static final class Tonemap {
+
+ public static final Key<Float> CURVE_BLUE =
+ new Key<Float>("android.tonemap.curveBlue", float.class);
+ public static final Key<Float> CURVE_GREEN =
+ new Key<Float>("android.tonemap.curveGreen", float.class);
+ public static final Key<float[]> CURVE_RED =
+ new Key<float[]>("android.tonemap.curveRed", float[].class);
+
+ public static final class ModeKey extends Key<Tonemap.ModeKey.Enum> {
+ public enum Enum {
+ CONTRAST_CURVE,
+ FAST,
+ HIGH_QUALITY;
+ }
+
+ public static final Enum CONTRAST_CURVE = Enum.CONTRAST_CURVE;
+ public static final Enum FAST = Enum.FAST;
+ public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private ModeKey(String name) {
+ super(name, Tonemap.ModeKey.Enum.class);
+ }
+ }
+
+ public static final Key<Tonemap.ModeKey.Enum> MODE =
+ new ModeKey("android.tonemap.mode");
+
+ }
+ public static final class Led {
+
+
+ public static final class TransmitKey extends Key<Led.TransmitKey.Enum> {
+ public enum Enum {
+ OFF,
+ ON;
+ }
+
+ public static final Enum OFF = Enum.OFF;
+ public static final Enum ON = Enum.ON;
+
+ // TODO: remove requirement for constructor by making Key an interface
+ private TransmitKey(String name) {
+ super(name, Led.TransmitKey.Enum.class);
+ }
+ }
+
+ public static final Key<Led.TransmitKey.Enum> TRANSMIT =
+ new TransmitKey("android.led.transmit");
+
+ }
+
+ static {
+ }
+}
+
+
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java
index 8a2d34780300..293d6f3daddd 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java
@@ -27,6 +27,7 @@ import static android.hardware.photography.CameraMetadata.*;
import java.lang.reflect.Array;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
+import java.nio.IntBuffer;
import static org.junit.Assert.assertArrayEquals;
@@ -436,4 +437,73 @@ public class CameraMetadataTest extends junit.framework.TestCase {
});
}
+
+ @SmallTest
+ public void testReadWriteEnumWithCustomValues() {
+ CameraMetadata.registerEnumValues(AeAntibandingMode.class, new int[] {
+ 0,
+ 10,
+ 20,
+ 30
+ });
+
+ // byte (single)
+ checkKeyGetAndSet("android.control.aeAntibandingMode", AeAntibandingMode.class,
+ AeAntibandingMode.AUTO);
+
+ // byte (n)
+ checkKeyGetAndSetArray("android.control.aeAvailableAntibandingModes",
+ AeAntibandingMode[].class, new AeAntibandingMode[] {
+ AeAntibandingMode.OFF, AeAntibandingMode._50HZ, AeAntibandingMode._60HZ,
+ AeAntibandingMode.AUTO
+ });
+
+ Key<AeAntibandingMode[]> aeAntibandingModeKey =
+ new Key<AeAntibandingMode[]>("android.control.aeAvailableAntibandingModes",
+ AeAntibandingMode[].class);
+ byte[] aeAntibandingModeValues = mMetadata.readValues(CameraMetadata
+ .getTag("android.control.aeAvailableAntibandingModes"));
+ byte[] expectedValues = new byte[] { 0, 10, 20, 30 };
+ assertArrayEquals(expectedValues, aeAntibandingModeValues);
+
+
+ /**
+ * Stranger cases that don't use byte enums
+ */
+ // int (n)
+ CameraMetadata.registerEnumValues(AvailableFormat.class, new int[] {
+ 0x20,
+ 0x32315659,
+ 0x11,
+ 0x22,
+ 0x23,
+ 0x21,
+ });
+
+ checkKeyGetAndSetArray("android.scaler.availableFormats", AvailableFormat[].class,
+ new AvailableFormat[] {
+ AvailableFormat.RAW_SENSOR,
+ AvailableFormat.YV12,
+ AvailableFormat.IMPLEMENTATION_DEFINED
+ });
+
+ Key<AeAntibandingMode> availableFormatsKey =
+ new Key<AeAntibandingMode>("android.scaler.availableFormats",
+ AeAntibandingMode.class);
+ byte[] availableFormatValues = mMetadata.readValues(CameraMetadata
+ .getTag(availableFormatsKey.getName()));
+
+ int[] expectedIntValues = new int[] {
+ 0x20,
+ 0x32315659,
+ 0x22
+ };
+
+ ByteBuffer bf = ByteBuffer.wrap(availableFormatValues).order(ByteOrder.nativeOrder());
+
+ assertEquals(expectedIntValues.length * 4, availableFormatValues.length);
+ for (int i = 0; i < expectedIntValues.length; ++i) {
+ assertEquals(expectedIntValues[i], bf.getInt());
+ }
+ }
}