diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp index de24c0b91af640345194a3a38c825090de8756e8..37da5e37068b9d9a96bdc9bfbb17da489c921c61 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp @@ -15,6 +15,7 @@ #include "dcamera_input_callback.h" +#include "camera_util.h" #include "dcamera_utils_tools.h" #include "distributed_camera_constants.h" #include "distributed_hardware_log.h" @@ -36,7 +37,11 @@ void DCameraInputCallback::OnError(const int32_t errorType, const int32_t errorM std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR; + if (errorType == CameraStandard::CamServiceError::CAMERA_DEVICE_PREEMPTED) { + event->eventResult_ = DCAMERA_EVENT_DEVICE_PREEMPT; + } else { + event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR; + } callback_->OnStateChanged(event); } diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index 8f476c365b4174db77a0386337051a80a5d16d41..98cdbfe8bf6050bc6cad36492f25562e8093e607 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -310,7 +310,11 @@ void DCameraSinkController::OnStateChanged(std::shared_ptr& event) { DHLOGI("DCameraSinkController::OnStateChanged dhId: %s, result: %d", GetAnonyString(dhId_).c_str(), event->eventResult_); - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("camera error")); + if (event->eventType_ == DCAMERA_EVENT_DEVICE_PREEMPT) { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_PREEMPT, std::string("camera device preempted")); + } else { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("camera error")); + } } void DCameraSinkController::OnMetadataResult(std::vector>& settings)