diff options
Diffstat (limited to 'services')
3 files changed, 42 insertions, 28 deletions
diff --git a/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp b/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp index 69bea24..3de5d90 100644 --- a/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp +++ b/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp @@ -78,7 +78,7 @@ bool FrameProcessor::processSingleFrame(CaptureResult &frame, } if (mSynthesize3ANotify) { - process3aState(frame.mMetadata, client); + process3aState(frame, client); } return FrameProcessorBase::processSingleFrame(frame, device); @@ -212,14 +212,15 @@ status_t FrameProcessor::processFaceDetect(const CameraMetadata &frame, return OK; } -status_t FrameProcessor::process3aState(const CameraMetadata &frame, +status_t FrameProcessor::process3aState(const CaptureResult &frame, const sp<Camera2Client> &client) { ATRACE_CALL(); + const CameraMetadata &metadata = frame.mMetadata; camera_metadata_ro_entry_t entry; int cameraId = client->getCameraId(); - entry = frame.find(ANDROID_REQUEST_FRAME_COUNT); + entry = metadata.find(ANDROID_REQUEST_FRAME_COUNT); int32_t frameNumber = entry.data.i32[0]; // Don't send 3A notifications for the same frame number twice @@ -238,26 +239,31 @@ status_t FrameProcessor::process3aState(const CameraMetadata &frame, // TODO: Also use AE mode, AE trigger ID - gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AF_MODE, + gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AF_MODE, &new3aState.afMode, frameNumber, cameraId); - gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AWB_MODE, + gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AWB_MODE, &new3aState.awbMode, frameNumber, cameraId); - gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AE_STATE, + gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AE_STATE, &new3aState.aeState, frameNumber, cameraId); - gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AF_STATE, + gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AF_STATE, &new3aState.afState, frameNumber, cameraId); - gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AWB_STATE, + gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AWB_STATE, &new3aState.awbState, frameNumber, cameraId); - gotAllStates &= get3aResult<int32_t>(frame, ANDROID_CONTROL_AF_TRIGGER_ID, - &new3aState.afTriggerId, frameNumber, cameraId); + if (client->getCameraDeviceVersion() >= CAMERA_DEVICE_API_VERSION_3_2) { + new3aState.afTriggerId = frame.mResultExtras.afTriggerId; + new3aState.aeTriggerId = frame.mResultExtras.precaptureTriggerId; + } else { + gotAllStates &= get3aResult<int32_t>(metadata, ANDROID_CONTROL_AF_TRIGGER_ID, + &new3aState.afTriggerId, frameNumber, cameraId); - gotAllStates &= get3aResult<int32_t>(frame, ANDROID_CONTROL_AE_PRECAPTURE_ID, - &new3aState.aeTriggerId, frameNumber, cameraId); + gotAllStates &= get3aResult<int32_t>(metadata, ANDROID_CONTROL_AE_PRECAPTURE_ID, + &new3aState.aeTriggerId, frameNumber, cameraId); + } if (!gotAllStates) return BAD_VALUE; diff --git a/services/camera/libcameraservice/api1/client2/FrameProcessor.h b/services/camera/libcameraservice/api1/client2/FrameProcessor.h index 514bd1a..4afca50 100644 --- a/services/camera/libcameraservice/api1/client2/FrameProcessor.h +++ b/services/camera/libcameraservice/api1/client2/FrameProcessor.h @@ -58,7 +58,7 @@ class FrameProcessor : public FrameProcessorBase { const sp<Camera2Client> &client); // Send 3A state change notifications to client based on frame metadata - status_t process3aState(const CameraMetadata &frame, + status_t process3aState(const CaptureResult &frame, const sp<Camera2Client> &client); // Helper for process3aState diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp index 24df819..5973625 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.cpp +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp @@ -1188,7 +1188,7 @@ status_t Camera3Device::triggerAutofocus(uint32_t id) { { ANDROID_CONTROL_AF_TRIGGER_ID, static_cast<int32_t>(id) - }, + } }; return mRequestThread->queueTrigger(trigger, @@ -1209,7 +1209,7 @@ status_t Camera3Device::triggerCancelAutofocus(uint32_t id) { { ANDROID_CONTROL_AF_TRIGGER_ID, static_cast<int32_t>(id) - }, + } }; return mRequestThread->queueTrigger(trigger, @@ -1230,7 +1230,7 @@ status_t Camera3Device::triggerPrecaptureMetering(uint32_t id) { { ANDROID_CONTROL_AE_PRECAPTURE_ID, static_cast<int32_t>(id) - }, + } }; return mRequestThread->queueTrigger(trigger, @@ -1571,8 +1571,6 @@ bool Camera3Device::processPartial3AQuirk( uint8_t aeState; uint8_t afState; uint8_t awbState; - int32_t afTriggerId; - int32_t aeTriggerId; gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AF_MODE, &afMode, frameNumber); @@ -1589,12 +1587,6 @@ bool Camera3Device::processPartial3AQuirk( gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AWB_STATE, &awbState, frameNumber); - gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AF_TRIGGER_ID, - &afTriggerId, frameNumber); - - gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AE_PRECAPTURE_ID, - &aeTriggerId, frameNumber); - if (!gotAllStates) return false; ALOGVV("%s: Camera %d: Frame %d, Request ID %d: AF mode %d, AWB mode %d, " @@ -1603,7 +1595,7 @@ bool Camera3Device::processPartial3AQuirk( __FUNCTION__, mId, frameNumber, resultExtras.requestId, afMode, awbMode, afState, aeState, awbState, - afTriggerId, aeTriggerId); + resultExtras.afTriggerId, resultExtras.precaptureTriggerId); // Got all states, so construct a minimal result to send // In addition to the above fields, this means adding in @@ -1667,12 +1659,12 @@ bool Camera3Device::processPartial3AQuirk( } if (!insert3AResult(min3AResult.mMetadata, ANDROID_CONTROL_AF_TRIGGER_ID, - &afTriggerId, frameNumber)) { + &resultExtras.afTriggerId, frameNumber)) { return false; } if (!insert3AResult(min3AResult.mMetadata, ANDROID_CONTROL_AE_PRECAPTURE_ID, - &aeTriggerId, frameNumber)) { + &resultExtras.precaptureTriggerId, frameNumber)) { return false; } @@ -2609,13 +2601,29 @@ status_t Camera3Device::RequestThread::insertTriggers( Mutex::Autolock al(mTriggerMutex); + sp<Camera3Device> parent = mParent.promote(); + if (parent == NULL) { + CLOGE("RequestThread: Parent is gone"); + return DEAD_OBJECT; + } + CameraMetadata &metadata = request->mSettings; size_t count = mTriggerMap.size(); for (size_t i = 0; i < count; ++i) { RequestTrigger trigger = mTriggerMap.valueAt(i); - uint32_t tag = trigger.metadataTag; + + if (tag == ANDROID_CONTROL_AF_TRIGGER_ID || tag == ANDROID_CONTROL_AE_PRECAPTURE_ID) { + bool isAeTrigger = (trigger.metadataTag == ANDROID_CONTROL_AE_PRECAPTURE_ID); + uint32_t triggerId = static_cast<uint32_t>(trigger.entryValue); + isAeTrigger ? request->mResultExtras.precaptureTriggerId = triggerId : + request->mResultExtras.afTriggerId = triggerId; + if (parent->mDeviceVersion >= CAMERA_DEVICE_API_VERSION_3_2) { + continue; // Trigger ID tag is deprecated since device HAL 3.2 + } + } + camera_metadata_entry entry = metadata.find(tag); if (entry.count > 0) { |