From 00900eb35473530a5fc77f7bd3ac306b6dcf19cb Mon Sep 17 00:00:00 2001 From: Chih-Chung Chang Date: Tue, 15 Sep 2009 14:51:56 +0800 Subject: Fix 2083478: Camera needs an auto-focus cancel API Change-Id: I13bda991b32aee47e82b5cf9d43b3021c416a9a2 --- libs/ui/Camera.cpp | 8 ++++++++ libs/ui/ICamera.cpp | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'libs') diff --git a/libs/ui/Camera.cpp b/libs/ui/Camera.cpp index 12a7725..0c6d340 100644 --- a/libs/ui/Camera.cpp +++ b/libs/ui/Camera.cpp @@ -242,6 +242,14 @@ status_t Camera::autoFocus() return c->autoFocus(); } +status_t Camera::cancelAutoFocus() +{ + LOGV("cancelAutoFocus"); + sp c = mCamera; + if (c == 0) return NO_INIT; + return c->cancelAutoFocus(); +} + // take a picture status_t Camera::takePicture() { diff --git a/libs/ui/ICamera.cpp b/libs/ui/ICamera.cpp index 805c2ca..fd7e084 100644 --- a/libs/ui/ICamera.cpp +++ b/libs/ui/ICamera.cpp @@ -32,6 +32,7 @@ enum { START_PREVIEW, STOP_PREVIEW, AUTO_FOCUS, + CANCEL_AUTO_FOCUS, TAKE_PICTURE, SET_PARAMETERS, GET_PARAMETERS, @@ -162,6 +163,17 @@ public: return ret; } + // cancel focus + status_t cancelAutoFocus() + { + LOGV("cancelAutoFocus"); + Parcel data, reply; + data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); + remote()->transact(CANCEL_AUTO_FOCUS, data, &reply); + status_t ret = reply.readInt32(); + return ret; + } + // take a picture - returns an IMemory (ref-counted mmap) status_t takePicture() { @@ -294,6 +306,12 @@ status_t BnCamera::onTransact( reply->writeInt32(autoFocus()); return NO_ERROR; } break; + case CANCEL_AUTO_FOCUS: { + LOGV("CANCEL_AUTO_FOCUS"); + CHECK_INTERFACE(ICamera, data, reply); + reply->writeInt32(cancelAutoFocus()); + return NO_ERROR; + } break; case TAKE_PICTURE: { LOGV("TAKE_PICTURE"); CHECK_INTERFACE(ICamera, data, reply); -- cgit v1.1