All HTC One S related changes reverted due to applyProperties problems on other devices. Libraries rebuilt.

(cherry picked from commit 8104164c78)
This commit is contained in:
Alexander Smorkalov 2012-09-14 16:50:04 +04:00 committed by Andrey Pavlenko
parent af2de86914
commit e9009db667
17 changed files with 23 additions and 36 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -357,6 +357,7 @@ const char* CameraHandler::antibandingModesNames[ANDROID_CAMERA_ANTIBANDING_MODE
CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, int cameraId, void* userData, CameraParameters* prevCameraParameters) CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, int cameraId, void* userData, CameraParameters* prevCameraParameters)
{ {
typedef sp<Camera> (*Android22ConnectFuncType)(); typedef sp<Camera> (*Android22ConnectFuncType)();
typedef sp<Camera> (*Android23ConnectFuncType)(int); typedef sp<Camera> (*Android23ConnectFuncType)(int);
typedef sp<Camera> (*Android3DConnectFuncType)(int, int); typedef sp<Camera> (*Android3DConnectFuncType)(int, int);
@ -391,19 +392,16 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
{ {
LOGD("Connecting to CameraService v 2.2"); LOGD("Connecting to CameraService v 2.2");
camera = Android22Connect(); camera = Android22Connect();
LOGD("Connection to CameraService v 2.2 established");
} }
else if (Android23ConnectFuncType Android23Connect = (Android23ConnectFuncType)dlsym(CameraHALHandle, Android23ConnectName)) else if (Android23ConnectFuncType Android23Connect = (Android23ConnectFuncType)dlsym(CameraHALHandle, Android23ConnectName))
{ {
LOGD("Connecting to CameraService v 2.3"); LOGD("Connecting to CameraService v 2.3");
camera = Android23Connect(cameraId); camera = Android23Connect(cameraId);
LOGD("Connection to CameraService v 2.3 established");
} }
else if (Android3DConnectFuncType Android3DConnect = (Android3DConnectFuncType)dlsym(CameraHALHandle, Android3DConnectName)) else if (Android3DConnectFuncType Android3DConnect = (Android3DConnectFuncType)dlsym(CameraHALHandle, Android3DConnectName))
{ {
LOGD("Connecting to CameraService v 3D"); LOGD("Connecting to CameraService v 3D");
camera = Android3DConnect(cameraId, CAMERA_SUPPORT_MODE_2D); camera = Android3DConnect(cameraId, CAMERA_SUPPORT_MODE_2D);
LOGD("Connection to CameraService v 3D established");
} }
else else
{ {
@ -414,23 +412,19 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
dlclose(CameraHALHandle); dlclose(CameraHALHandle);
if ( NULL == camera.get() ) if ( 0 == camera.get() )
{ {
LOGE("initCameraConnect: Unable to connect to CameraService\n"); LOGE("initCameraConnect: Unable to connect to CameraService\n");
return 0; return 0;
} }
LOGD("Creating camera handler");
CameraHandler* handler = new CameraHandler(callback, userData); CameraHandler* handler = new CameraHandler(callback, userData);
LOGD("Setting camera listener");
camera->setListener(handler); camera->setListener(handler);
LOGD("Updating camera handler");
handler->camera = camera; handler->camera = camera;
handler->cameraId = cameraId; handler->cameraId = cameraId;
LOGD("Checking previous camera parameters"); if (prevCameraParameters != 0)
if (NULL != prevCameraParameters)
{ {
LOGI("initCameraConnect: Setting paramers from previous camera handler"); LOGI("initCameraConnect: Setting paramers from previous camera handler");
camera->setParameters(prevCameraParameters->flatten()); camera->setParameters(prevCameraParameters->flatten());
@ -460,7 +454,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
#if !defined(ANDROID_r2_2_0) #if !defined(ANDROID_r2_2_0)
// Set focus mode to continuous-video if supported // Set focus mode to continuous-video if supported
const char* available_focus_modes = handler->params.get(CameraParameters::KEY_SUPPORTED_FOCUS_MODES); const char* available_focus_modes = handler->params.get(CameraParameters::KEY_SUPPORTED_FOCUS_MODES);
if (NULL != available_focus_modes) if (available_focus_modes != 0)
{ {
if (strstr(available_focus_modes, "continuous-video") != NULL) if (strstr(available_focus_modes, "continuous-video") != NULL)
{ {
@ -468,7 +462,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
status_t resParams = handler->camera->setParameters(handler->params.flatten()); status_t resParams = handler->camera->setParameters(handler->params.flatten());
if (0 != resParams) if (resParams != 0)
{ {
LOGE("initCameraConnect: failed to set autofocus mode to \"continuous-video\""); LOGE("initCameraConnect: failed to set autofocus mode to \"continuous-video\"");
} }
@ -814,25 +808,19 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
{ {
LOGD("CameraHandler::applyProperties()"); LOGD("CameraHandler::applyProperties()");
if (NULL == ppcameraHandler) if (ppcameraHandler == 0)
{ {
LOGE("applyProperties: Passed NULL ppcameraHandler"); LOGE("applyProperties: Passed NULL ppcameraHandler");
return; return;
} }
if (NULL == *ppcameraHandler) if (*ppcameraHandler == 0)
{ {
LOGE("applyProperties: Passed null *ppcameraHandler"); LOGE("applyProperties: Passed null *ppcameraHandler");
return; return;
} }
LOGD("CameraHandler::applyProperties()"); LOGD("CameraHandler::applyProperties()");
#if defined(ANDROID_r4_0_3)
LOGD("Reconnect camera");
(*ppcameraHandler)->camera->reconnect();
(*ppcameraHandler)->params = (*ppcameraHandler)->camera->getParameters();
#else
CameraHandler* previousCameraHandler=*ppcameraHandler; CameraHandler* previousCameraHandler=*ppcameraHandler;
CameraParameters curCameraParameters(previousCameraHandler->params.flatten()); CameraParameters curCameraParameters(previousCameraHandler->params.flatten());
@ -844,6 +832,7 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
previousCameraHandler->closeCameraConnect(); previousCameraHandler->closeCameraConnect();
LOGD("CameraHandler::applyProperties(): after previousCameraHandler->closeCameraConnect"); LOGD("CameraHandler::applyProperties(): after previousCameraHandler->closeCameraConnect");
LOGD("CameraHandler::applyProperties(): before initCameraConnect"); LOGD("CameraHandler::applyProperties(): before initCameraConnect");
CameraHandler* handler=initCameraConnect(cameraCallback, cameraId, userData, &curCameraParameters); CameraHandler* handler=initCameraConnect(cameraCallback, cameraId, userData, &curCameraParameters);
LOGD("CameraHandler::applyProperties(): after initCameraConnect, handler=0x%x", (int)handler); LOGD("CameraHandler::applyProperties(): after initCameraConnect, handler=0x%x", (int)handler);
@ -855,9 +844,7 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
LOGE("ERROR in applyProperties --- cannot reinit camera AGAIN --- cannot do anything else"); LOGE("ERROR in applyProperties --- cannot reinit camera AGAIN --- cannot do anything else");
} }
} }
(*ppcameraHandler)=handler; (*ppcameraHandler)=handler;
#endif
} }