diff --git a/interfaces/inner_kits/native_cpp/camera_sink/BUILD.gn b/interfaces/inner_kits/native_cpp/camera_sink/BUILD.gn index ea379967f915f47b37878d3cb19bb8642894a6a9..33d359b691f199e414c9f699b467cfd7e2ddc4e6 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/camera_sink/BUILD.gn @@ -33,6 +33,7 @@ ohos_shared_library("distributed_camera_sink_sdk") { sources = [ "src/dcamera_sink_handler.cpp", "src/dcamera_sink_handler_ipc.cpp", + "src/dcamera_sink_load_callback.cpp", "src/distributed_camera_sink_proxy.cpp", ] 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 52b95b6e03c6ee35496fb1c81d7ae8908a973d86..e9829725fb1aa32568b45b585aaf19c8e97f150c 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 @@ -16,6 +16,9 @@ #ifndef OHOS_DCAMERA_SINK_HANDLER_H #define OHOS_DCAMERA_SINK_HANDLER_H +#include +#include + #include "idistributed_hardware_sink.h" #include "single_instance.h" @@ -28,10 +31,19 @@ public: int32_t ReleaseSink() override; int32_t SubscribeLocalHardware(const std::string& dhId, const std::string& parameters) override; int32_t UnsubscribeLocalHardware(const std::string& dhId) override; - + void FinishStartSA(const std::string ¶ms); + void FinishStartSAFailed(int32_t systemAbilityId); private: + typedef enum { + DCAMERA_SA_STATE_STOP = 0, + DCAMERA_SA_STATE_START = 1, + } DCameraSAState; DCameraSinkHandler() = default; ~DCameraSinkHandler(); +private: + std::condition_variable producerCon_; + std::mutex producerMutex_; + DCameraSAState state_ = DCAMERA_SA_STATE_STOP; }; #ifdef __cplusplus diff --git a/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_load_callback.h b/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_load_callback.h new file mode 100644 index 0000000000000000000000000000000000000000..8230e09742592c85acb82d616904fb52a9e0392e --- /dev/null +++ b/interfaces/inner_kits/native_cpp/camera_sink/include/dcamera_sink_load_callback.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef OHOS_DCAMERA_SINk_LOAD_CALLBACK_H +#define OHOS_DCAMERA_SINk_LOAD_CALLBACK_H + +#include "system_ability_load_callback_stub.h" + +namespace OHOS { +namespace DistributedHardware { +class DCameraSinkLoadCallback : public SystemAbilityLoadCallbackStub { +public: + + explicit DCameraSinkLoadCallback(const std::string params); + void OnLoadSystemAbilitySuccess(int32_t systemAbilityId, const sptr& remoteObject); + void OnLoadSystemAbilityFail(int32_t systemAbilityId); +private: + std::string params; +}; +} +} +#endif \ No newline at end of file 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 4ddea60ad9c114a60943524ae7e497171acd681f..00a849e9aad46c0000d9f672219cc61ed340103c 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 @@ -14,11 +14,15 @@ */ #include "dcamera_sink_handler.h" +#include "dcamera_sink_load_callback.h" #include "anonymous_string.h" #include "dcamera_sink_handler_ipc.h" +#include "distributed_camera_constants.h" #include "distributed_camera_errno.h" #include "distributed_hardware_log.h" +#include "if_system_ability_manager.h" +#include "iservice_registry.h" namespace OHOS { namespace DistributedHardware { @@ -32,13 +36,50 @@ DCameraSinkHandler::~DCameraSinkHandler() int32_t DCameraSinkHandler::InitSink(const std::string& params) { DHLOGI("DCameraSinkHandler::InitSink"); + sptr loadCallback = new DCameraSinkLoadCallback(params); + sptr sm = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (sm == nullptr) { + DHLOGE("GetSourceLocalDHMS GetSystemAbilityManager failed"); + return DCAMERA_INIT_ERR; + } + int32_t ret = sm->LoadSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID, loadCallback); + if (ret != DCAMERA_OK) { + DHLOGE("systemAbilityId: %d load filed,result code: %d.", DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID, ret); + return DCAMERA_INIT_ERR; + } + uint32_t interval = 1; + std::unique_lock lock(producerMutex_); + producerCon_.wait_for(lock, std::chrono::minutes(interval), [this] { + return (this->state_ == DCAMERA_SA_STATE_START); + }); + if (state_ == DCAMERA_SA_STATE_STOP) { + DHLOGE("SinkSA Start failed!"); + return DCAMERA_INIT_ERR; + } + DHLOGI("DCameraSinkHandler InitSink end, result: %d", ret); + return DCAMERA_OK; +} + +void DCameraSinkHandler::FinishStartSA(const std::string ¶ms) +{ DCameraSinkHandlerIpc::GetInstance().Init(); sptr dCameraSinkSrv = DCameraSinkHandlerIpc::GetInstance().GetSinkLocalDHMS(); if (dCameraSinkSrv == nullptr) { DHLOGE("DCameraSinkHandler::InitSink get Service failed"); - return DCAMERA_INIT_ERR; + return; } - return dCameraSinkSrv->InitSink(params); + dCameraSinkSrv->InitSink(params); + std::unique_lock lock(producerMutex_); + state_ = DCAMERA_SA_STATE_START; + producerCon_.notify_one(); +} + +void DCameraSinkHandler::FinishStartSAFailed(int32_t systemAbilityId) +{ + DHLOGI("SinkSA Start failed, systemAbilityId: %d.", systemAbilityId); + std::unique_lock lock(producerMutex_); + state_ = DCAMERA_SA_STATE_STOP; + producerCon_.notify_one(); } int32_t DCameraSinkHandler::ReleaseSink() 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 new file mode 100644 index 0000000000000000000000000000000000000000..998af41953c66d18c6810f251a795c75bc3e6b4b --- /dev/null +++ b/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_load_callback.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "dcamera_sink_load_callback.h" +#include "dcamera_sink_handler.h" +#include "distributed_hardware_log.h" +#include "distributed_camera_constants.h" + +namespace OHOS { +namespace DistributedHardware { +DCameraSinkLoadCallback::DCameraSinkLoadCallback(const std::string params) : params(params) {} +void DCameraSinkLoadCallback::OnLoadSystemAbilitySuccess(int32_t systemAbilityId, + const sptr& remoteObject) +{ + DHLOGI("OnLoadSystemAbilitySuccess start systemAbilityId: %d.", systemAbilityId); + if (systemAbilityId != DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID) { + DHLOGE("start aystemabilityId is not sinkSAId!"); + return; + } + DHLOGE("OnLoadSystemAbilitySuccess systemAbilityId: %d, IRmoteObject result: %s", + systemAbilityId, (remoteObject != nullptr) ? "true" : "false"); + if (remoteObject == nullptr) { + DHLOGE("remoteObject is null."); + return; + } + DCameraSinkHandler::GetInstance().FinishStartSA(params); +} + +void DCameraSinkLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) +{ + DHLOGE("OnLoadSystemAbilityFail systemAbilityId: %d.", systemAbilityId); + if (systemAbilityId != DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID) { + DHLOGE("start aystemabilityId is not sinkSAId!"); + return; + } + DCameraSinkHandler::GetInstance().FinishStartSAFailed(systemAbilityId); +} +} +} \ No newline at end of file diff --git a/interfaces/inner_kits/native_cpp/camera_source/BUILD.gn b/interfaces/inner_kits/native_cpp/camera_source/BUILD.gn index 50cc17a13efdf4e753f4b26c69a974b7283b415f..011442db8f77fb9ab5d47e4a7482b44b7f8772ce 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/camera_source/BUILD.gn @@ -36,6 +36,7 @@ ohos_shared_library("distributed_camera_source_sdk") { "src/callback/dcamera_source_callback_stub.cpp", "src/dcamera_source_handler.cpp", "src/dcamera_source_handler_ipc.cpp", + "src/dcamera_source_load_callback.cpp", "src/distributed_camera_source_proxy.cpp", ] 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 a1f47f6c7f085960836badcfa9412cbde8e190be..0278578ee0c282c014b8afdaaad23fe68336e403 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 @@ -17,6 +17,7 @@ #define OHOS_DCAMERA_SOURCE_HANDLER_H #include +#include #include "iremote_proxy.h" #include "iremote_broker.h" @@ -39,14 +40,22 @@ public: std::shared_ptr callback) override; int32_t ConfigDistributedHardware(const std::string& devId, const std::string& dhId, const std::string& key, const std::string& value) override; - + void FinishStartSA(const std::string ¶ms); + void FinishStartSAFailed(int32_t systemAbilityId); private: + typedef enum { + DCAMERA_SA_STATE_STOP = 0, + DCAMERA_SA_STATE_START = 1, + } DCameraSAState; DCameraSourceHandler() = default; ~DCameraSourceHandler(); private: std::mutex optLock_; sptr callback_; + std::condition_variable producerCon_; + std::mutex producerMutex_; + DCameraSAState state_ = DCAMERA_SA_STATE_STOP; }; #ifdef __cplusplus diff --git a/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_load_callback.h b/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_load_callback.h new file mode 100644 index 0000000000000000000000000000000000000000..05f4d3471c36d149b7bb400ce3616d8f23c42a55 --- /dev/null +++ b/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_load_callback.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef OHOS_DCAMERA_SOURCE_LOAD_CALLBACK_H +#define OHOS_DCAMERA_SOURCE_LOAD_CALLBACK_H + +#include "system_ability_load_callback_stub.h" + +namespace OHOS { +namespace DistributedHardware { +class DCameraSourceLoadCallback : public SystemAbilityLoadCallbackStub { +public: + + explicit DCameraSourceLoadCallback(const std::string params); + void OnLoadSystemAbilitySuccess(int32_t systemAbilityId, const sptr& remoteObject); + void OnLoadSystemAbilityFail(int32_t systemAbilityId); +private: + std::string params; +}; +} +} +#endif \ No newline at end of file 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 ddee107feedeeeddf5d50e20597c89fa6b2e10de..244683c5bcc2176ac7e7a7e2d18116561c931c25 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 @@ -15,10 +15,14 @@ #include "dcamera_source_handler.h" #include "dcamera_source_callback.h" +#include "dcamera_source_load_callback.h" +#include "if_system_ability_manager.h" +#include "iservice_registry.h" #include "anonymous_string.h" #include "dcamera_source_handler_ipc.h" #include "dh_utils_tool.h" +#include "distributed_camera_constants.h" #include "distributed_camera_errno.h" #include "distributed_hardware_log.h" @@ -34,21 +38,56 @@ DCameraSourceHandler::~DCameraSourceHandler() int32_t DCameraSourceHandler::InitSource(const std::string& params) { DHLOGI("DCameraSourceHandler InitSource Start"); + sptr loadCallback = new DCameraSourceLoadCallback(params); + sptr sm = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (sm == nullptr) { + DHLOGE("GetSourceLocalDHMS GetSystemAbilityManager failed"); + return DCAMERA_INIT_ERR; + } + int32_t ret = sm->LoadSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID, loadCallback); + if (ret != DCAMERA_OK) { + DHLOGE("systemAbilityId: %d load filed,result code: %d.", DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID, ret); + return DCAMERA_INIT_ERR; + } + uint32_t interval = 1; + std::unique_lock lock(producerMutex_); + producerCon_.wait_for(lock, std::chrono::minutes(interval), [this] { + return (this->state_ == DCAMERA_SA_STATE_START); + }); + if (state_ == DCAMERA_SA_STATE_STOP) { + DHLOGE("SourceSA Start failed!"); + return DCAMERA_INIT_ERR; + } + DHLOGI("DCameraSourceHandler InitSource end, result: %d", ret); + return DCAMERA_OK; +} + +void DCameraSourceHandler::FinishStartSA(const std::string ¶ms) +{ DCameraSourceHandlerIpc::GetInstance().Init(); sptr dCameraSourceSrv = DCameraSourceHandlerIpc::GetInstance().GetSourceLocalDHMS(); if (dCameraSourceSrv == nullptr) { DHLOGE("DCameraSourceHandler InitSource get Service failed"); - return DCAMERA_INIT_ERR; + return; } callback_ = new DCameraSourceCallback(); if (callback_ == nullptr) { DHLOGE("DCameraSourceHandler InitSource init callback failed"); - return DCAMERA_INIT_ERR; + return; } - int32_t ret = dCameraSourceSrv->InitSource(params, callback_); - DHLOGI("DCameraSourceHandler InitSource end, ret: %d", ret); - return ret; + dCameraSourceSrv->InitSource(params, callback_); + std::unique_lock lock(producerMutex_); + state_ = DCAMERA_SA_STATE_START; + producerCon_.notify_one(); +} + +void DCameraSourceHandler::FinishStartSAFailed(int32_t systemAbilityId) +{ + DHLOGE("SourceSA Start failed, systemAbilityId: %d.", systemAbilityId); + std::unique_lock lock(producerMutex_); + state_ = DCAMERA_SA_STATE_STOP; + producerCon_.notify_one(); } int32_t DCameraSourceHandler::ReleaseSource() 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 new file mode 100644 index 0000000000000000000000000000000000000000..fe344ceb15d96603cc69b473686461b8ffaaab77 --- /dev/null +++ b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_load_callback.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "dcamera_source_load_callback.h" +#include "dcamera_source_handler.h" +#include "distributed_hardware_log.h" +#include "distributed_camera_constants.h" + +namespace OHOS { +namespace DistributedHardware { +DCameraSourceLoadCallback::DCameraSourceLoadCallback(const std::string params) : params(params) {} +void DCameraSourceLoadCallback::OnLoadSystemAbilitySuccess(int32_t systemAbilityId, + const sptr& remoteObject) +{ + DHLOGI("OnLoadSystemAbilitySuccess start systemAbilityId: %d.", systemAbilityId); + if (systemAbilityId != DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID) { + DHLOGE("start systemabilityId is not sourceSAId!"); + return; + } + DHLOGE("OnLoadSystemAbilitySuccess systemAbilityId: %d, IRmoteObject result: %s", + systemAbilityId, (remoteObject != nullptr) ? "true" : "false"); + if (remoteObject == nullptr) { + DHLOGE("remoteObject is null."); + return; + } + DCameraSourceHandler::GetInstance().FinishStartSA(params); +} + +void DCameraSourceLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) +{ + DHLOGE("OnLoadSystemAbilityFail systemAbilityId: %d.", systemAbilityId); + if (systemAbilityId != DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID) { + DHLOGE("start systemabilityId is not sourceSAId!"); + return; + } + DCameraSourceHandler::GetInstance().FinishStartSAFailed(systemAbilityId); +} +} +} \ No newline at end of file diff --git a/interfaces/inner_kits/native_cpp/camera_source/src/distributed_camera_source_proxy.cpp b/interfaces/inner_kits/native_cpp/camera_source/src/distributed_camera_source_proxy.cpp index 113bdbda2436aaed451413b43a4dd53b88c11e41..33af72b07c2b1834b259c952c188396eb9834294 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/src/distributed_camera_source_proxy.cpp +++ b/interfaces/inner_kits/native_cpp/camera_source/src/distributed_camera_source_proxy.cpp @@ -34,7 +34,7 @@ int32_t DistributedCameraSourceProxy::InitSource(const std::string& params, } MessageParcel data; MessageParcel reply; - MessageOption option; + MessageOption option = { MessageOption::TF_ASYNC }; if (!data.WriteInterfaceToken(DistributedCameraSourceProxy::GetDescriptor())) { DHLOGE("DistributedCameraSourceProxy InitSource write token failed"); return DCAMERA_BAD_VALUE; diff --git a/sa_profile/4803.xml b/sa_profile/4803.xml index d5e5bfaa79df8b30d30d9469d155311bc7fb6f81..fb50166a5b79c0dfbdb5f8b58b3140c00c0acb5a 100644 --- a/sa_profile/4803.xml +++ b/sa_profile/4803.xml @@ -14,13 +14,13 @@ * limitations under the License. --> - dhardware + dcamerasrc 4803 libdistributed_camera_source.z.so - true + false true 1 diff --git a/sa_profile/4804.xml b/sa_profile/4804.xml index f0e705748d635b5c4a7b93e0fa6ed41666f746d1..a827ae539fe5f4d678ea3dcc22b1ae54ff967bfd 100644 --- a/sa_profile/4804.xml +++ b/sa_profile/4804.xml @@ -14,13 +14,13 @@ * limitations under the License. --> - dhardware + dcamerasink 4804 libdistributed_camera_sink.z.so - true + false true 1 diff --git a/services/cameraservice/sinkservice/BUILD.gn b/services/cameraservice/sinkservice/BUILD.gn index 2ce72ccf8479a53fe88c5f709b3256f5fefa3077..c6f00f07dd5028c535b8d5ca42d2d72ad519e175 100644 --- a/services/cameraservice/sinkservice/BUILD.gn +++ b/services/cameraservice/sinkservice/BUILD.gn @@ -89,7 +89,7 @@ ohos_shared_library("distributed_camera_sink") { "src/distributedcameramgr/listener/dcamera_sink_output_channel_listener.cpp", ] - if (device_name == "baltimore") { + if ("${product_name}" == "m40") { sources += [ "src/distributedcameramgr/dcamera_sink_data_process.cpp" ] } else { sources += @@ -108,6 +108,7 @@ ohos_shared_library("distributed_camera_sink") { "${services_path}/data_process:distributed_camera_data_process", "//third_party/jsoncpp:jsoncpp", "//utils/native/base:utils", + ":dcamerasink.cfg", ] defines = [ @@ -127,4 +128,11 @@ ohos_shared_library("distributed_camera_sink") { subsystem_name = "distributedhardware" part_name = "distributed_camera" + } +ohos_prebuilt_etc("dcamerasink.cfg") { + relative_install_dir = "init" + source = "dcamerasink.cfg" + part_name = "distributed_camera" + subsystem_name = "distributedhardware" +} \ No newline at end of file diff --git a/services/cameraservice/sinkservice/dcamerasink.cfg b/services/cameraservice/sinkservice/dcamerasink.cfg new file mode 100644 index 0000000000000000000000000000000000000000..ff208b8017078e228ff41343329c2c20745fb185 --- /dev/null +++ b/services/cameraservice/sinkservice/dcamerasink.cfg @@ -0,0 +1,9 @@ +{ + "services" : [{ + "name" : "dcamerasink", + "path" : ["/system/bin/sa_main","/system/profile/dcamerasink.xml"], + "uid" : "system", + "gid" : ["system"], + "ondemand" : true + }] +} \ No newline at end of file diff --git a/services/cameraservice/sinkservice/src/distributedcamera/distributed_camera_sink_service.cpp b/services/cameraservice/sinkservice/src/distributedcamera/distributed_camera_sink_service.cpp index 888708d87df08381cd3d3325d610c84e85ac4e06..d35bd197111902b3c9b28858076b47ea56af94dc 100644 --- a/services/cameraservice/sinkservice/src/distributedcamera/distributed_camera_sink_service.cpp +++ b/services/cameraservice/sinkservice/src/distributedcamera/distributed_camera_sink_service.cpp @@ -117,6 +117,7 @@ int32_t DistributedCameraSinkService::ReleaseSink() } camerasMap_.clear(); DHLOGI("DistributedCameraSinkService::ReleaseSink success"); + exit(0); return DCAMERA_OK; } diff --git a/services/cameraservice/sourceservice/BUILD.gn b/services/cameraservice/sourceservice/BUILD.gn index 8f53c80dc8be0b59c64408fbb07e004dac756646..f2042b3e67d57d6c22eadd1803e21fd4c4d194dc 100644 --- a/services/cameraservice/sourceservice/BUILD.gn +++ b/services/cameraservice/sourceservice/BUILD.gn @@ -93,6 +93,7 @@ ohos_shared_library("distributed_camera_source") { "${services_path}/data_process:distributed_camera_data_process", "//third_party/jsoncpp:jsoncpp", "//utils/native/base:utils", + ":dcamerasrc.cfg", ] defines = [ @@ -112,4 +113,11 @@ ohos_shared_library("distributed_camera_source") { subsystem_name = "distributedhardware" part_name = "distributed_camera" + } +ohos_prebuilt_etc("dcamerasrc.cfg") { + relative_install_dir = "init" + source = "dcamerasrc.cfg" + part_name = "distributed_camera" + subsystem_name = "distributedhardware" +} \ No newline at end of file diff --git a/services/cameraservice/sourceservice/dcamerasrc.cfg b/services/cameraservice/sourceservice/dcamerasrc.cfg new file mode 100644 index 0000000000000000000000000000000000000000..74a11980e262b45ec1fbf03771565eeb155836b1 --- /dev/null +++ b/services/cameraservice/sourceservice/dcamerasrc.cfg @@ -0,0 +1,9 @@ +{ + "services" : [{ + "name" : "dcamerasrc", + "path" : ["/system/bin/sa_main","/system/profile/dcamerasrc.xml"], + "uid" : "system", + "gid" : ["system"], + "ondemand" : true + }] +} \ No newline at end of file diff --git a/services/cameraservice/sourceservice/src/distributedcamera/distributed_camera_source_service.cpp b/services/cameraservice/sourceservice/src/distributedcamera/distributed_camera_source_service.cpp index 1119e87b61d8fbf5bd5e4a0b905bf643d38f6fdb..6fcdf75c886a019ffefbb78e90fd89b514a68f49 100644 --- a/services/cameraservice/sourceservice/src/distributedcamera/distributed_camera_source_service.cpp +++ b/services/cameraservice/sourceservice/src/distributedcamera/distributed_camera_source_service.cpp @@ -102,6 +102,7 @@ int32_t DistributedCameraSourceService::ReleaseSource() return ret; } callbackProxy_ = nullptr; + exit(0); return DCAMERA_OK; }