aboutsummaryrefslogtreecommitdiffstats
path: root/include/system
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2012-03-06 23:22:20 +0800
committerWu-cheng Li <wuchengli@google.com>2012-03-14 10:35:53 +0800
commit2923c0ba526902604ee53e94e07a16bef55742af (patch)
treea51b7ea55b535f5615e16e1866604280c1565d8b /include/system
parent63d84d049a4673517b389188366ef61f840e9c2d (diff)
downloadsystem_core-2923c0ba526902604ee53e94e07a16bef55742af.tar.gz
system_core-2923c0ba526902604ee53e94e07a16bef55742af.tar.bz2
system_core-2923c0ba526902604ee53e94e07a16bef55742af.zip
Add camera ping command and release message.
The problem is both face unlock and camera application try to open the hardware camera at the same time. A new camera open API is added to let face unlock take the camera away from the existing client. The release message is used to notify the existing client, so it has time to release the hardware camera and clean up. If existing client tries to use the camera after it is released, the method will return error. It is still possible that the camera has been taken and the existing client has not got the notification. When any method returns error, the existing client can use ping command to check whether the camera has been released. If yes, the client can silently finish the app itself or show a toast if it wants. bug:5584464 Change-Id: I87f9f7db2f7b2b70ab2405f9b3da0d8946d6a01b
Diffstat (limited to 'include/system')
-rw-r--r--include/system/camera.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/system/camera.h b/include/system/camera.h
index 62167cf8..b8389b1e 100644
--- a/include/system/camera.h
+++ b/include/system/camera.h
@@ -151,11 +151,30 @@ enum {
* arg1 = 0 will disable, while passing arg1 = 1 will enable the callback.
*/
CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG = 8,
+
+ /**
+ * Ping camera service to see if camera hardware is released.
+ *
+ * When any camera method returns error, the client can use ping command
+ * to see if the camera has been taken away by other clients. If the result
+ * is NO_ERROR, it means the camera hardware is not released. If the result
+ * is not NO_ERROR, the camera has been released and the existing client
+ * can silently finish itself or show a dialog.
+ */
+ CAMERA_CMD_PING = 9,
};
/** camera fatal errors */
enum {
CAMERA_ERROR_UNKNOWN = 1,
+ /**
+ * Camera was released because another client has connected to the camera.
+ * The original client should call Camera::disconnect immediately after
+ * getting this notification. Otherwise, the camera will be released by
+ * camera service in a short time. The client should not call any method
+ * (except disconnect and sending CAMERA_CMD_PING) after getting this.
+ */
+ CAMERA_ERROR_RELEASED = 2,
CAMERA_ERROR_SERVER_DIED = 100
};