summaryrefslogtreecommitdiffstats
path: root/camera/ProCamera.cpp
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2013-02-20 17:41:57 -0800
committerIgor Murashkin <iam@google.com>2013-02-22 10:50:14 -0800
commit5376573eff55f370f041889618c9a7a9e1894615 (patch)
treeb90f41af6bb5a6952c7e7deb6812626c3035d927 /camera/ProCamera.cpp
parent634a51509ee50475f3e9f8ccf897e90fc72ded31 (diff)
downloadframeworks_av-5376573eff55f370f041889618c9a7a9e1894615.zip
frameworks_av-5376573eff55f370f041889618c9a7a9e1894615.tar.gz
frameworks_av-5376573eff55f370f041889618c9a7a9e1894615.tar.bz2
Camera: ProClient add asynchronous locks and such
Change-Id: I551e5e5e76d9be733fab5224beaa7309268c0f38
Diffstat (limited to 'camera/ProCamera.cpp')
-rw-r--r--camera/ProCamera.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/camera/ProCamera.cpp b/camera/ProCamera.cpp
index 134a4a3..8164188 100644
--- a/camera/ProCamera.cpp
+++ b/camera/ProCamera.cpp
@@ -118,6 +118,12 @@ void ProCamera::DeathNotifier::binderDied(const wp<IBinder>& who) {
ALOGW("Camera service died!");
}
+void ProCamera::setListener(const sp<ProCameraListener>& listener)
+{
+ Mutex::Autolock _l(mLock);
+ mListener = listener;
+}
+
// callback from camera service
void ProCamera::notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2)
@@ -164,6 +170,34 @@ void ProCamera::dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType,
/* IProCameraUser's implementation */
+void ProCamera::onLockStatusChanged(
+ IProCameraCallbacks::LockStatus newLockStatus)
+{
+ ALOGV("%s: newLockStatus = %d", __FUNCTION__, newLockStatus);
+
+ sp<ProCameraListener> listener;
+ {
+ Mutex::Autolock _l(mLock);
+ listener = mListener;
+ }
+ if (listener != NULL) {
+ switch (newLockStatus) {
+ case IProCameraCallbacks::LOCK_ACQUIRED:
+ listener->onLockAcquired();
+ break;
+ case IProCameraCallbacks::LOCK_RELEASED:
+ listener->onLockReleased();
+ break;
+ case IProCameraCallbacks::LOCK_STOLEN:
+ listener->onLockStolen();
+ break;
+ default:
+ ALOGE("%s: Unknown lock status: %d",
+ __FUNCTION__, newLockStatus);
+ }
+ }
+}
+
status_t ProCamera::exclusiveTryLock()
{
sp <IProCameraUser> c = mCamera;