am b8fa1240: am aa9e3e01: Camera: Play shutter sound iff enableShutterSound(true) && ShutterCallback !null

* commit 'b8fa1240eedeb487a7ee0cf7d60e17bed9b25cf4':
  Camera: Play shutter sound iff enableShutterSound(true) && ShutterCallback !null
diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp
index 9627416..d468aa6 100644
--- a/services/camera/libcameraservice/Camera2Client.cpp
+++ b/services/camera/libcameraservice/Camera2Client.cpp
@@ -1106,7 +1106,7 @@
     // Need HAL to have correct settings before (possibly) triggering precapture
     syncWithDevice();
 
-    res = mCaptureSequencer->startCapture();
+    res = mCaptureSequencer->startCapture(msgType);
     if (res != OK) {
         ALOGE("%s: Camera %d: Unable to start capture: %s (%d)",
                 __FUNCTION__, mCameraId, strerror(-res), res);
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
index b228faf..513a47e 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
@@ -45,7 +45,8 @@
         mCaptureState(IDLE),
         mTriggerId(0),
         mTimeoutCount(0),
-        mCaptureId(Camera2Client::kCaptureRequestIdStart) {
+        mCaptureId(Camera2Client::kCaptureRequestIdStart),
+        mMsgType(0) {
     ALOGV("%s", __FUNCTION__);
 }
 
@@ -58,7 +59,7 @@
     mZslProcessor = processor;
 }
 
-status_t CaptureSequencer::startCapture() {
+status_t CaptureSequencer::startCapture(int msgType) {
     ALOGV("%s", __FUNCTION__);
     ATRACE_CALL();
     Mutex::Autolock l(mInputMutex);
@@ -67,6 +68,7 @@
         return INVALID_OPERATION;
     }
     if (!mStartCapture) {
+        mMsgType = msgType;
         mStartCapture = true;
         mStartCaptureSignal.signal();
     }
@@ -343,7 +345,7 @@
 
     SharedParameters::Lock l(client->getParameters());
     /* warning: this also locks a SharedCameraClient */
-    shutterNotifyLocked(l.mParameters, client);
+    shutterNotifyLocked(l.mParameters, client, mMsgType);
     mShutterNotified = true;
     mTimeoutCount = kMaxTimeoutsForCaptureEnd;
     return STANDARD_CAPTURE_WAIT;
@@ -495,7 +497,7 @@
     if (mNewFrameReceived && !mShutterNotified) {
         SharedParameters::Lock l(client->getParameters());
         /* warning: this also locks a SharedCameraClient */
-        shutterNotifyLocked(l.mParameters, client);
+        shutterNotifyLocked(l.mParameters, client, mMsgType);
         mShutterNotified = true;
     }
     while (mNewFrameReceived && !mNewCaptureReceived) {
@@ -639,10 +641,12 @@
 }
 
 /*static*/ void CaptureSequencer::shutterNotifyLocked(const Parameters &params,
-            sp<Camera2Client> client) {
+            sp<Camera2Client> client, int msgType) {
     ATRACE_CALL();
 
-    if (params.state == Parameters::STILL_CAPTURE && params.playShutterSound) {
+    if (params.state == Parameters::STILL_CAPTURE
+        && params.playShutterSound
+        && (msgType & CAMERA_MSG_SHUTTER)) {
         client->getCameraService()->playSound(CameraService::SOUND_SHUTTER);
     }
 
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.h b/services/camera/libcameraservice/camera2/CaptureSequencer.h
index 4cde9c8..c42df05 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.h
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.h
@@ -51,7 +51,7 @@
     void setZslProcessor(wp<ZslProcessor> processor);
 
     // Begin still image capture
-    status_t startCapture();
+    status_t startCapture(int msgType);
 
     // Wait until current image capture completes; returns immediately if no
     // capture is active. Returns TIMED_OUT if capture does not complete during
@@ -138,6 +138,7 @@
     bool mAeInPrecapture;
 
     int32_t mCaptureId;
+    int mMsgType;
 
     // Main internal methods
 
@@ -167,7 +168,7 @@
 
     // Emit Shutter/Raw callback to java, and maybe play a shutter sound
     static void shutterNotifyLocked(const Parameters &params,
-            sp<Camera2Client> client);
+            sp<Camera2Client> client, int msgType);
 };
 
 }; // namespace camera2