diff options
author | Igor Murashkin <iam@google.com> | 2012-09-24 15:19:04 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-24 15:19:05 -0700 |
commit | f83e2b4fcff8298432dc75d9808aa05331b23bb1 (patch) | |
tree | 6c999602bb00c6b859625db14087df16e3aed5da /services/camera/libcameraservice/camera2/CaptureSequencer.cpp | |
parent | 2e57a199f302446957eec3fd1a603129fd03e1d4 (diff) | |
parent | 707c3e34b067064f45c1b50919e88080fcdb5e77 (diff) | |
download | frameworks_av-f83e2b4fcff8298432dc75d9808aa05331b23bb1.zip frameworks_av-f83e2b4fcff8298432dc75d9808aa05331b23bb1.tar.gz frameworks_av-f83e2b4fcff8298432dc75d9808aa05331b23bb1.tar.bz2 |
Merge "Camera2: Emit ShutterCallback/RawCallback events after takePicture" into jb-mr1-dev
Diffstat (limited to 'services/camera/libcameraservice/camera2/CaptureSequencer.cpp')
-rw-r--r-- | services/camera/libcameraservice/camera2/CaptureSequencer.cpp | 37 |
1 files changed, 30 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 ¶ms, return OK; } +/*static*/ void CaptureSequencer::shutterNotifyLocked(const Parameters ¶ms, + 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 |