diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index f2dd9534..cfa41aa8 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -784,6 +784,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< params.nightMode = mPhotoInfo.nightMode; params.autoFocus = mPhotoInfo.autoFocus; params.autoExposure = mPhotoInfo.autoExposure; + params.focusTimeout = mPhotoInfo.focusTimeout * 1000; params.exposureTime = mPhotoInfo.exposureTime; params.sensibility = mPhotoInfo.sensibility; params.orientation = mPhotoInfo.orientation; diff --git a/app/src/main/cpp/camera2/ndkcamera.cpp b/app/src/main/cpp/camera2/ndkcamera.cpp index c6f68b91..66e1d281 100644 --- a/app/src/main/cpp/camera2/ndkcamera.cpp +++ b/app/src/main/cpp/camera2/ndkcamera.cpp @@ -451,7 +451,7 @@ int NdkCamera::open(const std::string& cameraId) { status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AF_MODE, 1, &afMode); uint8_t trig = ACAMERA_CONTROL_AF_TRIGGER_START; - // status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AF_TRIGGER, 1, &trig); + status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AF_TRIGGER, 1, &trig); m_imagesCaptured = (status == ACAMERA_OK) ? ~0 : 0; } else @@ -859,7 +859,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque else { unsigned long long ts = GetMicroTimeStamp(); - if (ts - m_startTime >= 1000) + if (ts - m_startTime >= m_params.focusTimeout) { ALOGD("onCaptureCompleted Timeout for AutoFocus And will Capture AF_STATE=%u", (unsigned int)afState); m_imagesCaptured = 0; diff --git a/app/src/main/cpp/camera2/ndkcamera.h b/app/src/main/cpp/camera2/ndkcamera.h index fc7f4133..887866f3 100644 --- a/app/src/main/cpp/camera2/ndkcamera.h +++ b/app/src/main/cpp/camera2/ndkcamera.h @@ -74,7 +74,8 @@ public: unsigned int autoFocus : 1; unsigned int autoExposure : 1; unsigned int orientation:3; - unsigned int reserved : 25; + unsigned int focusTimeout : 14; // milli-seconds 65535 / 4 + unsigned int reserved : 11; unsigned int exposureTime; // ms unsigned int sensibility; };