summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2012-09-20 15:18:50 -0700
committerIgor Murashkin <iam@google.com>2012-09-24 12:30:03 -0700
commit1b65ae9b7bcb4302f80ddc1464f1aa2c7483efb8 (patch)
tree18c3b326a2a4f5c962be2282ea7c48b390495bee /services
parentc0c3b298cbcf47feeeaa597a7621a0dd45f5a99e (diff)
downloadframeworks_av-1b65ae9b7bcb4302f80ddc1464f1aa2c7483efb8.zip
frameworks_av-1b65ae9b7bcb4302f80ddc1464f1aa2c7483efb8.tar.gz
frameworks_av-1b65ae9b7bcb4302f80ddc1464f1aa2c7483efb8.tar.bz2
Camera2: Emit ShutterCallback/RawCallback events after takePicture
Bug: 7176692 Change-Id: I50e8f9511f1770d97a42d1fa208c04b1bbcfba6b
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/camera2/CaptureSequencer.cpp37
-rw-r--r--services/camera/libcameraservice/camera2/CaptureSequencer.h4
2 files changed, 34 insertions, 7 deletions
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
index bdd8fa9..6d7c54f 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
@@ -308,9 +308,8 @@ CaptureSequencer::CaptureState CaptureSequencer::manageZslStart(
}
SharedParameters::Lock l(client->getParameters());
- if (l.mParameters.playShutterSound) {
- client->getCameraService()->playSound(CameraService::SOUND_SHUTTER);
- }
+ /* warning: this also locks a SharedCameraClient */
+ shutterNotifyLocked(l.mParameters, client);
mTimeoutCount = kMaxTimeoutsForCaptureEnd;
return STANDARD_CAPTURE_WAIT;
@@ -443,10 +442,8 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardCapture(
return DONE;
}
- if (l.mParameters.playShutterSound &&
- l.mParameters.state == Parameters::STILL_CAPTURE) {
- client->getCameraService()->playSound(CameraService::SOUND_SHUTTER);
- }
+ /* warning: this also locks a SharedCameraClient */
+ shutterNotifyLocked(l.mParameters, client);
mTimeoutCount = kMaxTimeoutsForCaptureEnd;
return STANDARD_CAPTURE_WAIT;
@@ -632,6 +629,32 @@ status_t CaptureSequencer::updateCaptureRequest(const Parameters &params,
return OK;
}
+/*static*/ void CaptureSequencer::shutterNotifyLocked(const Parameters &params,
+ sp<Camera2Client> client) {
+ ATRACE_CALL();
+
+ if (params.state == Parameters::STILL_CAPTURE && params.playShutterSound) {
+ client->getCameraService()->playSound(CameraService::SOUND_SHUTTER);
+ }
+
+ {
+ Camera2Client::SharedCameraClient::Lock l(client->mSharedCameraClient);
+
+ ALOGV("%s: Notifying of shutter close to client", __FUNCTION__);
+ if (l.mCameraClient != 0) {
+ // ShutterCallback
+ l.mCameraClient->notifyCallback(CAMERA_MSG_SHUTTER,
+ /*ext1*/0, /*ext2*/0);
+
+ // RawCallback with null buffer
+ l.mCameraClient->notifyCallback(CAMERA_MSG_RAW_IMAGE_NOTIFY,
+ /*ext1*/0, /*ext2*/0);
+ } else {
+ ALOGV("%s: No client!", __FUNCTION__);
+ }
+ }
+}
+
}; // namespace camera2
}; // namespace android
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.h b/services/camera/libcameraservice/camera2/CaptureSequencer.h
index f0d1e79..27f3f1c 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.h
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.h
@@ -155,6 +155,10 @@ class CaptureSequencer:
status_t updateCaptureRequest(const Parameters &params,
sp<Camera2Client> &client);
+
+ // Emit Shutter/Raw callback to java, and maybe play a shutter sound
+ static void shutterNotifyLocked(const Parameters &params,
+ sp<Camera2Client> client);
};
}; // namespace camera2