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

Commit 85d647ce authored by Tyler Luu's avatar Tyler Luu Committed by Ricardo Cerqueira
Browse files

CameraService: Disable capture message types before stopping preview



If we try to stopPreview in the middle of capture, these
callbacks might occur. In this case, stopPreview will already be
holding mLock while the message handler will try to grab mLock.
Deadlock occurs if the stopPreview and message callback dependencies
are in the same thread.

Issue reproduced with Image Capture/Home Key scenario.

Port from GB: Issue is still reproducible (although extremely
              rarely) in ICS.

Signed-off-by: default avatarEmilian Peev <epeev@mm-sol.com>
Signed-off-by: default avatarJean Johnson <jean-johnson@ti.com>
Signed-off-by: default avatarDaniel Levin <dendy@ti.com>
Change-Id: I222d00f8bd69c11302a35610095efe0ddc49f876
parent 27006f2b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -774,6 +774,16 @@ void CameraService::Client::stopPreview() {
    Mutex::Autolock lock(mLock);
    if (checkPidAndHardware() != NO_ERROR) return;

#ifdef OMAP_ENHANCEMENT
    // According to framework documentation, preview needs
    // to be started for image capture. This will make sure
    // that image capture related messages get disabled if
    // not done already in their respective handlers.
    // If these messages come when in the midddle of
    // stopping preview we will deadlock the system in
    // lockIfMessageWanted().
    disableMsgType(CAMERA_MSG_POSTVIEW_FRAME);
#endif

    disableMsgType(CAMERA_MSG_PREVIEW_FRAME);
    mHardware->stopPreview();