/* * 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.camera2; import android.hardware.camera2.impl.CameraMetadataNative; import java.util.Collections; import java.util.List; /** *

The properties describing a * {@link CameraDevice CameraDevice}.

* *

These properties are fixed for a given CameraDevice, and can be queried * through the {@link CameraManager CameraManager} * interface in addition to through the CameraDevice interface.

* * @see CameraDevice * @see CameraManager */ public final class CameraCharacteristics extends CameraMetadata { private final CameraMetadataNative mProperties; private List> mAvailableRequestKeys; private List> mAvailableResultKeys; /** * Takes ownership of the passed-in properties object * @hide */ public CameraCharacteristics(CameraMetadataNative properties) { mProperties = properties; } @Override public T get(Key key) { return mProperties.get(key); } /** * Returns the list of keys supported by this {@link CameraDevice} for querying * with a {@link CaptureRequest}. * *

The list returned is not modifiable, so any attempts to modify it will throw * a {@code UnsupportedOperationException}.

* *

Each key is only listed once in the list. The order of the keys is undefined.

* *

Note that there is no {@code getAvailableCameraCharacteristicsKeys()} -- use * {@link #getKeys()} instead.

* * @return List of keys supported by this CameraDevice for CaptureRequests. */ public List> getAvailableCaptureRequestKeys() { if (mAvailableRequestKeys == null) { mAvailableRequestKeys = getAvailableKeyList(CaptureRequest.class); } return mAvailableRequestKeys; } /** * Returns the list of keys supported by this {@link CameraDevice} for querying * with a {@link CaptureResult}. * *

The list returned is not modifiable, so any attempts to modify it will throw * a {@code UnsupportedOperationException}.

* *

Each key is only listed once in the list. The order of the keys is undefined.

* *

Note that there is no {@code getAvailableCameraCharacteristicsKeys()} -- use * {@link #getKeys()} instead.

* * @return List of keys supported by this CameraDevice for CaptureResults. */ public List> getAvailableCaptureResultKeys() { if (mAvailableResultKeys == null) { mAvailableResultKeys = getAvailableKeyList(CaptureResult.class); } return mAvailableResultKeys; } /** * Returns the list of keys supported by this {@link CameraDevice} by metadataClass. * *

The list returned is not modifiable, so any attempts to modify it will throw * a {@code UnsupportedOperationException}.

* *

Each key is only listed once in the list. The order of the keys is undefined.

* * @param metadataClass The subclass of CameraMetadata that you want to get the keys for. * * @return List of keys supported by this CameraDevice for metadataClass. * * @throws IllegalArgumentException if metadataClass is not a subclass of CameraMetadata */ private List> getAvailableKeyList(Class metadataClass) { if (metadataClass.equals(CameraMetadata.class)) { throw new AssertionError( "metadataClass must be a strict subclass of CameraMetadata"); } else if (!CameraMetadata.class.isAssignableFrom(metadataClass)) { throw new AssertionError( "metadataClass must be a subclass of CameraMetadata"); } return Collections.unmodifiableList(getKeysStatic(metadataClass, /*instance*/null)); } /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ * The key entries below this point are generated from metadata * definitions in /system/media/camera/docs. Do not modify by hand or * modify the comment blocks at the start or end. *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/ /** *

Which set of antibanding modes are * supported

*/ public static final Key CONTROL_AE_AVAILABLE_ANTIBANDING_MODES = new Key("android.control.aeAvailableAntibandingModes", byte[].class); /** *

List of frame rate ranges supported by the * AE algorithm/hardware

*/ public static final Key CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES = new Key("android.control.aeAvailableTargetFpsRanges", int[].class); /** *

Maximum and minimum exposure compensation * setting, in counts of * android.control.aeCompensationStepSize

*/ public static final Key CONTROL_AE_COMPENSATION_RANGE = new Key("android.control.aeCompensationRange", int[].class); /** *

Smallest step by which exposure compensation * can be changed

*/ public static final Key CONTROL_AE_COMPENSATION_STEP = new Key("android.control.aeCompensationStep", Rational.class); /** *

List of AF modes that can be * selected

*/ public static final Key CONTROL_AF_AVAILABLE_MODES = new Key("android.control.afAvailableModes", byte[].class); /** *

what subset of the full color effect enum * list is supported

*/ public static final Key CONTROL_AVAILABLE_EFFECTS = new Key("android.control.availableEffects", byte[].class); /** *

what subset of the scene mode enum list is * supported.

*/ public static final Key CONTROL_AVAILABLE_SCENE_MODES = new Key("android.control.availableSceneModes", byte[].class); /** *

List of video stabilization modes that can * be supported

*/ public static final Key CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES = new Key("android.control.availableVideoStabilizationModes", byte[].class); /** */ public static final Key CONTROL_AWB_AVAILABLE_MODES = new Key("android.control.awbAvailableModes", byte[].class); /** *

For AE, AWB, and AF, how many individual * regions can be listed for metering?

*/ public static final Key CONTROL_MAX_REGIONS = new Key("android.control.maxRegions", int.class); /** *

Whether this camera has a * flash

*

If no flash, none of the flash controls do * anything. All other metadata should return 0

*/ public static final Key FLASH_INFO_AVAILABLE = new Key("android.flash.info.available", byte.class); /** *

Supported resolutions for the JPEG * thumbnail

*/ public static final Key JPEG_AVAILABLE_THUMBNAIL_SIZES = new Key("android.jpeg.availableThumbnailSizes", android.hardware.camera2.Size[].class); /** *

List of supported aperture * values

*

If variable aperture not available, only setting * should be for the fixed aperture

*/ public static final Key LENS_INFO_AVAILABLE_APERTURES = new Key("android.lens.info.availableApertures", float[].class); /** *

List of supported ND filter * values

*

If not available, only setting is 0. Otherwise, * lists the available exposure index values for dimming * (2 would mean the filter is set to reduce incoming * light by two stops)

*/ public static final Key LENS_INFO_AVAILABLE_FILTER_DENSITIES = new Key("android.lens.info.availableFilterDensities", float[].class); /** *

If fitted with optical zoom, what focal * lengths are available. If not, the static focal * length

*

If optical zoom not supported, only one value * should be reported

*/ public static final Key LENS_INFO_AVAILABLE_FOCAL_LENGTHS = new Key("android.lens.info.availableFocalLengths", float[].class); /** *

List of supported optical image * stabilization modes

*/ public static final Key LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION = new Key("android.lens.info.availableOpticalStabilization", byte[].class); /** *

Hyperfocal distance for this lens; set to * 0 if fixed focus

*

The hyperfocal distance is used for the old * API's 'fixed' setting

*/ public static final Key LENS_INFO_HYPERFOCAL_DISTANCE = new Key("android.lens.info.hyperfocalDistance", float.class); /** *

Shortest distance from frontmost surface * of the lens that can be focused correctly

*

If the lens is fixed-focus, this should be * 0

*/ public static final Key LENS_INFO_MINIMUM_FOCUS_DISTANCE = new Key("android.lens.info.minimumFocusDistance", float.class); /** *

Dimensions of lens shading map.

*

The map should be on the order of 30-40 rows and columns, and * must be smaller than 64x64.

*/ public static final Key LENS_INFO_SHADING_MAP_SIZE = new Key("android.lens.info.shadingMapSize", android.hardware.camera2.Size.class); /** *

Direction the camera faces relative to * device screen

* @see #LENS_FACING_FRONT * @see #LENS_FACING_BACK */ public static final Key LENS_FACING = new Key("android.lens.facing", int.class); /** *

If set to 1, the HAL will always split result * metadata for a single capture into multiple buffers, * returned using multiple process_capture_result calls.

*

Does not need to be listed in static * metadata. Support for partial results will be reworked in * future versions of camera service. This quirk will stop * working at that point; DO NOT USE without careful * consideration of future support.

* * Optional - This value may be null on some devices. * * @hide */ public static final Key QUIRKS_USE_PARTIAL_RESULT = new Key("android.quirks.usePartialResult", byte.class); /** *

How many output streams can be allocated at * the same time for each type of stream

*

Video snapshot with preview callbacks requires 3 * processed streams (preview, record, app callbacks) and * one JPEG stream (snapshot)

*/ public static final Key REQUEST_MAX_NUM_OUTPUT_STREAMS = new Key("android.request.maxNumOutputStreams", int[].class); /** *

List of app-visible formats

*/ public static final Key SCALER_AVAILABLE_FORMATS = new Key("android.scaler.availableFormats", int[].class); /** *

The minimum frame duration that is supported * for each resolution in availableJpegSizes. Should * correspond to the frame duration when only that JPEG * stream is active and captured in a burst, with all * processing set to FAST

*

When multiple streams are configured, the minimum * frame duration will be >= max(individual stream min * durations)

*/ public static final Key SCALER_AVAILABLE_JPEG_MIN_DURATIONS = new Key("android.scaler.availableJpegMinDurations", long[].class); /** *

The resolutions available for output from * the JPEG block. Listed as width x height

*/ public static final Key SCALER_AVAILABLE_JPEG_SIZES = new Key("android.scaler.availableJpegSizes", android.hardware.camera2.Size[].class); /** *

The maximum ratio between active area width * and crop region width, or between active area height and * crop region height, if the crop region height is larger * than width

*/ public static final Key SCALER_AVAILABLE_MAX_DIGITAL_ZOOM = new Key("android.scaler.availableMaxDigitalZoom", float.class); /** *

The minimum frame duration that is supported * for each resolution in availableProcessedSizes. Should * correspond to the frame duration when only that processed * stream is active, with all processing set to * FAST

*

When multiple streams are configured, the minimum * frame duration will be >= max(individual stream min * durations)

*/ public static final Key SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS = new Key("android.scaler.availableProcessedMinDurations", long[].class); /** *

The resolutions available for use with * processed output streams, such as YV12, NV12, and * platform opaque YUV/RGB streams to the GPU or video * encoders. Listed as width, height

*

The actual supported resolution list may be limited by * consumer end points for different use cases. For example, for * recording use case, the largest supported resolution may be * limited by max supported size from encoder, for preview use * case, the largest supported resolution may be limited by max * resolution SurfaceTexture/SurfaceView can support.

*/ public static final Key SCALER_AVAILABLE_PROCESSED_SIZES = new Key("android.scaler.availableProcessedSizes", android.hardware.camera2.Size[].class); /** *

Area of raw data which corresponds to only * active pixels; smaller or equal to * pixelArraySize.

*/ public static final Key SENSOR_INFO_ACTIVE_ARRAY_SIZE = new Key("android.sensor.info.activeArraySize", android.graphics.Rect.class); /** *

Range of valid sensitivities

*/ public static final Key SENSOR_INFO_SENSITIVITY_RANGE = new Key("android.sensor.info.sensitivityRange", int[].class); /** *

Range of valid exposure * times

*/ public static final Key SENSOR_INFO_EXPOSURE_TIME_RANGE = new Key("android.sensor.info.exposureTimeRange", long[].class); /** *

Maximum possible frame duration (minimum frame * rate)

*

Minimum duration is a function of resolution, * processing settings. See * android.scaler.availableProcessedMinDurations * android.scaler.availableJpegMinDurations * android.scaler.availableRawMinDurations

*/ public static final Key SENSOR_INFO_MAX_FRAME_DURATION = new Key("android.sensor.info.maxFrameDuration", long.class); /** *

The physical dimensions of the full pixel * array

*

Needed for FOV calculation for old API

*/ public static final Key SENSOR_INFO_PHYSICAL_SIZE = new Key("android.sensor.info.physicalSize", float[].class); /** *

Gain factor from electrons to raw units when * ISO=100

* * Optional - This value may be null on some devices. * * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} - * Present on all devices that report being FULL level hardware devices in the * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL HARDWARE_LEVEL} key. */ public static final Key SENSOR_BASE_GAIN_FACTOR = new Key("android.sensor.baseGainFactor", Rational.class); /** *

Maximum sensitivity that is implemented * purely through analog gain

*

For android.sensor.sensitivity values less than or * equal to this, all applied gain must be analog. For * values above this, it can be a mix of analog and * digital

* * Optional - This value may be null on some devices. * * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} - * Present on all devices that report being FULL level hardware devices in the * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL HARDWARE_LEVEL} key. */ public static final Key SENSOR_MAX_ANALOG_SENSITIVITY = new Key("android.sensor.maxAnalogSensitivity", int.class); /** *

Clockwise angle through which the output * image needs to be rotated to be upright on the device * screen in its native orientation. Also defines the * direction of rolling shutter readout, which is from top * to bottom in the sensor's coordinate system

*/ public static final Key SENSOR_ORIENTATION = new Key("android.sensor.orientation", int.class); /** *

Which face detection modes are available, * if any

*

OFF means face detection is disabled, it must * be included in the list.

*

SIMPLE means the device supports the * android.statistics.faceRectangles and * android.statistics.faceScores outputs.

*

FULL means the device additionally supports the * android.statistics.faceIds and * android.statistics.faceLandmarks outputs.

*/ public static final Key STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES = new Key("android.statistics.info.availableFaceDetectModes", byte[].class); /** *

Maximum number of simultaneously detectable * faces

*/ public static final Key STATISTICS_INFO_MAX_FACE_COUNT = new Key("android.statistics.info.maxFaceCount", int.class); /** *

Maximum number of supported points in the * tonemap curve

*/ public static final Key TONEMAP_MAX_CURVE_POINTS = new Key("android.tonemap.maxCurvePoints", int.class); /** *

A list of camera LEDs that are available on this system.

* @see #LED_AVAILABLE_LEDS_TRANSMIT * * @hide */ public static final Key LED_AVAILABLE_LEDS = new Key("android.led.availableLeds", int[].class); /** *

The camera 3 HAL device can implement one of two possible * operational modes; limited and full. Full support is * expected from new higher-end devices. Limited mode has * hardware requirements roughly in line with those for a * camera HAL device v1 implementation, and is expected from * older or inexpensive devices. Full is a strict superset of * limited, and they share the same essential operational flow.

*

For full details refer to "S3. Operational Modes" in camera3.h

* @see #INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED * @see #INFO_SUPPORTED_HARDWARE_LEVEL_FULL */ public static final Key INFO_SUPPORTED_HARDWARE_LEVEL = new Key("android.info.supportedHardwareLevel", int.class); /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ * End generated code *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ }