[LG Optimus Black] BPaul:
Duarte777, xonar_

for fix need remove separated

File

android/frameworks_av/services/camera/libcameraservice/Camera2Client.cpp

Line: 1338

void Camera2Client::notifyAutoFocus(uint8_t newState, int triggerId) {

void Camera2Client::notifyAutoFocus(uint8_t newState, int triggerId) {
ALOGV("%s: Autofocus state now %d, last trigger %d",
__FUNCTION__, newState, triggerId);
bool sendCompletedMessage = false;
bool sendMovingMessage = false;

bool success = false;
bool afInMotion = false;
{
SharedParameters::Lock l(mParameters);
l.mParameters.focusState = newState;
switch (l.mParameters.focusMode) {
case Parameters::FOCUS_MODE_AUTO:
case Parameters::FOCUS_MODE_MACRO:
// Don't send notifications upstream if they're not for the current AF
// trigger. For example, if cancel was called in between, or if we
// already sent a notification about this AF call.
if (triggerId != l.mParameters.currentAfTriggerId) break;
switch (newState) {
case ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED:
success = true;
// no break
case ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED:
sendCompletedMessage = true;
l.mParameters.currentAfTriggerId = -1;
break;
case ANDROID_CONTROL_AF_STATE_ACTIVE_SCAN:
// Just starting focusing, ignore
break;
case ANDROID_CONTROL_AF_STATE_INACTIVE:
case ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN:
case ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED:
default:
// Unexpected in AUTO/MACRO mode
ALOGE("%s: Unexpected AF state transition in AUTO/MACRO mode: %d",
__FUNCTION__, newState);
break;
}
break;
case Parameters::FOCUS_MODE_CONTINUOUS_VIDEO:
case Parameters::FOCUS_MODE_CONTINUOUS_PICTURE:
switch (newState) {
case ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED:
success = true;
// no break
case ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED:
// Don't send notifications upstream if they're not for
// the current AF trigger. For example, if cancel was
// called in between, or if we already sent a
// notification about this AF call.
// Send both a 'AF done' callback and a 'AF move' callback
if (triggerId != l.mParameters.currentAfTriggerId) break;
sendCompletedMessage = true;
afInMotion = false;
if (l.mParameters.enableFocusMoveMessages &&
l.mParameters.afInMotion) {
sendMovingMessage = true;
}
l.mParameters.currentAfTriggerId = -1;
break;
case ANDROID_CONTROL_AF_STATE_INACTIVE:
// Cancel was called, or we switched state; care if
// currently moving
afInMotion = false;
if (l.mParameters.enableFocusMoveMessages &&
l.mParameters.afInMotion) {
sendMovingMessage = true;
}
break;
case ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN:
// Start passive scan, inform upstream
afInMotion = true;
// no break
case ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED:
// Stop passive scan, inform upstream
if (l.mParameters.enableFocusMoveMessages) {
sendMovingMessage = true;
}
break;
}
l.mParameters.afInMotion = afInMotion;
break;
case Parameters::FOCUS_MODE_EDOF:
case Parameters::FOCUS_MODE_INFINITY:
case Parameters::FOCUS_MODE_FIXED:
default:
if (newState != ANDROID_CONTROL_AF_STATE_INACTIVE) {
ALOGE("%s: Unexpected AF state change %d "
"(ID %d) in focus mode %d",
__FUNCTION__, newState, triggerId,
l.mParameters.focusMode);
}
}
}
/* No work got building crash on OMAP3
* )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
if (sendMovingMessage) {
SharedCameraClient::Lock l(mSharedCameraClient);
if (l.mCameraClient != 0) {
l.mCameraClient->notifyCallback(CAMERA_MSG_FOCUS_MOVE,
afInMotion ? 1 : 0, 0);
}
}
* )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
*/
if (sendCompletedMessage) {
SharedCameraClient::Lock l(mSharedCameraClient);
if (l.mCameraClient != 0) {
l.mCameraClient->notifyCallback(CAMERA_MSG_FOCUS,
success ? 1 : 0, 0);
}
}
}