QCamera2: HAL: Featurize value added features
For features requiring camera frameworks enhancement, featurize
them such that HAL can compile against vanilla camera frameworks.
Change-Id: I6266aa4e7906e64d8c0f43acbb6274db882a5d76
diff --git a/QCamera2/HAL/QCamera2HWI.cpp b/QCamera2/HAL/QCamera2HWI.cpp
index e3eb252..7649c02 100644
--- a/QCamera2/HAL/QCamera2HWI.cpp
+++ b/QCamera2/HAL/QCamera2HWI.cpp
@@ -3211,6 +3211,7 @@
int rc = NO_ERROR;
switch (command) {
+#ifndef VANILLA_HAL
case CAMERA_CMD_LONGSHOT_ON:
arg1 = 0;
// Longshot can only be enabled when image capture
@@ -3275,13 +3276,16 @@
CDBG_HIGH("%s: Histogram -> %s", __func__,
mParameters.isHistogramEnabled() ? "Enabled" : "Disabled");
break;
+#endif
case CAMERA_CMD_START_FACE_DETECTION:
case CAMERA_CMD_STOP_FACE_DETECTION:
rc = setFaceDetection(command == CAMERA_CMD_START_FACE_DETECTION? true : false);
CDBG_HIGH("%s: FaceDetection -> %s", __func__,
mParameters.isFaceDetectionEnabled() ? "Enabled" : "Disabled");
break;
+#ifndef VANILLA_HAL
case CAMERA_CMD_HISTOGRAM_SEND_DATA:
+#endif
default:
rc = NO_ERROR;
break;
@@ -3758,6 +3762,7 @@
{
int rc = NO_ERROR;
+#ifndef VANILLA_HAL
if (hdr_scene.is_hdr_scene &&
(hdr_scene.hdr_confidence > HDR_CONFIDENCE_THRESHOLD) &&
mParameters.isAutoHDREnabled()) {
@@ -3815,6 +3820,7 @@
hdr_scene.is_hdr_scene,
hdr_scene.hdr_confidence);
+#endif
return rc;
}
@@ -3898,6 +3904,7 @@
return UNKNOWN_ERROR;
}
+#ifndef VANILLA_HAL
pASDData[0] = CAMERA_META_DATA_ASD;
pASDData[1] = data_len;
pASDData[2] = scene;
@@ -3915,6 +3922,7 @@
ALOGE("%s: fail sending notification", __func__);
asdBuffer->release(asdBuffer);
}
+#endif
return NO_ERROR;
}
@@ -5229,8 +5237,10 @@
qcamera_face_detect_type_t fd_type = fd_data->fd_type;
if ((NULL == mDataCb) ||
- (fd_type == QCAMERA_FD_PREVIEW && !msgTypeEnabled(CAMERA_MSG_PREVIEW_METADATA)) ||
- (fd_type == QCAMERA_FD_SNAPSHOT && !msgTypeEnabled(CAMERA_MSG_META_DATA))
+ (fd_type == QCAMERA_FD_PREVIEW && !msgTypeEnabled(CAMERA_MSG_PREVIEW_METADATA))
+#ifndef VANILLA_HAL
+ || (fd_type == QCAMERA_FD_SNAPSHOT && !msgTypeEnabled(CAMERA_MSG_META_DATA))
+#endif
) {
CDBG_HIGH("%s: metadata msgtype not enabled, no ops here", __func__);
return NO_ERROR;
@@ -5283,6 +5293,7 @@
if(fd_type == QCAMERA_FD_PREVIEW){
faceData = pFaceResult;
}else if(fd_type == QCAMERA_FD_SNAPSHOT){
+#ifndef VANILLA_HAL
//need fill meta type and meta data len first
int *data_header = (int* )pFaceResult;
data_header[0] = CAMERA_META_DATA_FD;
@@ -5305,7 +5316,7 @@
}
return rc;
}
-
+#endif
faceData = pFaceResult + 2 *sizeof(int); //skip two int length
}
@@ -5356,6 +5367,7 @@
faces[i].mouth[1] =
MAP_TO_DRIVER_COORDINATE(fd_data->faces[i].mouth_center.y, display_dim.height, 2000, -1000);
+#ifndef VANILLA_HAL
faces[i].smile_degree = fd_data->faces[i].smile_degree;
faces[i].smile_score = fd_data->faces[i].smile_confidence;
faces[i].blink_detected = fd_data->faces[i].blink_detected;
@@ -5371,6 +5383,7 @@
faces[i].reye_blink = fd_data->faces[i].right_blink;
faces[i].left_right_gaze = fd_data->faces[i].left_right_gaze;
faces[i].top_bottom_gaze = fd_data->faces[i].top_bottom_gaze;
+#endif
}
}
@@ -5380,9 +5393,12 @@
cbArg.cb_type = QCAMERA_DATA_CALLBACK;
if(fd_type == QCAMERA_FD_PREVIEW){
cbArg.msg_type = CAMERA_MSG_PREVIEW_METADATA;
- }else if(fd_type == QCAMERA_FD_SNAPSHOT){
+ }
+#ifndef VANILLA_HAL
+ else if(fd_type == QCAMERA_FD_SNAPSHOT){
cbArg.msg_type = CAMERA_MSG_META_DATA;
}
+#endif
cbArg.data = faceResultBuffer;
cbArg.metadata = roiData;
cbArg.user_data = faceResultBuffer;
@@ -5456,6 +5472,7 @@
*==========================================================================*/
int32_t QCamera2HardwareInterface::processHistogramStats(cam_hist_stats_t &stats_data)
{
+#ifndef VANILLA_HAL
if (!mParameters.isHistogramEnabled()) {
CDBG("%s: Histogram not enabled, no ops here", __func__);
return NO_ERROR;
@@ -5499,6 +5516,7 @@
ALOGE("%s: fail sending notification", __func__);
histBuffer->release(histBuffer);
}
+#endif
return NO_ERROR;
}
diff --git a/QCamera2/HAL/QCameraStateMachine.cpp b/QCamera2/HAL/QCameraStateMachine.cpp
index 1f4c422..8c79757 100644
--- a/QCamera2/HAL/QCameraStateMachine.cpp
+++ b/QCamera2/HAL/QCameraStateMachine.cpp
@@ -1599,10 +1599,12 @@
rc = m_parent->sendCommand(cmd_payload->cmd,
cmd_payload->arg1,
cmd_payload->arg2);
+#ifndef VANILLA_HAL
if ( CAMERA_CMD_LONGSHOT_OFF == cmd_payload->cmd ) {
// move state to previewing state
m_state = QCAMERA_SM_STATE_PREVIEWING;
}
+#endif
result.status = rc;
result.request_api = evt;
result.result_type = QCAMERA_API_RESULT_TYPE_DEF;
@@ -2650,10 +2652,12 @@
rc = m_parent->sendCommand(cmd_payload->cmd,
cmd_payload->arg1,
cmd_payload->arg2);
+#ifndef VANILLA_HAL
if ( CAMERA_CMD_LONGSHOT_OFF == cmd_payload->cmd ) {
// move state to previewing state
m_state = QCAMERA_SM_STATE_PREVIEWING;
}
+#endif
result.status = rc;
result.request_api = evt;
result.result_type = QCAMERA_API_RESULT_TYPE_DEF;