Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53fb870c authored by Alok Kediya's avatar Alok Kediya Committed by Ricardo Cerqueira
Browse files

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
parent a9b5ad61
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -484,6 +484,17 @@ void CameraClient::stopPreview() {
#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 @@ void CameraClient::stopRecording() {
    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);