if (matchedFrameCnt != -1) {
frameTime = systemTime();
m_requestManager->RegisterTimestamp(matchedFrameCnt, &frameTime);
+ m_requestManager->UpdateIspParameters(shot_ext, matchedFrameCnt, false);
if (m_IsAfModeUpdateRequired) {
ALOGE("### AF Mode change(Mode %d) ", m_afMode);
shot_ext->shot.ctl.aa.afMode = m_afMode;
}
if (m_IsAfTriggerRequired) {
ALOGE("### AF Triggering with mode (%d)", m_afMode);
- if (m_afState != HAL_AFSTATE_NEEDS_COMMAND)
- ALOGE("(%s): wrong trigger state %d", __FUNCTION__, m_afState);
- else
- m_afState = HAL_AFSTATE_STARTED;
- m_requestManager->UpdateIspParameters(shot_ext, matchedFrameCnt, true);
+ if (m_afState == HAL_AFSTATE_SCANNING) {
+ ALOGE("(%s): restarting trigger ", __FUNCTION__);
+ }
+ else {
+ if (m_afState != HAL_AFSTATE_NEEDS_COMMAND)
+ ALOGE("(%s): wrong trigger state %d", __FUNCTION__, m_afState);
+ else
+ m_afState = HAL_AFSTATE_STARTED;
+ }
shot_ext->shot.ctl.aa.afMode = m_afMode;
m_IsAfTriggerRequired = false;
}
else {
- m_requestManager->UpdateIspParameters(shot_ext, matchedFrameCnt, false);
}
if (m_wideAspect) {
// shot_ext->setfile = ISS_SUB_SCENARIO_VIDEO;
break;
case HAL_AFSTATE_STARTED:
nextState = HAL_AFSTATE_NEEDS_DETERMINATION;
+ m_AfHwStateFailed = false;
break;
case HAL_AFSTATE_SCANNING:
nextState = HAL_AFSTATE_NEEDS_DETERMINATION;
+ m_AfHwStateFailed = false;
break;
case HAL_AFSTATE_NEEDS_DETERMINATION:
nextState = NO_TRANSITION;
break;
case HAL_AFSTATE_PASSIVE_FOCUSED:
m_IsAfLockRequired = true;
- SetAfStateForService(ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED);
- nextState = HAL_AFSTATE_LOCKED;
+ if (m_AfHwStateFailed) {
+ ALOGV("(%s): LAST : fail", __FUNCTION__);
+ SetAfStateForService(ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED);
+ nextState = HAL_AFSTATE_FAILED;
+ }
+ else {
+ ALOGV("(%s): LAST : success", __FUNCTION__);
+ SetAfStateForService(ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED);
+ nextState = HAL_AFSTATE_LOCKED;
+ }
+ m_AfHwStateFailed = false;
break;
case HAL_AFSTATE_LOCKED:
nextState = NO_TRANSITION;
else if (m_afState == HAL_AFSTATE_SCANNING) {
switch (noti) {
case AA_AFSTATE_INACTIVE:
- bWrongTransition = true;
+ nextState = NO_TRANSITION;
break;
case AA_AFSTATE_ACTIVE_SCAN:
nextState = NO_TRANSITION;
+ m_AfHwStateFailed = false;
break;
case AA_AFSTATE_AF_ACQUIRED_FOCUS:
nextState = HAL_AFSTATE_PASSIVE_FOCUSED;
+ m_AfHwStateFailed = false;
SetAfStateForService(ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED);
break;
case AA_AFSTATE_AF_FAILED_FOCUS:
- nextState = NO_TRANSITION;
+ nextState = HAL_AFSTATE_PASSIVE_FOCUSED;
+ m_AfHwStateFailed = true;
+ SetAfStateForService(ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED);
break;
default:
bWrongTransition = true;
else if (m_afState == HAL_AFSTATE_PASSIVE_FOCUSED) {
switch (noti) {
case AA_AFSTATE_INACTIVE:
- bWrongTransition = true;
+ nextState = NO_TRANSITION;
break;
case AA_AFSTATE_ACTIVE_SCAN:
nextState = HAL_AFSTATE_SCANNING;
+ m_AfHwStateFailed = false;
SetAfStateForService(ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN);
break;
case AA_AFSTATE_AF_ACQUIRED_FOCUS:
nextState = NO_TRANSITION;
+ m_AfHwStateFailed = false;
break;
case AA_AFSTATE_AF_FAILED_FOCUS:
- nextState = HAL_AFSTATE_FAILED;
- SetAfStateForService(ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED);
+ nextState = NO_TRANSITION;
+ m_AfHwStateFailed = true;
break;
default:
bWrongTransition = true;
else if (m_afState == HAL_AFSTATE_NEEDS_DETERMINATION) {
switch (noti) {
case AA_AFSTATE_INACTIVE:
- bWrongTransition = true;
+ nextState = NO_TRANSITION;
break;
case AA_AFSTATE_ACTIVE_SCAN:
nextState = NO_TRANSITION;
else if (m_afState == HAL_AFSTATE_FAILED) {
switch (noti) {
case AA_AFSTATE_INACTIVE:
+ bWrongTransition = true;
+ break;
case AA_AFSTATE_ACTIVE_SCAN:
+ nextState = HAL_AFSTATE_SCANNING;
+ break;
case AA_AFSTATE_AF_ACQUIRED_FOCUS:
bWrongTransition = true;
break;
break;
case AA_AFSTATE_AF_FAILED_FOCUS:
nextState = NO_TRANSITION;
+ m_IsAfTriggerRequired = true;
break;
default:
bWrongTransition = true;