From 7e53015744e190a5accab10bd8028f67b23ec213 Mon Sep 17 00:00:00 2001 From: BrainL Date: Thu, 10 Apr 2025 09:22:19 +0800 Subject: [PATCH 1/4] modify defination Signed-off-by: BrainL --- common/include/dfx/standard/dm_hisysevent.h | 8 +- common/include/dfx/standard/dm_hitrace.h | 10 +- common/include/dm_anonymous.h | 6 +- common/include/dm_constants.h | 238 +++++++++--------- common/include/dm_single_instance.h | 10 +- common/src/dm_anonymous.cpp | 2 +- .../include/deviceprofile_connector.h | 120 ++++----- .../include/multiple_user_connector.h | 44 ++-- .../src/deviceprofile_connector.cpp | 76 +++--- .../src/multiple_user_connector.cpp | 26 +- .../native_cpp/include/device_manager.h | 2 +- .../native_cpp/include/dm_device_info.h | 26 +- json/src/json_object_cjson.cpp | 2 +- radar/include/dm_radar_helper.h | 10 +- .../include/config/json_config.h | 4 +- .../service/include/device_manager_service.h | 18 +- .../include/device_manager_service_listener.h | 6 +- .../service/src/device_manager_service.cpp | 16 +- utils/include/appInfo/standard/app_manager.h | 20 +- utils/include/crypto/dm_crypto.h | 26 +- utils/include/dm_random.h | 14 +- .../standard/dm_distributed_hardware_load.h | 2 +- utils/include/kvadapter/kv_adapter_manager.h | 12 +- utils/include/timer/dm_timer.h | 16 +- utils/src/appInfo/standard/app_manager.cpp | 14 +- utils/src/crypto/dm_crypto.cpp | 12 +- utils/src/dm_random.cpp | 2 +- .../standard/dm_distributed_hardware_load.cpp | 2 +- utils/src/kvadapter/kv_adapter_manager.cpp | 12 +- utils/src/timer/dm_timer.cpp | 2 +- 30 files changed, 379 insertions(+), 379 deletions(-) diff --git a/common/include/dfx/standard/dm_hisysevent.h b/common/include/dfx/standard/dm_hisysevent.h index c65b21982..2b422e7b4 100644 --- a/common/include/dfx/standard/dm_hisysevent.h +++ b/common/include/dfx/standard/dm_hisysevent.h @@ -18,13 +18,13 @@ #include -#ifndef EXPORT -#define EXPORT __attribute__ ((visibility ("default"))) -#endif // EXPORT +#ifndef DM_EXPORT +#define DM_EXPORT __attribute__ ((visibility ("default"))) +#endif // DM_EXPORT namespace OHOS { namespace DistributedHardware { -EXPORT void SysEventWrite( +DM_EXPORT void SysEventWrite( const std::string &status, int32_t eventType, const std::string &msg); } // namespace DistributedHardware } // namespace OHOS diff --git a/common/include/dfx/standard/dm_hitrace.h b/common/include/dfx/standard/dm_hitrace.h index 4fbae9444..260e8c57f 100644 --- a/common/include/dfx/standard/dm_hitrace.h +++ b/common/include/dfx/standard/dm_hitrace.h @@ -18,14 +18,14 @@ #include -#ifndef EXPORT -#define EXPORT __attribute__ ((visibility ("default"))) -#endif // EXPORT +#ifndef DM_EXPORT +#define DM_EXPORT __attribute__ ((visibility ("default"))) +#endif // DM_EXPORT namespace OHOS { namespace DistributedHardware { -EXPORT void DmTraceStart(const std::string &msg); -EXPORT void DmTraceEnd(); +DM_EXPORT void DmTraceStart(const std::string &msg); +DM_EXPORT void DmTraceEnd(); } // namespace DistributedHardware } // namespace OHOS #endif diff --git a/common/include/dm_anonymous.h b/common/include/dm_anonymous.h index aa2c98547..3649bb7db 100644 --- a/common/include/dm_anonymous.h +++ b/common/include/dm_anonymous.h @@ -27,13 +27,13 @@ namespace DistributedHardware { extern const char* PRINT_LIST_SPLIT; extern const int32_t LIST_SPLIT_LEN; -EXPORT std::string GetAnonyString(const std::string &value); +DM_EXPORT std::string GetAnonyString(const std::string &value); std::string GetAnonyStringList(const std::vector &values); std::string GetAnonyInt32(const int32_t value); std::string GetAnonyInt32List(const std::vector &values); bool IsNumberString(const std::string &inputString); bool IsString(const JsonItemObject &jsonObj, const std::string &key); -EXPORT bool IsInt32(const JsonItemObject &jsonObj, const std::string &key); +DM_EXPORT bool IsInt32(const JsonItemObject &jsonObj, const std::string &key); bool IsUint32(const JsonItemObject &jsonObj, const std::string &key); bool IsInt64(const JsonItemObject &jsonObj, const std::string &key); bool IsArray(const JsonItemObject &jsonObj, const std::string &key); @@ -101,7 +101,7 @@ bool IsIdLengthValid(const std::string &inputID); bool IsMessageLengthValid(const std::string &inputMessage); bool IsValueExist(const std::multimap unorderedmap, const std::string &udid, int32_t userId); bool IsDmCommonNotifyEventValid(DmCommonNotifyEvent dmCommonNotifyEvent); -EXPORT std::string SafetyDump(const JsonItemObject &jsonObj); +DM_EXPORT std::string SafetyDump(const JsonItemObject &jsonObj); std::string GetSubStr(const std::string &rawStr, const std::string &separator, int32_t index); bool IsJsonValIntegerString(const JsonItemObject &jsonObj, const std::string &key); } // namespace DistributedHardware diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h index 52dcb380b..50f2f46f0 100755 --- a/common/include/dm_constants.h +++ b/common/include/dm_constants.h @@ -20,142 +20,142 @@ #include "dm_error_type.h" -#ifndef EXPORT -#define EXPORT __attribute__ ((visibility ("default"))) -#endif // EXPORT +#ifndef DM_EXPORT +#define DM_EXPORT __attribute__ ((visibility ("default"))) +#endif // DM_EXPORT namespace OHOS { namespace DistributedHardware { -EXPORT extern const char* TAG_GROUP_ID; -EXPORT extern const char* TAG_GROUP_NAME; -EXPORT extern const char* TAG_REQUEST_ID; -EXPORT extern const char* TAG_DEVICE_ID; -EXPORT extern const char* TAG_AUTH_TYPE; -EXPORT extern const char* TAG_CRYPTO_SUPPORT; -EXPORT extern const char* TAG_VER; -EXPORT extern const char* TAG_MSG_TYPE; -EXPORT extern const char* DM_ITF_VER; -EXPORT extern const char* DM_PKG_NAME; -EXPORT extern const char* DM_SESSION_NAME; -EXPORT extern const char* DM_PIN_HOLDER_SESSION_NAME; -EXPORT extern const char* DM_SYNC_USERID_SESSION_NAME; -EXPORT extern const char* DM_CAPABILITY_OSD; -EXPORT extern const char* DM_CAPABILITY_APPROACH; -EXPORT extern const char* DM_CAPABILITY_OH_APPROACH; -EXPORT extern const char* DM_CAPABILITY_TOUCH; -EXPORT extern const char* DM_CAPABILITY_CASTPLUS; -EXPORT extern const char* DM_CAPABILITY_VIRTUAL_LINK; -EXPORT extern const char* DM_CAPABILITY_SHARE; -EXPORT extern const char* DM_CAPABILITY_WEAR; -EXPORT extern const char* DM_CAPABILITY_OOP; -EXPORT extern const char* DM_CREDENTIAL_TYPE; -EXPORT extern const char* DM_CREDENTIAL_REQJSONSTR; -EXPORT extern const char* DM_CREDENTIAL_RETURNJSONSTR; -EXPORT extern const char* DEVICE_MANAGER_GROUPNAME; -EXPORT extern const char* FIELD_CREDENTIAL_EXISTS; -EXPORT extern const char* DM_TYPE_MINE; -EXPORT extern const char* DM_TYPE_OH; -EXPORT extern const char* TAG_SESSION_HEARTBEAT; +DM_EXPORT extern const char* TAG_GROUP_ID; +DM_EXPORT extern const char* TAG_GROUP_NAME; +DM_EXPORT extern const char* TAG_REQUEST_ID; +DM_EXPORT extern const char* TAG_DEVICE_ID; +DM_EXPORT extern const char* TAG_AUTH_TYPE; +DM_EXPORT extern const char* TAG_CRYPTO_SUPPORT; +DM_EXPORT extern const char* TAG_VER; +DM_EXPORT extern const char* TAG_MSG_TYPE; +DM_EXPORT extern const char* DM_ITF_VER; +DM_EXPORT extern const char* DM_PKG_NAME; +DM_EXPORT extern const char* DM_SESSION_NAME; +DM_EXPORT extern const char* DM_PIN_HOLDER_SESSION_NAME; +DM_EXPORT extern const char* DM_SYNC_USERID_SESSION_NAME; +DM_EXPORT extern const char* DM_CAPABILITY_OSD; +DM_EXPORT extern const char* DM_CAPABILITY_APPROACH; +DM_EXPORT extern const char* DM_CAPABILITY_OH_APPROACH; +DM_EXPORT extern const char* DM_CAPABILITY_TOUCH; +DM_EXPORT extern const char* DM_CAPABILITY_CASTPLUS; +DM_EXPORT extern const char* DM_CAPABILITY_VIRTUAL_LINK; +DM_EXPORT extern const char* DM_CAPABILITY_SHARE; +DM_EXPORT extern const char* DM_CAPABILITY_WEAR; +DM_EXPORT extern const char* DM_CAPABILITY_OOP; +DM_EXPORT extern const char* DM_CREDENTIAL_TYPE; +DM_EXPORT extern const char* DM_CREDENTIAL_REQJSONSTR; +DM_EXPORT extern const char* DM_CREDENTIAL_RETURNJSONSTR; +DM_EXPORT extern const char* DEVICE_MANAGER_GROUPNAME; +DM_EXPORT extern const char* FIELD_CREDENTIAL_EXISTS; +DM_EXPORT extern const char* DM_TYPE_MINE; +DM_EXPORT extern const char* DM_TYPE_OH; +DM_EXPORT extern const char* TAG_SESSION_HEARTBEAT; //The following constant are provided only for HiLink. -EXPORT extern const char *EXT_PART; +DM_EXPORT extern const char *EXT_PART; // Auth -EXPORT extern const char* AUTH_TYPE; -EXPORT extern const char* APP_OPERATION; -EXPORT extern const char* CUSTOM_DESCRIPTION; -EXPORT extern const char* TOKEN; -EXPORT extern const char* PIN_TOKEN; -EXPORT extern const char* PIN_CODE_KEY; -EXPORT extern const int32_t CHECK_AUTH_ALWAYS_POS; -EXPORT extern const char AUTH_ALWAYS; -EXPORT extern const char AUTH_ONCE; -EXPORT extern const char* TAG_TARGET_DEVICE_NAME; -EXPORT extern const int32_t INVALID_PINCODE; +DM_EXPORT extern const char* AUTH_TYPE; +DM_EXPORT extern const char* APP_OPERATION; +DM_EXPORT extern const char* CUSTOM_DESCRIPTION; +DM_EXPORT extern const char* TOKEN; +DM_EXPORT extern const char* PIN_TOKEN; +DM_EXPORT extern const char* PIN_CODE_KEY; +DM_EXPORT extern const int32_t CHECK_AUTH_ALWAYS_POS; +DM_EXPORT extern const char AUTH_ALWAYS; +DM_EXPORT extern const char AUTH_ONCE; +DM_EXPORT extern const char* TAG_TARGET_DEVICE_NAME; +DM_EXPORT extern const int32_t INVALID_PINCODE; // HiChain -EXPORT extern const int32_t SERVICE_INIT_TRY_MAX_NUM; +DM_EXPORT extern const int32_t SERVICE_INIT_TRY_MAX_NUM; constexpr int32_t DEVICE_UUID_LENGTH = 65; -EXPORT extern const int32_t DEVICE_NETWORKID_LENGTH; -EXPORT extern const int32_t GROUP_TYPE_INVALID_GROUP; -EXPORT extern const int32_t GROUP_TYPE_IDENTICAL_ACCOUNT_GROUP; -EXPORT extern const int32_t GROUP_TYPE_PEER_TO_PEER_GROUP; -EXPORT extern const int32_t GROUP_TYPE_ACROSS_ACCOUNT_GROUP; -EXPORT extern const int32_t GROUP_VISIBILITY_PUBLIC; -EXPORT extern const int64_t MIN_REQUEST_ID; -EXPORT extern const int64_t MAX_REQUEST_ID; -EXPORT extern const int32_t AUTH_DEVICE_REQ_NEGOTIATE; -EXPORT extern const int32_t AUTH_DEVICE_RESP_NEGOTIATE; -EXPORT extern const int32_t DEVICEID_LEN; +DM_EXPORT extern const int32_t DEVICE_NETWORKID_LENGTH; +DM_EXPORT extern const int32_t GROUP_TYPE_INVALID_GROUP; +DM_EXPORT extern const int32_t GROUP_TYPE_IDENTICAL_ACCOUNT_GROUP; +DM_EXPORT extern const int32_t GROUP_TYPE_PEER_TO_PEER_GROUP; +DM_EXPORT extern const int32_t GROUP_TYPE_ACROSS_ACCOUNT_GROUP; +DM_EXPORT extern const int32_t GROUP_VISIBILITY_PUBLIC; +DM_EXPORT extern const int64_t MIN_REQUEST_ID; +DM_EXPORT extern const int64_t MAX_REQUEST_ID; +DM_EXPORT extern const int32_t AUTH_DEVICE_REQ_NEGOTIATE; +DM_EXPORT extern const int32_t AUTH_DEVICE_RESP_NEGOTIATE; +DM_EXPORT extern const int32_t DEVICEID_LEN; // Key of filter parameter -EXPORT extern const char* FILTER_PARA_RANGE; -EXPORT extern const char* FILTER_PARA_DEVICE_TYPE; -EXPORT extern const char* FILTER_PARA_INCLUDE_TRUST; +DM_EXPORT extern const char* FILTER_PARA_RANGE; +DM_EXPORT extern const char* FILTER_PARA_DEVICE_TYPE; +DM_EXPORT extern const char* FILTER_PARA_INCLUDE_TRUST; // Connection address type -EXPORT extern const char* CONN_ADDR_TYPE_ID; -EXPORT extern const char* CONN_ADDR_TYPE_BR; -EXPORT extern const char* CONN_ADDR_TYPE_BLE; -EXPORT extern const char* CONN_ADDR_TYPE_USB; -EXPORT extern const char* CONN_ADDR_TYPE_WLAN_IP; -EXPORT extern const char* CONN_ADDR_TYPE_ETH_IP; +DM_EXPORT extern const char* CONN_ADDR_TYPE_ID; +DM_EXPORT extern const char* CONN_ADDR_TYPE_BR; +DM_EXPORT extern const char* CONN_ADDR_TYPE_BLE; +DM_EXPORT extern const char* CONN_ADDR_TYPE_USB; +DM_EXPORT extern const char* CONN_ADDR_TYPE_WLAN_IP; +DM_EXPORT extern const char* CONN_ADDR_TYPE_ETH_IP; // Softbus connection address type int -EXPORT extern const int32_t CONNECTION_ADDR_USB; +DM_EXPORT extern const int32_t CONNECTION_ADDR_USB; // Parameter Key -EXPORT extern const char* PARAM_KEY_META_TYPE; -EXPORT extern const char* PARAM_KEY_TARGET_ID; -EXPORT extern const char* PARAM_KEY_BR_MAC; -EXPORT extern const char* PARAM_KEY_BLE_MAC; -EXPORT extern const char* PARAM_KEY_WIFI_IP; -EXPORT extern const char* PARAM_KEY_WIFI_PORT; -EXPORT extern const char* PARAM_KEY_USB_IP; -EXPORT extern const char* PARAM_KEY_USB_PORT; -EXPORT extern const char* PARAM_KEY_AUTH_TOKEN; -EXPORT extern const char* PARAM_KEY_AUTH_TYPE; -EXPORT extern const char* PARAM_KEY_PIN_CODE; -EXPORT extern const char* PARAM_KEY_APP_OPER; -EXPORT extern const char* PARAM_KEY_APP_DESC; -EXPORT extern const char* PARAM_KEY_BLE_UDID_HASH; +DM_EXPORT extern const char* PARAM_KEY_META_TYPE; +DM_EXPORT extern const char* PARAM_KEY_TARGET_ID; +DM_EXPORT extern const char* PARAM_KEY_BR_MAC; +DM_EXPORT extern const char* PARAM_KEY_BLE_MAC; +DM_EXPORT extern const char* PARAM_KEY_WIFI_IP; +DM_EXPORT extern const char* PARAM_KEY_WIFI_PORT; +DM_EXPORT extern const char* PARAM_KEY_USB_IP; +DM_EXPORT extern const char* PARAM_KEY_USB_PORT; +DM_EXPORT extern const char* PARAM_KEY_AUTH_TOKEN; +DM_EXPORT extern const char* PARAM_KEY_AUTH_TYPE; +DM_EXPORT extern const char* PARAM_KEY_PIN_CODE; +DM_EXPORT extern const char* PARAM_KEY_APP_OPER; +DM_EXPORT extern const char* PARAM_KEY_APP_DESC; +DM_EXPORT extern const char* PARAM_KEY_BLE_UDID_HASH; constexpr const char* PARAM_KEY_CUSTOM_DATA = "CUSTOM_DATA"; -EXPORT extern const char* PARAM_KEY_CONN_ADDR_TYPE; -EXPORT extern const char* PARAM_KEY_PUBLISH_ID; -EXPORT extern const char* PARAM_KEY_SUBSCRIBE_ID; -EXPORT extern const char* PARAM_KEY_TARGET_PKG_NAME; -EXPORT extern const char* PARAM_KEY_PEER_BUNDLE_NAME; -EXPORT extern const char* PARAM_KEY_DISC_FREQ; -EXPORT extern const char* PARAM_KEY_DISC_MEDIUM; -EXPORT extern const char* PARAM_KEY_DISC_CAPABILITY; -EXPORT extern const char* PARAM_KEY_DISC_MODE; -EXPORT extern const char* PARAM_KEY_AUTO_STOP_ADVERTISE; -EXPORT extern const char* PARAM_KEY_FILTER_OPTIONS; -EXPORT extern const char* PARAM_KEY_BIND_EXTRA_DATA; -EXPORT extern const char* PARAM_KEY_OS_TYPE; -EXPORT extern const char* PARAM_KEY_OS_VERSION; -EXPORT extern const char* PARAM_KEY_IS_SHOW_TRUST_DIALOG; -EXPORT extern const char* PARAM_KEY_UDID; -EXPORT extern const char* PARAM_KEY_UUID; -EXPORT extern const char* DM_CONNECTION_DISCONNECTED; -EXPORT extern const char* BIND_LEVEL; -EXPORT extern const char* TOKENID; -EXPORT extern const char* DM_BIND_RESULT_NETWORK_ID; -EXPORT extern const char* PARAM_KEY_POLICY_STRATEGY_FOR_BLE; -EXPORT extern const char* PARAM_KEY_POLICY_TIME_OUT; -EXPORT extern const char* DEVICE_SCREEN_STATUS; -EXPORT extern const char* PROCESS_NAME; -EXPORT extern const char* PARAM_CLOSE_SESSION_DELAY_SECONDS; -EXPORT extern const char* DM_AUTHENTICATION_TYPE; - -EXPORT extern const char* PARAM_KEY_CONN_SESSIONTYPE; -EXPORT extern const char* PARAM_KEY_HML_RELEASETIME; -EXPORT extern const char* PARAM_KEY_HML_ENABLE_160M; -EXPORT extern const char* PARAM_KEY_HML_ACTIONID; - -EXPORT extern const char* CONN_SESSION_TYPE_HML; -EXPORT extern const char* CONN_SESSION_TYPE_BLE; -EXPORT extern const char* UN_BIND_PARAM_UDID_KEY; +DM_EXPORT extern const char* PARAM_KEY_CONN_ADDR_TYPE; +DM_EXPORT extern const char* PARAM_KEY_PUBLISH_ID; +DM_EXPORT extern const char* PARAM_KEY_SUBSCRIBE_ID; +DM_EXPORT extern const char* PARAM_KEY_TARGET_PKG_NAME; +DM_EXPORT extern const char* PARAM_KEY_PEER_BUNDLE_NAME; +DM_EXPORT extern const char* PARAM_KEY_DISC_FREQ; +DM_EXPORT extern const char* PARAM_KEY_DISC_MEDIUM; +DM_EXPORT extern const char* PARAM_KEY_DISC_CAPABILITY; +DM_EXPORT extern const char* PARAM_KEY_DISC_MODE; +DM_EXPORT extern const char* PARAM_KEY_AUTO_STOP_ADVERTISE; +DM_EXPORT extern const char* PARAM_KEY_FILTER_OPTIONS; +DM_EXPORT extern const char* PARAM_KEY_BIND_EXTRA_DATA; +DM_EXPORT extern const char* PARAM_KEY_OS_TYPE; +DM_EXPORT extern const char* PARAM_KEY_OS_VERSION; +DM_EXPORT extern const char* PARAM_KEY_IS_SHOW_TRUST_DIALOG; +DM_EXPORT extern const char* PARAM_KEY_UDID; +DM_EXPORT extern const char* PARAM_KEY_UUID; +DM_EXPORT extern const char* DM_CONNECTION_DISCONNECTED; +DM_EXPORT extern const char* BIND_LEVEL; +DM_EXPORT extern const char* TOKENID; +DM_EXPORT extern const char* DM_BIND_RESULT_NETWORK_ID; +DM_EXPORT extern const char* PARAM_KEY_POLICY_STRATEGY_FOR_BLE; +DM_EXPORT extern const char* PARAM_KEY_POLICY_TIME_OUT; +DM_EXPORT extern const char* DEVICE_SCREEN_STATUS; +DM_EXPORT extern const char* PROCESS_NAME; +DM_EXPORT extern const char* PARAM_CLOSE_SESSION_DELAY_SECONDS; +DM_EXPORT extern const char* DM_AUTHENTICATION_TYPE; + +DM_EXPORT extern const char* PARAM_KEY_CONN_SESSIONTYPE; +DM_EXPORT extern const char* PARAM_KEY_HML_RELEASETIME; +DM_EXPORT extern const char* PARAM_KEY_HML_ENABLE_160M; +DM_EXPORT extern const char* PARAM_KEY_HML_ACTIONID; + +DM_EXPORT extern const char* CONN_SESSION_TYPE_HML; +DM_EXPORT extern const char* CONN_SESSION_TYPE_BLE; +DM_EXPORT extern const char* UN_BIND_PARAM_UDID_KEY; // screen state enum ScreenState { @@ -165,9 +165,9 @@ enum ScreenState { }; // errCode map -EXPORT extern const std::map MAP_ERROR_CODE; +DM_EXPORT extern const std::map MAP_ERROR_CODE; // wise device -EXPORT extern const int32_t MAX_DEVICE_PROFILE_SIZE; +DM_EXPORT extern const int32_t MAX_DEVICE_PROFILE_SIZE; const int32_t DEVICE_NAME_MAX_BYTES = 100; } // namespace DistributedHardware } // namespace OHOS diff --git a/common/include/dm_single_instance.h b/common/include/dm_single_instance.h index 18720862a..11da29f4e 100644 --- a/common/include/dm_single_instance.h +++ b/common/include/dm_single_instance.h @@ -16,15 +16,15 @@ #ifndef OHOS_DM_SINGLE_INSTANCE_H #define OHOS_DM_SINGLE_INSTANCE_H -#ifndef EXPORT -#define EXPORT __attribute__ ((visibility ("default"))) -#endif // EXPORT +#ifndef DM_EXPORT +#define DM_EXPORT __attribute__ ((visibility ("default"))) +#endif // DM_EXPORT namespace OHOS { namespace DistributedHardware { #define DM_DECLARE_SINGLE_INSTANCE_BASE(className) \ public: \ - EXPORT static className &GetInstance(); \ + DM_EXPORT static className &GetInstance(); \ \ private: \ className(const className &) = delete; \ @@ -40,7 +40,7 @@ private: \ ~className() = default; #define DM_IMPLEMENT_SINGLE_INSTANCE(className) \ - EXPORT className &className::GetInstance() \ + DM_EXPORT className &className::GetInstance() \ { \ static auto instance = new className(); \ return *instance; \ diff --git a/common/src/dm_anonymous.cpp b/common/src/dm_anonymous.cpp index 15d940b42..4cae8f989 100644 --- a/common/src/dm_anonymous.cpp +++ b/common/src/dm_anonymous.cpp @@ -368,7 +368,7 @@ bool IsDmCommonNotifyEventValid(DmCommonNotifyEvent dmCommonNotifyEvent) return false; } -EXPORT std::string SafetyDump(const JsonItemObject &jsonObj) +DM_EXPORT std::string SafetyDump(const JsonItemObject &jsonObj) { return jsonObj.Dump(); } diff --git a/commondependency/include/deviceprofile_connector.h b/commondependency/include/deviceprofile_connector.h index f0f697595..c3b5df5fa 100644 --- a/commondependency/include/deviceprofile_connector.h +++ b/commondependency/include/deviceprofile_connector.h @@ -30,20 +30,20 @@ enum AllowAuthType { ALLOW_AUTH_ALWAYS = 2 }; -EXPORT extern const uint32_t INVALIED_TYPE; -EXPORT extern const uint32_t APP_PEER_TO_PEER_TYPE; -EXPORT extern const uint32_t APP_ACROSS_ACCOUNT_TYPE; -EXPORT extern const uint32_t DEVICE_PEER_TO_PEER_TYPE; -EXPORT extern const uint32_t DEVICE_ACROSS_ACCOUNT_TYPE; -EXPORT extern const uint32_t IDENTICAL_ACCOUNT_TYPE; +DM_EXPORT extern const uint32_t INVALIED_TYPE; +DM_EXPORT extern const uint32_t APP_PEER_TO_PEER_TYPE; +DM_EXPORT extern const uint32_t APP_ACROSS_ACCOUNT_TYPE; +DM_EXPORT extern const uint32_t DEVICE_PEER_TO_PEER_TYPE; +DM_EXPORT extern const uint32_t DEVICE_ACROSS_ACCOUNT_TYPE; +DM_EXPORT extern const uint32_t IDENTICAL_ACCOUNT_TYPE; -EXPORT extern const uint32_t DM_IDENTICAL_ACCOUNT; -EXPORT extern const uint32_t DM_POINT_TO_POINT; -EXPORT extern const uint32_t DM_ACROSS_ACCOUNT; -EXPORT extern const uint32_t DM_INVALIED_BINDTYPE; -EXPORT extern const uint32_t DEVICE; -EXPORT extern const uint32_t SERVICE; -EXPORT extern const uint32_t APP; +DM_EXPORT extern const uint32_t DM_IDENTICAL_ACCOUNT; +DM_EXPORT extern const uint32_t DM_POINT_TO_POINT; +DM_EXPORT extern const uint32_t DM_ACROSS_ACCOUNT; +DM_EXPORT extern const uint32_t DM_INVALIED_BINDTYPE; +DM_EXPORT extern const uint32_t DEVICE; +DM_EXPORT extern const uint32_t SERVICE; +DM_EXPORT extern const uint32_t APP; enum ProfileState { INACTIVE = 0, @@ -114,118 +114,118 @@ public: class DeviceProfileConnector : public IDeviceProfileConnector { DM_DECLARE_SINGLE_INSTANCE(DeviceProfileConnector); public: - EXPORT std::vector + DM_EXPORT std::vector GetAccessControlProfile(); std::vector GetAccessControlProfileByUserId(int32_t userId); std::vector GetAclProfileByDeviceIdAndUserId( const std::string &deviceId, int32_t userId); - EXPORT uint32_t CheckBindType(std::string peerUdid, std::string localUdid); - EXPORT int32_t PutAccessControlList(DmAclInfo aclInfo, DmAccesser dmAccesser, + DM_EXPORT uint32_t CheckBindType(std::string peerUdid, std::string localUdid); + DM_EXPORT int32_t PutAccessControlList(DmAclInfo aclInfo, DmAccesser dmAccesser, DmAccessee dmAccessee); int32_t UpdateAccessControlList(int32_t userId, std::string &oldAccountId, std::string &newAccountId); - EXPORT std::unordered_map GetAppTrustDeviceList( + DM_EXPORT std::unordered_map GetAppTrustDeviceList( const std::string &pkgName, const std::string &deviceId); - EXPORT std::vector GetBindTypeByPkgName(std::string pkgName, + DM_EXPORT std::vector GetBindTypeByPkgName(std::string pkgName, std::string requestDeviceId, std::string trustUdid); - EXPORT uint64_t GetTokenIdByNameAndDeviceId(std::string pkgName, + DM_EXPORT uint64_t GetTokenIdByNameAndDeviceId(std::string pkgName, std::string requestDeviceId); - EXPORT std::vector SyncAclByBindType(std::string pkgName, + DM_EXPORT std::vector SyncAclByBindType(std::string pkgName, std::vector bindTypeVec, std::string localDeviceId, std::string targetDeviceId); int32_t GetDeviceAclParam(DmDiscoveryInfo discoveryInfo, bool &isOnline, int32_t &authForm); - EXPORT bool DeleteAclForAccountLogOut(const std::string &localUdid, + DM_EXPORT bool DeleteAclForAccountLogOut(const std::string &localUdid, int32_t localUserId, const std::string &peerUdid, int32_t peerUserId); - EXPORT void DeleteAclForUserRemoved(std::string localUdid, int32_t userId, std::vector peerUdids, + DM_EXPORT void DeleteAclForUserRemoved(std::string localUdid, int32_t userId, std::vector peerUdids, std::multimap &peerUserIdMap); - EXPORT void DeleteAclForRemoteUserRemoved(std::string peerUdid, + DM_EXPORT void DeleteAclForRemoteUserRemoved(std::string peerUdid, int32_t peerUserId, std::vector &userIds); - EXPORT DmOfflineParam DeleteAccessControlList(const std::string &pkgName, + DM_EXPORT DmOfflineParam DeleteAccessControlList(const std::string &pkgName, const std::string &localDeviceId, const std::string &remoteDeviceId, int32_t bindLevel, const std::string &extra); - EXPORT std::vector + DM_EXPORT std::vector GetProcessInfoFromAclByUserId(const std::string &localDeviceId, const std::string &targetDeviceId, int32_t userId); bool CheckIdenticalAccount(int32_t userId, const std::string &accountId); - EXPORT bool CheckSrcDevIdInAclForDevBind(const std::string &pkgName, + DM_EXPORT bool CheckSrcDevIdInAclForDevBind(const std::string &pkgName, const std::string &deviceId); - EXPORT bool CheckSinkDevIdInAclForDevBind(const std::string &pkgName, + DM_EXPORT bool CheckSinkDevIdInAclForDevBind(const std::string &pkgName, const std::string &deviceId); - EXPORT uint32_t DeleteTimeOutAcl(const std::string &deviceId, int32_t &peerUserId); - EXPORT int32_t GetTrustNumber(const std::string &deviceId); + DM_EXPORT uint32_t DeleteTimeOutAcl(const std::string &deviceId, int32_t &peerUserId); + DM_EXPORT int32_t GetTrustNumber(const std::string &deviceId); bool CheckDevIdInAclForDevBind(const std::string &pkgName, const std::string &deviceId); std::vector CompareBindType(std::vector profiles, std::string pkgName, std::vector &sinkBindType, std::string localDeviceId, std::string targetDeviceId); - EXPORT int32_t IsSameAccount(const std::string &udid); - EXPORT int32_t CheckAccessControl(const DmAccessCaller &caller, + DM_EXPORT int32_t IsSameAccount(const std::string &udid); + DM_EXPORT int32_t CheckAccessControl(const DmAccessCaller &caller, const std::string &srcUdid, const DmAccessCallee &callee, const std::string &sinkUdid); - EXPORT int32_t CheckIsSameAccount(const DmAccessCaller &caller, + DM_EXPORT int32_t CheckIsSameAccount(const DmAccessCaller &caller, const std::string &srcUdid, const DmAccessCallee &callee, const std::string &sinkUdid); - EXPORT void DeleteAccessControlList(const std::string &udid); - EXPORT int32_t GetBindLevel(const std::string &pkgName, + DM_EXPORT void DeleteAccessControlList(const std::string &udid); + DM_EXPORT int32_t GetBindLevel(const std::string &pkgName, const std::string &localUdid, const std::string &udid, uint64_t &tokenId); std::map GetDeviceIdAndBindLevel(std::vector userIds, const std::string &localUdid); - EXPORT std::multimap GetDeviceIdAndUserId( + DM_EXPORT std::multimap GetDeviceIdAndUserId( int32_t userId, const std::string &accountId, const std::string &localUdid); int32_t HandleAccountLogoutEvent(int32_t remoteUserId, const std::string &remoteAccountHash, const std::string &remoteUdid, const std::string &localUdid); - EXPORT int32_t HandleDevUnBindEvent(int32_t remoteUserId, + DM_EXPORT int32_t HandleDevUnBindEvent(int32_t remoteUserId, const std::string &remoteUdid, const std::string &localUdid); - EXPORT DmOfflineParam HandleAppUnBindEvent( + DM_EXPORT DmOfflineParam HandleAppUnBindEvent( int32_t remoteUserId, const std::string &remoteUdid, int32_t tokenId, const std::string &localUdid); - EXPORT DmOfflineParam HandleAppUnBindEvent( + DM_EXPORT DmOfflineParam HandleAppUnBindEvent( int32_t remoteUserId, const std::string &remoteUdid, int32_t tokenId, const std::string &localUdid, int32_t peerTokenId); - EXPORT std::vector + DM_EXPORT std::vector GetAllAccessControlProfile(); - EXPORT void DeleteAccessControlById(int64_t accessControlId); - EXPORT int32_t HandleUserSwitched(const std::string &localUdid, + DM_EXPORT void DeleteAccessControlById(int64_t accessControlId); + DM_EXPORT int32_t HandleUserSwitched(const std::string &localUdid, const std::vector &deviceVec, int32_t currentUserId, int32_t beforeUserId); - EXPORT int32_t HandleUserSwitched(const std::string &localUdid, + DM_EXPORT int32_t HandleUserSwitched(const std::string &localUdid, const std::vector &deviceVec, const std::vector &foregroundUserIds, const std::vector &backgroundUserIds); bool CheckAclStatusAndForegroundNotMatch(const std::string &localUdid, const std::vector &foregroundUserIds, const std::vector &backgroundUserIds); - EXPORT void HandleUserSwitched( + DM_EXPORT void HandleUserSwitched( const std::vector &activeProfiles, const std::vector &inActiveProfiles); - EXPORT void HandleSyncForegroundUserIdEvent( + DM_EXPORT void HandleSyncForegroundUserIdEvent( const std::vector &remoteUserIds, const std::string &remoteUdid, const std::vector &localUserIds, std::string &localUdid); std::vector GetOfflineProcessInfo(std::string &localUdid, const std::vector &localUserIds, const std::string &remoteUdid, const std::vector &remoteUserIds); - EXPORT std::map GetUserIdAndBindLevel( + DM_EXPORT std::map GetUserIdAndBindLevel( const std::string &localUdid, const std::string &peerUdid); - EXPORT void UpdateACL(std::string &localUdid, + DM_EXPORT void UpdateACL(std::string &localUdid, const std::vector &localUserIds, const std::string &remoteUdid, const std::vector &remoteFrontUserIds, const std::vector &remoteBackUserIds); - EXPORT std::multimap GetDevIdAndUserIdByActHash( + DM_EXPORT std::multimap GetDevIdAndUserIdByActHash( const std::string &localUdid, const std::string &peerUdid, int32_t peerUserId, const std::string &peerAccountHash); - EXPORT std::multimap GetDeviceIdAndUserId( + DM_EXPORT std::multimap GetDeviceIdAndUserId( const std::string &localUdid, int32_t localUserId); - EXPORT void HandleSyncBackgroundUserIdEvent( + DM_EXPORT void HandleSyncBackgroundUserIdEvent( const std::vector &remoteUserIds, const std::string &remoteUdid, const std::vector &localUserIds, std::string &localUdid); - EXPORT void HandleDeviceUnBind(int32_t bindType, const std::string &peerUdid, + DM_EXPORT void HandleDeviceUnBind(int32_t bindType, const std::string &peerUdid, const std::string &localUdid, int32_t localUserId, const std::string &localAccountId); - EXPORT int32_t SubscribeDeviceProfileInited( + DM_EXPORT int32_t SubscribeDeviceProfileInited( sptr dpInitedCallback); - EXPORT int32_t UnSubscribeDeviceProfileInited(); - EXPORT int32_t PutAllTrustedDevices( + DM_EXPORT int32_t UnSubscribeDeviceProfileInited(); + DM_EXPORT int32_t PutAllTrustedDevices( const std::vector &deviceInfos); - EXPORT int32_t CheckDeviceInfoPermission(const std::string &localUdid, + DM_EXPORT int32_t CheckDeviceInfoPermission(const std::string &localUdid, const std::string &peerDeviceId); - EXPORT int32_t UpdateAclDeviceName(const std::string &udid, + DM_EXPORT int32_t UpdateAclDeviceName(const std::string &udid, const std::string &newDeviceName); - EXPORT int32_t PutLocalServiceInfo( + DM_EXPORT int32_t PutLocalServiceInfo( const DistributedDeviceProfile::LocalServiceInfo &localServiceInfo); - EXPORT int32_t DeleteLocalServiceInfo(const std::string &bundleName, + DM_EXPORT int32_t DeleteLocalServiceInfo(const std::string &bundleName, int32_t pinExchangeType); - EXPORT int32_t UpdateLocalServiceInfo( + DM_EXPORT int32_t UpdateLocalServiceInfo( const DistributedDeviceProfile::LocalServiceInfo &localServiceInfo); - EXPORT int32_t GetLocalServiceInfoByBundleNameAndPinExchangeType( + DM_EXPORT int32_t GetLocalServiceInfoByBundleNameAndPinExchangeType( const std::string &bundleName, int32_t pinExchangeType, DistributedDeviceProfile::LocalServiceInfo &localServiceInfo); - EXPORT int32_t PutSessionKey(const std::vector &sessionKeyArray, + DM_EXPORT int32_t PutSessionKey(const std::vector &sessionKeyArray, int32_t &sessionKeyId); int32_t HandleUserStop(int32_t stopUserId, const std::string &stopEventUdid); int32_t HandleUserStop(int32_t stopUserId, const std::string &localUdid, diff --git a/commondependency/include/multiple_user_connector.h b/commondependency/include/multiple_user_connector.h index a96752c43..fce5f10da 100644 --- a/commondependency/include/multiple_user_connector.h +++ b/commondependency/include/multiple_user_connector.h @@ -22,9 +22,9 @@ #include #include -#ifndef EXPORT -#define EXPORT __attribute__ ((visibility ("default"))) -#endif // EXPORT +#ifndef DM_EXPORT +#define DM_EXPORT __attribute__ ((visibility ("default"))) +#endif // DM_EXPORT namespace OHOS { namespace DistributedHardware { @@ -39,14 +39,14 @@ public: * @tc.desc: Get Current Account UserID of the Multiple User Connector * @tc.type: FUNC */ - EXPORT static int32_t GetCurrentAccountUserID(void); + DM_EXPORT static int32_t GetCurrentAccountUserID(void); /** * @tc.name: MultipleUserConnector::SetSwitchOldUserId * @tc.desc: Set Switch Old UserId of the Multiple User Connector * @tc.type: FUNC */ - EXPORT static void SetSwitchOldUserId(int32_t userId); + DM_EXPORT static void SetSwitchOldUserId(int32_t userId); /** * @tc.name: MultipleUserConnector::GetSwitchOldUserId @@ -60,7 +60,7 @@ public: * @tc.desc: Get Current AccountId of current user * @tc.type: FUNC */ - EXPORT static std::string GetOhosAccountId(void); + DM_EXPORT static std::string GetOhosAccountId(void); /** * @brief Get the Ohos Account Id By Userid @@ -68,14 +68,14 @@ public: * @param userId the user id in which account login * @return std::string the account id */ - EXPORT static std::string GetOhosAccountIdByUserId(int32_t userId); + DM_EXPORT static std::string GetOhosAccountIdByUserId(int32_t userId); /** * @tc.name: MultipleUserConnector::SetSwitchOldAccountId * @tc.desc: Set Switch Old UserId of the Multiple User Connector * @tc.type: FUNC */ - EXPORT static void SetSwitchOldAccountId(std::string accountId); + DM_EXPORT static void SetSwitchOldAccountId(std::string accountId); /** * @tc.name: MultipleUserConnector::GetSwitchOldAccountId @@ -96,7 +96,7 @@ public: * @tc.desc: Get Current AccountName of the Multiple User Connector * @tc.type: FUNC */ - EXPORT static std::string GetOhosAccountName(void); + DM_EXPORT static std::string GetOhosAccountName(void); /** * @tc.name: MultipleUserConnector::GetSwitchOldAccountName @@ -105,22 +105,22 @@ public: */ static std::string GetSwitchOldAccountName(void); - EXPORT static void SetAccountInfo(int32_t userId, DMAccountInfo dmAccountInfo); - EXPORT static DMAccountInfo GetAccountInfoByUserId(int32_t userId); - EXPORT static void DeleteAccountInfoByUserId(int32_t userId); - EXPORT static void GetTokenIdAndForegroundUserId(uint32_t &tokenId, + DM_EXPORT static void SetAccountInfo(int32_t userId, DMAccountInfo dmAccountInfo); + DM_EXPORT static DMAccountInfo GetAccountInfoByUserId(int32_t userId); + DM_EXPORT static void DeleteAccountInfoByUserId(int32_t userId); + DM_EXPORT static void GetTokenIdAndForegroundUserId(uint32_t &tokenId, int32_t &userId); - EXPORT static void GetCallerUserId(int32_t &userId); - EXPORT static int32_t GetForegroundUserIds(std::vector &userVec); - EXPORT static int32_t GetFirstForegroundUserId(void); - EXPORT static int32_t GetBackgroundUserIds(std::vector &userIdVec); + DM_EXPORT static void GetCallerUserId(int32_t &userId); + DM_EXPORT static int32_t GetForegroundUserIds(std::vector &userVec); + DM_EXPORT static int32_t GetFirstForegroundUserId(void); + DM_EXPORT static int32_t GetBackgroundUserIds(std::vector &userIdVec); static int32_t GetAllUserIds(std::vector &userIdVec); - EXPORT static std::string GetAccountNickName(int32_t userId); - EXPORT static bool IsUserUnlocked(int32_t userId); - EXPORT static void ClearLockedUser(std::vector &foregroundUserVec); - EXPORT static void ClearLockedUser(std::vector &foregroundUserVec, + DM_EXPORT static std::string GetAccountNickName(int32_t userId); + DM_EXPORT static bool IsUserUnlocked(int32_t userId); + DM_EXPORT static void ClearLockedUser(std::vector &foregroundUserVec); + DM_EXPORT static void ClearLockedUser(std::vector &foregroundUserVec, std::vector &backgroundUserVec); - EXPORT static DMAccountInfo GetCurrentDMAccountInfo(); + DM_EXPORT static DMAccountInfo GetCurrentDMAccountInfo(); private: static int32_t oldUserId_; static std::string accountId_; diff --git a/commondependency/src/deviceprofile_connector.cpp b/commondependency/src/deviceprofile_connector.cpp index bb48d6c15..083d8855f 100644 --- a/commondependency/src/deviceprofile_connector.cpp +++ b/commondependency/src/deviceprofile_connector.cpp @@ -45,7 +45,7 @@ namespace OHOS { namespace DistributedHardware { DM_IMPLEMENT_SINGLE_INSTANCE(DeviceProfileConnector); -EXPORT std::vector DeviceProfileConnector::GetAccessControlProfile() +DM_EXPORT std::vector DeviceProfileConnector::GetAccessControlProfile() { std::vector profiles; std::map queryParams; @@ -90,7 +90,7 @@ std::vector DeviceProfileConnector::GetAclProfileByDeviceI return aclProfileVec; } -EXPORT std::unordered_map DeviceProfileConnector::GetAppTrustDeviceList( +DM_EXPORT std::unordered_map DeviceProfileConnector::GetAppTrustDeviceList( const std::string &pkgName, const std::string &deviceId) { int32_t userId = MultipleUserConnector::GetFirstForegroundUserId(); @@ -214,7 +214,7 @@ int32_t DeviceProfileConnector::HandleDmAuthForm(AccessControlProfile profiles, return DmAuthForm::INVALID_TYPE; } -EXPORT uint32_t DeviceProfileConnector::CheckBindType(std::string peerUdid, +DM_EXPORT uint32_t DeviceProfileConnector::CheckBindType(std::string peerUdid, std::string localUdid) { std::vector filterProfiles = GetAclProfileByUserId(localUdid, @@ -265,7 +265,7 @@ int32_t DeviceProfileConnector::GetAuthForm(DistributedDeviceProfile::AccessCont return priority; } -EXPORT std::vector DeviceProfileConnector::GetBindTypeByPkgName( +DM_EXPORT std::vector DeviceProfileConnector::GetBindTypeByPkgName( std::string pkgName, std::string requestDeviceId, std::string trustUdid) { LOGI("Start requestDeviceId %{public}s, trustUdid %{public}s.", GetAnonyString(requestDeviceId).c_str(), @@ -287,7 +287,7 @@ EXPORT std::vector DeviceProfileConnector::GetBindTypeByPkgName( return bindTypeVec; } -EXPORT uint64_t DeviceProfileConnector::GetTokenIdByNameAndDeviceId( +DM_EXPORT uint64_t DeviceProfileConnector::GetTokenIdByNameAndDeviceId( std::string pkgName, std::string requestDeviceId) { std::vector profiles = GetAccessControlProfile(); @@ -406,7 +406,7 @@ void DeviceProfileConnector::ProcessBindType(AccessControlProfile profiles, std: } } -EXPORT std::vector DeviceProfileConnector::SyncAclByBindType( +DM_EXPORT std::vector DeviceProfileConnector::SyncAclByBindType( std::string pkgName, std::vector bindTypeVec, std::string localDeviceId, std::string targetDeviceId) { std::vector profiles = @@ -434,7 +434,7 @@ EXPORT std::vector DeviceProfileConnector::SyncAclByBindType( return bindType; } -EXPORT +DM_EXPORT std::vector DeviceProfileConnector::GetProcessInfoFromAclByUserId( const std::string &localDeviceId, const std::string &targetDeviceId, int32_t userId) { @@ -499,7 +499,7 @@ int32_t DeviceProfileConnector::PutAccessControlList(DmAclInfo aclInfo, DmAccess return ret; } -EXPORT bool DeviceProfileConnector::DeleteAclForAccountLogOut( +DM_EXPORT bool DeviceProfileConnector::DeleteAclForAccountLogOut( const std::string &localUdid, int32_t localUserId, const std::string &peerUdid, int32_t peerUserId) { @@ -545,7 +545,7 @@ EXPORT bool DeviceProfileConnector::DeleteAclForAccountLogOut( return notifyOffline; } -EXPORT void DeviceProfileConnector::DeleteAclForUserRemoved(std::string localUdid, +DM_EXPORT void DeviceProfileConnector::DeleteAclForUserRemoved(std::string localUdid, int32_t userId, std::vector peerUdids, std::multimap &peerUserIdMap) { LOGI("localUdid %{public}s, userId %{public}d.", GetAnonyString(localUdid).c_str(), userId); @@ -575,7 +575,7 @@ EXPORT void DeviceProfileConnector::DeleteAclForUserRemoved(std::string localUdi } } -EXPORT void DeviceProfileConnector::DeleteAclForRemoteUserRemoved( +DM_EXPORT void DeviceProfileConnector::DeleteAclForRemoteUserRemoved( std::string peerUdid, int32_t peerUserId, std::vector &userIds) { LOGI("peerUdid %{public}s, peerUserId %{public}d.", GetAnonyString(peerUdid).c_str(), peerUserId); @@ -600,7 +600,7 @@ EXPORT void DeviceProfileConnector::DeleteAclForRemoteUserRemoved( } } -EXPORT void DeviceProfileConnector::DeleteAccessControlList(const std::string &udid) +DM_EXPORT void DeviceProfileConnector::DeleteAccessControlList(const std::string &udid) { LOGI("Udid: %{public}s.", GetAnonyString(udid).c_str()); if (udid.empty()) { @@ -846,7 +846,7 @@ int32_t DeviceProfileConnector::UpdateAccessControlList(int32_t userId, std::str return DM_OK; } -EXPORT bool DeviceProfileConnector::CheckSrcDevIdInAclForDevBind( +DM_EXPORT bool DeviceProfileConnector::CheckSrcDevIdInAclForDevBind( const std::string &pkgName, const std::string &deviceId) { std::vector profiles = GetAccessControlProfile(); @@ -882,7 +882,7 @@ bool DeviceProfileConnector::CheckDevIdInAclForDevBind(const std::string &pkgNam return (CheckSinkDevIdInAclForDevBind(pkgName, deviceId) || CheckSrcDevIdInAclForDevBind(pkgName, deviceId)); } -EXPORT uint32_t DeviceProfileConnector::DeleteTimeOutAcl(const std::string &deviceId, int32_t &peerUserId) +DM_EXPORT uint32_t DeviceProfileConnector::DeleteTimeOutAcl(const std::string &deviceId, int32_t &peerUserId) { std::vector profiles = GetAccessControlProfile(); LOGI("AccessControlProfile size is %{public}zu", profiles.size()); @@ -914,7 +914,7 @@ EXPORT uint32_t DeviceProfileConnector::DeleteTimeOutAcl(const std::string &devi return res; } -EXPORT int32_t DeviceProfileConnector::GetTrustNumber(const std::string &deviceId) +DM_EXPORT int32_t DeviceProfileConnector::GetTrustNumber(const std::string &deviceId) { std::vector profiles = GetAccessControlProfile(); LOGI("AccessControlProfile size is %{public}zu", profiles.size()); @@ -927,7 +927,7 @@ EXPORT int32_t DeviceProfileConnector::GetTrustNumber(const std::string &deviceI return trustNumber; } -EXPORT int32_t DeviceProfileConnector::IsSameAccount(const std::string &udid) +DM_EXPORT int32_t DeviceProfileConnector::IsSameAccount(const std::string &udid) { std::vector profiles = GetAccessControlProfile(); for (auto &item : profiles) { @@ -999,7 +999,7 @@ std::vector GetACLByDeviceIdAndUserId(std::vector DeviceProfileConnector::GetDeviceIdAndBindLevel(s return deviceIdMap; } -EXPORT std::multimap DeviceProfileConnector::GetDeviceIdAndUserId( +DM_EXPORT std::multimap DeviceProfileConnector::GetDeviceIdAndUserId( int32_t userId, const std::string &accountId, const std::string &localUdid) { LOGI("localUdid %{public}s, userId %{public}d, accountId %{public}s.", GetAnonyString(localUdid).c_str(), @@ -1235,7 +1235,7 @@ int32_t DeviceProfileConnector::HandleAccountLogoutEvent(int32_t remoteUserId, return bindType; } -EXPORT int32_t DeviceProfileConnector::HandleDevUnBindEvent(int32_t remoteUserId, +DM_EXPORT int32_t DeviceProfileConnector::HandleDevUnBindEvent(int32_t remoteUserId, const std::string &remoteUdid, const std::string &localUdid) { LOGI("RemoteUserId %{public}d, remoteUdid %{public}s, localUdid %{public}s.", remoteUserId, @@ -1256,7 +1256,7 @@ EXPORT int32_t DeviceProfileConnector::HandleDevUnBindEvent(int32_t remoteUserId return bindType; } -EXPORT DmOfflineParam DeviceProfileConnector::HandleAppUnBindEvent( +DM_EXPORT DmOfflineParam DeviceProfileConnector::HandleAppUnBindEvent( int32_t remoteUserId, const std::string &remoteUdid, int32_t tokenId, const std::string &localUdid) { LOGI("RemoteUserId %{public}d, remoteUdid %{public}s, tokenId %{public}d, localUdid %{public}s.", @@ -1304,7 +1304,7 @@ EXPORT DmOfflineParam DeviceProfileConnector::HandleAppUnBindEvent( return offlineParam; } -EXPORT DmOfflineParam DeviceProfileConnector::HandleAppUnBindEvent( +DM_EXPORT DmOfflineParam DeviceProfileConnector::HandleAppUnBindEvent( int32_t remoteUserId, const std::string &remoteUdid, int32_t tokenId, const std::string &localUdid, int32_t peerTokenId) { @@ -1355,7 +1355,7 @@ EXPORT DmOfflineParam DeviceProfileConnector::HandleAppUnBindEvent( return offlineParam; } -EXPORT std::vector DeviceProfileConnector::GetAllAccessControlProfile() +DM_EXPORT std::vector DeviceProfileConnector::GetAllAccessControlProfile() { std::vector profiles; if (DistributedDeviceProfileClient::GetInstance().GetAllAccessControlProfile(profiles) != DM_OK) { @@ -1364,13 +1364,13 @@ EXPORT std::vector DeviceProfileConnector::GetAllAccessCon return profiles; } -EXPORT void DeviceProfileConnector::DeleteAccessControlById( +DM_EXPORT void DeviceProfileConnector::DeleteAccessControlById( int64_t accessControlId) { DistributedDeviceProfileClient::GetInstance().DeleteAccessControlProfile(accessControlId); } -EXPORT int32_t DeviceProfileConnector::HandleUserSwitched( +DM_EXPORT int32_t DeviceProfileConnector::HandleUserSwitched( const std::string &localUdid, const std::vector &deviceVec, int32_t currentUserId, int32_t beforeUserId) { @@ -1408,7 +1408,7 @@ EXPORT int32_t DeviceProfileConnector::HandleUserSwitched( return DM_OK; } -EXPORT void DeviceProfileConnector::HandleUserSwitched( +DM_EXPORT void DeviceProfileConnector::HandleUserSwitched( const std::vector &activeProfiles, const std::vector &inActiveProfiles) { @@ -1441,7 +1441,7 @@ std::vector DeviceProfileConnector::GetAclProfileByUserId( return profilesTemp; } -EXPORT void DeviceProfileConnector::HandleSyncForegroundUserIdEvent( +DM_EXPORT void DeviceProfileConnector::HandleSyncForegroundUserIdEvent( const std::vector &remoteUserIds, const std::string &remoteUdid, const std::vector &localUserIds, std::string &localUdid) { @@ -1513,7 +1513,7 @@ std::vector DeviceProfileConnector::GetOfflineProcessInfo(std::stri return processInfos; } -EXPORT std::map DeviceProfileConnector::GetUserIdAndBindLevel( +DM_EXPORT std::map DeviceProfileConnector::GetUserIdAndBindLevel( const std::string &localUdid, const std::string &peerUdid) { LOGI("localUdid %{public}s, peerUdid %{public}s.", GetAnonyString(localUdid).c_str(), @@ -1544,7 +1544,7 @@ EXPORT std::map DeviceProfileConnector::GetUserIdAndBindLevel( return userIdAndBindLevel; } -EXPORT void DeviceProfileConnector::UpdateACL(std::string &localUdid, +DM_EXPORT void DeviceProfileConnector::UpdateACL(std::string &localUdid, const std::vector &localUserIds, const std::string &remoteUdid, const std::vector &remoteFrontUserIds, const std::vector &remoteBackUserIds) { @@ -1606,7 +1606,7 @@ void DeviceProfileConnector::UpdatePeerUserId(AccessControlProfile profile, std: } } -EXPORT std::multimap DeviceProfileConnector::GetDevIdAndUserIdByActHash( +DM_EXPORT std::multimap DeviceProfileConnector::GetDevIdAndUserIdByActHash( const std::string &localUdid, const std::string &peerUdid, int32_t peerUserId, const std::string &peerAccountHash) { @@ -1649,7 +1649,7 @@ EXPORT std::multimap DeviceProfileConnector::GetDevIdAndUs return deviceIdMap; } -EXPORT std::multimap DeviceProfileConnector::GetDeviceIdAndUserId( +DM_EXPORT std::multimap DeviceProfileConnector::GetDeviceIdAndUserId( const std::string &localUdid, int32_t localUserId) { LOGI("localUdid %{public}s, userId %{public}d.", GetAnonyString(localUdid).c_str(), localUserId); @@ -1676,7 +1676,7 @@ EXPORT std::multimap DeviceProfileConnector::GetDeviceIdAn return deviceIdMap; } -EXPORT void DeviceProfileConnector::HandleSyncBackgroundUserIdEvent( +DM_EXPORT void DeviceProfileConnector::HandleSyncBackgroundUserIdEvent( const std::vector &remoteUserIds, const std::string &remoteUdid, const std::vector &localUserIds, std::string &localUdid) { @@ -1706,7 +1706,7 @@ EXPORT void DeviceProfileConnector::HandleSyncBackgroundUserIdEvent( } } -EXPORT void DeviceProfileConnector::HandleDeviceUnBind(int32_t bindType, +DM_EXPORT void DeviceProfileConnector::HandleDeviceUnBind(int32_t bindType, const std::string &peerUdid, const std::string &localUdid, int32_t localUserId, const std::string &localAccountId) { std::vector profiles = @@ -1726,7 +1726,7 @@ EXPORT void DeviceProfileConnector::HandleDeviceUnBind(int32_t bindType, } } -EXPORT int32_t DeviceProfileConnector::SubscribeDeviceProfileInited( +DM_EXPORT int32_t DeviceProfileConnector::SubscribeDeviceProfileInited( sptr dpInitedCallback) { LOGI("In"); @@ -1743,7 +1743,7 @@ EXPORT int32_t DeviceProfileConnector::SubscribeDeviceProfileInited( return DM_OK; } -EXPORT int32_t DeviceProfileConnector::UnSubscribeDeviceProfileInited() +DM_EXPORT int32_t DeviceProfileConnector::UnSubscribeDeviceProfileInited() { LOGI("In"); int32_t ret = DistributedDeviceProfileClient::GetInstance().UnSubscribeDeviceProfileInited( @@ -1755,7 +1755,7 @@ EXPORT int32_t DeviceProfileConnector::UnSubscribeDeviceProfileInited() return DM_OK; } -EXPORT int32_t DeviceProfileConnector::PutAllTrustedDevices( +DM_EXPORT int32_t DeviceProfileConnector::PutAllTrustedDevices( const std::vector &deviceInfos) { LOGI("In deviceInfos.size:%{public}zu", deviceInfos.size()); @@ -1767,7 +1767,7 @@ EXPORT int32_t DeviceProfileConnector::PutAllTrustedDevices( return DM_OK; } -EXPORT int32_t DeviceProfileConnector::CheckDeviceInfoPermission( +DM_EXPORT int32_t DeviceProfileConnector::CheckDeviceInfoPermission( const std::string &localUdid, const std::string &peerDeviceId) { LOGI("CheckDeviceInfoPermission Start."); @@ -1923,7 +1923,7 @@ bool DeviceProfileConnector::CheckAclStatusAndForegroundNotMatch(const std::stri return false; } -EXPORT int32_t DeviceProfileConnector::HandleUserSwitched( +DM_EXPORT int32_t DeviceProfileConnector::HandleUserSwitched( const std::string &localUdid, const std::vector &deviceVec, const std::vector &foregroundUserIds, const std::vector &backgroundUserIds) { diff --git a/commondependency/src/multiple_user_connector.cpp b/commondependency/src/multiple_user_connector.cpp index 1bcaa8d8e..f416f4abd 100644 --- a/commondependency/src/multiple_user_connector.cpp +++ b/commondependency/src/multiple_user_connector.cpp @@ -56,7 +56,7 @@ int32_t MultipleUserConnector::GetCurrentAccountUserID(void) #endif } -EXPORT std::string MultipleUserConnector::GetOhosAccountId(void) +DM_EXPORT std::string MultipleUserConnector::GetOhosAccountId(void) { #if (defined(__LITEOS_M__) || defined(LITE_DEVICE)) return ""; @@ -73,7 +73,7 @@ EXPORT std::string MultipleUserConnector::GetOhosAccountId(void) #endif } -EXPORT std::string MultipleUserConnector::GetOhosAccountIdByUserId(int32_t userId) +DM_EXPORT std::string MultipleUserConnector::GetOhosAccountIdByUserId(int32_t userId) { #if (defined(__LITEOS_M__) || defined(LITE_DEVICE)) (void)userId; @@ -92,7 +92,7 @@ EXPORT std::string MultipleUserConnector::GetOhosAccountIdByUserId(int32_t userI #endif } -EXPORT std::string MultipleUserConnector::GetOhosAccountName(void) +DM_EXPORT std::string MultipleUserConnector::GetOhosAccountName(void) { #if (defined(__LITEOS_M__) || defined(LITE_DEVICE)) return ""; @@ -140,7 +140,7 @@ void MultipleUserConnector::GetCallerUserId(int32_t &userId) #endif } -EXPORT void MultipleUserConnector::SetSwitchOldUserId(int32_t userId) +DM_EXPORT void MultipleUserConnector::SetSwitchOldUserId(int32_t userId) { std::lock_guard lock(lock_); oldUserId_ = userId; @@ -152,7 +152,7 @@ int32_t MultipleUserConnector::GetSwitchOldUserId(void) return oldUserId_; } -EXPORT void MultipleUserConnector::SetSwitchOldAccountId(std::string accountId) +DM_EXPORT void MultipleUserConnector::SetSwitchOldAccountId(std::string accountId) { std::lock_guard lock(lock_); accountId_ = accountId; @@ -176,14 +176,14 @@ std::string MultipleUserConnector::GetSwitchOldAccountName(void) return accountName_; } -EXPORT void MultipleUserConnector::SetAccountInfo(int32_t userId, +DM_EXPORT void MultipleUserConnector::SetAccountInfo(int32_t userId, DMAccountInfo dmAccountInfo) { std::lock_guard lock(dmAccountInfoMaplock_); dmAccountInfoMap_[userId] = dmAccountInfo; } -EXPORT DMAccountInfo MultipleUserConnector::GetAccountInfoByUserId(int32_t userId) +DM_EXPORT DMAccountInfo MultipleUserConnector::GetAccountInfoByUserId(int32_t userId) { DMAccountInfo dmAccountInfo; { @@ -197,7 +197,7 @@ EXPORT DMAccountInfo MultipleUserConnector::GetAccountInfoByUserId(int32_t userI return dmAccountInfo; } -EXPORT void MultipleUserConnector::DeleteAccountInfoByUserId(int32_t userId) +DM_EXPORT void MultipleUserConnector::DeleteAccountInfoByUserId(int32_t userId) { std::lock_guard lock(dmAccountInfoMaplock_); LOGI("userId: %{public}d", userId); @@ -206,7 +206,7 @@ EXPORT void MultipleUserConnector::DeleteAccountInfoByUserId(int32_t userId) } } -EXPORT int32_t MultipleUserConnector::GetForegroundUserIds( +DM_EXPORT int32_t MultipleUserConnector::GetForegroundUserIds( std::vector &userVec) { #if (defined(__LITEOS_M__) || defined(LITE_DEVICE)) @@ -241,7 +241,7 @@ int32_t MultipleUserConnector::GetFirstForegroundUserId(void) return userVec[0]; } -EXPORT int32_t MultipleUserConnector::GetBackgroundUserIds( +DM_EXPORT int32_t MultipleUserConnector::GetBackgroundUserIds( std::vector &userIdVec) { #if (defined(__LITEOS_M__) || defined(LITE_DEVICE)) @@ -304,7 +304,7 @@ int32_t MultipleUserConnector::GetAllUserIds(std::vector &userIdVec) #endif } -EXPORT std::string MultipleUserConnector::GetAccountNickName(int32_t userId) +DM_EXPORT std::string MultipleUserConnector::GetAccountNickName(int32_t userId) { #if (defined(__LITEOS_M__) || defined(LITE_DEVICE)) return ""; @@ -338,7 +338,7 @@ bool MultipleUserConnector::IsUserUnlocked(int32_t userId) #endif } -EXPORT void MultipleUserConnector::ClearLockedUser( +DM_EXPORT void MultipleUserConnector::ClearLockedUser( std::vector &foregroundUserVec) { for (auto iter = foregroundUserVec.begin(); iter != foregroundUserVec.end();) { @@ -350,7 +350,7 @@ EXPORT void MultipleUserConnector::ClearLockedUser( } } -EXPORT void MultipleUserConnector::ClearLockedUser( +DM_EXPORT void MultipleUserConnector::ClearLockedUser( std::vector &foregroundUserVec, std::vector &backgroundUserVec) { for (auto iter = foregroundUserVec.begin(); iter != foregroundUserVec.end();) { diff --git a/interfaces/inner_kits/native_cpp/include/device_manager.h b/interfaces/inner_kits/native_cpp/include/device_manager.h index 8c75216bf..d43456e42 100644 --- a/interfaces/inner_kits/native_cpp/include/device_manager.h +++ b/interfaces/inner_kits/native_cpp/include/device_manager.h @@ -23,7 +23,7 @@ namespace OHOS { namespace DistributedHardware { class DeviceManager { public: - EXPORT static DeviceManager &GetInstance(); + DM_EXPORT static DeviceManager &GetInstance(); public: /** diff --git a/interfaces/inner_kits/native_cpp/include/dm_device_info.h b/interfaces/inner_kits/native_cpp/include/dm_device_info.h index 243012f27..d5871a55a 100644 --- a/interfaces/inner_kits/native_cpp/include/dm_device_info.h +++ b/interfaces/inner_kits/native_cpp/include/dm_device_info.h @@ -24,9 +24,9 @@ #define DM_MAX_DEVICE_ID_LEN (97) #define DM_MAX_DEVICE_NAME_LEN (129) -#ifndef EXPORT -#define EXPORT __attribute__ ((visibility ("default"))) -#endif // EXPORT +#ifndef DM_EXPORT +#define DM_EXPORT __attribute__ ((visibility ("default"))) +#endif // DM_EXPORT namespace OHOS { namespace DistributedHardware { @@ -355,16 +355,16 @@ typedef enum { MAX = 9, } DmCommonNotifyEvent; -EXPORT extern const char* DEVICE_TYPE_UNKNOWN_STRING; -EXPORT extern const char* DEVICE_TYPE_PHONE_STRING; -EXPORT extern const char* DEVICE_TYPE_PAD_STRING; -EXPORT extern const char* DEVICE_TYPE_TV_STRING; -EXPORT extern const char* DEVICE_TYPE_CAR_STRING; -EXPORT extern const char* DEVICE_TYPE_WATCH_STRING; -EXPORT extern const char* DEVICE_TYPE_WIFICAMERA_STRING; -EXPORT extern const char* DEVICE_TYPE_PC_STRING; -EXPORT extern const char* DEVICE_TYPE_SMART_DISPLAY_STRING; -EXPORT extern const char* DEVICE_TYPE_2IN1_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_UNKNOWN_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_PHONE_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_PAD_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_TV_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_CAR_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_WATCH_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_WIFICAMERA_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_PC_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_SMART_DISPLAY_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_2IN1_STRING; typedef struct DmAccessCaller { std::string accountId; diff --git a/json/src/json_object_cjson.cpp b/json/src/json_object_cjson.cpp index d26f314d9..3cf1bbcad 100644 --- a/json/src/json_object_cjson.cpp +++ b/json/src/json_object_cjson.cpp @@ -204,7 +204,7 @@ void FromJson(const JsonItemObject &itemObject, uint32_t &value) value = static_cast(tmpValue); } -EXPORT void FromJson(const JsonItemObject &itemObject, int64_t &value) +DM_EXPORT void FromJson(const JsonItemObject &itemObject, int64_t &value) { itemObject.GetTo(value); } diff --git a/radar/include/dm_radar_helper.h b/radar/include/dm_radar_helper.h index 3123d8536..4304b7aeb 100644 --- a/radar/include/dm_radar_helper.h +++ b/radar/include/dm_radar_helper.h @@ -27,9 +27,9 @@ namespace OHOS { namespace DistributedHardware { -EXPORT extern const char* ORGPKGNAME; -EXPORT extern const char* SOFTBUSNAME; -EXPORT extern const char* HICHAINNAME; +DM_EXPORT extern const char* ORGPKGNAME; +DM_EXPORT extern const char* SOFTBUSNAME; +DM_EXPORT extern const char* HICHAINNAME; enum class DiscoverScene : int32_t { DM_DISCOVER = 0x1, DM_GET_TRUST_DEVICE_LIST = 0x2, @@ -217,8 +217,8 @@ public: std::string funcName, DmDeviceInfo &info, int32_t errCode, std::string localUdid) override; std::string GetDeviceInfoList(std::vector &deviceInfoList) override; std::string ConvertHexToString(uint16_t hex); - EXPORT int32_t GetErrCode(int32_t errCode); - EXPORT std::string GetAnonyLocalUdid(); + DM_EXPORT int32_t GetErrCode(int32_t errCode); + DM_EXPORT std::string GetAnonyLocalUdid(); int32_t ReportDiscoverRegCallbackStageIdle(struct RadarInfo &info); int32_t ReportDiscoverUserResStageCancel(struct RadarInfo &info); int32_t ReportDiscoverUserResStageSucc(struct RadarInfo &info); diff --git a/services/implementation/include/config/json_config.h b/services/implementation/include/config/json_config.h index e357d8666..1ebb66c9e 100644 --- a/services/implementation/include/config/json_config.h +++ b/services/implementation/include/config/json_config.h @@ -20,7 +20,7 @@ namespace OHOS { namespace DistributedHardware { - EXPORT const std::string adapterJsonConfigString = + DM_EXPORT const std::string adapterJsonConfigString = R"({ "devicemanager_adapter_components": [ { @@ -42,7 +42,7 @@ namespace DistributedHardware { ] })"; -EXPORT const std::string authJsonConfigString = +DM_EXPORT const std::string authJsonConfigString = R"({ "devicemanager_auth_components": [ { diff --git a/services/service/include/device_manager_service.h b/services/service/include/device_manager_service.h index 8b40da361..2488e65c8 100644 --- a/services/service/include/device_manager_service.h +++ b/services/service/include/device_manager_service.h @@ -58,15 +58,15 @@ public: void InitHichainListener(); - EXPORT void RegisterCallerAppId(const std::string &pkgName); + DM_EXPORT void RegisterCallerAppId(const std::string &pkgName); - EXPORT void UnRegisterCallerAppId(const std::string &pkgName); + DM_EXPORT void UnRegisterCallerAppId(const std::string &pkgName); void UninitSoftbusListener(); int32_t InitDMServiceListener(); - EXPORT void UninitDMServiceListener(); + DM_EXPORT void UninitDMServiceListener(); int32_t GetTrustedDeviceList(const std::string &pkgName, const std::string &extra, std::vector &deviceList); @@ -283,14 +283,14 @@ private: #if !(defined(__LITEOS_M__) || defined(LITE_DEVICE)) void SubscribeAccountCommonEvent(); - EXPORT void AccountCommonEventCallback(const std::string commonEventType, + DM_EXPORT void AccountCommonEventCallback(const std::string commonEventType, int32_t currentUserId, int32_t beforeUserId); void SubscribeScreenLockEvent(); void ScreenCommonEventCallback(std::string commonEventType); - EXPORT void ConvertUdidHashToAnoyDeviceId(DmDeviceInfo &deviceInfo); - EXPORT int32_t ConvertUdidHashToAnoyDeviceId(const std::string &udidHash, + DM_EXPORT void ConvertUdidHashToAnoyDeviceId(DmDeviceInfo &deviceInfo); + DM_EXPORT int32_t ConvertUdidHashToAnoyDeviceId(const std::string &udidHash, std::string &anoyDeviceId); - EXPORT int32_t GetUdidHashByAnoyDeviceId(const std::string &anoyDeviceId, + DM_EXPORT int32_t GetUdidHashByAnoyDeviceId(const std::string &anoyDeviceId, std::string &udidHash); void HandleAccountLogout(int32_t userId, const std::string &accountId, const std::string &accountName); void HandleUserRemoved(int32_t removedUserId); @@ -341,7 +341,7 @@ private: void SubscribePublishCommonEvent(); void QueryDependsSwitchState(); #endif // SUPPORT_BLUETOOTH SUPPORT_WIFI - EXPORT void SubscribeDataShareCommonEvent(); + DM_EXPORT void SubscribeDataShareCommonEvent(); #endif void CheckRegisterInfoWithWise(int32_t curUserId); @@ -368,7 +368,7 @@ private: #if defined(SUPPORT_BLUETOOTH) || defined(SUPPORT_WIFI) std::shared_ptr publshCommonEventManager_; #endif // SUPPORT_BLUETOOTH SUPPORT_WIFI - EXPORT std::shared_ptr dataShareCommonEventManager_; + DM_EXPORT std::shared_ptr dataShareCommonEventManager_; #endif std::string localNetWorkId_ = ""; std::shared_ptr timer_; diff --git a/services/service/include/device_manager_service_listener.h b/services/service/include/device_manager_service_listener.h index 9766358fb..e616b606a 100644 --- a/services/service/include/device_manager_service_listener.h +++ b/services/service/include/device_manager_service_listener.h @@ -59,10 +59,10 @@ public: void OnCredentialResult(const ProcessInfo &processInfo, int32_t action, const std::string &resultInfo) override; - EXPORT void OnBindResult(const ProcessInfo &processInfo, + DM_EXPORT void OnBindResult(const ProcessInfo &processInfo, const PeerTargetId &targetId, int32_t result, int32_t status, std::string content) override; - EXPORT void OnUnbindResult(const ProcessInfo &processInfo, + DM_EXPORT void OnUnbindResult(const ProcessInfo &processInfo, const PeerTargetId &targetId, int32_t result, std::string content) override; void OnPinHolderCreate(const ProcessInfo &processInfo, const std::string &deviceId, DmPinType pinType, @@ -104,7 +104,7 @@ private: const DmDeviceInfo &deviceInfo); void RemoveOnlinePkgName(const DmDeviceInfo &info); #if !(defined(__LITEOS_M__) || defined(LITE_DEVICE)) - EXPORT int32_t ConvertUdidHashToAnoyAndSave(const std::string &pkgName, + DM_EXPORT int32_t ConvertUdidHashToAnoyAndSave(const std::string &pkgName, DmDeviceInfo &deviceInfo); int32_t ConvertUdidHashToAnoyDeviceId(const std::string &pkgName, const std::string &udidHash, std::string &anoyDeviceId); diff --git a/services/service/src/device_manager_service.cpp b/services/service/src/device_manager_service.cpp index aa87475de..52948d2aa 100644 --- a/services/service/src/device_manager_service.cpp +++ b/services/service/src/device_manager_service.cpp @@ -161,7 +161,7 @@ void DeviceManagerService::SubscribePublishCommonEvent() return; } #endif // SUPPORT_BLUETOOTH SUPPORT_WIFI -EXPORT void DeviceManagerService::SubscribeDataShareCommonEvent() +DM_EXPORT void DeviceManagerService::SubscribeDataShareCommonEvent() { LOGI("DeviceManagerServiceImpl::SubscribeDataShareCommonEvent"); if (dataShareCommonEventManager_ == nullptr) { @@ -269,7 +269,7 @@ int32_t DeviceManagerService::InitDMServiceListener() return DM_OK; } -EXPORT void DeviceManagerService::UninitDMServiceListener() +DM_EXPORT void DeviceManagerService::UninitDMServiceListener() { listener_ = nullptr; advertiseMgr_ = nullptr; @@ -281,12 +281,12 @@ EXPORT void DeviceManagerService::UninitDMServiceListener() LOGI("Uninit."); } -EXPORT void DeviceManagerService::RegisterCallerAppId(const std::string &pkgName) +DM_EXPORT void DeviceManagerService::RegisterCallerAppId(const std::string &pkgName) { AppManager::GetInstance().RegisterCallerAppId(pkgName); } -EXPORT void DeviceManagerService::UnRegisterCallerAppId(const std::string &pkgName) +DM_EXPORT void DeviceManagerService::UnRegisterCallerAppId(const std::string &pkgName) { AppManager::GetInstance().UnRegisterCallerAppId(pkgName); } @@ -1882,7 +1882,7 @@ void DeviceManagerService::SubscribeScreenLockEvent() return; } -EXPORT void DeviceManagerService::AccountCommonEventCallback( +DM_EXPORT void DeviceManagerService::AccountCommonEventCallback( const std::string commonEventType, int32_t currentUserId, int32_t beforeUserId) { LOGI("CommonEventType: %{public}s, currentUserId: %{public}d, beforeUserId: %{public}d", commonEventType.c_str(), @@ -2362,7 +2362,7 @@ int32_t DeviceManagerService::SetDnPolicy(const std::string &pkgName, std::map &bundleManager); std::mutex appIdMapLock_; diff --git a/utils/include/crypto/dm_crypto.h b/utils/include/crypto/dm_crypto.h index bd4bbaa8c..b0c55b8d6 100644 --- a/utils/include/crypto/dm_crypto.h +++ b/utils/include/crypto/dm_crypto.h @@ -20,36 +20,36 @@ #include "dm_kv_info.h" #endif -#ifndef EXPORT -#define EXPORT __attribute__ ((visibility ("default"))) -#endif // EXPORT +#ifndef DM_EXPORT +#define DM_EXPORT __attribute__ ((visibility ("default"))) +#endif // DM_EXPORT namespace OHOS { namespace DistributedHardware { class Crypto { public: - EXPORT static void DmGenerateStrHash(const void *data, size_t dataSize, + DM_EXPORT static void DmGenerateStrHash(const void *data, size_t dataSize, unsigned char *outBuf, uint32_t outBufLen, uint32_t startIndex); - EXPORT static std::string Sha256(const std::string &text, bool isUpper = false); - EXPORT static std::string Sha256(const void *data, size_t size, + DM_EXPORT static std::string Sha256(const std::string &text, bool isUpper = false); + DM_EXPORT static std::string Sha256(const void *data, size_t size, bool isUpper = false); - EXPORT static int32_t ConvertHexStringToBytes(unsigned char *outBuf, + DM_EXPORT static int32_t ConvertHexStringToBytes(unsigned char *outBuf, uint32_t outBufLen, const char *inBuf, uint32_t inLen); - EXPORT static int32_t GetUdidHash(const std::string &udid, + DM_EXPORT static int32_t GetUdidHash(const std::string &udid, unsigned char *udidHash); - EXPORT static std::string GetGroupIdHash(const std::string &groupId); + DM_EXPORT static std::string GetGroupIdHash(const std::string &groupId); static int32_t GetSecRandom(uint8_t *out, size_t outLen); static std::string GetSecSalt(); static std::string GetHashWithSalt(const std::string &text, const std::string &salt); - EXPORT static int32_t GetAccountIdHash(const std::string &accountId, + DM_EXPORT static int32_t GetAccountIdHash(const std::string &accountId, unsigned char *accountIdHash); - EXPORT static int32_t ConvertBytesToHexString(char *outBuf, uint32_t outBufLen, + DM_EXPORT static int32_t ConvertBytesToHexString(char *outBuf, uint32_t outBufLen, const unsigned char *inBuf, uint32_t inLen); #if !(defined(__LITEOS_M__) || defined(LITE_DEVICE)) - EXPORT static int32_t ConvertUdidHashToAnoyAndSave(const std::string &appId, + DM_EXPORT static int32_t ConvertUdidHashToAnoyAndSave(const std::string &appId, const std::string &udidHash, DmKVValue &kvValue); - EXPORT static int32_t ConvertUdidHashToAnoyDeviceId(const std::string &appId, + DM_EXPORT static int32_t ConvertUdidHashToAnoyDeviceId(const std::string &appId, const std::string &udidHash, DmKVValue &kvValue); static int32_t GetAnoyDeviceInfo(const std::string &appId, const std::string &udidHash, DmKVValue &kvValue); static int32_t ConvertUdidHashToAnoyGenerate(const std::string &appId, const std::string &udidHash, diff --git a/utils/include/dm_random.h b/utils/include/dm_random.h index 0947b4404..d22d4a002 100644 --- a/utils/include/dm_random.h +++ b/utils/include/dm_random.h @@ -19,16 +19,16 @@ #include #include -#ifndef EXPORT -#define EXPORT __attribute__ ((visibility ("default"))) -#endif // EXPORT +#ifndef DM_EXPORT +#define DM_EXPORT __attribute__ ((visibility ("default"))) +#endif // DM_EXPORT namespace OHOS { namespace DistributedHardware { -EXPORT int32_t GenRandInt(int32_t randMin, int32_t randMax); -EXPORT int64_t GenRandLongLong(int64_t randMin, int64_t randMax); -EXPORT uint16_t GenRandUint(uint16_t randMin, uint16_t randMax); -EXPORT uint16_t GenUniqueRandUint(std::set &randUint16Set); +DM_EXPORT int32_t GenRandInt(int32_t randMin, int32_t randMax); +DM_EXPORT int64_t GenRandLongLong(int64_t randMin, int64_t randMax); +DM_EXPORT uint16_t GenRandUint(uint16_t randMin, uint16_t randMax); +DM_EXPORT uint16_t GenUniqueRandUint(std::set &randUint16Set); } // namespace DistributedHardware } // namespace OHOS diff --git a/utils/include/fwkload/standard/dm_distributed_hardware_load.h b/utils/include/fwkload/standard/dm_distributed_hardware_load.h index b0c17a914..c9ac3c548 100644 --- a/utils/include/fwkload/standard/dm_distributed_hardware_load.h +++ b/utils/include/fwkload/standard/dm_distributed_hardware_load.h @@ -31,7 +31,7 @@ public: class DmDistributedHardwareLoad { DM_DECLARE_SINGLE_INSTANCE(DmDistributedHardwareLoad); public: - EXPORT void LoadDistributedHardwareFwk(void); + DM_EXPORT void LoadDistributedHardwareFwk(void); void InitDistributedHardwareLoadCount(void); uint32_t GetDistributedHardwareLoadCount(void); private: diff --git a/utils/include/kvadapter/kv_adapter_manager.h b/utils/include/kvadapter/kv_adapter_manager.h index dde193fcf..18e28b356 100644 --- a/utils/include/kvadapter/kv_adapter_manager.h +++ b/utils/include/kvadapter/kv_adapter_manager.h @@ -31,13 +31,13 @@ namespace DistributedHardware { class KVAdapterManager { DM_DECLARE_SINGLE_INSTANCE_BASE(KVAdapterManager); public: - EXPORT int32_t Init(); - EXPORT void UnInit(); - EXPORT void ReInit(); + DM_EXPORT int32_t Init(); + DM_EXPORT void UnInit(); + DM_EXPORT void ReInit(); int32_t PutByAnoyDeviceId(const std::string &key, const DmKVValue &value); - EXPORT int32_t Get(const std::string &key, DmKVValue &value); - EXPORT int32_t DeleteAgedEntry(); - EXPORT int32_t AppUnintall(const std::string &appId); + DM_EXPORT int32_t Get(const std::string &key, DmKVValue &value); + DM_EXPORT int32_t DeleteAgedEntry(); + DM_EXPORT int32_t AppUnintall(const std::string &appId); private: KVAdapterManager() = default; diff --git a/utils/include/timer/dm_timer.h b/utils/include/timer/dm_timer.h index 52ee3cf4a..b1bf2f4bc 100644 --- a/utils/include/timer/dm_timer.h +++ b/utils/include/timer/dm_timer.h @@ -26,9 +26,9 @@ #include "ffrt.h" -#ifndef EXPORT -#define EXPORT __attribute__ ((visibility ("default"))) -#endif // EXPORT +#ifndef DM_EXPORT +#define DM_EXPORT __attribute__ ((visibility ("default"))) +#endif // DM_EXPORT namespace OHOS { namespace DistributedHardware { @@ -36,15 +36,15 @@ using TimerCallback = std::function; class DmTimer { public: - EXPORT DmTimer(); - EXPORT ~DmTimer(); + DM_EXPORT DmTimer(); + DM_EXPORT ~DmTimer(); /** * @tc.name: DmTimer::StartTimer * @tc.desc: start timer running * @tc.type: FUNC */ - EXPORT int32_t StartTimer(std::string name, int32_t timeOut, + DM_EXPORT int32_t StartTimer(std::string name, int32_t timeOut, TimerCallback callback); /** @@ -52,14 +52,14 @@ public: * @tc.desc: delete timer * @tc.type: FUNC */ - EXPORT int32_t DeleteTimer(std::string timerName); + DM_EXPORT int32_t DeleteTimer(std::string timerName); /** * @tc.name: DmTimer::DeleteAll * @tc.desc: delete all timer * @tc.type: FUNC */ - EXPORT int32_t DeleteAll(); + DM_EXPORT int32_t DeleteAll(); private: mutable std::mutex timerMutex_; diff --git a/utils/src/appInfo/standard/app_manager.cpp b/utils/src/appInfo/standard/app_manager.cpp index 5ed61dee5..25a734ce0 100644 --- a/utils/src/appInfo/standard/app_manager.cpp +++ b/utils/src/appInfo/standard/app_manager.cpp @@ -70,7 +70,7 @@ const std::string AppManager::GetAppId() return appId; } -EXPORT void AppManager::RegisterCallerAppId(const std::string &pkgName) +DM_EXPORT void AppManager::RegisterCallerAppId(const std::string &pkgName) { if (pkgName.empty()) { LOGE("Invalid parameter, pkgName is empty."); @@ -86,7 +86,7 @@ EXPORT void AppManager::RegisterCallerAppId(const std::string &pkgName) appIdMap_[pkgName] = appId; } -EXPORT void AppManager::UnRegisterCallerAppId(const std::string &pkgName) +DM_EXPORT void AppManager::UnRegisterCallerAppId(const std::string &pkgName) { if (pkgName.empty()) { LOGE("Invalid parameter, pkgName is empty."); @@ -153,13 +153,13 @@ bool AppManager::IsSystemSA() return false; } -EXPORT bool AppManager::IsSystemApp() +DM_EXPORT bool AppManager::IsSystemApp() { uint64_t fullTokenId = IPCSkeleton::GetCallingFullTokenID(); return OHOS::Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(fullTokenId); } -EXPORT int32_t AppManager::GetCallerName(bool isSystemSA, std::string &callerName) +DM_EXPORT int32_t AppManager::GetCallerName(bool isSystemSA, std::string &callerName) { AccessTokenID tokenCaller = IPCSkeleton::GetCallingTokenID(); if (tokenCaller == 0) { @@ -191,7 +191,7 @@ EXPORT int32_t AppManager::GetCallerName(bool isSystemSA, std::string &callerNam return DM_OK; } -EXPORT int32_t AppManager::GetNativeTokenIdByName(std::string &processName, +DM_EXPORT int32_t AppManager::GetNativeTokenIdByName(std::string &processName, int64_t &tokenId) { AccessTokenID nativeTokenId = AccessTokenKit::GetNativeTokenId(processName); @@ -203,7 +203,7 @@ EXPORT int32_t AppManager::GetNativeTokenIdByName(std::string &processName, return DM_OK; } -EXPORT int32_t AppManager::GetHapTokenIdByName(int32_t userId, +DM_EXPORT int32_t AppManager::GetHapTokenIdByName(int32_t userId, std::string &bundleName, int32_t instIndex, int64_t &tokenId) { auto hapTokenId = AccessTokenKit::GetHapTokenID(userId, bundleName, instIndex); @@ -215,7 +215,7 @@ EXPORT int32_t AppManager::GetHapTokenIdByName(int32_t userId, return DM_OK; } -EXPORT int32_t AppManager::GetCallerProcessName(std::string &processName) +DM_EXPORT int32_t AppManager::GetCallerProcessName(std::string &processName) { AccessTokenID tokenCaller = IPCSkeleton::GetCallingTokenID(); if (tokenCaller == 0) { diff --git a/utils/src/crypto/dm_crypto.cpp b/utils/src/crypto/dm_crypto.cpp index 6d2ec638d..ea7497c2d 100644 --- a/utils/src/crypto/dm_crypto.cpp +++ b/utils/src/crypto/dm_crypto.cpp @@ -64,7 +64,7 @@ void Crypto::DmGenerateStrHash(const void *data, size_t dataSize, unsigned char SHA256_Final(&outBuf[startIndex], &ctx); } -EXPORT int32_t Crypto::ConvertBytesToHexString(char *outBuf, uint32_t outBufLen, +DM_EXPORT int32_t Crypto::ConvertBytesToHexString(char *outBuf, uint32_t outBufLen, const unsigned char *inBuf, uint32_t inLen) { if ((outBuf == nullptr) || (inBuf == nullptr) || (outBufLen < HexifyLen(inLen))) { @@ -124,7 +124,7 @@ int32_t Crypto::GetUdidHash(const std::string &udid, unsigned char *udidHash) return DM_OK; } -EXPORT int32_t Crypto::ConvertHexStringToBytes(unsigned char *outBuf, +DM_EXPORT int32_t Crypto::ConvertHexStringToBytes(unsigned char *outBuf, uint32_t outBufLen, const char *inBuf, uint32_t inLen) { (void)outBufLen; @@ -164,7 +164,7 @@ EXPORT int32_t Crypto::ConvertHexStringToBytes(unsigned char *outBuf, return DM_OK; } -EXPORT std::string Crypto::GetGroupIdHash(const std::string &groupId) +DM_EXPORT std::string Crypto::GetGroupIdHash(const std::string &groupId) { unsigned char hash[SHA256_DIGEST_LENGTH] = ""; DmGenerateStrHash(groupId.data(), groupId.size(), hash, SHA256_DIGEST_LENGTH, 0); @@ -211,7 +211,7 @@ std::string Crypto::GetHashWithSalt(const std::string &text, const std::string & return Crypto::Sha256(rawText); } -EXPORT int32_t Crypto::GetAccountIdHash(const std::string &accountId, +DM_EXPORT int32_t Crypto::GetAccountIdHash(const std::string &accountId, unsigned char *accountIdHash) { unsigned char hash[SHA256_DIGEST_LENGTH] = ""; @@ -225,7 +225,7 @@ EXPORT int32_t Crypto::GetAccountIdHash(const std::string &accountId, } #if !(defined(__LITEOS_M__) || defined(LITE_DEVICE)) -EXPORT int32_t Crypto::ConvertUdidHashToAnoyAndSave(const std::string &appId, +DM_EXPORT int32_t Crypto::ConvertUdidHashToAnoyAndSave(const std::string &appId, const std::string &udidHash, DmKVValue &kvValue) { if (GetAnoyDeviceInfo(appId, udidHash, kvValue) == DM_OK) { @@ -242,7 +242,7 @@ EXPORT int32_t Crypto::ConvertUdidHashToAnoyAndSave(const std::string &appId, return DM_OK; } -EXPORT int32_t Crypto::ConvertUdidHashToAnoyDeviceId(const std::string &appId, +DM_EXPORT int32_t Crypto::ConvertUdidHashToAnoyDeviceId(const std::string &appId, const std::string &udidHash, DmKVValue &kvValue) { LOGI("start."); diff --git a/utils/src/dm_random.cpp b/utils/src/dm_random.cpp index 4c8f8375a..d14c4b73d 100644 --- a/utils/src/dm_random.cpp +++ b/utils/src/dm_random.cpp @@ -44,7 +44,7 @@ int32_t GenRandInt(int32_t randMin, int32_t randMax) #endif } -EXPORT int64_t GenRandLongLong(int64_t randMin, int64_t randMax) +DM_EXPORT int64_t GenRandLongLong(int64_t randMin, int64_t randMax) { std::random_device randDevice; std::mt19937 genRand(randDevice()); diff --git a/utils/src/fwkload/standard/dm_distributed_hardware_load.cpp b/utils/src/fwkload/standard/dm_distributed_hardware_load.cpp index 428a146a5..a3465cbba 100644 --- a/utils/src/fwkload/standard/dm_distributed_hardware_load.cpp +++ b/utils/src/fwkload/standard/dm_distributed_hardware_load.cpp @@ -25,7 +25,7 @@ namespace DistributedHardware { DM_IMPLEMENT_SINGLE_INSTANCE(DmDistributedHardwareLoad); constexpr uint32_t MAX_LOAD_VALUE = 3; constexpr int32_t DM_OK = 0; -EXPORT void DmDistributedHardwareLoad::LoadDistributedHardwareFwk(void) +DM_EXPORT void DmDistributedHardwareLoad::LoadDistributedHardwareFwk(void) { LOGI("enter DmDistributedHardwareLoad::LoadDistributedHardwareFwk"); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); diff --git a/utils/src/kvadapter/kv_adapter_manager.cpp b/utils/src/kvadapter/kv_adapter_manager.cpp index 51dc4ece2..8bd979267 100644 --- a/utils/src/kvadapter/kv_adapter_manager.cpp +++ b/utils/src/kvadapter/kv_adapter_manager.cpp @@ -35,7 +35,7 @@ constexpr int64_t MAX_SUPPORTED_EXIST_TIME = 3 * 24 * 60 * 60; // 3days DM_IMPLEMENT_SINGLE_INSTANCE(KVAdapterManager); -EXPORT int32_t KVAdapterManager::Init() +DM_EXPORT int32_t KVAdapterManager::Init() { LOGI("Init Kv-Adapter manager"); { @@ -46,7 +46,7 @@ EXPORT int32_t KVAdapterManager::Init() return kvAdapter_->Init(); } -EXPORT void KVAdapterManager::UnInit() +DM_EXPORT void KVAdapterManager::UnInit() { LOGI("Uninit Kv-Adapter manager"); CHECK_NULL_VOID(kvAdapter_); @@ -54,7 +54,7 @@ EXPORT void KVAdapterManager::UnInit() kvAdapter_ = nullptr; } -EXPORT void KVAdapterManager::ReInit() +DM_EXPORT void KVAdapterManager::ReInit() { LOGI("Re init kv adapter"); CHECK_NULL_VOID(kvAdapter_); @@ -88,7 +88,7 @@ int32_t KVAdapterManager::PutByAnoyDeviceId(const std::string &key, const DmKVVa return DM_OK; } -EXPORT int32_t KVAdapterManager::Get(const std::string &key, DmKVValue &value) +DM_EXPORT int32_t KVAdapterManager::Get(const std::string &key, DmKVValue &value) { std::string dmKey = DM_KV_STORE_PREFIX + key; std::lock_guard lock(idCacheMapMtx_); @@ -110,7 +110,7 @@ EXPORT int32_t KVAdapterManager::Get(const std::string &key, DmKVValue &value) return DM_OK; } -EXPORT int32_t KVAdapterManager::DeleteAgedEntry() +DM_EXPORT int32_t KVAdapterManager::DeleteAgedEntry() { int64_t nowTime = GetSecondsSince1970ToNow(); std::lock_guard lock(idCacheMapMtx_); @@ -129,7 +129,7 @@ inline bool KVAdapterManager::IsTimeOut(int64_t sourceTime, int64_t targetTime, return targetTime - sourceTime >= timeOut ? true : false; } -EXPORT int32_t KVAdapterManager::AppUnintall(const std::string &appId) +DM_EXPORT int32_t KVAdapterManager::AppUnintall(const std::string &appId) { LOGI("appId %{public}s.", GetAnonyString(appId).c_str()); std::lock_guard lock(idCacheMapMtx_); diff --git a/utils/src/timer/dm_timer.cpp b/utils/src/timer/dm_timer.cpp index b0049e9b8..a41c1fdd1 100644 --- a/utils/src/timer/dm_timer.cpp +++ b/utils/src/timer/dm_timer.cpp @@ -85,7 +85,7 @@ int32_t DmTimer::DeleteTimer(std::string timerName) return DM_OK; } -EXPORT int32_t DmTimer::DeleteAll() +DM_EXPORT int32_t DmTimer::DeleteAll() { LOGI("DmTimer DeleteAll start"); std::lock_guard locker(timerMutex_); -- Gitee From cbad0fb9d6787d685fae0972c036cc5a7d66f8c6 Mon Sep 17 00:00:00 2001 From: BrainL Date: Thu, 10 Apr 2025 09:30:26 +0800 Subject: [PATCH 2/4] modify defination Signed-off-by: BrainL --- json/src/json_object_cjson.cpp | 2 +- services/service/include/device_manager_service_listener.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/json/src/json_object_cjson.cpp b/json/src/json_object_cjson.cpp index 3cf1bbcad..76b3a4aeb 100644 --- a/json/src/json_object_cjson.cpp +++ b/json/src/json_object_cjson.cpp @@ -204,7 +204,7 @@ void FromJson(const JsonItemObject &itemObject, uint32_t &value) value = static_cast(tmpValue); } -DM_EXPORT void FromJson(const JsonItemObject &itemObject, int64_t &value) +void FromJson(const JsonItemObject &itemObject, int64_t &value) { itemObject.GetTo(value); } diff --git a/services/service/include/device_manager_service_listener.h b/services/service/include/device_manager_service_listener.h index e616b606a..5a0e457d6 100644 --- a/services/service/include/device_manager_service_listener.h +++ b/services/service/include/device_manager_service_listener.h @@ -36,7 +36,7 @@ namespace OHOS { namespace DistributedHardware { -class DeviceManagerServiceListener : public IDeviceManagerServiceListener { +class DM_EXPORT DeviceManagerServiceListener : public IDeviceManagerServiceListener { public: DeviceManagerServiceListener() {}; virtual ~DeviceManagerServiceListener() {}; -- Gitee From 304805af789ab9abf31294f97a2db115568c5505 Mon Sep 17 00:00:00 2001 From: BrainL Date: Thu, 10 Apr 2025 15:21:58 +0800 Subject: [PATCH 3/4] modify warning Signed-off-by: BrainL --- commondependency/src/deviceprofile_connector.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/commondependency/src/deviceprofile_connector.cpp b/commondependency/src/deviceprofile_connector.cpp index 083d8855f..0bcacd20a 100644 --- a/commondependency/src/deviceprofile_connector.cpp +++ b/commondependency/src/deviceprofile_connector.cpp @@ -434,8 +434,7 @@ DM_EXPORT std::vector DeviceProfileConnector::SyncAclByBindType( return bindType; } -DM_EXPORT -std::vector DeviceProfileConnector::GetProcessInfoFromAclByUserId( +DM_EXPORT std::vector DeviceProfileConnector::GetProcessInfoFromAclByUserId( const std::string &localDeviceId, const std::string &targetDeviceId, int32_t userId) { std::vector filterProfiles = GetAclProfileByUserId(localDeviceId, -- Gitee From 0da77ec241778bd0f6e1597a30fef739b965b447 Mon Sep 17 00:00:00 2001 From: BrainL Date: Mon, 21 Apr 2025 10:35:10 +0800 Subject: [PATCH 4/4] modify Signed-off-by: BrainL --- .../include/deviceprofile_connector.h | 30 +++++++++---------- .../src/deviceprofile_connector.cpp | 30 +++++++++---------- .../src/multiple_user_connector.cpp | 8 ++--- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/commondependency/include/deviceprofile_connector.h b/commondependency/include/deviceprofile_connector.h index 29cc0fdbf..bbdea4326 100644 --- a/commondependency/include/deviceprofile_connector.h +++ b/commondependency/include/deviceprofile_connector.h @@ -148,7 +148,7 @@ public: const std::string &remoteDeviceId, int32_t bindLevel, const std::string &extra); DM_EXPORT std::vector GetAccessControlProfile(); - EXPORT DmOfflineParam HandleServiceUnBindEvent(int32_t remoteUserId, + DM_EXPORT DmOfflineParam HandleServiceUnBindEvent(int32_t remoteUserId, const std::string &remoteUdid, const std::string &localUdid, int32_t tokenId); std::vector GetAccessControlProfileByUserId(int32_t userId); std::vector GetAclProfileByDeviceIdAndUserId( @@ -269,17 +269,17 @@ public: int32_t HandleUserStop(int32_t stopUserId, const std::string &stopEventUdid); int32_t HandleUserStop(int32_t stopUserId, const std::string &localUdid, const std::vector &acceptEventUdids); - EXPORT std::string IsAuthNewVersion(int32_t bindLevel, std::string localUdid, std::string remoteUdid, + DM_EXPORT std::string IsAuthNewVersion(int32_t bindLevel, std::string localUdid, std::string remoteUdid, int32_t tokenId, int32_t userId); std::vector GetAclProfileByDeviceIdAndUserId( const std::string &deviceId, int32_t userId, const std::string &remoteDeviceId); - EXPORT std::vector GetAclList(const std::string localUdid, + DM_EXPORT std::vector GetAclList(const std::string localUdid, int32_t localUserId, const std::string remoteUdid, int32_t remoteUserId); - EXPORT bool ChecksumAcl(DistributedDeviceProfile::AccessControlProfile &acl, + DM_EXPORT bool ChecksumAcl(DistributedDeviceProfile::AccessControlProfile &acl, std::vector &acLStrList); - EXPORT std::string AccessToStr(DistributedDeviceProfile::AccessControlProfile acl); - EXPORT int32_t GetVersionByExtra(std::string &extraInfo, std::string &dmVersion); - EXPORT void GetAllVerionAclMap(DistributedDeviceProfile::AccessControlProfile &acl, + DM_EXPORT std::string AccessToStr(DistributedDeviceProfile::AccessControlProfile acl); + DM_EXPORT int32_t GetVersionByExtra(std::string &extraInfo, std::string &dmVersion); + DM_EXPORT void GetAllVerionAclMap(DistributedDeviceProfile::AccessControlProfile &acl, std::map> &aclMap, std::string dmVersion = ""); void GenerateAclHash(DistributedDeviceProfile::AccessControlProfile &acl, std::map> &aclMap, const std::string &dmVersion); @@ -292,17 +292,17 @@ public: * @param dmVersion target dm version * @return EXPORT 0 for success */ - EXPORT int32_t GetAclListHashStr(const DevUserInfo &localDevUserInfo, + DM_EXPORT int32_t GetAclListHashStr(const DevUserInfo &localDevUserInfo, const DevUserInfo &remoteDevUserInfo, std::string &aclListHash, std::string dmVersion = ""); - EXPORT bool IsLnnAcl(const DistributedDeviceProfile::AccessControlProfile &profile); - EXPORT void CacheAcerAclId(const DistributedDeviceProfile::AccessControlProfile &profile, + DM_EXPORT bool IsLnnAcl(const DistributedDeviceProfile::AccessControlProfile &profile); + DM_EXPORT void CacheAcerAclId(const DistributedDeviceProfile::AccessControlProfile &profile, DmOfflineParam &offlineParam); - EXPORT void CacheAceeAclId(const DistributedDeviceProfile::AccessControlProfile &profile, + DM_EXPORT void CacheAceeAclId(const DistributedDeviceProfile::AccessControlProfile &profile, DmOfflineParam &offlineParam); - EXPORT void AclHashItemToJson(JsonItemObject &itemObject, const AclHashItem &value); - EXPORT void AclHashVecToJson(JsonItemObject &itemObject, const std::vector &values); - EXPORT void AclHashItemFromJson(const JsonItemObject &itemObject, AclHashItem &value); - EXPORT void AclHashVecFromJson(const JsonItemObject &itemObject, std::vector &values); + DM_EXPORT void AclHashItemToJson(JsonItemObject &itemObject, const AclHashItem &value); + DM_EXPORT void AclHashVecToJson(JsonItemObject &itemObject, const std::vector &values); + DM_EXPORT void AclHashItemFromJson(const JsonItemObject &itemObject, AclHashItem &value); + DM_EXPORT void AclHashVecFromJson(const JsonItemObject &itemObject, std::vector &values); void DeleteCacheAcl(std::vector delAclIdVec, std::vector &profiles); private: diff --git a/commondependency/src/deviceprofile_connector.cpp b/commondependency/src/deviceprofile_connector.cpp index 55f3b7e23..877b9eb9f 100644 --- a/commondependency/src/deviceprofile_connector.cpp +++ b/commondependency/src/deviceprofile_connector.cpp @@ -57,7 +57,7 @@ const std::string DM_VERSION_STR_5_1_0 = DM_VERSION_5_1_0; const std::vector DM_SUPPORT_ACL_AGING_VERSIONS = {DM_VERSION_STR_5_1_0}; } DM_IMPLEMENT_SINGLE_INSTANCE(DeviceProfileConnector); -EXPORT int32_t DeviceProfileConnector::GetVersionByExtra(std::string &extraInfo, std::string &dmVersion) +DM_EXPORT int32_t DeviceProfileConnector::GetVersionByExtra(std::string &extraInfo, std::string &dmVersion) { JsonObject extraInfoJson(extraInfo); if (extraInfoJson.IsDiscarded()) { @@ -72,7 +72,7 @@ EXPORT int32_t DeviceProfileConnector::GetVersionByExtra(std::string &extraInfo, return DM_OK; } -EXPORT void DeviceProfileConnector::GetAllVerionAclMap(DistributedDeviceProfile::AccessControlProfile &acl, +DM_EXPORT void DeviceProfileConnector::GetAllVerionAclMap(DistributedDeviceProfile::AccessControlProfile &acl, std::map> &aclMap, std::string dmVersion) { std::vector needGenVersions = {}; @@ -124,7 +124,7 @@ void DeviceProfileConnector::GenerateAclHash(DistributedDeviceProfile::AccessCon } } -EXPORT int32_t DeviceProfileConnector::GetAclListHashStr(const DevUserInfo &localDevUserInfo, +DM_EXPORT int32_t DeviceProfileConnector::GetAclListHashStr(const DevUserInfo &localDevUserInfo, const DevUserInfo &remoteDevUserInfo, std::string &aclListHash, std::string dmVersion) { std::map> aclMap; @@ -159,7 +159,7 @@ EXPORT int32_t DeviceProfileConnector::GetAclListHashStr(const DevUserInfo &loca return DM_OK; } -EXPORT void DeviceProfileConnector::AclHashItemToJson(JsonItemObject &itemObject, const AclHashItem &value) +DM_EXPORT void DeviceProfileConnector::AclHashItemToJson(JsonItemObject &itemObject, const AclHashItem &value) { itemObject[TAG_ACL_HASH_KEY_VERSION] = value.version; JsonObject hashList(JsonCreateType::JSON_CREATE_TYPE_ARRAY); @@ -169,7 +169,7 @@ EXPORT void DeviceProfileConnector::AclHashItemToJson(JsonItemObject &itemObject itemObject[TAG_ACL_HASH_KEY_ACLHASHLIST] = hashList.Dump(); } -EXPORT void DeviceProfileConnector::AclHashVecToJson(JsonItemObject &itemObject, const std::vector &values) +DM_EXPORT void DeviceProfileConnector::AclHashVecToJson(JsonItemObject &itemObject, const std::vector &values) { for (const auto &val : values) { JsonObject object; @@ -178,7 +178,7 @@ EXPORT void DeviceProfileConnector::AclHashVecToJson(JsonItemObject &itemObject, } } -EXPORT void DeviceProfileConnector::AclHashItemFromJson(const JsonItemObject &itemObject, AclHashItem &value) +DM_EXPORT void DeviceProfileConnector::AclHashItemFromJson(const JsonItemObject &itemObject, AclHashItem &value) { value.version = itemObject[TAG_ACL_HASH_KEY_VERSION].Get(); std::string hashListStr = itemObject[TAG_ACL_HASH_KEY_ACLHASHLIST].Get(); @@ -189,7 +189,7 @@ EXPORT void DeviceProfileConnector::AclHashItemFromJson(const JsonItemObject &it } } -EXPORT void DeviceProfileConnector::AclHashVecFromJson(const JsonItemObject &itemObject, +DM_EXPORT void DeviceProfileConnector::AclHashVecFromJson(const JsonItemObject &itemObject, std::vector &values) { for (auto const &item : itemObject.Items()) { @@ -201,7 +201,7 @@ EXPORT void DeviceProfileConnector::AclHashVecFromJson(const JsonItemObject &ite } } -EXPORT bool DeviceProfileConnector::ChecksumAcl(DistributedDeviceProfile::AccessControlProfile &acl, +DM_EXPORT bool DeviceProfileConnector::ChecksumAcl(DistributedDeviceProfile::AccessControlProfile &acl, std::vector &acLStrList) { std::string aclStr = AccessToStr(acl); @@ -209,7 +209,7 @@ EXPORT bool DeviceProfileConnector::ChecksumAcl(DistributedDeviceProfile::Access return (aclIter != acLStrList.end()); } -EXPORT std::string DeviceProfileConnector::AccessToStr(DistributedDeviceProfile::AccessControlProfile acl) +DM_EXPORT std::string DeviceProfileConnector::AccessToStr(DistributedDeviceProfile::AccessControlProfile acl) { std::string aclStr = ""; DistributedDeviceProfile::Accesser accesser = acl.GetAccesser(); @@ -238,7 +238,7 @@ EXPORT std::string DeviceProfileConnector::AccessToStr(DistributedDeviceProfile: return aclStr; } -EXPORT std::vector DeviceProfileConnector::GetAclList( +DM_EXPORT std::vector DeviceProfileConnector::GetAclList( const std::string localUdid, int32_t localUserId, const std::string remoteUdid, int32_t remoteUserId) { std::vector profiles = @@ -266,7 +266,7 @@ EXPORT std::vector DeviceProfile return aclList; } -EXPORT std::string DeviceProfileConnector::IsAuthNewVersion(int32_t bindLevel, std::string localUdid, +DM_EXPORT std::string DeviceProfileConnector::IsAuthNewVersion(int32_t bindLevel, std::string localUdid, std::string remoteUdid, int32_t tokenId, int32_t userId) { LOGI("localUdid %{public}s, remoteUdid %{public}s, bindLevel %{public}d.", @@ -336,7 +336,7 @@ std::string DeviceProfileConnector::GetDeviceAuthVersionInfo(std::string localUd } return ""; } -EXPORT DmOfflineParam DeviceProfileConnector::FilterNeedDeleteACL(uint32_t tokenId, +DM_EXPORT DmOfflineParam DeviceProfileConnector::FilterNeedDeleteACL(uint32_t tokenId, const std::string &localDeviceId, const std::string &remoteDeviceId, int32_t bindLevel, const std::string &extra) { LOGI("localDeviceId %{public}s, remoteDeviceId %{public}s, bindLevel %{public}d.", @@ -2751,7 +2751,7 @@ int32_t DeviceProfileConnector::HandleUserStop(int32_t stopUserId, const std::st return DM_OK; } -EXPORT bool DeviceProfileConnector::IsLnnAcl(const DistributedDeviceProfile::AccessControlProfile &profile) +DM_EXPORT bool DeviceProfileConnector::IsLnnAcl(const DistributedDeviceProfile::AccessControlProfile &profile) { std::string extraData = profile.GetExtraData(); if (extraData.empty()) { @@ -2768,7 +2768,7 @@ EXPORT bool DeviceProfileConnector::IsLnnAcl(const DistributedDeviceProfile::Acc return isLnnAclStr == isLnnAclTrue; } -EXPORT void DeviceProfileConnector::CacheAcerAclId(const DistributedDeviceProfile::AccessControlProfile &profile, +DM_EXPORT void DeviceProfileConnector::CacheAcerAclId(const DistributedDeviceProfile::AccessControlProfile &profile, DmOfflineParam &offlineParam) { DmAclIdParam dmAclIdParam; @@ -2780,7 +2780,7 @@ EXPORT void DeviceProfileConnector::CacheAcerAclId(const DistributedDeviceProfil offlineParam.dmAclIdParamVec.push_back(dmAclIdParam); } -EXPORT void DeviceProfileConnector::CacheAceeAclId(const DistributedDeviceProfile::AccessControlProfile &profile, +DM_EXPORT void DeviceProfileConnector::CacheAceeAclId(const DistributedDeviceProfile::AccessControlProfile &profile, DmOfflineParam &offlineParam) { DmAclIdParam dmAclIdParam; diff --git a/commondependency/src/multiple_user_connector.cpp b/commondependency/src/multiple_user_connector.cpp index 00e02bb8f..3121e2149 100644 --- a/commondependency/src/multiple_user_connector.cpp +++ b/commondependency/src/multiple_user_connector.cpp @@ -122,7 +122,7 @@ void MultipleUserConnector::GetTokenIdAndForegroundUserId(uint32_t &tokenId, int userId = GetFirstForegroundUserId(); } -EXPORT void MultipleUserConnector::GetTokenId(uint32_t &tokenId) +DM_EXPORT void MultipleUserConnector::GetTokenId(uint32_t &tokenId) { #if !(defined(__LITEOS_M__) || defined(LITE_DEVICE)) tokenId = OHOS::IPCSkeleton::GetCallingTokenID(); @@ -372,7 +372,7 @@ DM_EXPORT void MultipleUserConnector::ClearLockedUser( } } -EXPORT DMAccountInfo MultipleUserConnector::GetCurrentDMAccountInfo() +DM_EXPORT DMAccountInfo MultipleUserConnector::GetCurrentDMAccountInfo() { DMAccountInfo dmAccountInfo; dmAccountInfo.accountId = GetOhosAccountId(); @@ -380,7 +380,7 @@ EXPORT DMAccountInfo MultipleUserConnector::GetCurrentDMAccountInfo() return dmAccountInfo; } -EXPORT void MultipleUserConnector::GetCallingTokenId(uint32_t &tokenId) +DM_EXPORT void MultipleUserConnector::GetCallingTokenId(uint32_t &tokenId) { #if !(defined(__LITEOS_M__) || defined(LITE_DEVICE)) tokenId = OHOS::IPCSkeleton::GetCallingTokenID(); @@ -389,7 +389,7 @@ EXPORT void MultipleUserConnector::GetCallingTokenId(uint32_t &tokenId) #endif } -EXPORT int32_t MultipleUserConnector::GetUserIdByDisplayId(uint64_t displayId) +DM_EXPORT int32_t MultipleUserConnector::GetUserIdByDisplayId(uint64_t displayId) { LOGI("displayId %{public}" PRIu64, displayId); int32_t userId = -1; -- Gitee