diff options
author | Ankit Premrajka <ankitp@codeaurora.org> | 2011-11-21 19:25:02 -0800 |
---|---|---|
committer | Ricardo Cerqueira <github@cerqueira.org> | 2012-03-27 17:28:20 +0100 |
commit | 273bce7ab42d08f905b47d26be5cdae0b77c47b6 (patch) | |
tree | 17d3f802d1ddd98d3095589fef7ea3df6ac78a5a /core/java/android/hardware/Camera.java | |
parent | 90c2f1e6f088a730f530045534ab97f054a0a9bf (diff) | |
download | frameworks_base-273bce7ab42d08f905b47d26be5cdae0b77c47b6.zip frameworks_base-273bce7ab42d08f905b47d26be5cdae0b77c47b6.tar.gz frameworks_base-273bce7ab42d08f905b47d26be5cdae0b77c47b6.tar.bz2 |
Add customized parameters for qcom camera features.
Squashed commit of the following submissions to CAF:
camera: add custom camera parameters to hardware java file.
Change-Id: Ic2b363df6d25a0c3a49aed30e717d10874f533ae
Camera: Add support for wavelet denoise
Change-Id: I97be72615fe5909987ac430034bbdc16f2d20509
Camera : Add support for histogram in frameworks
Change-Id: Ibf751c3b2d488f4be0afaaa3e994372bafeffbe7
Camera: Add ZSL support in framework.
Change-Id: I4e863020d7d407d9c3936beb83dc7abf385c4654
Camera: Add touch AF/AEC support in ICS framework
In, ICS the old touch AF/AEC functions getTouchIndexAf(),
setTouchIndexAf() etc are no longer valid. Added new functions to get
the center of touched area.
Change-Id: I37d00040f895cd8a4de2e2a438971aa2d9c1a045
Camera: Add support for Red eye reduction
Change-Id: Iada280ac33aee8b1114dc40d8d79e0e47ad5c2fd
Conflicts:
api/current.txt
Camera: Enable streaming texture and YV12 feature
Change-Id: I814c92b469e0f25baef0ce80338761d1e6443085
Camera: Add frameworks support for high frame rate
Change-Id: I9722e9b7e61433651ab5f76f76208853eb1fd849
Camera: Simplify ASD menu and best mode menu.
Change-Id: Ia7a1eca9268eec021a6e2c3f7ce2a932e8819d50
Camera : Macro definition change. PIXEL_FORMAT_YV12 to "yuv420p"
Why: CTS testcase is expecting "yuv420p" as the format string for YV12 mode.
CRs-Fixed: 328252
(cherry picked from commit 0a263f67b75497e4b95b9de8c370ed9496ab59ef)
Change-Id: I66f418a52775a969d81bcb332bbe500370e3ab7c
Camera: Changes for face detection
Change-Id: I7b2172e8690d6e23762e42f5888fecbfda15ba61
Camera: Add support for burst count
Change-Id: I4488a5eac1eebb0b5c8e2cc7cbbe7be0c7301be7
Camera: enable HDR feature
(cherry picked from commit e40770bbdadd925fc1e07a08249a15981b961570)
Change-Id: Ie9ca3066e8e53710bf292d047a3724aefc029854
Camera : Add API to find fullsize liveshot support
Change-Id: I3c2fc3578decbe5cf87fded5362f317df0b40b5e
(cherry picked from commit 65d80f04892776eec1c19c844eacb8c454b4bd1a)
Camera: Set default camera area string
The default invalid value for KEY_FOCUS_AREA and
KEY_METERING_AREA is changed to "(0,0,0,0,0)"
CRs-fixed: 334934
Change-Id: I354802c8611ee5c00a591b96b1a1ca04926969cb
Camera: Change the scenemode names in framework
To comply with ICS API Specification,
SCENE_MODE_AUTO changed to SCENE_MODE_ASD
SCENE_MODE_OFF changed to SCENE_MODE_AUTO
Change-Id: I8e744f10c728f469923b09f69d6d64bc5c7c6850
Camera : Framework changes for camcorder UI menu
Change-Id: Iff9e9021da44b67f81a24c828b960113ee249248
Camera : Remove unwanted video resolution in Framework
- FWVGA, WQVGA resolution UI options are removed for camcorder.
Change-Id: If621140966b01dbc8c30a4d161e6771528b8adda
Camera : Enable FWVGA and WQVGA resolutions in camcorder media profiles
Change-Id: Iad9cc33f7b6d8eb7de21df372c016edeef0b99ba
Unlock camera AWB lock only when white-balance is changed.
bug:5633546
Change-Id: I90bb4b5b445daedf38a64e2f8fb980fc0f0aaa81
Change-Id: Ie3cc15132489502e64321776d49d96846b5705d6
Diffstat (limited to 'core/java/android/hardware/Camera.java')
-rw-r--r-- | core/java/android/hardware/Camera.java | 1144 |
1 files changed, 1141 insertions, 3 deletions
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index 7ca6155..86725ac 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -137,6 +137,8 @@ public class Camera { private static final int CAMERA_MSG_RAW_IMAGE = 0x080; private static final int CAMERA_MSG_COMPRESSED_IMAGE = 0x100; private static final int CAMERA_MSG_RAW_IMAGE_NOTIFY = 0x200; + private static final int CAMERA_MSG_STATS_DATA = 0x800; + private static final int CAMERA_MSG_META_DATA = 0x8000; private static final int CAMERA_MSG_PREVIEW_METADATA = 0x400; private static final int CAMERA_MSG_ALL_MSGS = 0x4FF; @@ -148,6 +150,8 @@ public class Camera { private PreviewCallback mPreviewCallback; private PictureCallback mPostviewCallback; private AutoFocusCallback mAutoFocusCallback; + private CameraDataCallback mCameraDataCallback; + private CameraMetaDataCallback mCameraMetaDataCallback; private OnZoomChangeListener mZoomListener; private FaceDetectionListener mFaceListener; private ErrorCallback mErrorCallback; @@ -207,6 +211,18 @@ public class Camera { public static final int CAMERA_FACING_FRONT = 1; /** + * The facing of the camera is the same as that of the screen. + * @hide + */ + public static final int CAMERA_SUPPORT_MODE_ZSL = 2; + + /** + * The facing of the camera is the same as that of the screen. + * @hide + */ + public static final int CAMERA_SUPPORT_MODE_NONZSL = 3; + + /** * The direction that the camera faces. It should be * CAMERA_FACING_BACK or CAMERA_FACING_FRONT. */ @@ -289,6 +305,8 @@ public class Camera { mPreviewCallback = null; mPostviewCallback = null; mZoomListener = null; + mCameraDataCallback = null; + mCameraMetaDataCallback = null; Looper looper; if ((looper = Looper.myLooper()) != null) { @@ -706,6 +724,21 @@ public class Camera { } return; + case CAMERA_MSG_STATS_DATA: + int statsdata[] = new int[257]; + for(int i =0; i<257; i++ ) { + statsdata[i] = byteToInt( (byte[])msg.obj, i*4); + } + if (mCameraDataCallback != null) { + mCameraDataCallback.onCameraData(statsdata, mCamera); + } + return; + + case CAMERA_MSG_META_DATA: + if (mCameraMetaDataCallback != null) { + mCameraMetaDataCallback.onCameraMetaData((int[])msg.obj, mCamera); + } + return; case CAMERA_MSG_POSTVIEW_FRAME: if (mPostviewCallback != null) { mPostviewCallback.onPictureTaken((byte[])msg.obj, mCamera); @@ -744,6 +777,14 @@ public class Camera { } } + private static int byteToInt(byte[] b, int offset) { + int value = 0; + for (int i = 0; i < 4; i++) { + int shift = (4 - 1 - i) * 8; + value += (b[(3-i) + offset] & 0x000000FF) << shift; + } + return value; + } private static void postEventFromNative(Object camera_ref, int what, int arg1, int arg2, Object obj) { @@ -849,6 +890,15 @@ public class Camera { private native final void native_cancelAutoFocus(); /** + * @hide + */ + + public final void encodeData() + { + native_encodeData(); + } + private native final void native_encodeData(); + /** * Callback interface used to signal the moment of actual image capture. * * @see #takePicture(ShutterCallback, PictureCallback, PictureCallback, PictureCallback) @@ -864,6 +914,84 @@ public class Camera { */ void onShutter(); } + /** + * @hide + * Handles the callback for when Camera Data is available. + * data is read from the camera. + */ + public interface CameraDataCallback { + /** + * Callback for when camera data is available. + * + * @param data a int array of the camera data + * @param camera the Camera service object + */ + void onCameraData(int[] data, Camera camera); + }; + + /** + * @hide + * Set camera histogram mode and registers a callback function to run. + * Only valid after startPreview() has been called. + * + * @param cb the callback to run + */ + public final void setHistogramMode(CameraDataCallback cb) + { + mCameraDataCallback = cb; + native_setHistogramMode(cb!=null); + } + private native final void native_setHistogramMode(boolean mode); + + /** + * @hide + * Set camera histogram command to send data. + * + */ + public final void sendHistogramData() + { + native_sendHistogramData(); + } + private native final void native_sendHistogramData(); + + /** + * @hide + * Handles the callback for when Camera Meta Data is available. + * Meta data is read from the camera. + */ + public interface CameraMetaDataCallback { + /** + * Callback for when camera meta data is available. + * + * @param data a int array of the camera meta data + * @param camera the Camera service object + */ + void onCameraMetaData(int[] data, Camera camera); + }; + + /** + * @hide + * Set camera face detection mode and registers a callback function to run. + * Only valid after startPreview() has been called. + * + * @param cb the callback to run + */ + public final void setFaceDetectionCb(CameraMetaDataCallback cb) + { + mCameraMetaDataCallback = cb; + native_setFaceDetectionCb(cb!=null); + } + private native final void native_setFaceDetectionCb(boolean mode); + + /** + * @hide + * Set camera face detection command to send meta data. + */ + public final void sendMetaData() + { + native_sendMetaData(); + } + private native final void native_sendMetaData(); /** * Callback interface used to supply image data from a photo capture. @@ -1435,6 +1563,43 @@ public class Camera { */ public int weight; } + /** + * @hide + * Handles the Touch Co-ordinate. + */ + public class Coordinate { + /** + * Sets the x,y co-ordinates for a touch event + * + * @param x the x co-ordinate (pixels) + * @param y the y co-ordinate (pixels) + */ + public Coordinate(int x, int y) { + xCoordinate = x; + yCoordinate = y; + } + /** + * Compares {@code obj} to this co-ordinate. + * + * @param obj the object to compare this co-ordinate with. + * @return {@code true} if the xCoordinate and yCoordinate of {@code obj} is the + * same as those of this coordinate. {@code false} otherwise. + */ + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Coordinate)) { + return false; + } + Coordinate c = (Coordinate) obj; + return xCoordinate == c.xCoordinate && yCoordinate == c.yCoordinate; + } + + /** x co-ordinate for the touch event*/ + public int xCoordinate; + + /** y co-ordinate for the touch event */ + public int yCoordinate; + }; /** * Camera service settings. @@ -1456,9 +1621,13 @@ public class Camera { public class Parameters { // Parameter keys to communicate with the camera driver. private static final String KEY_PREVIEW_SIZE = "preview-size"; + private static final String KEY_HFR_SIZE = "hfr-size"; private static final String KEY_PREVIEW_FORMAT = "preview-format"; private static final String KEY_PREVIEW_FRAME_RATE = "preview-frame-rate"; private static final String KEY_PREVIEW_FPS_RANGE = "preview-fps-range"; + private static final String KEY_PREVIEW_FRAME_RATE_MODE = "preview-frame-rate-mode"; + private static final String KEY_PREVIEW_FRAME_RATE_AUTO_MODE = "frame-rate-auto"; + private static final String KEY_PREVIEW_FRAME_RATE_FIXED_MODE = "frame-rate-fixed"; private static final String KEY_PICTURE_SIZE = "picture-size"; private static final String KEY_PICTURE_FORMAT = "picture-format"; private static final String KEY_JPEG_THUMBNAIL_SIZE = "jpeg-thumbnail-size"; @@ -1470,14 +1639,27 @@ public class Camera { private static final String KEY_GPS_LATITUDE = "gps-latitude"; private static final String KEY_GPS_LONGITUDE = "gps-longitude"; private static final String KEY_GPS_ALTITUDE = "gps-altitude"; + private static final String KEY_GPS_LATITUDE_REF = "gps-latitude-ref"; + private static final String KEY_GPS_LONGITUDE_REF = "gps-longitude-ref"; + private static final String KEY_GPS_ALTITUDE_REF = "gps-altitude-ref"; + private static final String KEY_GPS_STATUS = "gps-status"; private static final String KEY_GPS_TIMESTAMP = "gps-timestamp"; + private static final String KEY_EXIF_DATETIME = "exif-datetime"; private static final String KEY_GPS_PROCESSING_METHOD = "gps-processing-method"; private static final String KEY_WHITE_BALANCE = "whitebalance"; private static final String KEY_EFFECT = "effect"; + private static final String KEY_TOUCH_AF_AEC = "touch-af-aec"; + private static final String KEY_TOUCH_INDEX_AEC = "touch-index-aec"; + private static final String KEY_TOUCH_INDEX_AF = "touch-index-af"; private static final String KEY_ANTIBANDING = "antibanding"; private static final String KEY_SCENE_MODE = "scene-mode"; + private static final String KEY_SCENE_DETECT = "scene-detect"; private static final String KEY_FLASH_MODE = "flash-mode"; private static final String KEY_FOCUS_MODE = "focus-mode"; + private static final String KEY_ISO_MODE = "iso"; + private static final String KEY_LENSSHADE = "lensshade"; + private static final String KEY_HISTOGRAM = "histogram"; + private static final String KEY_SKIN_TONE_ENHANCEMENT = "skinToneEnhancement"; private static final String KEY_FOCUS_AREAS = "focus-areas"; private static final String KEY_MAX_NUM_FOCUS_AREAS = "max-num-focus-areas"; private static final String KEY_FOCAL_LENGTH = "focal-length"; @@ -1493,6 +1675,7 @@ public class Camera { private static final String KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED = "auto-whitebalance-lock-supported"; private static final String KEY_METERING_AREAS = "metering-areas"; private static final String KEY_MAX_NUM_METERING_AREAS = "max-num-metering-areas"; + private static final String KEY_AUTO_EXPOSURE = "auto-exposure"; private static final String KEY_ZOOM = "zoom"; private static final String KEY_MAX_ZOOM = "max-zoom"; private static final String KEY_ZOOM_RATIOS = "zoom-ratios"; @@ -1506,8 +1689,24 @@ public class Camera { private static final String KEY_MAX_NUM_DETECTED_FACES_SW = "max-num-detected-faces-sw"; private static final String KEY_RECORDING_HINT = "recording-hint"; private static final String KEY_VIDEO_SNAPSHOT_SUPPORTED = "video-snapshot-supported"; + private static final String KEY_FULL_VIDEO_SNAP_SUPPORTED = "full-video-snap-supported"; private static final String KEY_VIDEO_STABILIZATION = "video-stabilization"; private static final String KEY_VIDEO_STABILIZATION_SUPPORTED = "video-stabilization-supported"; + private static final String KEY_SHARPNESS = "sharpness"; + private static final String KEY_MAX_SHARPNESS = "max-sharpness"; + private static final String KEY_CONTRAST = "contrast"; + private static final String KEY_MAX_CONTRAST = "max-contrast"; + private static final String KEY_SATURATION = "saturation"; + private static final String KEY_MAX_SATURATION = "max-saturation"; + private static final String KEY_DENOISE = "denoise"; + private static final String KEY_CONTINUOUS_AF = "continuous-af"; + private static final String KEY_SELECTABLE_ZONE_AF = "selectable-zone-af"; + private static final String KEY_FACE_DETECTION = "face-detection"; + private static final String KEY_MEMORY_COLOR_ENHANCEMENT = "mce"; + private static final String KEY_REDEYE_REDUCTION = "redeye-reduction"; + private static final String KEY_ZSL = "zsl"; + private static final String KEY_CAMERA_MODE = "camera-mode"; + private static final String KEY_VIDEO_HIGH_FRAME_RATE = "video-hfr"; // Parameter key suffix for supported values. private static final String SUPPORTED_VALUES_SUFFIX = "-values"; @@ -1536,11 +1735,90 @@ public class Camera { public static final String EFFECT_BLACKBOARD = "blackboard"; public static final String EFFECT_AQUA = "aqua"; + // Values for touch af/aec settings. + /** @hide */ + public static final String TOUCH_AF_AEC_OFF = "touch-off"; + /** @hide */ + public static final String TOUCH_AF_AEC_ON = "touch-on"; + + // Values for auto exposure settings. + /** @hide */ + public static final String AUTO_EXPOSURE_FRAME_AVG = "frame-average"; + /** @hide */ + public static final String AUTO_EXPOSURE_CENTER_WEIGHTED = "center-weighted"; + /** @hide */ + public static final String AUTO_EXPOSURE_SPOT_METERING = "spot-metering"; // Values for antibanding settings. public static final String ANTIBANDING_AUTO = "auto"; public static final String ANTIBANDING_50HZ = "50hz"; public static final String ANTIBANDING_60HZ = "60hz"; public static final String ANTIBANDING_OFF = "off"; + //Values for ISO settings + + /** @hide */ + public static final String ISO_AUTO = "auto"; + /** @hide */ + public static final String ISO_HJR = "ISO_HJR"; + /** @hide */ + public static final String ISO_100 = "ISO100"; + /** @hide */ + public static final String ISO_200 = "ISO200"; + /** @hide */ + public static final String ISO_400 = "ISO400"; + /** @hide */ + public static final String ISO_800 = "ISO800"; + /** @hide */ + public static final String ISO_1600 = "ISO1600"; + + //Values for Lens Shading + + /** @hide */ + public static final String LENSSHADE_ENABLE = "enable"; + /** @hide */ + public static final String LENSSHADE_DISABLE= "disable"; + + /** @hide */ + public static final String HISTOGRAM_ENABLE = "enable"; + /** @hide */ + public static final String HISTOGRAM_DISABLE= "disable"; + + /** @hide */ + public static final String SKIN_TONE_ENHANCEMENT_ENABLE = "enable"; + /** @hide */ + public static final String SKIN_TONE_ENHANCEMENT_DISABLE= "disable"; + + // Values for MCE settings. + /** @hide */ + public static final String MCE_ENABLE = "enable"; + /** @hide */ + public static final String MCE_DISABLE = "disable"; + + // Values for ZSL settings. + /** @hide */ + public static final String ZSL_ON = "on"; + /** @hide */ + public static final String ZSL_OFF = "off"; + + // Values for HDR Bracketing settings. + /** @hide */ + public static final String AE_BRACKET_HDR_OFF = "Off"; + /** @hide */ + public static final String AE_BRACKET_HDR = "HDR"; + /** @hide */ + public static final String AE_BRACKET = "AE-Bracket"; + + // Values for HFR settings. + /** @hide */ + public static final String VIDEO_HFR_OFF = "off"; + /** @hide */ + public static final String VIDEO_HFR_2X = "60"; + /** @hide */ + public static final String VIDEO_HFR_3X = "90"; + /** @hide */ + public static final String VIDEO_HFR_4X = "120"; + + /** @hide */ + public static final String KEY_AE_BRACKET_HDR = "ae-bracket-hdr"; // Values for flash mode settings. /** @@ -1573,6 +1851,12 @@ public class Camera { /** * Scene mode is off. + * @hide + */ + public static final String SCENE_MODE_ASD = "asd"; + + /** + * Scene mode is auto ASD. */ public static final String SCENE_MODE_AUTO = "auto"; @@ -1647,6 +1931,16 @@ public class Camera { * Capture the naturally warm color of scenes lit by candles. */ public static final String SCENE_MODE_CANDLELIGHT = "candlelight"; + /** @hide */ + public static final String SCENE_MODE_BACKLIGHT = "backlight"; + /** @hide */ + public static final String SCENE_MODE_FLOWERS = "flowers"; + + // Values for auto scene detection settings. + /** @hide */ + public static final String SCENE_DETECT_OFF = "off"; + /** @hide */ + public static final String SCENE_DETECT_ON = "on"; /** * Applications are looking for a barcode. Camera driver will be @@ -1682,6 +1976,14 @@ public class Camera { public static final String FOCUS_MODE_FIXED = "fixed"; /** + * Normal focus mode. Applications should call + * {@link #autoFocus(AutoFocusCallback)} to start the focus in this + * mode. + * @hide + */ + public static final String FOCUS_MODE_NORMAL = "normal"; + + /** * Extended depth of field (EDOF). Focusing is done digitally and * continuously. Applications should not call {@link * #autoFocus(AutoFocusCallback)} in this mode. @@ -1769,11 +2071,47 @@ public class Camera { // Formats for setPreviewFormat and setPictureFormat. private static final String PIXEL_FORMAT_YUV422SP = "yuv422sp"; private static final String PIXEL_FORMAT_YUV420SP = "yuv420sp"; + private static final String PIXEL_FORMAT_YUV420SP_ADRENO = "yuv420sp-adreno"; private static final String PIXEL_FORMAT_YUV422I = "yuv422i-yuyv"; private static final String PIXEL_FORMAT_YUV420P = "yuv420p"; private static final String PIXEL_FORMAT_RGB565 = "rgb565"; private static final String PIXEL_FORMAT_JPEG = "jpeg"; private static final String PIXEL_FORMAT_BAYER_RGGB = "bayer-rggb"; + private static final String PIXEL_FORMAT_RAW = "raw"; + private static final String PIXEL_FORMAT_YV12 = "yv12"; + private static final String PIXEL_FORMAT_NV12 = "nv12"; + + //Values for Continuous AF + + /** @hide */ + public static final String CONTINUOUS_AF_OFF = "caf-off"; + /** @hide */ + public static final String CONTINUOUS_AF_ON = "caf-on"; + /** @hide */ + public static final String DENOISE_OFF = "denoise-off"; + /** @hide */ + public static final String DENOISE_ON = "denoise-on"; + // Values for Redeye Reduction settings. + /** @hide */ + public static final String REDEYE_REDUCTION_ENABLE = "enable"; + /** @hide */ + public static final String REDEYE_REDUCTION_DISABLE = "disable"; + + // Values for selectable zone af settings. + /** @hide */ + public static final String SELECTABLE_ZONE_AF_AUTO = "auto"; + /** @hide */ + public static final String SELECTABLE_ZONE_AF_SPOTMETERING = "spot-metering"; + /** @hide */ + public static final String SELECTABLE_ZONE_AF_CENTER_WEIGHTED = "center-weighted"; + /** @hide */ + public static final String SELECTABLE_ZONE_AF_FRAME_AVERAGE = "frame-average"; + + // Values for Face Detection settings. + /** @hide */ + public static final String FACE_DETECTION_OFF = "off"; + /** @hide */ + public static final String FACE_DETECTION_ON = "on"; private HashMap<String, String> mMap; @@ -1966,6 +2304,18 @@ public class Camera { return splitSize(str); } + /** + * @hide + * Gets the supported preview sizes in high frame rate recording mode. + * + * @return a list of Size object. This method will always return a list + * with at least one element. + */ + public List<Size> getSupportedHfrSizes() { + String str = get(KEY_HFR_SIZE + SUPPORTED_VALUES_SUFFIX); + return splitSize(str); + } + /** * <p>Gets the supported video frame sizes that can be used by * MediaRecorder.</p> @@ -2418,6 +2768,16 @@ public class Camera { } /** + * @hide + * Sets GPS latitude reference coordinate. This will be stored in JPEG EXIF + * header. + * @param latRef GPS latitude reference coordinate. + */ + public void setGpsLatitudeRef(String latRef) { + set(KEY_GPS_LATITUDE_REF, latRef); + } + + /** * Sets GPS latitude coordinate. This will be stored in JPEG EXIF * header. * @@ -2428,6 +2788,16 @@ public class Camera { } /** + * @hide + * Sets GPS longitude reference coordinate. This will be stored in JPEG EXIF + * header. + * @param lonRef GPS longitude reference coordinate. + */ + public void setGpsLongitudeRef(String lonRef) { + set(KEY_GPS_LONGITUDE_REF, lonRef); + } + + /** * Sets GPS longitude coordinate. This will be stored in JPEG EXIF * header. * @@ -2438,6 +2808,15 @@ public class Camera { } /** + * @hide + * Sets GPS altitude reference. This will be stored in JPEG EXIF header. + * @param altRef reference GPS altitude in meters. + */ + public void setGpsAltitudeRef(double altRef) { + set(KEY_GPS_ALTITUDE_REF, Double.toString(altRef)); + } + + /** * Sets GPS altitude. This will be stored in JPEG EXIF header. * * @param altitude GPS altitude in meters. @@ -2467,12 +2846,37 @@ public class Camera { } /** + * @hide + * Sets system timestamp. This will be stored in JPEG EXIF header. + * + * @param dateTime current timestamp (UTC in seconds since January 1, + * 1970). + */ + public void setExifDateTime(String dateTime) { + set(KEY_EXIF_DATETIME, dateTime); + } + + /** + * @hide + * Sets GPS Status. This will be stored in JPEG EXIF header. + * + * @param status GPS status (UTC in seconds since January 1, + * 1970). + */ + public void setGpsStatus(double status) { + set(KEY_GPS_STATUS, Double.toString(status)); + } + + /** * Removes GPS latitude, longitude, altitude, and timestamp from the * parameters. */ public void removeGpsData() { + remove(KEY_GPS_LATITUDE_REF); remove(KEY_GPS_LATITUDE); + remove(KEY_GPS_LONGITUDE_REF); remove(KEY_GPS_LONGITUDE); + remove(KEY_GPS_ALTITUDE_REF); remove(KEY_GPS_ALTITUDE); remove(KEY_GPS_TIMESTAMP); remove(KEY_GPS_PROCESSING_METHOD); @@ -2566,8 +2970,234 @@ public class Camera { return split(str); } + /** + * @hide + * Gets the current Touch AF/AEC setting. + * + * @return one of TOUCH_AF_AEC_XXX string constant. null if Touch AF/AEC + * setting is not supported. + * + */ + public String getTouchAfAec() { + return get(KEY_TOUCH_AF_AEC); + } + + /** + * @hide + * Sets the current TOUCH AF/AEC setting. + * + * @param value TOUCH_AF_AEC_XXX string constants. + * + */ + public void setTouchAfAec(String value) { + set(KEY_TOUCH_AF_AEC, value); + } + + /** + * @hide + * Gets the supported Touch AF/AEC setting. + * + * @return a List of TOUCH_AF_AEC_XXX string constants. null if TOUCH AF/AEC + * setting is not supported. + * + */ + public List<String> getSupportedTouchAfAec() { + String str = get(KEY_TOUCH_AF_AEC + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** + * @hide + * Sets the touch co-ordinate for Touch AEC. + * + * @param x the x co-ordinate of the touch event + * @param y the y co-ordinate of the touch event + * + */ + public void setTouchIndexAec(int x, int y) { + String v = Integer.toString(x) + "x" + Integer.toString(y); + set(KEY_TOUCH_INDEX_AEC, v); + } + + /** + * @hide + * Returns the touch co-ordinates of the touch event. + * + * @return a Index object with the x and y co-ordinated + * for the touch event + * + */ + public Coordinate getTouchIndexAec() { + String pair = get(KEY_TOUCH_INDEX_AEC); + return strToCoordinate(pair); + } + + /** + * @hide + * Sets the touch co-ordinate for Touch AF. + * + * @param x the x co-ordinate of the touch event + * @param y the y co-ordinate of the touch event + * + */ + public void setTouchIndexAf(int x, int y) { + String v = Integer.toString(x) + "x" + Integer.toString(y); + set(KEY_TOUCH_INDEX_AF, v); + } + + /** + * @hide + * Returns the touch co-ordinates of the touch event. + * + * @return a Index object with the x and y co-ordinated + * for the touch event + * + */ + public Coordinate getTouchIndexAf() { + String pair = get(KEY_TOUCH_INDEX_AF); + return strToCoordinate(pair); + } + + /** + * @hide + * Get Sharpness level + * + * @return sharpness level + */ + public int getSharpness(){ + return getInt(KEY_SHARPNESS); + } + + /** + * @hide + * Set Sharpness Level + * + * @param sharpness level + */ + public void setSharpness(int sharpness){ + if((sharpness < 0) || (sharpness > getMaxSharpness()) ) + throw new IllegalArgumentException( + "Invalid Sharpness " + sharpness); + + set(KEY_SHARPNESS, String.valueOf(sharpness)); + } + + /** + * @hide + * Get Max Sharpness Level + * + * @return max sharpness level + */ + public int getMaxSharpness(){ + return getInt(KEY_MAX_SHARPNESS); + } /** + * @hide + * Get Contrast level + * + * @return contrast level + */ + public int getContrast(){ + return getInt(KEY_CONTRAST); + } + + /** + * @hide + * Set Contrast Level + * + * @param contrast level + */ + public void setContrast(int contrast){ + if((contrast < 0 ) || (contrast > getMaxContrast())) + throw new IllegalArgumentException( + "Invalid Contrast " + contrast); + + set(KEY_CONTRAST, String.valueOf(contrast)); + } + + /** + * @hide + * Get Max Contrast Level + * + * @return max contrast level + */ + public int getMaxContrast(){ + return getInt(KEY_MAX_CONTRAST); + } + + /** + * @hide + * Get Saturation level + * + * @return saturation level + */ + public int getSaturation(){ + return getInt(KEY_SATURATION); + } + + /** + * @hide + * Set Saturation Level + * + * @param saturation level + */ + public void setSaturation(int saturation){ + if((saturation < 0 ) || (saturation > getMaxSaturation())) + throw new IllegalArgumentException( + "Invalid Saturation " + saturation); + + set(KEY_SATURATION, String.valueOf(saturation)); + } + + /** + * @hide + * Get Max Saturation Level + * + * @return max contrast level + */ + public int getMaxSaturation(){ + return getInt(KEY_MAX_SATURATION); + } + + /** + * @hide + * Gets the current redeye reduction setting. + * + * @return one of REDEYE_REDUCTION_XXX string constant. null if redeye reduction + * setting is not supported. + * + */ + public String getRedeyeReductionMode() { + return get(KEY_REDEYE_REDUCTION); + } + + /** + * @hide + * Sets the redeye reduction. Other parameters may be changed after changing + * redeye reduction. After setting redeye reduction, + * applications should call getParameters to know if some parameters are + * changed. + * + * @param value REDEYE_REDUCTION_XXX string constants. + * + */ + public void setRedeyeReductionMode(String value) { + set(KEY_REDEYE_REDUCTION, value); + } + /** + * @hide + * Gets the supported redeye reduction modes. + * + * @return a List of REDEYE_REDUCTION_XXX string constant. null if redeye reduction + * setting is not supported. + * + */ + public List<String> getSupportedRedeyeReductionModes() { + String str = get(KEY_REDEYE_REDUCTION + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + /** * Gets the current antibanding setting. * * @return current antibanding. null if antibanding setting is not @@ -2604,6 +3234,39 @@ public class Camera { } /** + * @hide + * Gets the frame rate mode setting. + * + * @return one of FRAME_RATE_XXX_MODE string constant. null if this + * setting is not supported. + */ + public String getPreviewFrameRateMode() { + return get(KEY_PREVIEW_FRAME_RATE_MODE); + } + + /** + * @hide + * Sets the frame rate mode. + * + * @param value FRAME_RATE_XXX_MODE string constants. + */ + public void setPreviewFrameRateMode(String value) { + set(KEY_PREVIEW_FRAME_RATE_MODE, value); + } + + /** + * @hide + * Gets the supported frame rate modes. + * + * @return a List of FRAME_RATE_XXX_MODE string constant. null if this + * setting is not supported. + */ + public List<String> getSupportedPreviewFrameRateModes() { + String str = get(KEY_PREVIEW_FRAME_RATE_MODE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** * Gets the current scene mode setting. * * @return one of SCENE_MODE_XXX string constant. null if scene mode @@ -2657,6 +3320,45 @@ public class Camera { } /** + * @hide + * Gets the current auto scene detection setting. + * + * @return one of SCENE_DETECT_XXX string constant. null if auto scene detection + * setting is not supported. + * + */ + public String getSceneDetectMode() { + return get(KEY_SCENE_DETECT); + } + + /** + * @hide + * Sets the auto scene detect. Other parameters may be changed after changing + * scene detect. After setting auto scene detection, + * applications should call getParameters to know if some parameters are + * changed. + * + * @param value SCENE_DETECT_XXX string constants. + * + */ + public void setSceneDetectMode(String value) { + set(KEY_SCENE_DETECT, value); + } + + /** + * @hide + * Gets the supported auto scene detection modes. + * + * @return a List of SCENE_DETECT_XXX string constant. null if scene detection + * setting is not supported. + * + */ + public List<String> getSupportedSceneDetectModes() { + String str = get(KEY_SCENE_DETECT + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** * Gets the current flash mode setting. * * @return current flash mode. null if flash mode setting is not @@ -2672,6 +3374,19 @@ public class Camera { } /** + * @hide + * Gets the current hdr bracketing mode setting. + * + * @return current hdr bracketing mode. + * @see #KEY_AE_BRACKET_OFF + * @see #KEY_AE_BRACKET_HDR + * @see #KEY_AE_BRACKET_BRACKATING + */ + public String getAEBracket() { + return get(KEY_AE_BRACKET_HDR); + } + + /** * Sets the flash mode. * * @param value flash mode. @@ -2682,6 +3397,16 @@ public class Camera { } /** + * @hide + * Set HDR-Bracketing Level + * + * @param value HDR-Bracketing + */ + public void setAEBracket(String value){ + set(KEY_AE_BRACKET_HDR, value); + } + + /** * Gets the supported flash modes. * * @return a list of supported flash modes. null if flash mode setting @@ -3038,7 +3763,246 @@ public class Camera { } /** - * <p>Gets the distances from the camera to where an object appears to be + * @hide + * Gets the current ISO setting. + * + * @return one of ISO_XXX string constant. null if ISO + * setting is not supported. + */ + public String getISOValue() { + return get(KEY_ISO_MODE); + } + + /** + * @hide + * Sets the ISO. + * + * @param iso ISO_XXX string constant. + */ + public void setISOValue(String iso) { + set(KEY_ISO_MODE, iso); + } + + /** + * @hide + * Gets the supported ISO values. + * + * @return a List of FLASH_MODE_XXX string constants. null if flash mode + * setting is not supported. + */ + public List<String> getSupportedIsoValues() { + String str = get(KEY_ISO_MODE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** + * @hide + * Gets the current LensShade Mode. + * + * @return LensShade Mode + */ + public String getLensShade() { + return get(KEY_LENSSHADE); + } + /** + * @hide + * Sets the current LensShade Mode. + * + * @return LensShade Mode + */ + public void setLensShade(String lensshade) { + set(KEY_LENSSHADE, lensshade); + } + + /** + * @hide + * Gets the supported Lensshade modes. + * + * @return a List of LENS_MODE_XXX string constants. null if lens mode + * setting is not supported. + */ + public List<String> getSupportedLensShadeModes() { + String str = get(KEY_LENSSHADE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** + * @hide + * Gets the supported Histogram modes. + * + * @return a List of HISTOGRAM_XXX string constants. null if histogram mode + * setting is not supported. + */ + public List<String> getSupportedHistogramModes() { + String str = get(KEY_HISTOGRAM + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** + * @hide + * Gets the supported Skin Tone Enhancement modes. + * + * @return a List of SKIN_TONE_ENHANCEMENT_XXX string constants. null if skin tone enhancement + * setting is not supported. + */ + public List<String> getSupportedSkinToneEnhancementModes() { + String str = get(KEY_SKIN_TONE_ENHANCEMENT + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** + * @hide + * Gets the current auto exposure setting. + * + * @return one of AUTO_EXPOSURE_XXX string constant. null if auto exposure + * setting is not supported. + */ + public String getAutoExposure() { + return get(KEY_AUTO_EXPOSURE); + } + + /** + * @hide + * Sets the current auto exposure setting. + * + * @param value AUTO_EXPOSURE_XXX string constants. + */ + public void setAutoExposure(String value) { + set(KEY_AUTO_EXPOSURE, value); + } + + /** + * @hide + * Gets the supported auto exposure setting. + * + * @return a List of AUTO_EXPOSURE_XXX string constants. null if auto exposure + * setting is not supported. + */ + public List<String> getSupportedAutoexposure() { + String str = get(KEY_AUTO_EXPOSURE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** + * @hide + * Gets the current MCE Mode. + * + * @return MCE value + */ + public String getMemColorEnhance() { + return get(KEY_MEMORY_COLOR_ENHANCEMENT); + } + + /** + * @hide + * Sets the current MCE Mode. + * + * @return MCE Mode + */ + public void setMemColorEnhance(String mce) { + set(KEY_MEMORY_COLOR_ENHANCEMENT, mce); + } + + /** + * @hide + * Gets the supported MCE modes. + * + * @return a List of MCE_ENABLE/DISABLE string constants. null if MCE mode + * setting is not supported. + */ + public List<String> getSupportedMemColorEnhanceModes() { + String str = get(KEY_MEMORY_COLOR_ENHANCEMENT + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** + * @hide + * Gets the current ZSL Mode. + * + * @return ZSL mode value + */ + public String getZSLMode() { + return get(KEY_ZSL); + } + + /** + * @hide + * Sets the current ZSL Mode. ZSL mode is set as a 0th bit in KEY_CAMERA_MODE. + * + * @return null + */ + public void setZSLMode(String zsl) { + set(KEY_ZSL, zsl); + } + + /** + * @hide + * Gets the supported ZSL modes. + * + * @return a List of ZSL_OFF/OFF string constants. null if ZSL mode + * setting is not supported. + */ + public List<String> getSupportedZSLModes() { + String str = get(KEY_ZSL + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** + * @hide + * Gets the current Camera Mode Flag. Camera mode includes a + * flag(byte) which indicates different camera modes. + * For now support for ZSL added at bit0 + * + * @return Camera Mode. + */ + public String getCameraMode() { + return get(KEY_CAMERA_MODE); + } + + /** + * @hide + * Sets the current Camera Mode. + * + * @return null + */ + public void setCameraMode(int cameraMode) { + set(KEY_CAMERA_MODE, cameraMode); + } + + /** + * @hide + * Gets the current HFR Mode. + * + * @return VIDEO_HFR_XXX string constants + */ + public String getVideoHighFrameRate() { + return get(KEY_VIDEO_HIGH_FRAME_RATE); + } + + /** + * @hide + * Sets the current HFR Mode. + * + * @param hfr VIDEO_HFR_XXX string constants + */ + public void setVideoHighFrameRate(String hfr) { + set(KEY_VIDEO_HIGH_FRAME_RATE, hfr); + } + + /** + * @hide + * Gets the supported HFR modes. + * + * @return a List of VIDEO_HFR_XXX string constants. null if hfr mode + * setting is not supported. + */ + public List<String> getSupportedVideoHighFrameRateModes() { + String str = get(KEY_VIDEO_HIGH_FRAME_RATE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** + * Gets the distances from the camera to where an object appears to be * in focus. The object is sharpest at the optimal focus distance. The * depth of field is the far focus distance minus near focus distance.</p> * @@ -3131,6 +4095,28 @@ public class Camera { public List<Area> getFocusAreas() { return splitArea(get(KEY_FOCUS_AREAS)); } + /** + * @hide + * Gets the current DENOISE setting. + * + * @return one of DENOISE_XXX string constant. null if Denoise + * setting is not supported. + * + */ + public String getDenoise() { + return get(KEY_DENOISE); + } + /** + * @hide + * Gets the current Continuous AF setting. + * + * @return one of CONTINUOUS_AF_XXX string constant. null if continuous AF + * setting is not supported. + * + */ + public String getContinuousAf() { + return get(KEY_CONTINUOUS_AF); + } /** * Sets focus areas. See {@link #getFocusAreas()} for documentation. @@ -3141,6 +4127,25 @@ public class Camera { public void setFocusAreas(List<Area> focusAreas) { set(KEY_FOCUS_AREAS, focusAreas); } + /** + * @hide + * Sets the current Denoise mode. + * @param value DENOISE_XXX string constants. + * + */ + + public void setDenoise(String value) { + set(KEY_DENOISE, value); + } + /** + * @hide + * Sets the current Continuous AF mode. + * @param value CONTINUOUS_AF_XXX string constants. + * + */ + public void setContinuousAf(String value) { + set(KEY_CONTINUOUS_AF, value); + } /** * Gets the maximum number of metering areas supported. This is the @@ -3199,15 +4204,51 @@ public class Camera { } /** + * @hide + * Gets the supported Continuous AF modes. + * + * @return a List of CONTINUOUS_AF_XXX string constant. null if continuous AF + * setting is not supported. + * + */ + public List<String> getSupportedContinuousAfModes() { + String str = get(KEY_CONTINUOUS_AF + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + /** + * @hide + * Gets the supported DENOISE modes. + * + * @return a List of DENOISE_XXX string constant. null if DENOISE + * setting is not supported. + * + */ + public List<String> getSupportedDenoiseModes() { + String str = get(KEY_DENOISE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + + /** * Sets metering areas. See {@link #getMeteringAreas()} for * documentation. * * @param meteringAreas the metering areas * @see #getMeteringAreas() */ - public void setMeteringAreas(List<Area> meteringAreas) { + public void setMeteringAreas(List<Area> meteringAreas) { set(KEY_METERING_AREAS, meteringAreas); } + /** + * @hide + * Gets the current selectable zone af setting. + * + * @return one of SELECTABLE_ZONE_AF_XXX string constant. null if selectable zone af + * setting is not supported. + */ + public String getSelectableZoneAf() { + return get(KEY_SELECTABLE_ZONE_AF); + } /** * Gets the maximum number of detected faces supported. This is the @@ -3218,9 +4259,18 @@ public class Camera { * @return the maximum number of detected face supported by the camera. * @see #startFaceDetection() */ - public int getMaxNumDetectedFaces() { + public int getMaxNumDetectedFaces() { return getInt(KEY_MAX_NUM_DETECTED_FACES_HW, 0); } + /** + * @hide + * Sets the current selectable zone af setting. + * + * @param value SELECTABLE_ZONE_AF_XXX string constants. + */ + public void setSelectableZoneAf(String value) { + set(KEY_SELECTABLE_ZONE_AF, value); + } /** * Sets recording mode hint. This tells the camera that the intent of @@ -3245,6 +4295,18 @@ public class Camera { } /** + * @hide + * Gets the supported selectable zone af setting. + * + * @return a List of SELECTABLE_ZONE_AF_XXX string constants. null if selectable zone af + * setting is not supported. + */ + public List<String> getSupportedSelectableZoneAf() { + String str = get(KEY_SELECTABLE_ZONE_AF + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** * Returns true if video snapshot is supported. That is, applications * can call {@link #takePicture(Camera.ShutterCallback, * Camera.PictureCallback, Camera.PictureCallback, Camera.PictureCallback)} @@ -3272,6 +4334,27 @@ public class Camera { return TRUE.equals(str); } + /** + * @hide + * @return true if full size video snapshot is supported. + */ + public boolean isFullsizeVideoSnapSupported() { + String str = get(KEY_FULL_VIDEO_SNAP_SUPPORTED); + return TRUE.equals(str); + } + + /** + * @hide + * Gets the current face detection setting. + * + * @return one of FACE_DETECTION_XXX string constant. null if face detection + * setting is not supported. + * + */ + public String getFaceDetectionMode() { + return get(KEY_FACE_DETECTION); + } + /** * <p>Enables and disables video stabilization. Use * {@link #isVideoStabilizationSupported} to determine if calling this @@ -3297,6 +4380,17 @@ public class Camera { } /** + * Sets the auto scene detect. Other settings like Touch AF/AEC might be + * changed after setting face detection. + * + * @param value FACE_DETECTION_XXX string constants. + * @hide + */ + public void setFaceDetectionMode(String value) { + set(KEY_FACE_DETECTION, value); + } + + /** * Get the current state of video stabilization. See * {@link #setVideoStabilization} for details of video stabilization. * @@ -3322,6 +4416,19 @@ public class Camera { return TRUE.equals(str); } + /** + * @hide + * Gets the supported face detection modes. + * + * @return a List of FACE_DETECTION_XXX string constant. null if face detection + * setting is not supported. + * + */ + public List<String> getSupportedFaceDetectionModes() { + String str = get(KEY_FACE_DETECTION + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + // Splits a comma delimited string to an ArrayList of String. // Return null if the passing string is null or the size is 0. private ArrayList<String> split(String str) { @@ -3484,6 +4591,37 @@ public class Camera { return result; } + // Splits a comma delimited string to an ArrayList of Coordinate. + // Return null if the passing string is null or the Coordinate is 0. + private ArrayList<Coordinate> splitCoordinate(String str) { + if (str == null) return null; + + StringTokenizer tokenizer = new StringTokenizer(str, ","); + ArrayList<Coordinate> coordinateList = new ArrayList<Coordinate>(); + while (tokenizer.hasMoreElements()) { + Coordinate c = strToCoordinate(tokenizer.nextToken()); + if (c != null) coordinateList.add(c); + } + if (coordinateList.size() == 0) return null; + return coordinateList; + } + + // Parses a string (ex: "500x500") to Coordinate object. + // Return null if the passing string is null. + private Coordinate strToCoordinate(String str) { + if (str == null) return null; + + int pos = str.indexOf('x'); + if (pos != -1) { + String x = str.substring(0, pos); + String y = str.substring(pos + 1); + return new Coordinate(Integer.parseInt(x), + Integer.parseInt(y)); + } + Log.e(TAG, "Invalid Coordinate parameter string=" + str); + return null; + } + private boolean same(String s1, String s2) { if (s1 == null && s2 == null) return true; if (s1 != null && s1.equals(s2)) return true; |