Camera: Disable TakePicture related messages in stopPreview,stopRecording
This change fixes the race condition and avoid the deadlock
in abnormal snapshot stop I.e, Observed DeadLock when Data
or Notify Callbacks is sent to App after StopPreview is
triggered and so disabling the corresponding take picture messages.
Change-Id: Ifc20e495091c75cc718c24d29db3334fbf7ceb07
diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp
index 23e7785..9fc845e 100644
--- a/services/camera/libcameraservice/api1/CameraClient.cpp
+++ b/services/camera/libcameraservice/api1/CameraClient.cpp
@@ -484,6 +484,17 @@
#endif
disableMsgType(CAMERA_MSG_PREVIEW_FRAME);
+#ifdef QCOM_HARDWARE
+ //Disable picture related message types
+ ALOGI("stopPreview: Disable picture related messages");
+ int picMsgType = 0;
+ picMsgType = (CAMERA_MSG_SHUTTER |
+ CAMERA_MSG_POSTVIEW_FRAME |
+ CAMERA_MSG_RAW_IMAGE |
+ CAMERA_MSG_RAW_IMAGE_NOTIFY |
+ CAMERA_MSG_COMPRESSED_IMAGE);
+ disableMsgType(picMsgType);
+#endif
mHardware->stopPreview();
mPreviewBuffer.clear();
@@ -496,6 +507,17 @@
if (checkPidAndHardware() != NO_ERROR) return;
disableMsgType(CAMERA_MSG_VIDEO_FRAME);
+#ifdef QCOM_HARDWARE
+ //Disable picture related message types
+ ALOGI("stopRecording: Disable picture related messages");
+ int picMsgType = 0;
+ picMsgType = (CAMERA_MSG_SHUTTER |
+ CAMERA_MSG_POSTVIEW_FRAME |
+ CAMERA_MSG_RAW_IMAGE |
+ CAMERA_MSG_RAW_IMAGE_NOTIFY |
+ CAMERA_MSG_COMPRESSED_IMAGE);
+ disableMsgType(picMsgType);
+#endif
mHardware->stopRecording();
mCameraService->playSound(CameraService::SOUND_RECORDING);