Camera: HAL: Terminate camframe thread when
camframe_timeout_callback is issued from mm-camera.

1. When the camframe thread issues camframe_timeout_callback,
camframe_terminate should be invoked which ensures that the
camframe thread is terminated.
2. release_cam_conf_thread should be invoked even if
the timeout_callback is received, otherwise the config
thread is not terminated and resources wont be freed.
diff --git a/QualcommCameraHardware.cpp b/QualcommCameraHardware.cpp
index 01bbb44..2385286 100644
--- a/QualcommCameraHardware.cpp
+++ b/QualcommCameraHardware.cpp
@@ -1925,8 +1925,8 @@
 		LOGE("ioctl CAMERA_EXIT fd %d error %s",
 			mCameraControlFd, strerror(errno));
 
-	    LINK_release_cam_conf_thread();
 	}
+	LINK_release_cam_conf_thread();
     }
     close(mCameraControlFd);
     mCameraControlFd = -1;
@@ -2032,20 +2032,18 @@
         Mutex::Autolock l(&mCamframeTimeoutLock);
 	if(!camframe_timeout_flag) {
 	    mCameraRunning = !native_stop_preview(mCameraControlFd);
-	    if (!mCameraRunning && mPreviewInitialized) {
-		deinitPreview();
-		mPreviewInitialized = false;
-	    }
-	    else LOGE("stopPreviewInternal: failed to stop preview");
 	} else {
 	    /* This means that the camframetimeout was issued.
 	     * But we did not issue native_stop_preview(), so we
-	     * need to update mCameraRunning & mPreviewInitialized
-	     * to indicate that Camera is no longer running.
-	     */
+	     * need to update mCameraRunning to indicate that
+	     * Camera is no longer running. */
 	    mCameraRunning = 0;
+	}
+	if (!mCameraRunning && mPreviewInitialized) {
+	    deinitPreview();
 	    mPreviewInitialized = false;
 	}
+	else LOGE("stopPreviewInternal: failed to stop preview");
     }
     LOGV("stopPreviewInternal X: %d", mCameraRunning);
 }