diff --git a/0001-remove-dependency-and-adapt-for-build-device_manager.patch b/0001-remove-dependency-and-adapt-for-build-device_manager.patch new file mode 100644 index 0000000000000000000000000000000000000000..b5068ac72f3b72f0a765129ff7a21bba39628c4e --- /dev/null +++ b/0001-remove-dependency-and-adapt-for-build-device_manager.patch @@ -0,0 +1,406 @@ +From cd2f37dcc4bc09b440753670b0f4ec7c1c425c0c Mon Sep 17 00:00:00 2001 +From: heppen +Date: Tue, 20 Jun 2023 17:44:14 +0800 +Subject: [PATCH] remove dependency and adapt for build + +--- + bundle.json | 3 ++- + common/src/dfx/standard/dm_hisysevent.cpp | 23 ++++++++-------- + common/src/dfx/standard/dm_hitrace.cpp | 8 +++--- + ext/no_interaction_auth/BUILD.gn | 10 +++---- + ext/pin_auth/BUILD.gn | 2 +- + interfaces/inner_kits/native_cpp/BUILD.gn | 4 +-- + interfaces/kits/js/BUILD.gn | 2 +- + services/implementation/BUILD.gn | 6 ++--- + services/service/BUILD.gn | 12 +++------ + .../ipc/standard/ipc_server_listener.h | 1 + + .../dmcommoneventmanager_fuzzer/BUILD.gn | 2 +- + .../dmdiscoverymanager_fuzzer/BUILD.gn | 2 +- + test/fuzztest/pinauth_fuzzer/BUILD.gn | 2 +- + test/fuzztest/pinauthui_fuzzer/BUILD.gn | 2 +- + test/unittest/BUILD.gn | 26 +++++++++---------- + test/unittest/UTTest_dm_dfx.h | 2 +- + utils/BUILD.gn | 6 ++--- + .../standard/permission_manager.cpp | 2 +- + 18 files changed, 58 insertions(+), 57 deletions(-) + +diff --git a/bundle.json b/bundle.json +index 5d6b7849..bee412cb 100644 +--- a/bundle.json ++++ b/bundle.json +@@ -72,7 +72,8 @@ + "device_manager_callback.h", + "dm_device_info.h", + "dm_publish_info.h", +- "dm_subscribe_info.h" ++ "dm_subscribe_info.h", ++ "dm_app_image_info.h" + ], + "header_base": "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include" + } +diff --git a/common/src/dfx/standard/dm_hisysevent.cpp b/common/src/dfx/standard/dm_hisysevent.cpp +index 4e9b2970..a508cb85 100644 +--- a/common/src/dfx/standard/dm_hisysevent.cpp ++++ b/common/src/dfx/standard/dm_hisysevent.cpp +@@ -17,23 +17,24 @@ + + #include "dm_constants.h" // for DM_OK + #include "dm_log.h" // for LOGE +-#include "hisysevent.h" // for HiSysEvent, HiSysEvent::Domain, HiSysEvent... ++// #include "hisysevent.h" // for HiSysEvent, HiSysEvent::Domain, HiSysEvent... + #include "unistd.h" // for getpid, getuid + + namespace OHOS { + namespace DistributedHardware { + void SysEventWrite(const std::string &status, int32_t eventType, const std::string &msg) + { +- int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( +- OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_DEVICE_MANAGER, +- status.c_str(), +- (OHOS::HiviewDFX::HiSysEvent::EventType)eventType, +- "PID", getpid(), +- "UID", getuid(), +- "MSG", msg.c_str()); +- if (res != DM_OK) { +- LOGE("%s Write HiSysEvent error, res:%d", status.c_str(), res); +- } ++ return; ++ // int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( ++ // OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_DEVICE_MANAGER, ++ // status.c_str(), ++ // (OHOS::HiviewDFX::HiSysEvent::EventType)eventType, ++ // "PID", getpid(), ++ // "UID", getuid(), ++ // "MSG", msg.c_str()); ++ // if (res != DM_OK) { ++ // LOGE("%s Write HiSysEvent error, res:%d", status.c_str(), res); ++ // } + } + } // namespace DistributedHardware + } // namespace OHOS +diff --git a/common/src/dfx/standard/dm_hitrace.cpp b/common/src/dfx/standard/dm_hitrace.cpp +index 1bbe65fa..caa79885 100644 +--- a/common/src/dfx/standard/dm_hitrace.cpp ++++ b/common/src/dfx/standard/dm_hitrace.cpp +@@ -13,18 +13,20 @@ + * limitations under the License. + */ + #include "dm_hitrace.h" +-#include "hitrace_meter.h" ++// #include "hitrace_meter.h" + + namespace OHOS { + namespace DistributedHardware { + void DmTraceStart(const std::string &msg) + { +- StartTrace(HITRACE_TAG_DEVICE_MANAGER, msg); ++ return; ++ // StartTrace(HITRACE_TAG_DEVICE_MANAGER, msg); + } + + void DmTraceEnd() + { +- FinishTrace(HITRACE_TAG_DEVICE_MANAGER); ++ return; ++ // FinishTrace(HITRACE_TAG_DEVICE_MANAGER); + } + } // namespace DistributedHardware + } // namespace OHOS +diff --git a/ext/no_interaction_auth/BUILD.gn b/ext/no_interaction_auth/BUILD.gn +index 231e60e4..29b7d6c1 100644 +--- a/ext/no_interaction_auth/BUILD.gn ++++ b/ext/no_interaction_auth/BUILD.gn +@@ -72,12 +72,12 @@ if (defined(ohos_lite)) { + ] + + external_deps = [ +- "ability_base:want", +- "bundle_framework:appexecfwk_base", +- "bundle_framework:appexecfwk_core", ++ # "ability_base:want", ++ #"bundle_framework:appexecfwk_base", ++ #"bundle_framework:appexecfwk_core", + "c_utils:utils", +- "common_event_service:cesfwk_core", +- "common_event_service:cesfwk_innerkits", ++ # "common_event_service:cesfwk_core", ++ # "common_event_service:cesfwk_innerkits", + "dsoftbus:softbus_client", + "hiviewdfx_hilog_native:libhilog", + "init:libbeget_proxy", +diff --git a/ext/pin_auth/BUILD.gn b/ext/pin_auth/BUILD.gn +index d49e4f4a..efcb0321 100644 +--- a/ext/pin_auth/BUILD.gn ++++ b/ext/pin_auth/BUILD.gn +@@ -140,7 +140,7 @@ if (defined(ohos_lite)) { + ] + + external_deps = [ +- "ability_base:want", ++ # "ability_base:want", + "init:libbegetutil", + ] + +diff --git a/interfaces/inner_kits/native_cpp/BUILD.gn b/interfaces/inner_kits/native_cpp/BUILD.gn +index d5726567..81ea6a65 100644 +--- a/interfaces/inner_kits/native_cpp/BUILD.gn ++++ b/interfaces/inner_kits/native_cpp/BUILD.gn +@@ -149,8 +149,8 @@ if (defined(ohos_lite)) { + + external_deps = [ + "c_utils:utils", +- "hisysevent_native:libhisysevent", +- "hitrace_native:hitrace_meter", ++ # "hisysevent_native:libhisysevent", ++ # "hitrace_native:hitrace_meter", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "samgr:samgr_proxy", +diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn +index a71f79a1..bd0febab 100644 +--- a/interfaces/kits/js/BUILD.gn ++++ b/interfaces/kits/js/BUILD.gn +@@ -46,7 +46,7 @@ ohos_shared_library("devicemanager") { + "LOG_DOMAIN=0xD004100", + ] + +- external_deps = [ "bundle_framework:appexecfwk_base" ] ++ external_deps = [ #"bundle_framework:appexecfwk_base" ] + + subsystem_name = "distributedhardware" + relative_install_dir = "module/distributedhardware" +diff --git a/services/implementation/BUILD.gn b/services/implementation/BUILD.gn +index 126232e2..45bf523b 100644 +--- a/services/implementation/BUILD.gn ++++ b/services/implementation/BUILD.gn +@@ -220,10 +220,10 @@ if (defined(ohos_lite)) { + } + + external_deps = [ +- "ability_base:want", ++ # "ability_base:want", + "c_utils:utils", +- "common_event_service:cesfwk_core", +- "common_event_service:cesfwk_innerkits", ++ # "common_event_service:cesfwk_core", ++ # "common_event_service:cesfwk_innerkits", + "dsoftbus:softbus_client", + "init:libbegetutil", + "ipc:ipc_core", +diff --git a/services/service/BUILD.gn b/services/service/BUILD.gn +index bb353c12..fd7bb180 100644 +--- a/services/service/BUILD.gn ++++ b/services/service/BUILD.gn +@@ -112,10 +112,10 @@ if (defined(ohos_lite)) { + "//third_party/mbedtls", + ] + +- external_deps = [ +- "hisysevent_native:libhisysevent", +- "hitrace_native:hitrace_meter", +- ] ++ # external_deps = [ ++ # # "hisysevent_native:libhisysevent", ++ # # "hitrace_native:hitrace_meter", ++ # ] + } + } else { + executable("devicemanagerservice") { +@@ -180,10 +180,6 @@ if (defined(ohos_lite)) { + ] + } + } +-} else if (!support_jsapi) { +- group("devicemanagerservice") { +- deps = [] +- } + } else { + config("devicemanagerservice_config") { + include_dirs = [ +diff --git a/services/service/include/ipc/standard/ipc_server_listener.h b/services/service/include/ipc/standard/ipc_server_listener.h +index 0ff7bb80..02283724 100644 +--- a/services/service/include/ipc/standard/ipc_server_listener.h ++++ b/services/service/include/ipc/standard/ipc_server_listener.h +@@ -17,6 +17,7 @@ + #define OHOS_DM_IPC_SERVER_LISTENER_H + + #include ++#include + + #include "ipc_req.h" + #include "ipc_rsp.h" +diff --git a/test/fuzztest/dmcommoneventmanager_fuzzer/BUILD.gn b/test/fuzztest/dmcommoneventmanager_fuzzer/BUILD.gn +index a7dda4f8..997596f2 100644 +--- a/test/fuzztest/dmcommoneventmanager_fuzzer/BUILD.gn ++++ b/test/fuzztest/dmcommoneventmanager_fuzzer/BUILD.gn +@@ -57,7 +57,7 @@ ohos_fuzztest("DmCommonEventManagerFuzzTest") { + ] + + external_deps = [ +- "ability_base:want", ++ # "ability_base:want", + "c_utils:utils", + "common_event_service:cesfwk_core", + "common_event_service:cesfwk_innerkits", +diff --git a/test/fuzztest/dmdiscoverymanager_fuzzer/BUILD.gn b/test/fuzztest/dmdiscoverymanager_fuzzer/BUILD.gn +index a183baab..64b5f7bf 100644 +--- a/test/fuzztest/dmdiscoverymanager_fuzzer/BUILD.gn ++++ b/test/fuzztest/dmdiscoverymanager_fuzzer/BUILD.gn +@@ -56,7 +56,7 @@ ohos_fuzztest("DmDiscoveryManagerFuzzTest") { + ] + + external_deps = [ +- "ability_base:want", ++ # "ability_base:want", + "c_utils:utils", + "common_event_service:cesfwk_core", + "common_event_service:cesfwk_innerkits", +diff --git a/test/fuzztest/pinauth_fuzzer/BUILD.gn b/test/fuzztest/pinauth_fuzzer/BUILD.gn +index a37f310f..5d9e7b8c 100644 +--- a/test/fuzztest/pinauth_fuzzer/BUILD.gn ++++ b/test/fuzztest/pinauth_fuzzer/BUILD.gn +@@ -92,7 +92,7 @@ ohos_fuzztest("PinAuthFuzzTest") { + ] + + external_deps = [ +- "ability_base:want", ++ # "ability_base:want", + "init:libbegetutil", + ] + } +diff --git a/test/fuzztest/pinauthui_fuzzer/BUILD.gn b/test/fuzztest/pinauthui_fuzzer/BUILD.gn +index 5de26477..dd56d78e 100644 +--- a/test/fuzztest/pinauthui_fuzzer/BUILD.gn ++++ b/test/fuzztest/pinauthui_fuzzer/BUILD.gn +@@ -92,7 +92,7 @@ ohos_fuzztest("PinAuthUiFuzzTest") { + ] + + external_deps = [ +- "ability_base:want", ++ # "ability_base:want", + "init:libbegetutil", + ] + } +diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn +index b154fdfb..cae3a92b 100644 +--- a/test/unittest/BUILD.gn ++++ b/test/unittest/BUILD.gn +@@ -178,8 +178,8 @@ ohos_unittest("UTTest_softbus_connector") { + deps = [ ":device_manager_test_common" ] + + external_deps = [ +- "hisysevent_native:libhisysevent", +- "hitrace_native:hitrace_meter", ++ # "hisysevent_native:libhisysevent", ++ # "hitrace_native:hitrace_meter", + ] + } + +@@ -194,8 +194,8 @@ ohos_unittest("UTTest_softbus_session") { + deps = [ ":device_manager_test_common" ] + + external_deps = [ +- "hisysevent_native:libhisysevent", +- "hitrace_native:hitrace_meter", ++ # "hisysevent_native:libhisysevent", ++ # "hitrace_native:hitrace_meter", + ] + } + +@@ -367,8 +367,8 @@ ohos_unittest("UTTest_dm_device_state_manager") { + deps = [ ":device_manager_test_common" ] + + external_deps = [ +- "hisysevent_native:libhisysevent", +- "hitrace_native:hitrace_meter", ++ # "hisysevent_native:libhisysevent", ++ # "hitrace_native:hitrace_meter", + ] + } + +@@ -504,7 +504,7 @@ ohos_unittest("UTTest_dm_discovery_manager") { + + deps = [ ":device_manager_test_common" ] + +- external_deps = [ "hitrace_native:hitrace_meter" ] ++ # external_deps = [ "hitrace_native:hitrace_meter" ] + } + + ## UnitTest UTTest_dm_discovery_manager }}} +@@ -528,7 +528,7 @@ ohos_unittest("UTTest_dm_publish_manager") { + + deps = [ ":device_manager_test_common" ] + +- external_deps = [ "hitrace_native:hitrace_meter" ] ++ # external_deps = [ "hitrace_native:hitrace_meter" ] + } + + ## UnitTest UTTest_dm_publish_manager }}} +@@ -642,15 +642,15 @@ ohos_static_library("device_manager_test_common") { + } + + external_deps = [ +- "ability_base:want", +- "bundle_framework:appexecfwk_base", +- "bundle_framework:appexecfwk_core", ++ # "ability_base:want", ++ #"bundle_framework:appexecfwk_base", ++ #"bundle_framework:appexecfwk_core", + "common_event_service:cesfwk_core", + "common_event_service:cesfwk_innerkits", + "dsoftbus:softbus_client", + "eventhandler:libeventhandler", +- "hisysevent_native:libhisysevent", +- "hitrace_native:hitrace_meter", ++ # "hisysevent_native:libhisysevent", ++ # "hitrace_native:hitrace_meter", + "hiviewdfx_hilog_native:libhilog", + "init:libbegetutil", + "ipc:ipc_core", +diff --git a/test/unittest/UTTest_dm_dfx.h b/test/unittest/UTTest_dm_dfx.h +index 8bba3789..d20b9b8f 100644 +--- a/test/unittest/UTTest_dm_dfx.h ++++ b/test/unittest/UTTest_dm_dfx.h +@@ -29,7 +29,7 @@ + #undef private + #include "dm_hisysevent.h" + #include "dm_hitrace.h" +-#include "hitrace_meter.h" ++// #include "hitrace_meter.h" + + namespace OHOS { + namespace DistributedHardware { +diff --git a/utils/BUILD.gn b/utils/BUILD.gn +index 0d231c71..59e9e9bd 100644 +--- a/utils/BUILD.gn ++++ b/utils/BUILD.gn +@@ -181,10 +181,10 @@ if (defined(ohos_lite)) { + deps = [ "//third_party/mbedtls:mbedtls_shared" ] + + external_deps = [ +- "access_token:libaccesstoken_sdk", ++ # "access_token:libaccesstoken_sdk", + "c_utils:utils", +- "hisysevent_native:libhisysevent", +- "hitrace_native:hitrace_meter", ++ # # "hisysevent_native:libhisysevent", ++ # "hitrace_native:hitrace_meter", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "samgr:samgr_proxy", +diff --git a/utils/src/permission/standard/permission_manager.cpp b/utils/src/permission/standard/permission_manager.cpp +index 11db468c..e3de417b 100644 +--- a/utils/src/permission/standard/permission_manager.cpp ++++ b/utils/src/permission/standard/permission_manager.cpp +@@ -24,7 +24,7 @@ + #include "iservice_registry.h" + #include "system_ability_definition.h" + #include "ipc_skeleton.h" +-#include "access_token.h" ++// #include "access_token.h" + #include "hap_token_info.h" + #include "native_token_info.h" + #include "accesstoken_kit.h" +-- +2.33.0 + diff --git a/0002-device-manager-only-support-for-network.patch b/0002-device-manager-only-support-for-network.patch new file mode 100644 index 0000000000000000000000000000000000000000..531df59913d28e28b1b167f5a0d2f715895c31a8 --- /dev/null +++ b/0002-device-manager-only-support-for-network.patch @@ -0,0 +1,55 @@ +From 62b2759508a22df2ce28dea46a20e8f87bf46337 Mon Sep 17 00:00:00 2001 +From: tianhang +Date: Tue, 26 Sep 2023 13:42:14 +0800 +Subject: [PATCH] only support network coap + +--- + .../src/dependency/softbus/softbus_connector.cpp | 2 +- + services/service/src/softbus/softbus_listener.cpp | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/services/implementation/src/dependency/softbus/softbus_connector.cpp b/services/implementation/src/dependency/softbus/softbus_connector.cpp +index 6640fff..4c655e2 100644 +--- a/services/implementation/src/dependency/softbus/softbus_connector.cpp ++++ b/services/implementation/src/dependency/softbus/softbus_connector.cpp +@@ -135,7 +135,7 @@ int32_t SoftbusConnector::PublishDiscovery(const DmPublishInfo &dmPublishInfo) + (void)memset_s(&publishInfo, sizeof(PublishInfo), 0, sizeof(PublishInfo)); + publishInfo.publishId = dmPublishInfo.publishId; + publishInfo.mode = (DiscoverMode)dmPublishInfo.mode; +- publishInfo.medium = ExchangeMedium::AUTO; ++ publishInfo.medium = ExchangeMedium::COAP; + publishInfo.freq = (ExchangeFreq)dmPublishInfo.freq; + publishInfo.capability = DM_CAPABILITY_OSD; + publishInfo.ranging = dmPublishInfo.ranging; +diff --git a/services/service/src/softbus/softbus_listener.cpp b/services/service/src/softbus/softbus_listener.cpp +index b882271..b4d36b5 100644 +--- a/services/service/src/softbus/softbus_listener.cpp ++++ b/services/service/src/softbus/softbus_listener.cpp +@@ -100,7 +100,7 @@ void SoftbusListener::SetPublishInfo(PublishInfo &dmPublishInfo) + { + dmPublishInfo.publishId = DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID; + dmPublishInfo.mode = DiscoverMode::DISCOVER_MODE_ACTIVE; +- dmPublishInfo.medium = ExchangeMedium::AUTO; ++ dmPublishInfo.medium = ExchangeMedium::COAP; + dmPublishInfo.freq = ExchangeFreq::HIGH; + dmPublishInfo.capability = DM_CAPABILITY_OSD; + dmPublishInfo.ranging = false; +@@ -288,7 +288,7 @@ void SoftbusListener::OnParameterChgCallback(const char *key, const char *value, + (void)memset_s(&dmPublishInfo, sizeof(PublishInfo), 0, sizeof(PublishInfo)); + dmPublishInfo.publishId = DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID; + dmPublishInfo.mode = DiscoverMode::DISCOVER_MODE_ACTIVE; +- dmPublishInfo.medium = ExchangeMedium::AUTO; ++ dmPublishInfo.medium = ExchangeMedium::COAP; + dmPublishInfo.freq = ExchangeFreq::HIGH; + dmPublishInfo.capability = DM_CAPABILITY_OSD; + dmPublishInfo.ranging = false; +@@ -331,4 +331,4 @@ void SoftbusListener::OnSoftbusDeviceInfoChanged(NodeBasicInfoType type, NodeBas + LOGD("SoftbusListener::OnSoftbusDeviceInfoChanged."); + } + } // namespace DistributedHardware +-} // namespace OHOS +\ No newline at end of file ++} // namespace OHOS +-- +2.33.0 + diff --git a/0003-Fix-crash-for-nullptr-in-EstablishAuthChannel.patch b/0003-Fix-crash-for-nullptr-in-EstablishAuthChannel.patch new file mode 100644 index 0000000000000000000000000000000000000000..2dd9a954f7f3beafd2d775276acc2742dcf85147 --- /dev/null +++ b/0003-Fix-crash-for-nullptr-in-EstablishAuthChannel.patch @@ -0,0 +1,35 @@ +From 0ed00210a137abe34c706bdb1058a7fe0bcb3dfe Mon Sep 17 00:00:00 2001 +From: Wei Jiangang +Date: Thu, 28 Mar 2024 12:13:57 +0800 +Subject: [PATCH] Fix crash for nullptr in EstablishAuthChannel + +Signed-off-by: Wei Jiangang +--- + .../implementation/src/authentication/dm_auth_manager.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp +index 4b0fbd91..2874bec6 100644 +--- a/services/implementation/src/authentication/dm_auth_manager.cpp ++++ b/services/implementation/src/authentication/dm_auth_manager.cpp +@@ -426,7 +426,9 @@ int32_t DmAuthManager::EstablishAuthChannel(const std::string &deviceId) + LOGE("OpenAuthSession failed, stop the authentication"); + authResponseContext_ = std::make_shared(); + authResponseContext_->state = AuthState::AUTH_REQUEST_NEGOTIATE; +- authRequestContext_->reason = ERR_DM_AUTH_OPEN_SESSION_FAILED; ++ if (authRequestContext_ != nullptr) { ++ authRequestContext_->reason = ERR_DM_AUTH_OPEN_SESSION_FAILED; ++ } + if (authRequestState_ != nullptr) { + authRequestState_->TransitionTo(std::make_shared()); + } +@@ -940,4 +942,4 @@ bool DmAuthManager::IsIdenticalAccount() + return true; + } + } // namespace DistributedHardware +-} // namespace OHOS +\ No newline at end of file ++} // namespace OHOS +-- +2.33.0 + diff --git a/device_manager.BUILD.gn b/device_manager.BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..6640ff2808b5cb4d9c46f1cc8ca63035703de7cb --- /dev/null +++ b/device_manager.BUILD.gn @@ -0,0 +1,25 @@ +# 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. + +import("//build/ohos.gni") + +config("devicemanagersdk_config") { + include_dirs = [ + "include" + ] + libs = ["devicemanagersdk.z"] +} + +group("devicemanagersdk") { + public_configs = [":devicemanagersdk_config"] +} \ No newline at end of file diff --git a/device_manager.bundle.json b/device_manager.bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..a2d62751d2824a6e86024df9c1f4b01488159bbb --- /dev/null +++ b/device_manager.bundle.json @@ -0,0 +1,72 @@ +{ + "name": "@ohos/device_manager", + "description": "device manager service", + "version": "3.1", + "license": "Apache License 2.0", + "repository": "https://gitee.com/openharmony/device_manager", + "publishAs": "code-segment", + "segment": { + "destPath": "foundation/distributedhardware/device_manager" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "device_manager", + "subsystem": "distributedhardware", + "syscap":[ "SystemCapability.DistributedHardware.DeviceManager" ], + "features":["device_manager_no_interaction_auth"], + "adapted_system_type": [ "standard", "small" ], + "rom": "2M", + "ram": "16M", + "deps": { + "components": [ + "ability_base", + "ability_runtime", + "access_token", + "appexecfwk_standard", + "bundle_framework", + "c_utils", + "common_event_service", + "device_auth", + "dsoftbus", + "hisysevent_native", + "hitrace_native", + "hiviewdfx_hilog_native", + "init", + "ipc", + "napi", + "os_account", + "safwk", + "samgr", + "startup_l2" + ], + "third_party": [ + "json", + "node", + "googletest", + "mbedtls" + ] + }, + "build": { + "group_type": { + }, + "inner_kits": [ + { + "type": "so", + "name": "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp:devicemanagersdk", + "header": { + "header_files": [ + "device_manager.h", + "device_manager_callback.h", + "dm_device_info.h", + "dm_publish_info.h", + "dm_subscribe_info.h" + ], + "header_base": "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include" + } + } + ], + "test": [] + } + } +} diff --git a/device_manager.spec b/device_manager.spec new file mode 100644 index 0000000000000000000000000000000000000000..42d7fa8705298210d259edc3dc33e221acf01c48 --- /dev/null +++ b/device_manager.spec @@ -0,0 +1,130 @@ +%define debug_package %{nil} +%global oh_version OpenHarmony-v3.2-Release + +%global distributedhardware_dir %{_builddir}/foundation/distributedhardware +%global build_opt /opt/distributed-middleware-build +%global systemabilitymgr_dir %{_builddir}/foundation/systemabilitymgr +%global third_party_dir %{_builddir}/third_party + +Name: distributedhardware_device_manager +Version: 1.0.0 +Release: 4 +Summary: Distributed middleware used components. +License: Apache-2.0 +Url: https://gitee.com/openharmony/ +Source1: https://gitee.com/openharmony/distributedhardware_device_manager/repository/archive/openHarmony-v3.2-Release.tar.gz #/distributedhardware_device_manager-OpenHarmony-v3.2-Release.tar.gz +Source2: https://gitee.com/openharmony/third_party_json/repository/archive/openHarmony-v3.2-Release.tar.gz #/third_party_json-OpenHarmony-v3.2-Release.tar.gz +Source3: device_manager.bundle.json +Source4: device_manager.BUILD.gn +Source5: device_manager.xml + +Patch1: 0001-remove-dependency-and-adapt-for-build-device_manager.patch +Patch2: 0002-device-manager-only-support-for-network.patch +Patch3: 0003-Fix-crash-for-nullptr-in-EstablishAuthChannel.patch + +BuildRequires: gcc, make, hilog, kernel-devel, uname-build-checks +BuildRequires: distributed-build, distributed-beget +BuildRequires: commonlibrary_c_utils +BuildRequires: notification_eventhandler +BuildRequires: communication_ipc, communication_dsoftbus +BuildRequires: security_device_auth, security_huks +BuildRequires: systemabilitymgr_safwk, systemabilitymgr_samgr + +Requires: distributed-beget +Requires: commonlibrary_c_utils +Requires: notification_eventhandler +Requires: communication_ipc, communication_dsoftbus +Requires: security_device_auth, security_huks +Requires: systemabilitymgr_safwk, systemabilitymgr_samgr +Requires: libboundscheck + +%description +The DeviceManager component provides authentication networking capabilities for account independent distributed devices on OpenHarmony, and provides developers with a set of interfaces for monitoring, discovering, and authenticating between distributed devices. + +# Decompress source code package, make patches to the source code. +%prep +rm -rf %{_builddir}/* + +cp -rf %{build_opt} %{_builddir}/build +[ ! -L "%{_builddir}/build.sh" ] && ln -s %{_builddir}/build/build_scripts/build.sh %{_builddir}/build.sh +[ ! -L "%{_builddir}/.gn" ] && ln -s %{_builddir}/build/core/gn/dotfile.gn %{_builddir}/.gn +[ ! -L "%{_builddir}/build.py" ] && ln -s %{_builddir}/build/lite/build.py %{_builddir}/build.py +cp -rf %{_builddir}/build/openeuler/vendor %{_builddir}/ +cp -rf %{_builddir}/build/openeuler/compiler_gn/* %{_builddir} + +%setup -q -D -T -a 1 -c -n %{distributedhardware_dir}/ +%patch -P1 -p1 -d %{distributedhardware_dir}/device_manager +%patch -P2 -p1 -d %{distributedhardware_dir}/device_manager +%patch -P3 -p1 -d %{distributedhardware_dir}/device_manager + +%setup -q -D -T -a 2 -c -n %{third_party_dir}/ + +%build + +%ifarch x86_64 +%{_builddir}/build.sh --product-name openeuler --target-cpu x86_64 +%endif + +%ifarch aarch64 +%{_builddir}/build.sh --product-name openeuler --target-cpu arm64 +%endif + +%install +install -d -m 0755 %{buildroot}/%{_includedir}/device_manager +install -d -m 0755 %{buildroot}/%{_libdir} +install -d -m 0755 %{buildroot}%{_includedir}/nlohmann_json +install -d -m 0755 %{buildroot}%{_includedir}/nlohmann_json/single_include +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp +install -d -m 0755 %{buildroot}/system/lib64 +install -d -m 0755 %{buildroot}/system/profile + +%ifarch aarch64 +%define header_out_path out/openeuler/innerkits/linux-arm64/ +%define module_out_path out/openeuler/linux_clang_arm64 +%endif +%ifarch x86_64 +%define header_out_path out/openeuler/innerkits/linux-x86_64/ +%define module_out_path out/openeuler/linux_clang_x86_64 +%endif + +# prepare so +install -m 0755 %{_builddir}/%{module_out_path}/distributedhardware/device_manager/*.so %{buildroot}/%{_libdir} +install -m 0755 %{_builddir}/%{module_out_path}/distributedhardware/device_manager/*.so %{buildroot}/system/lib64 + +# prepare head files +find %{_builddir}/%{header_out_path} -name *.h -print0 | xargs -0 -i cp -rf {} %{buildroot}/%{_includedir}/device_manager/ + +# copy nlohmann_json header file to includedir. +cp -rf %{third_party_dir}/json/include/nlohmann %{buildroot}/%{_includedir}/nlohmann_json +cp -rf %{third_party_dir}/json/single_include/nlohmann %{buildroot}/%{_includedir}/nlohmann_json/single_include + +#cp json file +install -m 0755 %{SOURCE3} %{buildroot}/%{build_opt}/openeuler/compiler_gn/foundation/distributedhardware/device_manager/bundle.json + +#cp gn file +install -m 0755 %{SOURCE4} %{buildroot}/%{build_opt}/openeuler/compiler_gn/foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/BUILD.gn + +#cp sa profile +install -m 0755 %{SOURCE5} %{buildroot}/system/profile + +#create soft link +ln -s /usr/include/device_manager %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include + +%files +%{_includedir}/device_manager/* +%{_includedir}/nlohmann_json/* +%{_libdir}/*.so +%{build_opt}/* +/system/* + +%changelog +* Wed Mar 27 2024 wei_jiangang - 1.0.0-4 +- Fix crash while authenticating +* Tue Mar 26 2024 tianhang - 1.0.0-3 +- the auto parameter in device manager may cause the softbus to be abnormal +* Fri Dec 15 2023 heppen - 1.0.0-2 +- Add SA profile +* Tue Oct 31 2023 Yuying Mu - 1.0.0-1 +* Tue Nov 21 2023 Jiaqi Zhao - 1.0.0-1 +- Init and adapt device manager to openEuler + diff --git a/device_manager.xml b/device_manager.xml new file mode 100755 index 0000000000000000000000000000000000000000..e6506fcbd9b73db4fdffec739807466352f20d03 --- /dev/null +++ b/device_manager.xml @@ -0,0 +1,14 @@ + + + device_manager + + libdevicemanagerservice.z.so + + + 4802 + libdevicemanagerservice.z.so + true + false + 1 + + diff --git a/distributedhardware_device_manager-OpenHarmony-v3.2-Release.tar.gz b/distributedhardware_device_manager-OpenHarmony-v3.2-Release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..0fead35ada9e512336b93b464b06a991b90975f1 Binary files /dev/null and b/distributedhardware_device_manager-OpenHarmony-v3.2-Release.tar.gz differ diff --git a/third_party_json-OpenHarmony-v3.2-Release.tar.gz b/third_party_json-OpenHarmony-v3.2-Release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..842a58bb2eb0d3d567d286f5312d95a8f8faee1a Binary files /dev/null and b/third_party_json-OpenHarmony-v3.2-Release.tar.gz differ