hardware: samsung_slsi: libcamera2: Fix AF lockup
authorSungjoong Kang <sj3.kang@samsung.com>
Tue, 28 Aug 2012 20:05:01 +0000 (13:05 -0700)
committerRebecca Schultz Zavin <rebecca@android.com>
Wed, 29 Aug 2012 00:26:55 +0000 (17:26 -0700)
Fixed most of the cases of AF lockup

Change-Id: If5e190e916c4b1f4e0246ee953d55d1e5d8a4882
Signed-off-by: Sungjoong Kang <sj3.kang@samsung.com>
libcamera2/ExynosCameraHWInterface2.cpp

index 1c8c282d4f6915a49448dbf3fbf387787d08081c..8a5c963fd5d72522ce1b17166d309887832c466c 100644 (file)
@@ -2396,7 +2396,7 @@ void ExynosCameraHWInterface2::m_sensorThreadFunc(SignalDrivenThread * self)
                 ALOGV("### Af Trigger pulled, waiting for mode change cnt(%d) ", m_afModeWaitingCnt);
                 m_afModeWaitingCnt --;
                 if (m_afModeWaitingCnt == 1) {
-                    m_afModeWaitingCnt == 0;
+                    m_afModeWaitingCnt = 0;
                     OnAfTrigger(m_afPendingTriggerId);
                 }
             }
@@ -3420,7 +3420,7 @@ jpeg_encode_done:
 void ExynosCameraHWInterface2::OnAfTriggerStart(int id)
 {
     m_afPendingTriggerId = id;
-    m_afModeWaitingCnt = 4;
+    m_afModeWaitingCnt = 3;
 }
 
 void ExynosCameraHWInterface2::OnAfTrigger(int id)
@@ -3719,8 +3719,9 @@ void ExynosCameraHWInterface2::OnAfNotificationCAFPicture(enum aa_afstate noti)
             SetAfStateForService(ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED);
             break;
         case AA_AFSTATE_AF_FAILED_FOCUS:
-            nextState = HAL_AFSTATE_FAILED;
-            SetAfStateForService(ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED);
+            //nextState = HAL_AFSTATE_FAILED;
+            //SetAfStateForService(ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED);
+            nextState = NO_TRANSITION;
             break;
         default:
             bWrongTransition = true;
@@ -4015,6 +4016,7 @@ void ExynosCameraHWInterface2::OnAfCancelAutoMacro(int id)
     switch (m_afState) {
     case HAL_AFSTATE_INACTIVE:
         nextState = NO_TRANSITION;
+        SetAfStateForService(ANDROID_CONTROL_AF_STATE_INACTIVE);
         break;
     case HAL_AFSTATE_NEEDS_COMMAND:
     case HAL_AFSTATE_STARTED:
@@ -4114,10 +4116,10 @@ void ExynosCameraHWInterface2::SetAfMode(enum aa_afmode afMode)
             ALOGV("(%s): current(%d) new(%d)", __FUNCTION__, m_afMode, afMode);
             m_IsAfModeUpdateRequired = true;
             m_afMode = afMode;
-        }
-        if (m_afModeWaitingCnt != 0) {
-            m_afModeWaitingCnt = 0;
-            OnAfTrigger(m_afPendingTriggerId);
+            if (m_afModeWaitingCnt != 0) {
+                m_afModeWaitingCnt = 0;
+                OnAfTrigger(m_afPendingTriggerId);
+            }
         }
     }
 }