10 个文件变更+18-8
@@ -51,6 +51,7 @@ static const std::map<int32_t, std::string> errorCodeToMessageV2 = {
51 {74002014, "Camera service fatal error: Invalid Input Device"},51 {74002014, "Camera service fatal error: Invalid Input Device"},
52 {74002015, "Camera service fatal error: Camera Service is Null"},52 {74002015, "Camera service fatal error: Camera Service is Null"},
53 {74002016, "Camera service fatal error: Stop Without Start"},53 {74002016, "Camera service fatal error: Stop Without Start"},
54+ {74002017, "Camera service fatal error: Mismatch resolution configuration."},
54 {7400801, "Capability not supported."},55 {7400801, "Capability not supported."},
55};56};
56 57 
@@ -69,6 +70,7 @@ static const std::map<int32_t, std::string> errorCodeToJSErrorCode = {
69 {74002014, "7400201"},70 {74002014, "7400201"},
70 {74002015, "7400201"},71 {74002015, "7400201"},
71 {74002016, "7400201"},72 {74002016, "7400201"},
73+ {74002017, "7400201"},
72 {7400801, "801"}74 {7400801, "801"}
73};75};
74 76 
@@ -84,6 +86,7 @@ static const std::map<int32_t, int32_t> errorCodeToNumberCode = {
84 {74002014, 7400201},86 {74002014, 7400201},
85 {74002015, 7400201},87 {74002015, 7400201},
86 {74002016, 7400201},88 {74002016, 7400201},
89+ {74002017, 7400201},
87 {7400801, 801}90 {7400801, 801}
88};91};
89 92 
@@ -550,7 +550,7 @@ int32_t CaptureSession::CommitConfig()
550 SetZoomRatioForAudio(DEFAULT_ZOOM_RATIO);550 SetZoomRatioForAudio(DEFAULT_ZOOM_RATIO);
551 CHECK_EXECUTE (cameraDfxReportHelper_ != nullptr, cameraDfxReportHelper_->ReportCameraConfigInfo(errCode));551 CHECK_EXECUTE (cameraDfxReportHelper_ != nullptr, cameraDfxReportHelper_->ReportCameraConfigInfo(errCode));
552 CHECK_EXECUTE(errCode == CAMERA_OK, CheckAndEnableMacro());552 CHECK_EXECUTE(errCode == CAMERA_OK, CheckAndEnableMacro());
553- return ServiceToCameraError(errCode);553+ return ServiceToCameraErrorV2(errCode);
554}554}
555 555 
556void CaptureSession::CheckAndEnableMacro()556void CaptureSession::CheckAndEnableMacro()
@@ -823,7 +823,7 @@ HWTEST_F(CameraBaseFunctionModuleTest, camera_base_function_moduletest_003, Test
823 823 
824 EXPECT_EQ(captureSession_->BeginConfig(), SUCCESS);824 EXPECT_EQ(captureSession_->BeginConfig(), SUCCESS);
825 EXPECT_EQ(captureSession_->AddOutput((sptr<CaptureOutput>&)previewOutput), SERVICE_FATL_ERROR_OF_CONFIG);825 EXPECT_EQ(captureSession_->AddOutput((sptr<CaptureOutput>&)previewOutput), SERVICE_FATL_ERROR_OF_CONFIG);
826- EXPECT_EQ(captureSession_->CommitConfig(), SERVICE_FATL_ERROR);826+ EXPECT_EQ(captureSession_->CommitConfig(), SERVICE_FATL_ERROR_OF_INVALID_SESSION_CFG);
827 827 
828 EXPECT_EQ(captureSession_->AddInput((sptr<CaptureInput>&)cameraInput_), SUCCESS);828 EXPECT_EQ(captureSession_->AddInput((sptr<CaptureInput>&)cameraInput_), SUCCESS);
829 EXPECT_EQ(captureSession_->AddOutput((sptr<CaptureOutput>&)previewOutput), SUCCESS);829 EXPECT_EQ(captureSession_->AddOutput((sptr<CaptureOutput>&)previewOutput), SUCCESS);
@@ -851,7 +851,7 @@ HWTEST_F(CameraBaseFunctionModuleTest, camera_base_function_moduletest_003, Test
851 851 
852 EXPECT_EQ(captureSession_->BeginConfig(), SUCCESS);852 EXPECT_EQ(captureSession_->BeginConfig(), SUCCESS);
853 EXPECT_EQ(captureSession_->AddInput((sptr<CaptureInput>&)cameraInput_), SUCCESS);853 EXPECT_EQ(captureSession_->AddInput((sptr<CaptureInput>&)cameraInput_), SUCCESS);
854- EXPECT_EQ(captureSession_->CommitConfig(), SERVICE_FATL_ERROR);854+ EXPECT_EQ(captureSession_->CommitConfig(), SERVICE_FATL_ERROR_OF_INVALID_SESSION_CFG);
855 855 
856 EXPECT_EQ(captureSession_->AddOutput((sptr<CaptureOutput>&)previewOutput), SUCCESS);856 EXPECT_EQ(captureSession_->AddOutput((sptr<CaptureOutput>&)previewOutput), SUCCESS);
857 EXPECT_EQ(captureSession_->CommitConfig(), SUCCESS);857 EXPECT_EQ(captureSession_->CommitConfig(), SUCCESS);
@@ -1349,7 +1349,7 @@ HWTEST_F(CameraPhotoOutputUnit, IsOfflineSupported_002, TestSize.Level0)
1349 ASSERT_NE(session, nullptr);1349 ASSERT_NE(session, nullptr);
1350 EXPECT_EQ(session->BeginConfig(), 0);1350 EXPECT_EQ(session->BeginConfig(), 0);
1351 EXPECT_EQ(GetCameraErrorCode(session->AddOutput(photoOutput)), CameraErrorCode::SERVICE_FATL_ERROR);1351 EXPECT_EQ(GetCameraErrorCode(session->AddOutput(photoOutput)), CameraErrorCode::SERVICE_FATL_ERROR);
1352- EXPECT_EQ(session->CommitConfig(), CameraErrorCode::SERVICE_FATL_ERROR);1352+ EXPECT_EQ(session->CommitConfig(), CameraErrorCode::SERVICE_FATL_ERROR_OF_INVALID_SESSION_CFG);
1353 EXPECT_EQ(session->Start(), CameraErrorCode::SESSION_NOT_CONFIG);1353 EXPECT_EQ(session->Start(), CameraErrorCode::SESSION_NOT_CONFIG);
1354 EXPECT_EQ(phtOutput->IsOfflineSupported(), false);1354 EXPECT_EQ(phtOutput->IsOfflineSupported(), false);
1355}1355}
@@ -1429,7 +1429,7 @@ HWTEST_F(CameraPhotoOutputUnit, EnableOfflinePhoto_002, TestSize.Level0)
1429 ASSERT_NE(session, nullptr);1429 ASSERT_NE(session, nullptr);
1430 EXPECT_EQ(session->BeginConfig(), 0);1430 EXPECT_EQ(session->BeginConfig(), 0);
1431 EXPECT_EQ(GetCameraErrorCode(session->AddOutput(photoOutput)), CameraErrorCode::SERVICE_FATL_ERROR);1431 EXPECT_EQ(GetCameraErrorCode(session->AddOutput(photoOutput)), CameraErrorCode::SERVICE_FATL_ERROR);
1432- EXPECT_EQ(session->CommitConfig(), CameraErrorCode::SERVICE_FATL_ERROR);1432+ EXPECT_EQ(session->CommitConfig(), CameraErrorCode::SERVICE_FATL_ERROR_OF_INVALID_SESSION_CFG);
1433 EXPECT_EQ(session->Start(), CameraErrorCode::SESSION_NOT_CONFIG);1433 EXPECT_EQ(session->Start(), CameraErrorCode::SESSION_NOT_CONFIG);
1434 EXPECT_EQ(phtOutput->EnableOfflinePhoto(), CameraErrorCode::SESSION_NOT_RUNNING);1434 EXPECT_EQ(phtOutput->EnableOfflinePhoto(), CameraErrorCode::SESSION_NOT_RUNNING);
1435}1435}
@@ -1607,7 +1607,7 @@ HWTEST_F(CameraPhotoOutputUnit, IsAutoAigcPhotoSupported_002, TestSize.Level0)
1607 ASSERT_NE(session, nullptr);1607 ASSERT_NE(session, nullptr);
1608 EXPECT_EQ(session->BeginConfig(), 0);1608 EXPECT_EQ(session->BeginConfig(), 0);
1609 EXPECT_EQ(GetCameraErrorCode(session->AddOutput(photoOutput)), CameraErrorCode::SERVICE_FATL_ERROR);1609 EXPECT_EQ(GetCameraErrorCode(session->AddOutput(photoOutput)), CameraErrorCode::SERVICE_FATL_ERROR);
1610- EXPECT_EQ(session->CommitConfig(), CameraErrorCode::SERVICE_FATL_ERROR);1610+ EXPECT_EQ(session->CommitConfig(), CameraErrorCode::SERVICE_FATL_ERROR_OF_INVALID_SESSION_CFG);
1611 EXPECT_EQ(session->Start(), CameraErrorCode::SESSION_NOT_CONFIG);1611 EXPECT_EQ(session->Start(), CameraErrorCode::SESSION_NOT_CONFIG);
1612 bool isAutoAigcPhotoSupported = false;1612 bool isAutoAigcPhotoSupported = false;
1613 EXPECT_EQ(phtOutput->IsAutoAigcPhotoSupported(isAutoAigcPhotoSupported), SERVICE_FATL_ERROR);1613 EXPECT_EQ(phtOutput->IsAutoAigcPhotoSupported(isAutoAigcPhotoSupported), SERVICE_FATL_ERROR);
@@ -1686,7 +1686,7 @@ HWTEST_F(CameraPhotoOutputUnit, EnableAutoAigcPhoto_002, TestSize.Level0)
1686 ASSERT_NE(session, nullptr);1686 ASSERT_NE(session, nullptr);
1687 EXPECT_EQ(session->BeginConfig(), 0);1687 EXPECT_EQ(session->BeginConfig(), 0);
1688 EXPECT_EQ(GetCameraErrorCode(session->AddOutput(photoOutput)), CameraErrorCode::SERVICE_FATL_ERROR);1688 EXPECT_EQ(GetCameraErrorCode(session->AddOutput(photoOutput)), CameraErrorCode::SERVICE_FATL_ERROR);
1689- EXPECT_EQ(session->CommitConfig(), CameraErrorCode::SERVICE_FATL_ERROR);1689+ EXPECT_EQ(session->CommitConfig(), CameraErrorCode::SERVICE_FATL_ERROR_OF_INVALID_SESSION_CFG);
1690 EXPECT_EQ(session->Start(), CameraErrorCode::SESSION_NOT_CONFIG);1690 EXPECT_EQ(session->Start(), CameraErrorCode::SESSION_NOT_CONFIG);
1691 bool enabled = true;1691 bool enabled = true;
1692 EXPECT_EQ(phtOutput->EnableAutoAigcPhoto(enabled), CameraErrorCode::SESSION_NOT_RUNNING);1692 EXPECT_EQ(phtOutput->EnableAutoAigcPhoto(enabled), CameraErrorCode::SESSION_NOT_RUNNING);
@@ -45,6 +45,7 @@ static const std::unordered_map<int32_t, Camera_ErrorCode> frameworkToNdkErrorMa
45 {static_cast<int32_t>(CameraErrorCode::SERVICE_FATL_ERROR_OF_INPUT_DEVICE), CAMERA_SERVICE_FATAL_ERROR},45 {static_cast<int32_t>(CameraErrorCode::SERVICE_FATL_ERROR_OF_INPUT_DEVICE), CAMERA_SERVICE_FATAL_ERROR},
46 {static_cast<int32_t>(CameraErrorCode::SERVICE_FATL_ERROR_OF_SERVICE_NULL), CAMERA_SERVICE_FATAL_ERROR},46 {static_cast<int32_t>(CameraErrorCode::SERVICE_FATL_ERROR_OF_SERVICE_NULL), CAMERA_SERVICE_FATAL_ERROR},
47 {static_cast<int32_t>(CameraErrorCode::SERVICE_FATL_ERROR_OF_STOP_WITHOUT_START), CAMERA_SERVICE_FATAL_ERROR},47 {static_cast<int32_t>(CameraErrorCode::SERVICE_FATL_ERROR_OF_STOP_WITHOUT_START), CAMERA_SERVICE_FATAL_ERROR},
48+ {static_cast<int32_t>(CameraErrorCode::SERVICE_FATL_ERROR_OF_MISMATCH_RESOLUTION), CAMERA_SERVICE_FATAL_ERROR},
48 {static_cast<int32_t>(CameraErrorCode::UNRESOLVED_CONFLICTS_BETWEEN_STREAMS),49 {static_cast<int32_t>(CameraErrorCode::UNRESOLVED_CONFLICTS_BETWEEN_STREAMS),
49 CAMERA_UNRESOLVED_CONFLICTS_WITH_CURRENT_CONFIGURATIONS},50 CAMERA_UNRESOLVED_CONFLICTS_WITH_CURRENT_CONFIGURATIONS},
50 {static_cast<int32_t>(CameraErrorCode::CAPABILITY_NOT_SUPPORTED),51 {static_cast<int32_t>(CameraErrorCode::CAPABILITY_NOT_SUPPORTED),
@@ -511,6 +511,7 @@ static const std::map<int32_t, int32_t> errorJSCodeMap = {
511 {74002014, 7400201},511 {74002014, 7400201},
512 {74002015, 7400201},512 {74002015, 7400201},
513 {74002016, 7400201},513 {74002016, 7400201},
514+ {74002017, 7400201},
514 {7400801, 801}515 {7400801, 801}
515};516};
516 517
@@ -59,6 +59,7 @@ enum CameraErrorCode : int32_t {
59 SERVICE_FATL_ERROR_OF_INPUT_DEVICE = 74002014,59 SERVICE_FATL_ERROR_OF_INPUT_DEVICE = 74002014,
60 SERVICE_FATL_ERROR_OF_SERVICE_NULL = 74002015,60 SERVICE_FATL_ERROR_OF_SERVICE_NULL = 74002015,
61 SERVICE_FATL_ERROR_OF_STOP_WITHOUT_START = 74002016,61 SERVICE_FATL_ERROR_OF_STOP_WITHOUT_START = 74002016,
62+ SERVICE_FATL_ERROR_OF_MISMATCH_RESOLUTION = 74002017,
62 63 
63 UNSUPPORTED_MULTI_CAMERA_COMBINATION = 7400113,64 UNSUPPORTED_MULTI_CAMERA_COMBINATION = 7400113,
64 CAPABILITY_NOT_SUPPORTED = 740080165 CAPABILITY_NOT_SUPPORTED = 7400801
@@ -122,6 +122,7 @@ static const std::unordered_map<int32_t, int32_t> ServiceToCameraErrorMap = {
122 {CAMERA_INVALID_STATE, CameraErrorCode::SERVICE_FATL_ERROR},122 {CAMERA_INVALID_STATE, CameraErrorCode::SERVICE_FATL_ERROR},
123 {CAMERA_UNKNOWN_ERROR, CameraErrorCode::SERVICE_FATL_ERROR},123 {CAMERA_UNKNOWN_ERROR, CameraErrorCode::SERVICE_FATL_ERROR},
124 {CAMERA_SERVICE_NULL, CameraErrorCode::SERVICE_FATL_ERROR_OF_SERVICE_NULL},124 {CAMERA_SERVICE_NULL, CameraErrorCode::SERVICE_FATL_ERROR_OF_SERVICE_NULL},
125+ {CAMERA_INVALID_RESOLUTION, CameraErrorCode::SERVICE_FATL_ERROR_OF_MISMATCH_RESOLUTION},
125 {CAMERA_DEVICE_PREEMPTED, CameraErrorCode::DEVICE_PREEMPTED},126 {CAMERA_DEVICE_PREEMPTED, CameraErrorCode::DEVICE_PREEMPTED},
126 {CAMERA_OPERATION_NOT_ALLOWED, CameraErrorCode::OPERATION_NOT_ALLOWED},127 {CAMERA_OPERATION_NOT_ALLOWED, CameraErrorCode::OPERATION_NOT_ALLOWED},
127 {CAMERA_DEVICE_ERROR, CameraErrorCode::OPERATION_NOT_ALLOWED},128 {CAMERA_DEVICE_ERROR, CameraErrorCode::OPERATION_NOT_ALLOWED},
@@ -143,6 +143,7 @@ enum CamServiceError {
143 CAMERA_INPUT_DEVICE,143 CAMERA_INPUT_DEVICE,
144 CAMERA_STOP_WITHOUT_START, // start/stop 时序错误144 CAMERA_STOP_WITHOUT_START, // start/stop 时序错误
145 CAMERA_CAPTURE_NOT_READY,145 CAMERA_CAPTURE_NOT_READY,
146+ CAMERA_INVALID_RESOLUTION
146};147};
147 148 
148enum ClientPriorityLevels {149enum ClientPriorityLevels {
@@ -1410,7 +1410,9 @@ int32_t HStreamOperator::CreateAndCommitStreams(std::vector<HDI::Camera::V1_5::S
1410 AdjustStreamInfosByMode(streamInfos, operationMode);1410 AdjustStreamInfosByMode(streamInfos, operationMode);
1411 int retCode = CreateStreams(streamInfos);1411 int retCode = CreateStreams(streamInfos);
1412 CHECK_RETURN_RET(retCode != CAMERA_OK, retCode);1412 CHECK_RETURN_RET(retCode != CAMERA_OK, retCode);
1413- return CommitStreams(deviceSettings, operationMode);1413+ retCode = CommitStreams(deviceSettings, operationMode);
1414+ CHECK_EXECUTE(retCode == CAMERA_INVALID_ARG, retCode = CAMERA_INVALID_RESOLUTION);
1415+ return retCode;
1414}1416}
1415 1417 
1416void HStreamOperator::AdjustStreamInfosByMode(1418void HStreamOperator::AdjustStreamInfosByMode(