From d7a4d6dcb9a82eb5daad7ab897a1be5357ce19c3 Mon Sep 17 00:00:00 2001 From: "Wang, Jianfeng XA" Date: Tue, 27 May 2014 17:48:08 +0900 Subject: libcameraservice: Allow media server to disconnect camera even unlocked The camera service may fail to release the camera hardware instance in some use cases. When an application unlocked the camera before disconnect, disconnect from the application will not be accepted. And disconnect from media server will not be accepted also. Then, the camera hardware instance will not be released and a resource leak will be caused. Allow media server to disconnect the camera at all times even if the camera is unlocked. Change-Id: Icd5ed81bed242fa5947aa40ca85e4ca7fa7286e7 --- services/camera/libcameraservice/api1/CameraClient.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'services/camera/libcameraservice/api1/CameraClient.cpp') diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp index 55555fd..735a4ae 100644 --- a/services/camera/libcameraservice/api1/CameraClient.cpp +++ b/services/camera/libcameraservice/api1/CameraClient.cpp @@ -243,11 +243,6 @@ void CameraClient::disconnect() { return; } - if (mClientPid <= 0) { - LOG1("camera is unlocked (mClientPid = %d), don't tear down hardware", mClientPid); - return; - } - // Make sure disconnect() is done once and once only, whether it is called // from the user directly, or called by the destructor. if (mHardware == 0) return; -- cgit v1.1 From baf93ea325ca416aa5a0fc0c6892dda4cef1f444 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Wed, 16 Mar 2016 20:02:38 +0000 Subject: CameraClient: MTK Support Return on MTK hardware, the HAL does this internally and duplicating it here causes an infinite loop. Change-Id: I5bdb925ddb49980747b58dfae4543f812cef4c7d --- services/camera/libcameraservice/api1/CameraClient.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'services/camera/libcameraservice/api1/CameraClient.cpp') diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp index 735a4ae..af46d63 100644 --- a/services/camera/libcameraservice/api1/CameraClient.cpp +++ b/services/camera/libcameraservice/api1/CameraClient.cpp @@ -695,6 +695,9 @@ void CameraClient::disableMsgType(int32_t msgType) { #define CHECK_MESSAGE_INTERVAL 10 // 10ms bool CameraClient::lockIfMessageWanted(int32_t msgType) { +#ifdef MTK_HARDWARE + return true; +#endif int sleepCount = 0; while (mMsgEnabled & msgType) { if (mLock.tryLock() == NO_ERROR) { -- cgit v1.1