OSDN Git Service

Camera2: Play shutter and recording sounds.
authorEino-Ville Talvala <etalvala@google.com>
Fri, 7 Sep 2012 01:26:58 +0000 (18:26 -0700)
committerEino-Ville Talvala <etalvala@google.com>
Fri, 7 Sep 2012 01:31:58 +0000 (18:31 -0700)
Bug: 6987540

Change-Id: Icd441a757c4b68fc4988b3bfbef428adb8d1ba28

services/camera/libcameraservice/Camera2Client.cpp
services/camera/libcameraservice/Camera2Client.h
services/camera/libcameraservice/camera2/CaptureSequencer.cpp

index 5400604..2c8a6a2 100644 (file)
@@ -816,6 +816,8 @@ status_t Camera2Client::startRecordingL(Parameters &params, bool restart) {
         return INVALID_OPERATION;
     }
 
+    mCameraService->playSound(CameraService::SOUND_RECORDING);
+
     res = updateRecordingStream(params);
     if (res != OK) {
         ALOGE("%s: Camera %d: Unable to update recording stream: %s (%d)",
@@ -910,6 +912,8 @@ void Camera2Client::stopRecording() {
             return;
     };
 
+    mCameraService->playSound(CameraService::SOUND_RECORDING);
+
     // Back to preview. Since record can only be reached through preview,
     // all preview stream setup should be up to date.
     res = mDevice->setStreamingRequest(mPreviewRequest);
@@ -1448,6 +1452,10 @@ const sp<Camera2Device>& Camera2Client::getCameraDevice() {
     return mDevice;
 }
 
+const sp<CameraService>& Camera2Client::getCameraService() {
+    return mCameraService;
+}
+
 camera2::SharedParameters& Camera2Client::getParameters() {
     return mParameters;
 }
index df5dbf4..264000e 100644 (file)
@@ -99,6 +99,7 @@ public:
 
     int getCameraId() const;
     const sp<Camera2Device>& getCameraDevice();
+    const sp<CameraService>& getCameraService();
     camera2::SharedParameters& getParameters();
 
     int getPreviewStreamId() const;
index 532d2aa..1c42cbf 100644 (file)
@@ -388,6 +388,10 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardCapture(
         return DONE;
     }
 
+    if (l.mParameters.playShutterSound) {
+        client->getCameraService()->playSound(CameraService::SOUND_SHUTTER);
+    }
+
     mTimeoutCount = kMaxTimeoutsForCaptureEnd;
     return STANDARD_CAPTURE_WAIT;
 }