diff --git a/common/include/dfx/standard/dm_hisysevent.h b/common/include/dfx/standard/dm_hisysevent.h index c65b2198252f1f44df5fc1b9bc9d935c9a1062f7..2b422e7b4f4a68d6e47b62392fd9d1ec1febfae8 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 4fbae9444cfe6428d456bdccdba30b8f6a0494f8..260e8c57f2ab881bb85905c9b7aa3052b97e5dd2 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 3a6f331c322fa565597802e66fe6c965875cb3d9..2e3647104bc0bd5ab19c75e6b1899e993a2bdb4a 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 IsUint64(const JsonItemObject &jsonObj, const std::string &key); @@ -103,7 +103,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 d3d5b82d9d270db7690f71ba4f970d7bb6466fec..97cff53bbc843c491e9b7ecd08fbfb7a114b5062 100755 --- a/common/include/dm_constants.h +++ b/common/include/dm_constants.h @@ -20,141 +20,141 @@ #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 MIN_PINCODE_SIZE; +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 MIN_PINCODE_SIZE; // 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 { @@ -164,9 +164,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; EXPORT extern const char* ACL_IS_LNN_ACL_KEY; diff --git a/common/include/dm_single_instance.h b/common/include/dm_single_instance.h index 18720862af0483f155f4dc4514bdf7caf1da45e6..11da29f4e419ba03dba4ba2865aab6da158548e9 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 fdc5f5e359054ce9bae245396abf43bfa1f4c01d..6a4c57063858fbc04dd12083749ecc90d63bac63 100644 --- a/common/src/dm_anonymous.cpp +++ b/common/src/dm_anonymous.cpp @@ -396,7 +396,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 a7c10452a0913ed9b51b6bcbcc8ab5478554cdac..bbdea43269f9ba1d3b09ad692a2e25a86147752d 100644 --- a/commondependency/include/deviceprofile_connector.h +++ b/commondependency/include/deviceprofile_connector.h @@ -31,19 +31,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; -EXPORT extern const uint32_t SERVICE_PEER_TO_PEER_TYPE; -EXPORT extern const uint32_t SERVICE_ACROSS_ACCOUNT_TYPE; -EXPORT extern const uint32_t DM_INVALIED_TYPE; -EXPORT extern const uint32_t USER; -EXPORT extern const uint32_t SERVICE; -EXPORT extern const uint32_t APP; +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; +DM_EXPORT extern const uint32_t SERVICE_PEER_TO_PEER_TYPE; +DM_EXPORT extern const uint32_t SERVICE_ACROSS_ACCOUNT_TYPE; + +DM_EXPORT extern const uint32_t DM_INVALIED_TYPE; +DM_EXPORT extern const uint32_t USER; +DM_EXPORT extern const uint32_t SERVICE; +DM_EXPORT extern const uint32_t APP; extern const char* TAG_PEER_BUNDLE_NAME; extern const char* TAG_PEER_TOKENID; @@ -142,138 +143,143 @@ public: class DeviceProfileConnector : public IDeviceProfileConnector { DM_DECLARE_SINGLE_INSTANCE(DeviceProfileConnector); public: - EXPORT DmOfflineParam FilterNeedDeleteACL(uint32_t tokenId, const std::string &localDeviceId, + + DM_EXPORT DmOfflineParam FilterNeedDeleteACL(uint32_t tokenId, const std::string &localDeviceId, const std::string &remoteDeviceId, int32_t bindLevel, const std::string &extra); - EXPORT std::vector + 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( 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, DmOfflineParam &offlineParam); - 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, DmOfflineParam &offlineParam); - EXPORT void DeleteAclForRemoteUserRemoved(std::string peerUdid, + DM_EXPORT void DeleteAclForRemoteUserRemoved(std::string peerUdid, int32_t peerUserId, std::vector &userIds, DmOfflineParam &offlineParam); - 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, DmOfflineParam &offlineParam); - EXPORT int32_t GetTrustNumber(const std::string &deviceId); + + DM_EXPORT uint32_t DeleteTimeOutAcl(const std::string &deviceId, DmOfflineParam &offlineParam); + 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, const std::string &remoteUdid, + + DM_EXPORT int32_t HandleDevUnBindEvent(int32_t remoteUserId, const std::string &remoteUdid, const std::string &localUdid, DmOfflineParam &offlineParam); - EXPORT DmOfflineParam HandleAppUnBindEvent(int32_t remoteUserId, const std::string &remoteUdid, + DM_EXPORT DmOfflineParam HandleAppUnBindEvent(int32_t remoteUserId, const std::string &remoteUdid, int32_t tokenId, const std::string &localUdid); - EXPORT DmOfflineParam HandleAppUnBindEvent(int32_t remoteUserId, const std::string &remoteUdid, + 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 std::vector GetAllAclIncludeLnnAcl(); - EXPORT void DeleteAccessControlById(int64_t accessControlId); - EXPORT int32_t HandleUserSwitched(const std::string &localUdid, + DM_EXPORT std::vector GetAllAclIncludeLnnAcl(); + 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 DeleteSessionKey(int32_t userId, int32_t sessionKeyId); - EXPORT int32_t SubscribeDeviceProfileInited( + + DM_EXPORT int32_t DeleteSessionKey(int32_t userId, int32_t sessionKeyId); + 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(int32_t userId, const std::vector &sessionKeyArray, + DM_EXPORT int32_t PutSessionKey(int32_t userId, 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, 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); @@ -286,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/include/multiple_user_connector.h b/commondependency/include/multiple_user_connector.h index 8d24824d98cba452b34d4cb95bf692de1248f9a3..228a5d592bb462d5344a7067cde9ed20c26847e1 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,25 +105,26 @@ 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 GetTokenId(uint32_t &tokenId); - 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 GetTokenId(uint32_t &tokenId); + 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(); - EXPORT static void GetCallingTokenId(uint32_t &tokenId); - EXPORT static int32_t GetUserIdByDisplayId(uint64_t displayId); + DM_EXPORT static DMAccountInfo GetCurrentDMAccountInfo(); + DM_EXPORT static void GetCallingTokenId(uint32_t &tokenId); + DM_EXPORT static int32_t GetUserIdByDisplayId(uint64_t displayId); private: static int32_t oldUserId_; static std::string accountId_; diff --git a/commondependency/src/deviceprofile_connector.cpp b/commondependency/src/deviceprofile_connector.cpp index 5fecc26d072fc710ab6dbfc5a1005772d2467c1b..877b9eb9f423f3f82920b77109ec2d54373836c9 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.", @@ -615,7 +615,7 @@ void DeviceProfileConnector::FilterNeedDeleteDeviceBindLevel(DmOfflineParam &off offlineParam.leftAclNumber = bindNums - deleteNums; } -EXPORT std::vector DeviceProfileConnector::GetAccessControlProfile() +DM_EXPORT std::vector DeviceProfileConnector::GetAccessControlProfile() { std::vector profiles; std::map queryParams; @@ -660,6 +660,7 @@ std::vector DeviceProfileConnector::GetAclProfileByDeviceI return aclProfileVec; } + std::vector DeviceProfileConnector::GetAclProfileByDeviceIdAndUserId(const std::string &deviceId, int32_t userId, const std::string &remoteDeviceId) { @@ -678,7 +679,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(); @@ -806,7 +807,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, @@ -866,7 +867,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(), @@ -888,7 +889,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(); @@ -1008,7 +1009,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 = @@ -1036,7 +1037,8 @@ 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) { @@ -1101,7 +1103,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, DmOfflineParam &offlineParam) { @@ -1146,7 +1148,8 @@ EXPORT bool DeviceProfileConnector::DeleteAclForAccountLogOut( return notifyOffline; } -EXPORT void DeviceProfileConnector::DeleteAclForUserRemoved(std::string localUdid, int32_t userId, + +DM_EXPORT void DeviceProfileConnector::DeleteAclForUserRemoved(std::string localUdid, int32_t userId, std::vector peerUdids, std::multimap &peerUserIdMap, DmOfflineParam &offlineParam) { @@ -1177,7 +1180,8 @@ 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, DmOfflineParam &offlineParam) { LOGI("peerUdid %{public}s, peerUserId %{public}d.", GetAnonyString(peerUdid).c_str(), peerUserId); @@ -1202,7 +1206,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()) { @@ -1450,7 +1454,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(); @@ -1486,7 +1490,8 @@ bool DeviceProfileConnector::CheckDevIdInAclForDevBind(const std::string &pkgNam return (CheckSinkDevIdInAclForDevBind(pkgName, deviceId) || CheckSrcDevIdInAclForDevBind(pkgName, deviceId)); } -EXPORT uint32_t DeviceProfileConnector::DeleteTimeOutAcl(const std::string &deviceId, DmOfflineParam &offlineParam) + +DM_EXPORT uint32_t DeviceProfileConnector::DeleteTimeOutAcl(const std::string &deviceId, DmOfflineParam &offlineParam) { std::vector profiles = GetAllAclIncludeLnnAcl(); LOGI("AccessControlProfile size is %{public}zu", profiles.size()); @@ -1526,6 +1531,7 @@ EXPORT uint32_t DeviceProfileConnector::DeleteTimeOutAcl(const std::string &devi return res; } + bool DeviceProfileConnector::CacheLnnAcl(AccessControlProfile profile, const std::string &localUdid, DmAclIdParam &dmAclIdParam) { @@ -1549,7 +1555,7 @@ bool DeviceProfileConnector::CacheLnnAcl(AccessControlProfile profile, const std return false; } -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()); @@ -1562,7 +1568,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) { @@ -1634,7 +1640,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(), @@ -1873,7 +1879,8 @@ int32_t DeviceProfileConnector::HandleAccountLogoutEvent(int32_t remoteUserId, return bindType; } -EXPORT int32_t DeviceProfileConnector::HandleDevUnBindEvent(int32_t remoteUserId, const std::string &remoteUdid, + +DM_EXPORT int32_t DeviceProfileConnector::HandleDevUnBindEvent(int32_t remoteUserId, const std::string &remoteUdid, const std::string &localUdid, DmOfflineParam &offlineParam) { LOGI("RemoteUserId %{public}d, remoteUdid %{public}s, localUdid %{public}s.", remoteUserId, @@ -1910,7 +1917,8 @@ EXPORT int32_t DeviceProfileConnector::HandleDevUnBindEvent(int32_t remoteUserId return bindType; } -EXPORT DmOfflineParam DeviceProfileConnector::HandleAppUnBindEvent(int32_t remoteUserId, + +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.", @@ -1963,7 +1971,8 @@ EXPORT DmOfflineParam DeviceProfileConnector::HandleAppUnBindEvent(int32_t remot return offlineParam; } -EXPORT DmOfflineParam DeviceProfileConnector::HandleAppUnBindEvent(int32_t remoteUserId, + +DM_EXPORT DmOfflineParam DeviceProfileConnector::HandleAppUnBindEvent(int32_t remoteUserId, const std::string &remoteUdid, int32_t tokenId, const std::string &localUdid, int32_t peerTokenId) { LOGI("RemoteUserId %{public}d, remoteUdid %{public}s, tokenId %{public}d, localUdid %{public}s.", @@ -2063,7 +2072,7 @@ DmOfflineParam DeviceProfileConnector::HandleServiceUnBindEvent(int32_t remoteUs return offlineParam; } -EXPORT std::vector DeviceProfileConnector::GetAllAccessControlProfile() +DM_EXPORT std::vector DeviceProfileConnector::GetAllAccessControlProfile() { std::vector profiles; if (DistributedDeviceProfileClient::GetInstance().GetAllAccessControlProfile(profiles) != DM_OK) { @@ -2072,7 +2081,7 @@ EXPORT std::vector DeviceProfileConnector::GetAllAccessCon return profiles; } -EXPORT std::vector DeviceProfileConnector::GetAllAclIncludeLnnAcl() +DM_EXPORT std::vector DeviceProfileConnector::GetAllAclIncludeLnnAcl() { std::vector profiles; if (DistributedDeviceProfileClient::GetInstance().GetAllAclIncludeLnnAcl(profiles) != DM_OK) { @@ -2081,13 +2090,13 @@ EXPORT std::vector DeviceProfileConnector::GetAllAclInclud 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) { @@ -2125,7 +2134,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) { @@ -2159,7 +2168,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) { @@ -2234,7 +2243,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(), @@ -2268,7 +2277,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) { @@ -2330,7 +2339,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) { @@ -2373,7 +2382,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); @@ -2400,7 +2409,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) { @@ -2430,7 +2439,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 = @@ -2450,7 +2459,7 @@ EXPORT void DeviceProfileConnector::HandleDeviceUnBind(int32_t bindType, } } -EXPORT int32_t DeviceProfileConnector::SubscribeDeviceProfileInited( +DM_EXPORT int32_t DeviceProfileConnector::SubscribeDeviceProfileInited( sptr dpInitedCallback) { LOGI("In"); @@ -2467,7 +2476,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( @@ -2479,7 +2488,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()); @@ -2491,7 +2500,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."); @@ -2660,7 +2669,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) { @@ -2742,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()) { @@ -2759,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; @@ -2771,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 0b6949ea64c7813334d1f49ef65eef7eb02fe479..3121e2149fd8982f6aa95b0d2023680177ccfbfe 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 ""; @@ -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(); @@ -149,7 +149,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; @@ -161,7 +161,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; @@ -185,14 +185,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; { @@ -206,7 +206,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); @@ -215,7 +215,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)) @@ -250,7 +250,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)) @@ -313,7 +313,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 ""; @@ -347,7 +347,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();) { @@ -359,7 +359,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();) { @@ -372,7 +372,7 @@ 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; diff --git a/interfaces/inner_kits/native_cpp/include/device_manager.h b/interfaces/inner_kits/native_cpp/include/device_manager.h index 8c75216bf1ff54e30820df0f69042f139b06922e..d43456e42fbf504e8b104519590124ae76f0d6cd 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 e6fb4a594ded11f6a9cfb52a585b37e7e16d068a..7205b0dbf4a1aa567c2243aa89a1313fbbc56791 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 { @@ -356,16 +356,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 d26f314d99514f7b41a639fdee6df1d2b989b799..76b3a4aeb6804272e6e73e00e2a77bdcda461e01 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) +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 3123d85369e718e08cfc58c317f3be4d5cf0462d..4304b7aebc4c5ec013a5e9ad953a5921065c4568 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 e357d8666fe7e667b6368234ef32a404e98b2505..1ebb66c9e3fd71224915aa046b0d1e72392704b9 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 43d47980d0d50505f62f35aede6576fc5a0d6be5..86914ea72d7c6deb8a57d7d4caddb20398a87d6a 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); @@ -288,14 +288,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); @@ -346,7 +346,7 @@ private: void SubscribePublishCommonEvent(); void QueryDependsSwitchState(); #endif // SUPPORT_BLUETOOTH SUPPORT_WIFI - EXPORT void SubscribeDataShareCommonEvent(); + DM_EXPORT void SubscribeDataShareCommonEvent(); #endif void CheckRegisterInfoWithWise(int32_t curUserId); void NotifyRemoteLocalLogout(const std::vector &peerUdids, @@ -375,7 +375,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 9766358fb77cde194719f2d77c5065abf6940e5e..5a0e457d6b2ad95b501c0a1187527bab6005c2de 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() {}; @@ -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 3cc7595f8fd2492f75396e3281f4b384b03c3ff2..141ea255e566b7bed74940bed148d0879a211668 100644 --- a/services/service/src/device_manager_service.cpp +++ b/services/service/src/device_manager_service.cpp @@ -162,7 +162,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) { @@ -274,7 +274,7 @@ int32_t DeviceManagerService::InitDMServiceListener() return DM_OK; } -EXPORT void DeviceManagerService::UninitDMServiceListener() +DM_EXPORT void DeviceManagerService::UninitDMServiceListener() { listener_ = nullptr; advertiseMgr_ = nullptr; @@ -286,12 +286,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); } @@ -1887,7 +1887,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(), @@ -2367,7 +2367,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 bd4bbaa8ce61a67a46276171f3bf20cc6c8fd717..b0c55b8d6eac448ae299f2313c39684aa5b012d1 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 0947b4404a27f19f92543ffba465d315e09a7d66..d22d4a002971befb2a4bab8fbbbf9e5d2777ae4d 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 b0c17a9141ee101b5d1ee8309b1e620bab5892c7..c9ac3c54846f96becbea8ef29aa5241ea4b0dfda 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 dde193fcf1e25fa1a6420a9e574b54f28bf5b771..18e28b356801c8e54cf97fc8d6f99d8c5a5df9a7 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 52ee3cf4a5addf794bbdf32ca0f5a43adea4668c..b1bf2f4bc28685807bc51eec5c3740cb602adc10 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 5ed61dee5dec98749f6f2b1112ad222115f4534e..25a734ce0bc712b6ad76a3758f39a1054cd9a928 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 015adfa62ad622095f3523cea6e35a1cd9ddad2f..c679b7488342157a26b3f34696cbefbb629919a0 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) { LOGD("start."); diff --git a/utils/src/dm_random.cpp b/utils/src/dm_random.cpp index 4c8f8375afaac4a89e9fa9b558b17640f511a4bd..d14c4b73da9c6acd54ae3c71ff98bd6cea19bfd5 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 428a146a5183ccc6ec29cbf561be19401ee048f8..a3465cbba26ed517d18a0a2580bfbeeabcca59b4 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 51dc4ece27bc1fe7243b3507db2a47b68a6bebfd..8bd979267f3c3945af3d1fa33212ae92b17b8dc9 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 b0049e9b82e86a5c056afdd261f9b63b78047aac..a41c1fdd12e1bf3235e214a650d426fea7699f26 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_);