summaryrefslogtreecommitdiffstats
path: root/core/java/android/hardware/Camera.java
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:51:23 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:51:23 -0800
commitb798689749c64baba81f02e10cf2157c747d6b46 (patch)
treeda394a395ddb1a6cf69193314846b03fe47a397e /core/java/android/hardware/Camera.java
parentf013e1afd1e68af5e3b868c26a653bbfb39538f8 (diff)
downloadframeworks_base-b798689749c64baba81f02e10cf2157c747d6b46.zip
frameworks_base-b798689749c64baba81f02e10cf2157c747d6b46.tar.gz
frameworks_base-b798689749c64baba81f02e10cf2157c747d6b46.tar.bz2
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'core/java/android/hardware/Camera.java')
-rw-r--r--core/java/android/hardware/Camera.java106
1 files changed, 101 insertions, 5 deletions
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index dc75748..e2d7097 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -100,10 +100,12 @@ public class Camera {
/**
* Reconnect to the camera after passing it to MediaRecorder. To save
- * setup/teardown time, a client of Camara can pass an initialized Camera
+ * setup/teardown time, a client of Camera can pass an initialized Camera
* object to a MediaRecorder to use for video recording. Once the
* MediaRecorder is done with the Camera, this method can be used to
- * re-establish a connection with the camera hardware.
+ * re-establish a connection with the camera hardware. NOTE: The Camera
+ * object must first be unlocked by the process that owns it before it
+ * can be connected to another proces.
*
* @throws IOException if the method fails.
*
@@ -113,6 +115,34 @@ public class Camera {
public native final void reconnect() throws IOException;
/**
+ * Lock the camera to prevent other processes from accessing it. To save
+ * setup/teardown time, a client of Camera can pass an initialized Camera
+ * object to another process. This method is used to re-lock the Camera
+ * object prevent other processes from accessing it. By default, the
+ * Camera object is locked. Locking it again from the same process will
+ * have no effect. Attempting to lock it from another process if it has
+ * not been unlocked will fail.
+ * Returns 0 if lock was successful.
+ *
+ * FIXME: Unhide after approval
+ * @hide
+ */
+ public native final int lock();
+
+ /**
+ * Unlock the camera to allow aother process to access it. To save
+ * setup/teardown time, a client of Camera can pass an initialized Camera
+ * object to another process. This method is used to unlock the Camera
+ * object before handing off the Camera object to the other process.
+
+ * Returns 0 if unlock was successful.
+ *
+ * FIXME: Unhide after approval
+ * @hide
+ */
+ public native final int unlock();
+
+ /**
* Sets the SurfaceHolder to be used for a picture preview. If the surface
* changed since the last call, the screen will blank. Nothing happens
* if the same surface is re-set.
@@ -152,6 +182,14 @@ public class Camera {
public native final void stopPreview();
/**
+ * Return current preview state.
+ *
+ * FIXME: Unhide before release
+ * @hide
+ */
+ public native final boolean previewEnabled();
+
+ /**
* Can be called at any time to instruct the camera to use a callback for
* each preview frame in addition to displaying it.
*
@@ -242,7 +280,9 @@ public class Camera {
};
/**
- * Registers a callback to be invoked when the auto focus responds.
+ * Starts auto-focus function and registers a callback function to
+ * run when camera is focused. Only valid after startPreview() has
+ * been called.
*
* @param cb the callback to run
*/
@@ -525,6 +565,58 @@ public class Camera {
}
/**
+ * Sets the dimensions for EXIF thumbnails.
+ *
+ * @param width the width of the thumbnail, in pixels
+ * @param height the height of the thumbnail, in pixels
+ *
+ * FIXME: unhide before release
+ * @hide
+ */
+ public void setThumbnailSize(int width, int height) {
+ set("jpeg-thumbnail-width", width);
+ set("jpeg-thumbnail-height", height);
+ }
+
+ /**
+ * Returns the dimensions for EXIF thumbnail
+ *
+ * @return a Size object with the height and width setting
+ * for the EXIF thumbnails
+ *
+ * FIXME: unhide before release
+ * @hide
+ */
+ public Size getThumbnailSize() {
+ return new Size(getInt("jpeg-thumbnail-width"),
+ getInt("jpeg-thumbnail-height"));
+ }
+
+ /**
+ * Sets the quality of the EXIF thumbnail
+ *
+ * @param quality the JPEG quality of the EXIT thumbnail
+ *
+ * FIXME: unhide before release
+ * @hide
+ */
+ public void setThumbnailQuality(int quality) {
+ set("jpeg-thumbnail-quality", quality);
+ }
+
+ /**
+ * Returns the quality setting for the EXIF thumbnail
+ *
+ * @return the JPEG quality setting of the EXIF thumbnail
+ *
+ * FIXME: unhide before release
+ * @hide
+ */
+ public int getThumbnailQuality() {
+ return getInt("jpeg-thumbnail-quality");
+ }
+
+ /**
* Sets the rate at which preview frames are received.
*
* @param fps the frame rate (frames per second)
@@ -547,7 +639,7 @@ public class Camera {
* Sets the image format for preview pictures.
*
* @param pixel_format the desired preview picture format
- * (<var>PixelFormat.YCbCr_422_SP</var>,
+ * (<var>PixelFormat.YCbCr_420_SP</var>,
* <var>PixelFormat.RGB_565</var>, or
* <var>PixelFormat.JPEG</var>)
* @see android.graphics.PixelFormat
@@ -604,7 +696,7 @@ public class Camera {
* Sets the image format for pictures.
*
* @param pixel_format the desired picture format
- * (<var>PixelFormat.YCbCr_422_SP</var>,
+ * (<var>PixelFormat.YCbCr_420_SP</var>,
* <var>PixelFormat.RGB_565</var>, or
* <var>PixelFormat.JPEG</var>)
* @see android.graphics.PixelFormat
@@ -630,6 +722,7 @@ public class Camera {
private String cameraFormatForPixelFormat(int pixel_format) {
switch(pixel_format) {
case PixelFormat.YCbCr_422_SP: return "yuv422sp";
+ case PixelFormat.YCbCr_420_SP: return "yuv420sp";
case PixelFormat.RGB_565: return "rgb565";
case PixelFormat.JPEG: return "jpeg";
default: return null;
@@ -643,6 +736,9 @@ public class Camera {
if (format.equals("yuv422sp"))
return PixelFormat.YCbCr_422_SP;
+ if (format.equals("yuv420sp"))
+ return PixelFormat.YCbCr_420_SP;
+
if (format.equals("rgb565"))
return PixelFormat.RGB_565;