From 857c52508df875039ec43348acd6dc2c95ee5f02 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 03:56:06 +0000 Subject: [PATCH 01/13] update interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_handler.h. Signed-off-by: ry521 --- .../camera_sink/include/dcamera_sink_handler.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_handler.h b/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_handler.h index 083e2006..e4f9316e 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_handler.h +++ b/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_handler.h @@ -37,6 +37,7 @@ public: int32_t PauseDistributedHardware(const std::string &networkId) override; int32_t ResumeDistributedHardware(const std::string &networkId) override; int32_t StopDistributedHardware(const std::string &networkId) override; + void OnRemoteSinkSvrDied(const wptr &remote); private: typedef enum { DCAMERA_SA_STATE_STOP = 0, @@ -44,11 +45,17 @@ private: } DCameraSAState; DCameraSinkHandler(); ~DCameraSinkHandler(); - void FinishStartSA(const std::string ¶ms); + void FinishStartSA(const std::string ¶ms, const sptr &remoteObject); void FinishStartSAFailed(const int32_t systemAbilityId); + class CameraSinkRecipient : public IRemoteObject::DeathRecipient { + public: + void OnRemoteDied(const wptr &remote) override; + }; private: std::condition_variable producerCon_; std::mutex producerMutex_; + sptr dCameraSinkProxy_ = nullptr; + sptr sinkSvrRecipient_ = nullptr; DCameraSAState state_ = DCAMERA_SA_STATE_STOP; friend class DCameraSinkLoadCallback; sptr dCameraSinkCallback_ = nullptr; -- Gitee From a69d812dc8ce5eff2e3a790b78cf10a522347777 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 03:58:35 +0000 Subject: [PATCH 02/13] update interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler.cpp. Signed-off-by: ry521 --- .../camera_sink/src/dcamera_sink_handler.cpp | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler.cpp b/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler.cpp index 7b7feca3..0a9b522d 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler.cpp +++ b/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler.cpp @@ -42,6 +42,9 @@ DCameraSinkHandler::DCameraSinkHandler() if (!dCameraSinkCallback_) { dCameraSinkCallback_ = new DCameraSinkCallback(); } + if (sinkSvrRecipient_ == nullptr) { + sinkSvrRecipient_ = new (std::nothrow) CameraSinkRecipient(); + } } DCameraSinkHandler::~DCameraSinkHandler() @@ -86,10 +89,16 @@ int32_t DCameraSinkHandler::InitSink(const std::string& params) return DCAMERA_OK; } -void DCameraSinkHandler::FinishStartSA(const std::string& params) +void DCameraSinkHandler::FinishStartSA(const std::string& params, const sptr &remoteObject) { DCameraSinkHandlerIpc::GetInstance().Init(); sptr dCameraSinkSrv = DCameraSinkHandlerIpc::GetInstance().GetSinkLocalCamSrv(); + remoteObject->AddDeathRecipient(sinkSvrRecipient_); + dCameraSinkProxy_ = iface_cast(remoteObject); + if ((dCameraSinkProxy_ == nullptr) || (dCameraSinkProxy_->AsObject() == nullptr)) { + DHLOGE("Faild to get input sink proxy."); + return; + } if (dCameraSinkSrv == nullptr) { DHLOGE("get Service failed"); return; @@ -193,6 +202,42 @@ int32_t DCameraSinkHandler::StopDistributedHardware(const std::string &networkId return dCameraSinkSrv->StopDistributedHardware(networkId); } +void DCameraSinkHandler::CameraSinkRecipient::OnRemoteDied(const wptr &remote) +{ + if (remote == nullptr) { + DHLOGE("OnRemoteDied remote is nullptr."); + return; + } + DHLOGI("DInputSinkSvrRecipient OnRemoteDied."); + DCameraSinkHandler::GetInstance().OnRemoteSinkSvrDied(remote); +} + +void DCameraSinkHandler::OnRemoteSinkSvrDied(const wptr &remote) +{ + DHLOGI("DCameraSinkHandle OnRemoteSinkSvrDied."); + std::lock_guard lock(proxyMutex_); + if (dCameraSinkProxy_ == nullptr) { + DHLOGE("dCameraSinkProxy_ is nullptr."); + return; + } + if (dCameraSinkProxy_->AsObject() == nullptr) { + DHLOGE("AsObject is nullptr."); + return; + } + sptr remoteObject = remote.promote(); + if (remoteObject == nullptr) { + DHLOGE("OnRemoteDied remote promoted failed"); + return; + } + + if (dCameraSinkProxy_->AsObject() != remoteObject) { + DHLOGE("OnRemoteSinkSvrDied not found remote object."); + return; + } + dCameraSinkProxy_->AsObject()->RemoveDeathRecipient(sinkSvrRecipient_); + dCameraSinkProxy_ = nullptr; +} + IDistributedHardwareSink *GetSinkHardwareHandler() { DHLOGI("DCameraSinkHandler::GetSinkHardwareHandler"); -- Gitee From 628d0ef71507aba3dcae9efb7cdecb54085afafd Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 04:00:01 +0000 Subject: [PATCH 03/13] update interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h. Signed-off-by: ry521 --- .../camera_source/include/dcamera_source_handler.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h b/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h index 7675c899..b3bcf59f 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h +++ b/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h @@ -47,13 +47,21 @@ private: } DCameraSAState; DCameraSourceHandler(); ~DCameraSourceHandler(); - void FinishStartSA(const std::string ¶ms); + void FinishStartSA(const std::string ¶ms, const sptr &remoteObject); void FinishStartSAFailed(const int32_t systemAbilityId); + void OnRemoteSourceSvrDied(const wptr &remote); + class CameraSourceRecipient : public IRemoteObject::DeathRecipient { + public: + void OnRemoteDied(const wptr &remote) override; + }; private: std::mutex optLock_; sptr callback_; std::condition_variable producerCon_; std::mutex producerMutex_; + sptr dCameraSourceProxy_ = nullptr; + sptr dInputSourceCallback_ = nullptr; + sptr sourceSvrRecipient_ = nullptr; DCameraSAState state_ = DCAMERA_SA_STATE_STOP; friend class DCameraSourceLoadCallback; }; -- Gitee From 0f068e9be0578c1f6630ccbce8496c54ce6dfe18 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 04:02:33 +0000 Subject: [PATCH 04/13] update interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp. Signed-off-by: ry521 --- .../src/dcamera_source_handler.cpp | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp index cb66085f..13ee7811 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp +++ b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp @@ -34,6 +34,13 @@ DCameraSourceHandler::DCameraSourceHandler() { DHLOGI("DCameraSourceHandler construct."); callback_ = new DCameraSourceCallback(); + if (sourceSvrRecipient_ == nullptr) { + sourceSvrRecipient_ = new (std::nothrow) DInputSourceSvrRecipient(); + } + + if (dInputSourceCallback_ == nullptr) { + dInputSourceCallback_ = new (std::nothrow) LoadDInputSourceCallback(); + } } DCameraSourceHandler::~DCameraSourceHandler() @@ -77,10 +84,16 @@ int32_t DCameraSourceHandler::InitSource(const std::string& params) return DCAMERA_OK; } -void DCameraSourceHandler::FinishStartSA(const std::string ¶ms) +void DCameraSourceHandler::FinishStartSA(const std::string ¶ms, const sptr &remoteObject); { DCameraSourceHandlerIpc::GetInstance().Init(); sptr dCameraSourceSrv = DCameraSourceHandlerIpc::GetInstance().GetSourceLocalCamSrv(); + remoteObject->AddDeathRecipient(sourceSvrRecipient_); + dCameraSourceProxy_ = iface_cast(remoteObject); + if ((dCameraSourceProxy_ == nullptr) || (dCameraSourceProxy_->AsObject() == nullptr)) { + DHLOGE("Faild to get camera source proxy."); + return; + } if (dCameraSourceSrv == nullptr) { DHLOGE("get Service failed"); return; @@ -179,6 +192,42 @@ int32_t DCameraSourceHandler::ConfigDistributedHardware(const std::string& devId return DCAMERA_OK; } +void DCameraSourceHandler::CameraSourceRecipient::OnRemoteDied(const wptr &remote) +{ + if (remote == nullptr) { + DHLOGE("OnRemoteDied remote is nullptr."); + return; + } + DHLOGI("DCameraSourceSvrRecipient OnRemoteDied."); + DCameraSourceHandler::GetInstance().OnRemoteSourceSvrDied(remote); +} + +void DCameraSourceHandler::OnRemoteSourceSvrDied(const wptr &remote) +{ + DHLOGI("OnRemoteSourceSvrDied."); + std::lock_guard lock(proxyMutex_); + if (dCameraSourceProxy_ == nullptr) { + DHLOGE("dCameraSourceProxy is nullptr."); + return; + } + if (dCameraSourceProxy_->AsObject() == nullptr) { + DHLOGE("AsObject is nullptr."); + return; + } + sptr remoteObject = remote.promote(); + if (remoteObject == nullptr) { + DHLOGE("OnRemoteDied remote promoted failed"); + return; + } + + if (dCameraSourceProxy_->AsObject() != remoteObject) { + DHLOGE("OnRemoteSourceSvrDied not found remote object."); + return; + } + dCameraSourceProxy_->AsObject()->RemoveDeathRecipient(sourceSvrRecipient_); + dCameraSourceProxy_ = nullptr; +} + IDistributedHardwareSource *GetSourceHardwareHandler() { DHLOGI("DCameraSourceHandler GetSourceHardwareHandler Start"); -- Gitee From e70969af34fff0c63a8cd5c09475387a78bd505d Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 07:41:35 +0000 Subject: [PATCH 05/13] update interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_handler.h. Signed-off-by: ry521 --- .../native_cpp/camera_sink/include/dcamera_sink_handler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_handler.h b/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_handler.h index e4f9316e..e62cf5e1 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_handler.h +++ b/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_handler.h @@ -19,7 +19,7 @@ #include #include #include - +#include "idistributed_camera_sink.h" #include "idistributed_hardware_sink.h" #include "dcamera_sink_callback.h" #include "single_instance.h" -- Gitee From 55c5bda16ddf8071d876896b66da2c6a514710e4 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 07:42:14 +0000 Subject: [PATCH 06/13] update interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler.cpp. Signed-off-by: ry521 --- .../native_cpp/camera_sink/src/dcamera_sink_handler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler.cpp b/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler.cpp index 0a9b522d..759881f9 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler.cpp +++ b/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler.cpp @@ -215,7 +215,7 @@ void DCameraSinkHandler::CameraSinkRecipient::OnRemoteDied(const wptr &remote) { DHLOGI("DCameraSinkHandle OnRemoteSinkSvrDied."); - std::lock_guard lock(proxyMutex_); + std::lock_guard lock(producerMutex_); if (dCameraSinkProxy_ == nullptr) { DHLOGE("dCameraSinkProxy_ is nullptr."); return; -- Gitee From 01c85b4e4ba947354262e88eb675d569f8561365 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 07:42:46 +0000 Subject: [PATCH 07/13] update interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_load_callback.cpp. Signed-off-by: ry521 --- .../native_cpp/camera_sink/src/dcamera_sink_load_callback.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_load_callback.cpp b/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_load_callback.cpp index f7ea2632..cba754f5 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_load_callback.cpp +++ b/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_load_callback.cpp @@ -37,7 +37,7 @@ void DCameraSinkLoadCallback::OnLoadSystemAbilitySuccess(int32_t systemAbilityId DHLOGE("remoteObject is null."); return; } - DCameraSinkHandler::GetInstance().FinishStartSA(params_); + DCameraSinkHandler::GetInstance().FinishStartSA(params_, remoteObject); } void DCameraSinkLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) -- Gitee From b9420b5ac6bac2de359cae32c4ecd8d3bd968905 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 07:43:35 +0000 Subject: [PATCH 08/13] update interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h. Signed-off-by: ry521 --- .../native_cpp/camera_source/include/dcamera_source_handler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h b/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h index b3bcf59f..95d9aa26 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h +++ b/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h @@ -24,6 +24,7 @@ #include "refbase.h" #include "dcamera_source_callback.h" +#include "idistributed_camera_source.h" #include "idistributed_hardware_source.h" #include "single_instance.h" @@ -60,7 +61,7 @@ private: std::condition_variable producerCon_; std::mutex producerMutex_; sptr dCameraSourceProxy_ = nullptr; - sptr dInputSourceCallback_ = nullptr; + sptr dCameraSourceCallback_ = nullptr; sptr sourceSvrRecipient_ = nullptr; DCameraSAState state_ = DCAMERA_SA_STATE_STOP; friend class DCameraSourceLoadCallback; -- Gitee From 37a579b84c88a573312347e0245bb7b55ddc2897 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 07:44:21 +0000 Subject: [PATCH 09/13] update interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp. Signed-off-by: ry521 --- .../native_cpp/camera_source/src/dcamera_source_handler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp index 13ee7811..b32eff21 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp +++ b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp @@ -35,11 +35,11 @@ DCameraSourceHandler::DCameraSourceHandler() DHLOGI("DCameraSourceHandler construct."); callback_ = new DCameraSourceCallback(); if (sourceSvrRecipient_ == nullptr) { - sourceSvrRecipient_ = new (std::nothrow) DInputSourceSvrRecipient(); + sourceSvrRecipient_ = new (std::nothrow) CameraSourceRecipient(); } - if (dInputSourceCallback_ == nullptr) { - dInputSourceCallback_ = new (std::nothrow) LoadDInputSourceCallback(); + if (dCameraSourceCallback_ == nullptr) { + dCameraSourceCallback_ = new (std::nothrow) DCameraSourceCallback(); } } -- Gitee From 6a6ffe550a0f333f2b634756a5e0b04554dc57b4 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 07:44:52 +0000 Subject: [PATCH 10/13] update interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp. Signed-off-by: ry521 --- .../native_cpp/camera_source/src/dcamera_source_handler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp index b32eff21..18570caa 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp +++ b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp @@ -84,7 +84,7 @@ int32_t DCameraSourceHandler::InitSource(const std::string& params) return DCAMERA_OK; } -void DCameraSourceHandler::FinishStartSA(const std::string ¶ms, const sptr &remoteObject); +void DCameraSourceHandler::FinishStartSA(const std::string ¶ms, const sptr &remoteObject) { DCameraSourceHandlerIpc::GetInstance().Init(); sptr dCameraSourceSrv = DCameraSourceHandlerIpc::GetInstance().GetSourceLocalCamSrv(); @@ -205,7 +205,7 @@ void DCameraSourceHandler::CameraSourceRecipient::OnRemoteDied(const wptr &remote) { DHLOGI("OnRemoteSourceSvrDied."); - std::lock_guard lock(proxyMutex_); + std::lock_guard lock(producerMutex_); if (dCameraSourceProxy_ == nullptr) { DHLOGE("dCameraSourceProxy is nullptr."); return; -- Gitee From e3118e5aaef380f767817f6bc93d6d726b5a7011 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 07:45:20 +0000 Subject: [PATCH 11/13] update interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_load_callback.cpp. Signed-off-by: ry521 --- .../camera_source/src/dcamera_source_load_callback.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_load_callback.cpp b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_load_callback.cpp index d6e52434..fbb21f84 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_load_callback.cpp +++ b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_load_callback.cpp @@ -37,7 +37,7 @@ void DCameraSourceLoadCallback::OnLoadSystemAbilitySuccess(int32_t systemAbility DHLOGE("remoteObject is null."); return; } - DCameraSourceHandler::GetInstance().FinishStartSA(params_); + DCameraSourceHandler::GetInstance().FinishStartSA(params_, remoteObject); } void DCameraSourceLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) -- Gitee From aa1b59a43d7a03d664fdb63a3f5310db3e283398 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 07:47:26 +0000 Subject: [PATCH 12/13] . Signed-off-by: ry521 --- .../common/camera_sink/dcamera_sink_handler_test.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_test.cpp b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_test.cpp index 7b0677c8..4f4b4646 100644 --- a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_test.cpp +++ b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_test.cpp @@ -93,7 +93,10 @@ HWTEST_F(DCameraSinkHandlerTest, dcamera_sink_handler_test_002, TestSize.Level1) EXPECT_EQ(DCAMERA_OK, ret); int32_t systemAbilityId = 4804; - DCameraSinkHandler::GetInstance().FinishStartSA(params); + sptr samgr = + SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + sptr remoteObject = samgr->GetSystemAbility(systemAbilityId); + DCameraSinkHandler::GetInstance().FinishStartSA(params,remoteObject); DCameraSinkHandler::GetInstance().FinishStartSAFailed(systemAbilityId); ret = DCameraSinkHandler::GetInstance().ReleaseSink(); EXPECT_EQ(DCAMERA_OK, ret); -- Gitee From f84bbbe7f166328b14924ed43e61f023035e5c71 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 24 Nov 2023 07:48:29 +0000 Subject: [PATCH 13/13] . Signed-off-by: ry521 --- .../common/camera_source/dcamera_source_handler_test.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_test.cpp b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_test.cpp index e65d9745..b036f2f9 100644 --- a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_test.cpp +++ b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_test.cpp @@ -94,8 +94,11 @@ HWTEST_F(DCameraSourceHandlerTest, dcamera_source_handler_test_002, TestSize.Lev int32_t ret = DCameraSourceHandler::GetInstance().InitSource(params); EXPECT_EQ(DCAMERA_OK, ret); + sptr samgr = + SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); int32_t systemAbilityId = 4803; - DCameraSourceHandler::GetInstance().FinishStartSA(params); + sptr remoteObject = samgr->GetSystemAbility(systemAbilityId); + DCameraSourceHandler::GetInstance().FinishStartSA(params, remoteObject); DCameraSourceHandler::GetInstance().FinishStartSAFailed(systemAbilityId); ret = DCameraSourceHandler::GetInstance().ReleaseSource(); EXPECT_EQ(DCAMERA_OK, ret); -- Gitee