Fix a deadlock in commandSetVideoBufferCountL()

o The lock to be acquired in recordingEnabled() has aleady been acquired in sendCommand()
  before the call to commandSetVideoBufferCountL().

Change-Id: I664d51ef449c9eb3576d5d56f73f29c98444ff3f
diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp
index 0d45596..8667bac 100644
--- a/services/camera/libcameraservice/Camera2Client.cpp
+++ b/services/camera/libcameraservice/Camera2Client.cpp
@@ -793,8 +793,15 @@
 bool Camera2Client::recordingEnabled() {
     ATRACE_CALL();
     Mutex::Autolock icl(mICameraLock);
+
     if ( checkPid(__FUNCTION__) != OK) return false;
 
+    return recordingEnabledL();
+}
+
+bool Camera2Client::recordingEnabledL() {
+    ATRACE_CALL();
+
     return (mState == RECORD || mState == VIDEO_SNAPSHOT);
 }
 
@@ -1633,7 +1640,7 @@
 }
 
 status_t Camera2Client::commandSetVideoBufferCountL(size_t count) {
-    if (recordingEnabled()) {
+    if (recordingEnabledL()) {
         ALOGE("%s: Camera %d: Error setting video buffer count after "
                 "recording was started", __FUNCTION__, mCameraId);
         return INVALID_OPERATION;
diff --git a/services/camera/libcameraservice/Camera2Client.h b/services/camera/libcameraservice/Camera2Client.h
index 6651507..5bc9172 100644
--- a/services/camera/libcameraservice/Camera2Client.h
+++ b/services/camera/libcameraservice/Camera2Client.h
@@ -97,6 +97,8 @@
     void stopPreviewL();
     status_t startPreviewL();
 
+    bool recordingEnabledL();
+
     // Individual commands for sendCommand()
     status_t commandStartSmoothZoomL();
     status_t commandStopSmoothZoomL();