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 | |
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
-rw-r--r-- | core/java/android/hardware/Camera.java | 1144 | ||||
-rw-r--r-- | core/jni/android_hardware_Camera.cpp | 42 | ||||
-rw-r--r-- | include/camera/CameraParameters.h | 21 | ||||
-rw-r--r-- | include/media/MediaProfiles.h | 9 | ||||
-rw-r--r-- | libs/camera/CameraParameters.cpp | 68 | ||||
-rw-r--r-- | media/java/android/media/CamcorderProfile.java | 30 | ||||
-rw-r--r-- | media/jni/android_media_MediaProfiles.cpp | 11 | ||||
-rw-r--r-- | media/libmedia/MediaProfiles.cpp | 15 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraHardwareInterface.h | 10 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 27 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.h | 1 |
11 files changed, 1351 insertions, 27 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; diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index fe60381..c8dd098 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -601,6 +601,42 @@ static void android_hardware_Camera_setHasPreviewCallback(JNIEnv *env, jobject t context->setCallbackMode(env, installed, manualBuffer); } + static void android_hardware_Camera_sendHistogramData(JNIEnv *env, jobject thiz) + { +#ifdef QCOM_HARDWARE + LOGV("setHistogramMode: mode:" ); + JNICameraContext* context; + status_t rc; + sp<Camera> camera = get_native_camera(env, thiz, &context); + if (camera == 0) return; + + rc = camera->sendCommand(CAMERA_CMD_HISTOGRAM_SEND_DATA, 0, 0); + + if (rc != NO_ERROR) { + jniThrowException(env, "java/lang/RuntimeException", "set histogram mode failed"); + } +#endif + } + static void android_hardware_Camera_setHistogramMode(JNIEnv *env, jobject thiz, jboolean mode) + { +#ifdef QCOM_HARDWARE + LOGV("sendHistogramData: mode:%d", (int)mode); + JNICameraContext* context; + status_t rc; + sp<Camera> camera = get_native_camera(env, thiz, &context); + if (camera == 0) return; + + if(mode == true) + rc = camera->sendCommand(CAMERA_CMD_HISTOGRAM_ON, 0, 0); + else + rc = camera->sendCommand(CAMERA_CMD_HISTOGRAM_OFF, 0, 0); + + if (rc != NO_ERROR) { + jniThrowException(env, "java/lang/RuntimeException", "set histogram mode failed"); + } +#endif + } + static void android_hardware_Camera_addCallbackBuffer(JNIEnv *env, jobject thiz, jbyteArray bytes, int msgType) { LOGV("addCallbackBuffer: 0x%x", msgType); @@ -840,6 +876,12 @@ static JNINativeMethod camMethods[] = { { "native_takePicture", "(I)V", (void *)android_hardware_Camera_takePicture }, + { "native_setHistogramMode", + "(Z)V", + (void *)android_hardware_Camera_setHistogramMode }, + { "native_sendHistogramData", + "()V", + (void *)android_hardware_Camera_sendHistogramData }, { "native_setParameters", "(Ljava/lang/String;)V", (void *)android_hardware_Camera_setParameters }, diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h index 3821f86..7582ea0 100644 --- a/include/camera/CameraParameters.h +++ b/include/camera/CameraParameters.h @@ -123,6 +123,8 @@ public: void getTouchIndexAf(int *x, int *y) const; #endif + void getMeteringAreaCenter(int * x, int *y) const; + void dump() const; status_t dump(int fd, const Vector<String16>& args) const; @@ -564,6 +566,7 @@ public: // captured pictures. // Example value: "true" or "false". Read only. static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[]; + static const char KEY_FULL_VIDEO_SNAP_SUPPORTED[]; #ifdef QCOM_HARDWARE static const char KEY_ISO_MODE[]; @@ -599,6 +602,11 @@ public: static const char KEY_MEMORY_COLOR_ENHANCEMENT[]; static const char KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[]; + static const char KEY_ZSL[]; + static const char KEY_SUPPORTED_ZSL_MODES[]; + + static const char KEY_CAMERA_MODE[]; + static const char KEY_VIDEO_HIGH_FRAME_RATE[]; static const char KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[]; static const char KEY_HIGH_DYNAMIC_RANGE_IMAGING[]; @@ -609,6 +617,8 @@ public: // stream and record stabilized videos. static const char KEY_VIDEO_STABILIZATION_SUPPORTED[]; + static const char KEY_AE_BRACKET_HDR[]; + // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED. static const char TRUE[]; static const char FALSE[]; @@ -687,6 +697,7 @@ public: // Values for scene mode settings. static const char SCENE_MODE_AUTO[]; + static const char SCENE_MODE_ASD[]; static const char SCENE_MODE_ACTION[]; static const char SCENE_MODE_PORTRAIT[]; static const char SCENE_MODE_LANDSCAPE[]; @@ -732,6 +743,7 @@ public: #ifdef QCOM_HARDWARE static const char PIXEL_FORMAT_RAW[]; static const char PIXEL_FORMAT_YV12[]; // NV21 + static const char PIXEL_FORMAT_NV12[]; //NV12 #endif // Values for focus mode settings. @@ -840,6 +852,15 @@ public: static const char MCE_ENABLE[]; static const char MCE_DISABLE[]; + // Values for ZSL settings. + static const char ZSL_OFF[]; + static const char ZSL_ON[]; + + // Values for HDR Bracketing settings. + static const char AE_BRACKET_HDR_OFF[]; + static const char AE_BRACKET_HDR[]; + static const char AE_BRACKET[]; + // Values for HFR settings. static const char VIDEO_HFR_OFF[]; static const char VIDEO_HFR_2X[]; diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h index 6eba32c..1a4875a 100644 --- a/include/media/MediaProfiles.h +++ b/include/media/MediaProfiles.h @@ -32,8 +32,13 @@ enum camcorder_quality { CAMCORDER_QUALITY_480P = 4, CAMCORDER_QUALITY_720P = 5, CAMCORDER_QUALITY_1080P = 6, - CAMCORDER_QUALITY_QVGA = 7, - CAMCORDER_QUALITY_LIST_END = 7, + CAMCORDER_QUALITY_QVGA = 11, + CAMCORDER_QUALITY_FWVGA = 7, + CAMCORDER_QUALITY_WVGA = 8, + CAMCORDER_QUALITY_VGA = 9, + CAMCORDER_QUALITY_WQVGA = 10, + + CAMCORDER_QUALITY_LIST_END = 11, CAMCORDER_QUALITY_TIME_LAPSE_LIST_START = 1000, CAMCORDER_QUALITY_TIME_LAPSE_LOW = 1000, diff --git a/libs/camera/CameraParameters.cpp b/libs/camera/CameraParameters.cpp index d401cf6..a7f33a6 100644 --- a/libs/camera/CameraParameters.cpp +++ b/libs/camera/CameraParameters.cpp @@ -129,8 +129,17 @@ const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW[] = "max-num-detected const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW[] = "max-num-detected-faces-sw"; const char CameraParameters::KEY_RECORDING_HINT[] = "recording-hint"; const char CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED[] = "video-snapshot-supported"; +const char CameraParameters::KEY_FULL_VIDEO_SNAP_SUPPORTED[] = "full-video-snap-supported"; const char CameraParameters::KEY_VIDEO_STABILIZATION[] = "video-stabilization"; const char CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED[] = "video-stabilization-supported"; +#ifdef QCOM_HARDWARE +const char CameraParameters::KEY_ZSL[] = "zsl"; +const char CameraParameters::KEY_SUPPORTED_ZSL_MODES[] = "zsl-values"; +const char CameraParameters::KEY_CAMERA_MODE[] = "camera-mode"; +#endif +const char CameraParameters::KEY_AE_BRACKET_HDR[] = "ae-bracket-hdr"; +/*only effective when KEY_AE_BRACKET_HDR set to ae_bracketing*/ +//const char CameraParameters::KEY_AE_BRACKET_SETTING_KEY[] = "ae-bracket-setting"; const char CameraParameters::TRUE[] = "true"; const char CameraParameters::FALSE[] = "false"; @@ -180,7 +189,8 @@ const char CameraParameters::FLASH_MODE_RED_EYE[] = "red-eye"; const char CameraParameters::FLASH_MODE_TORCH[] = "torch"; // Values for scene mode settings. -const char CameraParameters::SCENE_MODE_AUTO[] = "auto"; +const char CameraParameters::SCENE_MODE_AUTO[] = "auto"; // corresponds to CAMERA_BESTSHOT_OFF in HAL +const char CameraParameters::SCENE_MODE_ASD[] = "asd"; // corresponds to CAMERA_BESTSHOT_AUTO in HAL const char CameraParameters::SCENE_MODE_ACTION[] = "action"; const char CameraParameters::SCENE_MODE_PORTRAIT[] = "portrait"; const char CameraParameters::SCENE_MODE_LANDSCAPE[] = "landscape"; @@ -222,7 +232,8 @@ const char CameraParameters::PIXEL_FORMAT_JPEG[] = "jpeg"; const char CameraParameters::PIXEL_FORMAT_BAYER_RGGB[] = "bayer-rggb"; #ifdef QCOM_HARDWARE const char CameraParameters::PIXEL_FORMAT_RAW[] = "raw"; -const char CameraParameters::PIXEL_FORMAT_YV12[] = "yv12"; +const char CameraParameters::PIXEL_FORMAT_YV12[] = "yuv420p"; +const char CameraParameters::PIXEL_FORMAT_NV12[] = "nv12"; #endif // Values for focus mode settings. @@ -232,9 +243,8 @@ const char CameraParameters::FOCUS_MODE_MACRO[] = "macro"; const char CameraParameters::FOCUS_MODE_FIXED[] = "fixed"; const char CameraParameters::FOCUS_MODE_EDOF[] = "edof"; const char CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO[] = "continuous-video"; -#ifndef QCOM_HARDWARE const char CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE[] = "continuous-picture"; -#elif defined(QCOM_HARDWARE) +#if defined(QCOM_HARDWARE) const char CameraParameters::FOCUS_MODE_NORMAL[] = "normal"; @@ -312,6 +322,15 @@ const char CameraParameters::REDEYE_REDUCTION_DISABLE[] = "disable"; const char CameraParameters::HDR_ENABLE[] = "enable"; const char CameraParameters::HDR_DISABLE[] = "disable"; +// Values for ZSL settings. +const char CameraParameters::ZSL_OFF[] = "off"; +const char CameraParameters::ZSL_ON[] = "on"; + +// Values for HDR Bracketing settings. +const char CameraParameters::AE_BRACKET_HDR_OFF[] = "Off"; +const char CameraParameters::AE_BRACKET_HDR[] = "HDR"; +const char CameraParameters::AE_BRACKET[] = "AE-Bracket"; + static const char* portrait = "portrait"; static const char* landscape = "landscape"; @@ -479,6 +498,32 @@ static int parse_pair(const char *str, int *first, int *second, char delim, return 0; } +// Parse string like "(1, 2, 3, 4, ..., N)" +// num is pointer to an allocated array of size N +static int parseNDimVector(const char *str, int *num, int N, char delim = ',') +{ + char *start, *end; + if(num == NULL) { + LOGE("Invalid output array (num == NULL)"); + return -1; + } + //check if string starts and ends with parantheses + if(str[0] != '(' || str[strlen(str)-1] != ')') { + LOGE("Invalid format of string %s, valid format is (n1, n2, n3, n4 ...)", str); + return -1; + } + start = (char*) str; + start++; + for(int i=0; i<N; i++) { + *(num+i) = (int) strtol(start, &end, 10); + if(*end != delim && i < N-1) { + LOGE("Cannot find delimeter '%c' in string \"%s\". end = %c", delim, str, *end); + return -1; + } + start = end+1; + } + return 0; +} static void parseSizesList(const char *sizesStr, Vector<Size> &sizes) { if (sizesStr == 0) { @@ -685,6 +730,21 @@ void CameraParameters::setTouchIndexAf(int x, int y) set(KEY_TOUCH_INDEX_AF, str); } +void CameraParameters::getMeteringAreaCenter(int *x, int *y) const +{ + //Default invalid values + *x = -2000; + *y = -2000; + + const char *p = get(KEY_METERING_AREAS); + if(p != NULL) { + int arr[5] = {-2000, -2000, -2000, -2000, 0}; + parseNDimVector(p, arr, 5); //p = "(x1, y1, x2, y2, weight)" + *x = (arr[0] + arr[2])/2; //center_x = (x1+x2)/2 + *y = (arr[1] + arr[3])/2; //center_y = (y1+y2)/2 + } +} + void CameraParameters::getTouchIndexAf(int *x, int *y) const { *x = -1; diff --git a/media/java/android/media/CamcorderProfile.java b/media/java/android/media/CamcorderProfile.java index 7d60c55..137dc92 100644 --- a/media/java/android/media/CamcorderProfile.java +++ b/media/java/android/media/CamcorderProfile.java @@ -61,9 +61,9 @@ public class CamcorderProfile public static final int QUALITY_QCIF = 2; /** - * Quality level corresponding to the cif (352 x 288) resolution. + * Quality level corresponding to the cif (352 x 288) resolution. */ - public static final int QUALITY_CIF = 3; + public static final int QUALITY_QVGA = 7; /** * Quality level corresponding to the 480p (720 x 480) resolution. @@ -82,12 +82,34 @@ public class CamcorderProfile /** * Quality level corresponding to the QVGA (320x240) resolution. + * */ - public static final int QUALITY_QVGA = 7; + public static final int QUALITY_CIF = 3; + + /** + * {@hide} + */ + public static final int QUALITY_WQVGA = 10; + + /** + * {@hide} + */ + public static final int QUALITY_VGA = 9; + + /** + * {@hide} + */ + public static final int QUALITY_WVGA = 8; + + /** + * {@hide} + */ + public static final int QUALITY_FWVGA = 11; + // Start and end of quality list private static final int QUALITY_LIST_START = QUALITY_LOW; - private static final int QUALITY_LIST_END = QUALITY_QVGA; + private static final int QUALITY_LIST_END = QUALITY_FWVGA; /** * Time lapse quality level corresponding to the lowest available resolution. diff --git a/media/jni/android_media_MediaProfiles.cpp b/media/jni/android_media_MediaProfiles.cpp index 7ed0050..c718e73 100644 --- a/media/jni/android_media_MediaProfiles.cpp +++ b/media/jni/android_media_MediaProfiles.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -//#define LOG_NDEBUG 0 +#define LOG_NDEBUG 0 #define LOG_TAG "MediaProfilesJNI" #include <utils/Log.h> @@ -36,12 +36,15 @@ MediaProfiles *sProfiles = NULL; static void android_media_MediaProfiles_native_init(JNIEnv *env) { - LOGV("native_init"); + LOGE("native_init"); Mutex::Autolock lock(sLock); + LOGE("After native_init lock"); if (sProfiles == NULL) { + LOGE("Guru : native_init profiles"); sProfiles = MediaProfiles::getInstance(); } + LOGE("retun sProfiles"); } static jint @@ -172,7 +175,7 @@ static bool isCamcorderQualityKnown(int quality) static jobject android_media_MediaProfiles_native_get_camcorder_profile(JNIEnv *env, jobject thiz, jint id, jint quality) { - LOGV("native_get_camcorder_profile: %d %d", id, quality); + LOGE("native_get_camcorder_profile: %d %d", id, quality); if (!isCamcorderQualityKnown(quality)) { jniThrowException(env, "java/lang/RuntimeException", "Unknown camcorder profile quality"); return NULL; @@ -221,7 +224,7 @@ android_media_MediaProfiles_native_get_camcorder_profile(JNIEnv *env, jobject th static jboolean android_media_MediaProfiles_native_has_camcorder_profile(JNIEnv *env, jobject thiz, jint id, jint quality) { - LOGV("native_has_camcorder_profile: %d %d", id, quality); + LOGE("native_has_camcorder_profile: %d %d", id, quality); if (!isCamcorderQualityKnown(quality)) { return false; } diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp index 084b4bc..fb3bf80 100644 --- a/media/libmedia/MediaProfiles.cpp +++ b/media/libmedia/MediaProfiles.cpp @@ -68,6 +68,10 @@ const MediaProfiles::NameToTagMap MediaProfiles::sCamcorderQualityNameMap[] = { {"720p", CAMCORDER_QUALITY_720P}, {"1080p", CAMCORDER_QUALITY_1080P}, {"qvga", CAMCORDER_QUALITY_QVGA}, + {"fwvga", CAMCORDER_QUALITY_FWVGA}, + {"wvga", CAMCORDER_QUALITY_WVGA}, + {"vga", CAMCORDER_QUALITY_VGA}, + {"wqvga", CAMCORDER_QUALITY_WQVGA}, {"timelapselow", CAMCORDER_QUALITY_TIME_LAPSE_LOW}, {"timelapsehigh", CAMCORDER_QUALITY_TIME_LAPSE_HIGH}, @@ -612,7 +616,7 @@ void MediaProfiles::checkAndAddRequiredProfilesIfNecessary() { /*static*/ MediaProfiles* MediaProfiles::getInstance() { - LOGV("getInstance"); + LOGE("getInstance"); Mutex::Autolock lock(sLock); if (!sIsInitialized) { char value[PROPERTY_VALUE_MAX]; @@ -620,20 +624,22 @@ MediaProfiles::getInstance() const char *defaultXmlFile = "/etc/media_profiles.xml"; FILE *fp = fopen(defaultXmlFile, "r"); if (fp == NULL) { - LOGW("could not find media config xml file"); + LOGE("could not find media config xml file"); sInstance = createDefaultInstance(); } else { + LOGE("Guru :Else 1"); fclose(fp); // close the file first. sInstance = createInstanceFromXmlFile(defaultXmlFile); } } else { + LOGE("Guru : Else 2"); sInstance = createInstanceFromXmlFile(value); } CHECK(sInstance != NULL); sInstance->checkAndAddRequiredProfilesIfNecessary(); sIsInitialized = true; } - + LOGE("getInstance %x",sInstance); return sInstance; } @@ -1122,6 +1128,7 @@ int MediaProfiles::getCamcorderProfileIndex(int cameraId, camcorder_quality qual break; } } + LOGE("Guru : quality = %d, index = %d",quality,index); return index; } @@ -1129,7 +1136,7 @@ int MediaProfiles::getCamcorderProfileParamByName(const char *name, int cameraId, camcorder_quality quality) const { - LOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d", + LOGE("getCamcorderProfileParamByName: %s for camera %d, quality %d", name, cameraId, quality); int index = getCamcorderProfileIndex(cameraId, quality); diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h index c3ced4c2..57f923f 100644 --- a/services/camera/libcameraservice/CameraHardwareInterface.h +++ b/services/camera/libcameraservice/CameraHardwareInterface.h @@ -458,13 +458,17 @@ private: LOGV("%s", __FUNCTION__); CameraHardwareInterface *__this = static_cast<CameraHardwareInterface *>(user); - sp<CameraHeapMemory> mem(static_cast<CameraHeapMemory *>(data->handle)); - if (index >= mem->mNumBufs) { + if (data != NULL) { + sp<CameraHeapMemory> mem(static_cast<CameraHeapMemory *>(data->handle)); + if (index >= mem->mNumBufs) { LOGE("%s: invalid buffer index %d, max allowed is %d", __FUNCTION__, index, mem->mNumBufs); return; + } + __this->mDataCb(msg_type, mem->mBuffers[index], metadata, __this->mCbUser); + } else { + __this->mDataCb(msg_type, NULL, metadata, __this->mCbUser); } - __this->mDataCb(msg_type, mem->mBuffers[index], metadata, __this->mCbUser); } static void __data_cb_timestamp(nsecs_t timestamp, int32_t msg_type, diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index bb0e664..b0efea5 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -352,6 +352,7 @@ CameraService::Client::Client(const sp<CameraService>& cameraService, mCameraFacing = cameraFacing; mClientPid = clientPid; mMsgEnabled = 0; + mburstCnt = 0; mSurface = 0; mPreviewWindow = 0; mHardware->setCallbacks(notifyCallback, @@ -609,6 +610,7 @@ void CameraService::Client::setPreviewCallbackFlag(int callback_flag) { // start preview mode status_t CameraService::Client::startPreview() { LOG1("startPreview (pid %d)", getCallingPid()); + enableMsgType(CAMERA_MSG_PREVIEW_METADATA); return startCameraMode(CAMERA_PREVIEW_MODE); } @@ -694,6 +696,7 @@ status_t CameraService::Client::startRecordingMode() { // stop preview mode void CameraService::Client::stopPreview() { LOG1("stopPreview (pid %d)", getCallingPid()); + disableMsgType(CAMERA_MSG_PREVIEW_METADATA); Mutex::Autolock lock(mLock); if (checkPidAndHardware() != NO_ERROR) return; @@ -772,6 +775,7 @@ status_t CameraService::Client::cancelAutoFocus() { // take a picture - image is returned in callback status_t CameraService::Client::takePicture(int msgType) { + char prop[PROPERTY_VALUE_MAX]; LOG1("takePicture (pid %d): 0x%x", getCallingPid(), msgType); Mutex::Autolock lock(mLock); @@ -793,9 +797,15 @@ status_t CameraService::Client::takePicture(int msgType) { CAMERA_MSG_RAW_IMAGE | CAMERA_MSG_RAW_IMAGE_NOTIFY | CAMERA_MSG_COMPRESSED_IMAGE); - + disableMsgType(CAMERA_MSG_PREVIEW_METADATA); enableMsgType(picMsgType); - + memset(prop, 0, sizeof(prop)); + property_get("persist.camera.snapshot.number", prop, "0"); + mburstCnt = atoi(prop); + if (!mburstCnt) { + mburstCnt = mHardware->getParameters().getInt("num-snaps-per-shutter"); + } + LOG1("mburstCnt = %d", mburstCnt); return mHardware->takePicture(); } @@ -885,6 +895,13 @@ status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t a } else if (cmd == CAMERA_CMD_PLAY_RECORDING_SOUND) { mCameraService->playSound(SOUND_RECORDING); } + else if (cmd == CAMERA_CMD_HISTOGRAM_ON ) { + enableMsgType(CAMERA_MSG_STATS_DATA); + } + else if (cmd == CAMERA_CMD_HISTOGRAM_OFF) { + disableMsgType(CAMERA_MSG_STATS_DATA); + } + return mHardware->sendCommand(cmd, arg1, arg2); } @@ -1131,8 +1148,12 @@ void CameraService::Client::handleRawPicture(const sp<IMemory>& mem) { // picture callback - compressed picture ready void CameraService::Client::handleCompressedPicture(const sp<IMemory>& mem) { - disableMsgType(CAMERA_MSG_COMPRESSED_IMAGE); + if (mburstCnt) mburstCnt--; + if (!mburstCnt) { + LOG1("mburstCnt = %d", mburstCnt); + disableMsgType(CAMERA_MSG_COMPRESSED_IMAGE); + } sp<ICameraClient> c = mCameraClient; mLock.unlock(); if (c != 0) { diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index cdfbc56..f2f7c75 100644 --- a/services/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h @@ -211,6 +211,7 @@ private: // This function keeps trying to grab mLock, or give up if the message // is found to be disabled. It returns true if mLock is grabbed. bool lockIfMessageWanted(int32_t msgType); + int mburstCnt; }; camera_module_t *mModule; |