From 80a2eeb9c95c24e0dd69e61c3f58e6da36cf703d Mon Sep 17 00:00:00 2001 From: Akwasi Boateng Date: Sat, 29 Oct 2011 14:25:50 -0500 Subject: CameraHAL: Avoids a possible deadlock in AppCallbackNotifier - 'disableMsgType()' was querying CameraHal for enabled message types through 'msgTypeEnabled()'. This method will lock 'mLock' in CameraHal. On the other hand 'takePicture()' inside CameraHal will also lock 'mLock' before execution. If preview callbacks are enabled before image capture, then 'takePicture()' will call AppCallbackNotifier's 'disableMsgType()', which will try to lock 'mLock' again. Solution, a query to CameraHal for enabled message types is not needed inside 'disableMsgType()' because the passed argument 'msgType' already contains all the needed information. Signed-off-by: Emilian Peev Signed-off-by: Akwasi Boateng Signed-off-by: Iliyan Malchev Change-Id: Ia4b7634ce21b8243f08d9124823c77e6bde84a8d --- camera/AppCallbackNotifier.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'camera') diff --git a/camera/AppCallbackNotifier.cpp b/camera/AppCallbackNotifier.cpp index bfdd671..201460d 100644 --- a/camera/AppCallbackNotifier.cpp +++ b/camera/AppCallbackNotifier.cpp @@ -1664,7 +1664,7 @@ status_t AppCallbackNotifier::enableMsgType(int32_t msgType) status_t AppCallbackNotifier::disableMsgType(int32_t msgType) { - if(!mCameraHal->msgTypeEnabled(CAMERA_MSG_PREVIEW_FRAME | CAMERA_MSG_POSTVIEW_FRAME)) { + if( msgType & (CAMERA_MSG_PREVIEW_FRAME | CAMERA_MSG_POSTVIEW_FRAME) ) { mFrameProvider->disableFrameNotification(CameraFrame::PREVIEW_FRAME_SYNC); } -- cgit v1.2.3