diff --git a/0001-init-and-adapt-to-openeuler.patch b/0001-init-and-adapt-to-openeuler.patch new file mode 100644 index 0000000000000000000000000000000000000000..25abdccdb0b692e712a47ed424c3227b51bb6d2a --- /dev/null +++ b/0001-init-and-adapt-to-openeuler.patch @@ -0,0 +1,798 @@ +From 95ae06ef9f9554fc557fe3479b570c1c8ab491d2 Mon Sep 17 00:00:00 2001 +From: tian2020 +Date: Thu, 15 Jun 2023 18:15:29 +0800 +Subject: [PATCH] init and adapt to openeuler + +--- + common/include/dm_constants.h | 6 ++-- + common/src/dfx/standard/dm_hisysevent.cpp | 4 ++- + common/src/dfx/standard/dm_hitrace.cpp | 6 ++-- + ext/BUILD.gn | 4 +-- + ext/no_interaction_auth/BUILD.gn | 10 +++---- + ext/pin_auth/BUILD.gn | 8 ++--- + .../include/ability/dm_ability_manager.h | 4 +-- + ext/pin_auth/include/standard/pin_auth_ui.h | 4 +-- + ext/pin_auth/src/standard/pin_auth_ui.cpp | 15 ++++++++-- + interfaces/inner_kits/native_cpp/BUILD.gn | 4 +-- + .../native_cpp/include/dm_subscribe_info.h | 2 ++ + services/implementation/BUILD.gn | 22 +++++++------- + .../include/config/json_config.h | 12 ++++---- + .../include/device_manager_service_impl.h | 4 +-- + .../src/authentication/dm_auth_manager.cpp | 3 +- + .../showconfirm/standard/show_confirm.cpp | 7 +++-- + .../src/device_manager_service_impl.cpp | 30 +++++++++++++++---- + .../devicestate/dm_device_state_manager.cpp | 8 ++--- + services/service/BUILD.gn | 16 +++++----- + .../ipc/standard/ipc_server_listener.h | 4 ++- + .../src/device_manager_service_listener.cpp | 2 +- + .../src/ipc/standard/ipc_server_listener.cpp | 2 +- + utils/BUILD.gn | 6 ++-- + 23 files changed, 110 insertions(+), 73 deletions(-) + +diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h +index 263d6aa4..8104c657 100755 +--- a/common/include/dm_constants.h ++++ b/common/include/dm_constants.h +@@ -19,9 +19,9 @@ + #include + + #ifdef __LP64__ +-constexpr const char* LIB_LOAD_PATH = "/system/lib64/"; ++constexpr const char* LIB_LOAD_PATH = "/usr/lib64/"; + #else +-constexpr const char* LIB_LOAD_PATH = "/system/lib/"; ++constexpr const char* LIB_LOAD_PATH = "/usr/lib/"; + #endif + + namespace OHOS { +@@ -120,4 +120,4 @@ constexpr const char* EVENT_INIT_CODE = "2"; + constexpr uint32_t MAX_MESSAGE_LEN = 40 * 1024 * 1024; + } // namespace DistributedHardware + } // namespace OHOS +-#endif // OHOS_DM_CONSTANTS_H +\ No newline at end of file ++#endif // OHOS_DM_CONSTANTS_H +diff --git a/common/src/dfx/standard/dm_hisysevent.cpp b/common/src/dfx/standard/dm_hisysevent.cpp +index 4e9b2970..9aba6603 100644 +--- a/common/src/dfx/standard/dm_hisysevent.cpp ++++ b/common/src/dfx/standard/dm_hisysevent.cpp +@@ -17,13 +17,14 @@ + + #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(), +@@ -34,6 +35,7 @@ void SysEventWrite(const std::string &status, int32_t eventType, const std::stri + 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..50fa4c5e 100644 +--- a/common/src/dfx/standard/dm_hitrace.cpp ++++ b/common/src/dfx/standard/dm_hitrace.cpp +@@ -13,18 +13,18 @@ + * 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); ++ //StartTrace(HITRACE_TAG_DEVICE_MANAGER, msg); + } + + void DmTraceEnd() + { +- FinishTrace(HITRACE_TAG_DEVICE_MANAGER); ++ //FinishTrace(HITRACE_TAG_DEVICE_MANAGER); + } + } // namespace DistributedHardware + } // namespace OHOS +diff --git a/ext/BUILD.gn b/ext/BUILD.gn +index 03033ecc..23b3c97c 100644 +--- a/ext/BUILD.gn ++++ b/ext/BUILD.gn +@@ -16,11 +16,11 @@ import("//foundation/distributedhardware/device_manager/device_manager.gni") + + group("ext_modules") { + deps = [] +- if (support_jsapi) { ++ #if (support_jsapi) { + if (device_manager_no_interaction_auth) { + deps += [ "./no_interaction_auth:devicemanagerext_no_interaction_auth" ] + } else { + deps += [ "./pin_auth:devicemanagerext_pin_auth" ] + } +- } ++ #} + } +diff --git a/ext/no_interaction_auth/BUILD.gn b/ext/no_interaction_auth/BUILD.gn +index 231e60e4..5d75aa4f 100644 +--- a/ext/no_interaction_auth/BUILD.gn ++++ b/ext/no_interaction_auth/BUILD.gn +@@ -57,12 +57,12 @@ if (defined(ohos_lite)) { + ] + + sources = [ +- "src/ability/standard/dm_ability_manager.cpp", ++ #"src/ability/standard/dm_ability_manager.cpp", + "src/no_interaction_auth.cpp", + ] + + deps = [ +- "${ability_runtime_innerkits_path}/ability_manager:ability_manager", ++ #"${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_services_path}/abilitymgr:abilityms", + "${innerkits_path}/native_cpp:devicemanagersdk", + "${utils_path}:devicemanagerutils", +@@ -72,12 +72,12 @@ if (defined(ohos_lite)) { + ] + + external_deps = [ +- "ability_base:want", ++ #"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..a5ab558a 100644 +--- a/ext/pin_auth/BUILD.gn ++++ b/ext/pin_auth/BUILD.gn +@@ -57,7 +57,7 @@ if (defined(ohos_lite)) { + ] + + sources = [ +- "src/ability/lite/dm_ability_manager.cpp", ++ #"src/ability/lite/dm_ability_manager.cpp", + "src/lite/pin_auth_ui.cpp", + "src/pin_auth.cpp", + ] +@@ -128,19 +128,19 @@ if (defined(ohos_lite)) { + ] + + sources = [ +- "src/ability/standard/dm_ability_manager.cpp", ++ #"src/ability/standard/dm_ability_manager.cpp", + "src/pin_auth.cpp", + "src/standard/pin_auth_ui.cpp", + ] + + deps = [ +- "${ability_runtime_innerkits_path}/ability_manager:ability_manager", ++ #"${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${innerkits_path}/native_cpp:devicemanagersdk", + "//foundation/distributedhardware/device_manager/services/implementation:devicemanagerserviceimpl", + ] + + external_deps = [ +- "ability_base:want", ++ #"ability_base:want", + "init:libbegetutil", + ] + +diff --git a/ext/pin_auth/include/ability/dm_ability_manager.h b/ext/pin_auth/include/ability/dm_ability_manager.h +index 83a62f2c..34c8382a 100644 +--- a/ext/pin_auth/include/ability/dm_ability_manager.h ++++ b/ext/pin_auth/include/ability/dm_ability_manager.h +@@ -18,7 +18,7 @@ + + #include + #include +-#include "want.h" ++//#include "want.h" + + namespace OHOS { + namespace DistributedHardware { +@@ -37,7 +37,7 @@ enum UiAction { + + class DmAbilityManager { + public: +- AbilityStatus StartAbility(AAFwk::Want &want); ++ //AbilityStatus StartAbility(AAFwk::Want &want); + }; + } // namespace DistributedHardware + } // namespace OHOS +diff --git a/ext/pin_auth/include/standard/pin_auth_ui.h b/ext/pin_auth/include/standard/pin_auth_ui.h +index aa33b20f..c8e219f9 100644 +--- a/ext/pin_auth/include/standard/pin_auth_ui.h ++++ b/ext/pin_auth/include/standard/pin_auth_ui.h +@@ -20,7 +20,7 @@ + + #include "dm_auth_manager.h" + #include "dm_ability_manager.h" +-#include "want.h" ++//#include "want.h" + + namespace OHOS { + namespace DistributedHardware { +@@ -32,4 +32,4 @@ public: + }; + } // namespace DistributedHardware + } // namespace OHOS +-#endif // OHOS_DM_PIN_AUTH_UI_H +\ No newline at end of file ++#endif // OHOS_DM_PIN_AUTH_UI_H +diff --git a/ext/pin_auth/src/standard/pin_auth_ui.cpp b/ext/pin_auth/src/standard/pin_auth_ui.cpp +index 65af67a6..365ae7e4 100644 +--- a/ext/pin_auth/src/standard/pin_auth_ui.cpp ++++ b/ext/pin_auth/src/standard/pin_auth_ui.cpp +@@ -12,7 +12,7 @@ + * See the License for the specific language governing permissions and + * limitations under the License. + */ +- ++#include + #include "pin_auth_ui.h" + + #include "dm_ability_manager.h" +@@ -36,6 +36,8 @@ int32_t PinAuthUi::ShowPinDialog(int32_t code, std::shared_ptr au + LOGE("authManager is null"); + return ERR_DM_FAILED; + } ++ std::cout << "PinCode:%d" << std::to_string(code) << std::endl; ++ /* + std::shared_ptr dmAbilityMgr = std::make_shared(); + AAFwk::Want want; + want.SetParam("PinCode", std::to_string(code)); +@@ -50,7 +52,7 @@ int32_t PinAuthUi::ShowPinDialog(int32_t code, std::shared_ptr au + if (status != AbilityStatus::ABILITY_STATUS_SUCCESS) { + LOGE("ShowConfirm::start ui service fail"); + return ERR_DM_FAILED; +- } ++ }*/ + LOGI("ShowPinDialog end"); + return DM_OK; + } +@@ -62,6 +64,13 @@ int32_t PinAuthUi::InputPinDialog(std::shared_ptr authManager) + LOGE("authManager is null"); + return ERR_DM_FAILED; + } ++ ++ int code; ++ std::cout << "Input PinCode:" << std::endl; ++ std::cin >> code ; ++ authManager->OnUserOperation(5,std::to_string(code)); ++ ++ /* + std::shared_ptr dmAbilityMgr = std::make_shared(); + + AAFwk::Want want; +@@ -77,7 +86,7 @@ int32_t PinAuthUi::InputPinDialog(std::shared_ptr authManager) + if (status != AbilityStatus::ABILITY_STATUS_SUCCESS) { + LOGE("ShowConfirm::start ui service success"); + return ERR_DM_FAILED; +- } ++ }*/ + LOGI("InputPinDialog end"); + return DM_OK; + } +diff --git a/interfaces/inner_kits/native_cpp/BUILD.gn b/interfaces/inner_kits/native_cpp/BUILD.gn +index d5726567..a8788e96 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/inner_kits/native_cpp/include/dm_subscribe_info.h b/interfaces/inner_kits/native_cpp/include/dm_subscribe_info.h +index 603e2421..054bfd3b 100644 +--- a/interfaces/inner_kits/native_cpp/include/dm_subscribe_info.h ++++ b/interfaces/inner_kits/native_cpp/include/dm_subscribe_info.h +@@ -17,6 +17,8 @@ + #define OHOS_DM_SUBSCRIBE_INFO_H + + #include ++#include ++#include + + #define DM_MAX_DEVICE_CAPABILITY_LEN 65 + +diff --git a/services/implementation/BUILD.gn b/services/implementation/BUILD.gn +index 126232e2..faf09518 100644 +--- a/services/implementation/BUILD.gn ++++ b/services/implementation/BUILD.gn +@@ -76,7 +76,7 @@ if (defined(ohos_lite)) { + ] + + sources = [ +- "${servicesimpl_path}/src/ability/lite/dm_ability_manager.cpp", ++ #"${servicesimpl_path}/src/ability/lite/dm_ability_manager.cpp", + "${servicesimpl_path}/src/adapter/standard/dm_adapter_manager.cpp", + "${servicesimpl_path}/src/authentication/auth_message_processor.cpp", + "${servicesimpl_path}/src/authentication/auth_request_state.cpp", +@@ -127,10 +127,10 @@ if (defined(ohos_lite)) { + ] + } + } +-} else if (!support_jsapi) { +- group("devicemanagerserviceimpl") { +- deps = [] +- } ++#} else if (!support_jsapi) { ++# group("devicemanagerserviceimpl") { ++# deps = [] ++# } + } else { + config("devicemanagerserviceimpl_config") { + include_dirs = [ +@@ -174,7 +174,7 @@ if (defined(ohos_lite)) { + + ohos_shared_library("devicemanagerserviceimpl") { + sources = [ +- "src/ability/standard/dm_ability_manager.cpp", ++ #"src/ability/standard/dm_ability_manager.cpp", + "src/adapter/standard/dm_adapter_manager.cpp", + "src/authentication/auth_message_processor.cpp", + "src/authentication/auth_request_state.cpp", +@@ -183,7 +183,7 @@ if (defined(ohos_lite)) { + "src/authentication/showconfirm/standard/show_confirm.cpp", + "src/config/dm_config_manager.cpp", + "src/credential/dm_credential_manager.cpp", +- "src/dependency/commonevent/dm_common_event_manager.cpp", ++ #"src/dependency/commonevent/dm_common_event_manager.cpp", + "src/dependency/hichain/hichain_connector.cpp", + "src/dependency/multipleuser/multiple_user_connector.cpp", + "src/dependency/softbus/softbus_connector.cpp", +@@ -205,7 +205,7 @@ if (defined(ohos_lite)) { + ] + + deps = [ +- "${ability_runtime_innerkits_path}/ability_manager:ability_manager", ++ #"${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${innerkits_path}/native_cpp:devicemanagersdk", + "${utils_path}:devicemanagerutils", + "//base/security/device_auth/services:deviceauth_sdk", +@@ -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/implementation/include/config/json_config.h b/services/implementation/include/config/json_config.h +index f9598faa..59d061d4 100644 +--- a/services/implementation/include/config/json_config.h ++++ b/services/implementation/include/config/json_config.h +@@ -29,7 +29,7 @@ const std::string adapterJsonConfigString = + "version": "1.0", + "funcName": "CreateCryptoAdapterObject", + "soName": "libdevicemanager_crypto_adapter.z.so", +- "soPath": "/system/lib/" ++ "soPath": "/usr/lib64/" + }, + { + "name": "device_decision", +@@ -37,7 +37,7 @@ const std::string adapterJsonConfigString = + "version": "1.0", + "funcName": "CreateDeviceDecisionObject", + "soName": "libdevicemanagerext_decision.z.so", +- "soPath": "/system/lib/" ++ "soPath": "/usr/lib64/" + } + ] + })"; +@@ -52,7 +52,7 @@ const std::string authJsonConfigString = + "authType": 1, + "funcName": "CreatePinAuthObject", + "soName": "libdevicemanagerext_pin_auth.z.so", +- "soPath": "/system/lib/" ++ "soPath": "/usr/lib64/" + }, + { + "name": "QRcode_auth", +@@ -61,7 +61,7 @@ const std::string authJsonConfigString = + "authType": 2, + "funcName": "CreateQRcodeAuthObject", + "soName": "libdevicemanager_qrcodeauth.z.so", +- "soPath": "/system/lib/" ++ "soPath": "/usr/lib64/" + }, + { + "name": "nfc_auth", +@@ -70,7 +70,7 @@ const std::string authJsonConfigString = + "authType": 3, + "funcName": "CreateNfcAuthObject", + "soName": "libdevicemanager_nfcauth.z.so", +- "soPath": "/system/lib/" ++ "soPath": "/usr/lib64/" + }, + { + "name": "no_interaction_auth", +@@ -79,7 +79,7 @@ const std::string authJsonConfigString = + "authType": 4, + "funcName": "CreatePinAuthObject", + "soName": "libdevicemanagerext_no_interaction_auth.z.so", +- "soPath": "/system/lib/" ++ "soPath": "/usr/lib64/" + } + ] + })"; +diff --git a/services/implementation/include/device_manager_service_impl.h b/services/implementation/include/device_manager_service_impl.h +index 0eec8291..b1064f7f 100644 +--- a/services/implementation/include/device_manager_service_impl.h ++++ b/services/implementation/include/device_manager_service_impl.h +@@ -21,7 +21,7 @@ + + #include "dm_ability_manager.h" + #include "dm_auth_manager.h" +-#include "dm_common_event_manager.h" ++//#include "dm_common_event_manager.h" + #include "dm_credential_manager.h" + #include "dm_device_info.h" + #include "dm_device_state_manager.h" +@@ -100,7 +100,7 @@ private: + std::shared_ptr abilityMgr_; + std::shared_ptr hiChainConnector_; + std::shared_ptr credentialMgr_; +- std::shared_ptr commonEventManager_; ++ //std::shared_ptr commonEventManager_; + }; + + using CreateDMServiceFuncPtr = IDeviceManagerServiceImpl *(*)(void); +diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp +index 4b0fbd91..5a23b4e7 100644 +--- a/services/implementation/src/authentication/dm_auth_manager.cpp ++++ b/services/implementation/src/authentication/dm_auth_manager.cpp +@@ -443,6 +443,7 @@ void DmAuthManager::StartNegotiate(const int32_t &sessionId) + LOGI("DmAuthManager::StartNegotiate session id is %d", sessionId); + char localDeviceId[DEVICE_UUID_LENGTH] = {0}; + GetDevUdid(localDeviceId, DEVICE_UUID_LENGTH); ++ + authRequestContext_->localDeviceId = localDeviceId; + authResponseContext_->localDeviceId = localDeviceId; + authResponseContext_->reply = ERR_DM_AUTH_REJECT; +@@ -940,4 +941,4 @@ bool DmAuthManager::IsIdenticalAccount() + return true; + } + } // namespace DistributedHardware +-} // namespace OHOS +\ No newline at end of file ++} // namespace OHOS +diff --git a/services/implementation/src/authentication/showconfirm/standard/show_confirm.cpp b/services/implementation/src/authentication/showconfirm/standard/show_confirm.cpp +index 37ec3b5c..68d6e77f 100644 +--- a/services/implementation/src/authentication/showconfirm/standard/show_confirm.cpp ++++ b/services/implementation/src/authentication/showconfirm/standard/show_confirm.cpp +@@ -34,6 +34,9 @@ void ShowConfirm::ShowConfirmDialog(const std::string ¶ms, std::shared_ptr dmAbilityMgr) + { + LOGI("ShowConfirm hap start"); ++ LOGI("TEST CONFIRM OK.."); ++ authManager->OnUserOperation(0,params); ++ /* + if (dmAbilityMgr == nullptr) { + LOGE("ShowConfirm::dmAbilityManager is null"); + return; +@@ -42,8 +45,8 @@ void ShowConfirm::ShowConfirmDialog(const std::string ¶ms, std::shared_ptr(); +@@ -84,6 +85,7 @@ int32_t DeviceManagerServiceImpl::Initialize(const std::shared_ptrGetSoftbusSession()->UnRegisterSessionCallback(); + hiChainConnector_->UnRegisterHiChainCallback(); + authMgr_ = nullptr; +@@ -108,10 +112,12 @@ void DeviceManagerServiceImpl::Release() + int32_t DeviceManagerServiceImpl::StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo, + const std::string &extra) + { ++/* + if (!PermissionManager::GetInstance().CheckPermission()) { + LOGI("The caller does not have permission to call"); + return ERR_DM_NO_PERMISSION; + } ++*/ + if (pkgName.empty()) { + LOGE("StartDeviceDiscovery failed, pkgName is empty"); + return ERR_DM_INPUT_PARA_INVALID; +@@ -121,10 +127,12 @@ int32_t DeviceManagerServiceImpl::StartDeviceDiscovery(const std::string &pkgNam + + int32_t DeviceManagerServiceImpl::StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId) + { ++/* + if (!PermissionManager::GetInstance().CheckPermission()) { + LOGI("The caller does not have permission to call"); + return ERR_DM_NO_PERMISSION; + } ++*/ + if (pkgName.empty()) { + LOGE("StopDeviceDiscovery failed, pkgName is empty"); + return ERR_DM_INPUT_PARA_INVALID; +@@ -134,10 +142,12 @@ int32_t DeviceManagerServiceImpl::StopDeviceDiscovery(const std::string &pkgName + + int32_t DeviceManagerServiceImpl::PublishDeviceDiscovery(const std::string &pkgName, const DmPublishInfo &publishInfo) + { ++/* + if (!PermissionManager::GetInstance().CheckPermission()) { + LOGI("The caller does not have permission to call"); + return ERR_DM_NO_PERMISSION; + } ++*/ + if (pkgName.empty()) { + LOGE("PublishDeviceDiscovery failed, pkgName is empty"); + return ERR_DM_INPUT_PARA_INVALID; +@@ -147,10 +157,12 @@ int32_t DeviceManagerServiceImpl::PublishDeviceDiscovery(const std::string &pkgN + + int32_t DeviceManagerServiceImpl::UnPublishDeviceDiscovery(const std::string &pkgName, int32_t publishId) + { ++/* + if (!PermissionManager::GetInstance().CheckPermission()) { + LOGI("The caller does not have permission to call"); + return ERR_DM_NO_PERMISSION; + } ++*/ + if (pkgName.empty()) { + LOGE("UnPublishDeviceDiscovery failed, pkgName is empty"); + return ERR_DM_INPUT_PARA_INVALID; +@@ -161,10 +173,12 @@ int32_t DeviceManagerServiceImpl::UnPublishDeviceDiscovery(const std::string &pk + int32_t DeviceManagerServiceImpl::AuthenticateDevice(const std::string &pkgName, int32_t authType, + const std::string &deviceId, const std::string &extra) + { ++/* + if (!PermissionManager::GetInstance().CheckPermission()) { + LOGI("The caller does not have permission to call"); + return ERR_DM_NO_PERMISSION; + } ++*/ + if (pkgName.empty() || deviceId.empty()) { + LOGE("DeviceManagerServiceImpl::AuthenticateDevice failed, pkgName is %s, deviceId is %s, extra is %s", + pkgName.c_str(), GetAnonyString(deviceId).c_str(), extra.c_str()); +@@ -175,10 +189,12 @@ int32_t DeviceManagerServiceImpl::AuthenticateDevice(const std::string &pkgName, + + int32_t DeviceManagerServiceImpl::UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId) + { ++/* + if (!PermissionManager::GetInstance().CheckPermission()) { + LOGI("The caller does not have permission to call"); + return ERR_DM_NO_PERMISSION; + } ++*/ + if (pkgName.empty() || deviceId.empty()) { + LOGE("DeviceManagerServiceImpl::AuthenticateDevice failed, pkgName is %s, deviceId is %s", + pkgName.c_str(), GetAnonyString(deviceId).c_str()); +@@ -189,10 +205,12 @@ int32_t DeviceManagerServiceImpl::UnAuthenticateDevice(const std::string &pkgNam + + int32_t DeviceManagerServiceImpl::VerifyAuthentication(const std::string &authParam) + { ++/* + if (!PermissionManager::GetInstance().CheckPermission()) { + LOGI("The caller does not have permission to call"); + return ERR_DM_NO_PERMISSION; + } ++*/ + return authMgr_->VerifyAuthentication(authParam); + } + +@@ -391,7 +409,7 @@ int32_t DeviceManagerServiceImpl::NotifyEvent(const std::string &pkgName, const + + void DeviceManagerServiceImpl::LoadHardwareFwkService() + { +- DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk(); ++ //DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk(); + } + + extern "C" IDeviceManagerServiceImpl *CreateDMServiceObject(void) +diff --git a/services/implementation/src/devicestate/dm_device_state_manager.cpp b/services/implementation/src/devicestate/dm_device_state_manager.cpp +index 26f72dbb..b9571e10 100644 +--- a/services/implementation/src/devicestate/dm_device_state_manager.cpp ++++ b/services/implementation/src/devicestate/dm_device_state_manager.cpp +@@ -18,7 +18,7 @@ + #include "dm_adapter_manager.h" + #include "dm_anonymous.h" + #include "dm_constants.h" +-#include "dm_distributed_hardware_load.h" ++//#include "dm_distributed_hardware_load.h" + #include "dm_log.h" + + namespace OHOS { +@@ -29,7 +29,7 @@ DmDeviceStateManager::DmDeviceStateManager(std::shared_ptr sof + std::shared_ptr listener, std::shared_ptr hiChainConnector) + : softbusConnector_(softbusConnector), listener_(listener), hiChainConnector_(hiChainConnector) + { +- decisionSoName_ = "libdevicemanagerext_decision.z.so"; ++ decisionSoName_ = "libdevicemanagerext_decision.so"; + StartEventThread(); + LOGI("DmDeviceStateManager constructor"); + } +@@ -192,7 +192,7 @@ void DmDeviceStateManager::OnDbReady(const std::string &pkgName, const std::stri + } + saveInfo = iter->second; + } +- DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk(); ++ //DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk(); + if (listener_ != nullptr) { + DmDeviceState state = DEVICE_INFO_READY; + listener_->OnDeviceStateChange(pkgName, state, saveInfo); +@@ -380,4 +380,4 @@ int32_t DmDeviceStateManager::ProcNotifyEvent(const std::string &pkgName, const + return AddTask(std::make_shared(eventId, deviceId)); + } + } // namespace DistributedHardware +-} // namespace OHOS +\ No newline at end of file ++} // namespace OHOS +diff --git a/services/service/BUILD.gn b/services/service/BUILD.gn +index bb353c12..3714eab1 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,10 @@ if (defined(ohos_lite)) { + ] + } + } +-} else if (!support_jsapi) { +- group("devicemanagerservice") { +- deps = [] +- } ++#} 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..abfa0fc7 100644 +--- a/services/service/include/ipc/standard/ipc_server_listener.h ++++ b/services/service/include/ipc/standard/ipc_server_listener.h +@@ -17,7 +17,9 @@ + #define OHOS_DM_IPC_SERVER_LISTENER_H + + #include +- ++#include ++#include ++#include + #include "ipc_req.h" + #include "ipc_rsp.h" + +diff --git a/services/service/src/device_manager_service_listener.cpp b/services/service/src/device_manager_service_listener.cpp +index 567b427c..993b8202 100644 +--- a/services/service/src/device_manager_service_listener.cpp ++++ b/services/service/src/device_manager_service_listener.cpp +@@ -12,7 +12,7 @@ + * See the License for the specific language governing permissions and + * limitations under the License. + */ +- ++#include + #include "device_manager_service_listener.h" + + #include "dm_constants.h" +diff --git a/services/service/src/ipc/standard/ipc_server_listener.cpp b/services/service/src/ipc/standard/ipc_server_listener.cpp +index 513b1fd5..74137d0a 100644 +--- a/services/service/src/ipc/standard/ipc_server_listener.cpp ++++ b/services/service/src/ipc/standard/ipc_server_listener.cpp +@@ -12,7 +12,7 @@ + * See the License for the specific language governing permissions and + * limitations under the License. + */ +- ++#include + #include "ipc_server_listener.h" + + #include "dm_constants.h" +diff --git a/utils/BUILD.gn b/utils/BUILD.gn +index 0d231c71..acd56970 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", +-- +2.33.0 + diff --git a/device_manager.spec b/device_manager.spec new file mode 100644 index 0000000000000000000000000000000000000000..8fdcd7943ba7a518a3c1ee7af0ce6523dd7b507b --- /dev/null +++ b/device_manager.spec @@ -0,0 +1,121 @@ +%define debug_package %{nil} +%global openHarmony_source_release OpenHarmony-v3.2-Release +%global device_manager_dir %{_builddir}/foundation/distributedhardware +%global build_opt /opt/distributed-middleware-build + +Name: device_manager +Version: 1.0.0 +Release: 1 +Summary: OpenEuler supports device manager for distributed softbus capability +License: Apache License 2.0 +Url: https://gitee.com/openharmony/distributedhardware_device_manager +Source0: https://gitee.com/openharmony/distributedhardware_device_manager/repository/archive/%{openHarmony_source_release}.tar.gz #/distributedhardware_device_manager-%{openHarmony_source_release}.tar.gz +Patch0000: 0001-init-and-adapt-to-openeuler.patch + +BuildRequires: distributed-build, libboundscheck +#dsoftbus, c_utils, samgr, huks, device_auth, ipc, hilog +Requires: libboundscheck, dsoftbus + +%description +OpenEuler supports device manager for distributed softbus capability + +%prep +#clean %{_builddir} +rm -rf %{_builddir}/* +%autosetup -p1 -n distributedhardware_device_manager-%{openHarmony_source_release} + +cd %{_builddir} +mkdir -p %{device_manager_dir} +mv distributedhardware_device_manager-%{openHarmony_source_release} %{device_manager_dir}/device_manager + +# build directory +cp -rp %{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 -r %{_builddir}/build/openeuler/vendor %{_builddir}/ +cp -r %{_builddir}/build/openeuler/compiler_gn/third_party %{_builddir}/ + +# copy depends components GN from build/openeuler/compiler_gn +mkdir -p %{_builddir}/base/startup +mkdir -p %{_builddir}/base/hiviewdfx +mkdir -p %{_builddir}/base/security +mkdir -p %{_builddir}/base/notification/ +mkdir -p %{_builddir}/foundation/systemabilitymgr +mkdir -p %{_builddir}/foundation/communication + + +cp -rf %{_builddir}/build/openeuler/compiler_gn/commonlibrary %{_builddir} +cp -rf %{_builddir}/build/openeuler/compiler_gn/base/startup %{_builddir}/base +cp -rf %{_builddir}/build/openeuler/compiler_gn/base/hiviewdfx/hilog %{_builddir}/base/hiviewdfx +cp -rf %{_builddir}/build/openeuler/compiler_gn/base/hiviewdfx/hitrace %{_builddir}/base/hiviewdfx +cp -rf %{_builddir}/build/openeuler/compiler_gn/foundation/systemabilitymgr/samgr %{_builddir}/foundation/systemabilitymgr +cp -rf %{_builddir}/build/openeuler/compiler_gn/foundation/systemabilitymgr/safwk %{_builddir}/foundation/systemabilitymgr +cp -rf %{_builddir}/build/openeuler/compiler_gn/foundation/communication/ipc %{_builddir}/foundation/communication +cp -rf %{_builddir}/build/openeuler/compiler_gn/foundation/communication/dsoftbus %{_builddir}/foundation/communication +cp -rf %{_builddir}/build/openeuler/compiler_gn/base/security/huks %{_builddir}/base/security +cp -rf %{_builddir}/build/openeuler/compiler_gn/base/security/device_auth %{_builddir}/base/security +cp -rf %{_builddir}/build/openeuler/compiler_gn/base/notification/eventhandler %{_builddir}/base/notification/ + +#directory to avoid %build fail +mkdir distributedhardware_device_manager-%{openHarmony_source_release} + +%build +cd %{_builddir} +rm -rf %{_builddir}/out + +%ifarch x86_64 +./build.sh --product-name openeuler --target-cpu x86_64 +%endif + +%ifarch aarch64 +./build.sh --product-name openeuler --target-cpu arm64 +%endif + +%install +#include files +install -d %{buildroot}/%{_includedir}/device_manager +install -d %{buildroot}/%{_includedir}/device_manager/ipc +install -d %{buildroot}/%{_includedir}/device_manager/ipc/lite +install -d %{buildroot}/%{_includedir}/device_manager/ipc/standard +install -d %{buildroot}/%{_includedir}/device_manager/notify +install -d %{buildroot}/%{_includedir}/device_manager/common +install -d %{buildroot}/%{_includedir}/device_manager/common/ipc +install -d %{buildroot}/%{_includedir}/device_manager/common/ipc/model +install -d %{buildroot}/%{_includedir}/device_manager/common/ips/standard +install -d %{buildroot}/%{_includedir}/device_manager/common/dfx +install -d %{buildroot}/%{_includedir}/device_manager/common/dfx/standard +#sa file +install -d %{buildroot}/system/profile +#lib file +install -d %{buildroot}/%{_libdir} + +# prepare so +install -m 0755 %{_builddir}/out/openeuler/packages/phone/system/lib64/libdevicemanager*.so %{buildroot}/%{_libdir} + +# prepare head files according to bundle.json +install -m 554 %{device_manager_dir}/device_manager/interfaces/inner_kits/native_cpp/include/*.h %{buildroot}/%{_includedir}/device_manager +install -m 554 %{device_manager_dir}/device_manager/interfaces/inner_kits/native_cpp/include/ipc/*.h %{buildroot}/%{_includedir}/device_manager/ipc +install -m 554 %{device_manager_dir}/device_manager/interfaces/inner_kits/native_cpp/include/ipc/lite/*.h %{buildroot}/%{_includedir}/device_manager/ipc/lite +install -m 554 %{device_manager_dir}/device_manager/interfaces/inner_kits/native_cpp/include/ipc/standard/*.h %{buildroot}/%{_includedir}/device_manager/ipc/standard +install -m 554 %{device_manager_dir}/device_manager/interfaces/inner_kits/native_cpp/include/notify/*.h %{buildroot}/%{_includedir}/device_manager/notify + +install -m 554 %{device_manager_dir}/device_manager/common/include/*.h %{buildroot}/%{_includedir}/device_manager/common +install -m 554 %{device_manager_dir}/device_manager/common/include/ipc/*.h %{buildroot}/%{_includedir}/device_manager/common/ipc +install -m 554 %{device_manager_dir}/device_manager/common/include/ipc/model/*.h %{buildroot}/%{_includedir}/device_manager/common/ipc/model +install -m 554 %{device_manager_dir}/device_manager/common/include/ipc/standard/*.h %{buildroot}/%{_includedir}/device_manager/common/ips/standard +install -m 554 %{device_manager_dir}/device_manager/common/include/dfx/*.h %{buildroot}/%{_includedir}/device_manager/common/dfx +install -m 554 %{device_manager_dir}/device_manager/common/include/dfx/standard/*.h %{buildroot}/%{_includedir}/device_manager/common/dfx/standard + +#prepare sa file +install -m 0755 %{_builddir}/out/openeuler/packages/phone/sa_profile/merged_sa/device_manager.xml %{buildroot}/system/profile + +%files +%{_includedir}/device_manager/* +%{_libdir}/*.so +/system/profile/* + +%changelog +* Fri Jun 16 2023 tianhang - 1.0.0-1 +- Init and adapt to openeuler + 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..c85867a00fee8d6d428a54e4f8793085917abd74 Binary files /dev/null and b/distributedhardware_device_manager-OpenHarmony-v3.2-Release.tar.gz differ