summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChien-Yu Chen <cychen@google.com>2015-02-17 13:56:46 -0800
committerChien-Yu Chen <cychen@google.com>2015-03-03 14:07:47 -0800
commit88da526d97442c80731e01bfc94c6b47c4b0c3c7 (patch)
treed62e3b5051bd55ac6f2bb0e4762a15be28650c5a /include
parent7841f704fee0e5acd45fa6e47a336120c3cad42c (diff)
downloadframeworks_av-88da526d97442c80731e01bfc94c6b47c4b0c3c7.zip
frameworks_av-88da526d97442c80731e01bfc94c6b47c4b0c3c7.tar.gz
frameworks_av-88da526d97442c80731e01bfc94c6b47c4b0c3c7.tar.bz2
camera: fix flashlight implementation for HAL v2
Update torch availability when the camera device availability changes. For device HAL v2 and v3 implementation, notify torch unavailable for all camera devices with a flash unit when a camera device is opened. Notify torch available for all camera devices with flash unit when all camera devices are closed. Don't invoke torch status callback in camera service. Invoke torch status callback in HAL or FlashControlBase implementations to avoid race condition. Clean up previous CL. Bug: 2682206 Change-Id: I24f5478f467b2c680565fe98f112eef33e2547a1
Diffstat (limited to 'include')
-rw-r--r--include/camera/ICameraService.h11
-rw-r--r--include/camera/ICameraServiceListener.h18
2 files changed, 20 insertions, 9 deletions
diff --git a/include/camera/ICameraService.h b/include/camera/ICameraService.h
index cc41efe..194a646 100644
--- a/include/camera/ICameraService.h
+++ b/include/camera/ICameraService.h
@@ -145,7 +145,16 @@ public:
sp<ICamera>& device) = 0;
/**
- * Turn on or off a camera's torch mode.
+ * Turn on or off a camera's torch mode. Torch mode will be turned off by
+ * camera service if the lastest client binder that turns it on dies.
+ *
+ * return values:
+ * 0: on a successful operation.
+ * -ENOSYS: the camera device doesn't support this operation. It it returned
+ * if and only if android.flash.into.available is false.
+ * -EBUSY: the camera device is opened.
+ * -EINVAL: camera_id is invalid or clientBinder is NULL when enabling a
+ * torch mode.
*/
virtual status_t setTorchMode(const String16& cameraId, bool enabled,
const sp<IBinder>& clientBinder) = 0;
diff --git a/include/camera/ICameraServiceListener.h b/include/camera/ICameraServiceListener.h
index 9e8b912..709ff31 100644
--- a/include/camera/ICameraServiceListener.h
+++ b/include/camera/ICameraServiceListener.h
@@ -71,18 +71,20 @@ public:
*
* Initial status will be transmitted with onTorchStatusChanged immediately
* after this listener is added to the service listener list.
+ *
+ * The enums should be set to values matching
+ * include/hardware/camera_common.h
*/
enum TorchStatus {
- // The camera's torch mode has become available to use via
- // setTorchMode().
- TORCH_STATUS_AVAILABLE = TORCH_MODE_STATUS_AVAILABLE,
// The camera's torch mode has become not available to use via
// setTorchMode().
- TORCH_STATUS_NOT_AVAILABLE = TORCH_MODE_STATUS_RESOURCE_BUSY,
- // The camera's torch mode has been turned off by setTorchMode().
- TORCH_STATUS_OFF = TORCH_MODE_STATUS_OFF,
- // The camera's torch mode has been turned on by setTorchMode().
- TORCH_STATUS_ON = 0x80000000,
+ TORCH_STATUS_NOT_AVAILABLE = TORCH_MODE_STATUS_NOT_AVAILABLE,
+ // The camera's torch mode is off and available to be turned on via
+ // setTorchMode().
+ TORCH_STATUS_AVAILABLE_OFF = TORCH_MODE_STATUS_AVAILABLE_OFF,
+ // The camera's torch mode is on and available to be turned off via
+ // setTorchMode().
+ TORCH_STATUS_AVAILABLE_ON = TORCH_MODE_STATUS_AVAILABLE_ON,
// Use to initialize variables only
TORCH_STATUS_UNKNOWN = 0xFFFFFFFF,