diff --git a/services/implementation/include/authentication/dm_auth_manager.h b/services/implementation/include/authentication/dm_auth_manager.h index a9631252feb1c1ff7c4579e27af10ec1006cc279..0e07eb948d0b721db392047de0830e5b32551b40 100644 --- a/services/implementation/include/authentication/dm_auth_manager.h +++ b/services/implementation/include/authentication/dm_auth_manager.h @@ -494,9 +494,6 @@ public: static bool IsPinCodeValid(int32_t numpin); bool IsImportedAuthCodeValid(); bool IsSrc(); - void GetCallerInfo(DmBindCallerInfo &callerInfo); - void SetCallerInfo(const DmBindCallerInfo &callerInfo); - void ClearCallerInfo(); private: bool IsHmlSessionType(); @@ -513,7 +510,6 @@ private: const std::string &extra); int32_t CheckAuthParamVaildExtra(const std::string &extra, const std::string &deviceId); bool CheckHmlParamValid(JsonObject &jsonObject); - bool CheckProcessNameInWhiteList(const std::string &processName); void ProcessSourceMsg(); void ProcessSinkMsg(); std::string GetAccountGroupIdHash(); @@ -539,7 +535,6 @@ private: void MemberJoinAuthRequest(int64_t requestId, int32_t status); void PutSrcAccessControlList(DmAccesser &accesser, DmAccessee &accessee, const std::string &localUdid); void PutSinkAccessControlList(DmAccesser &accesser, DmAccessee &accessee, const std::string &localUdid); - void GetCallerInfo(const std::string &pkgName, JsonObject &jsonObject); public: void RequestCredential(); @@ -582,7 +577,6 @@ private: void PutAccessControlList(); void SinkAuthenticateFinish(); void SrcAuthenticateFinish(); - std::string GetBundleLable(const std::string &bundleName); bool IsScreenLocked(); void CheckAndEndTvDream(); std::string ConvertSinkVersion(const std::string &version); @@ -591,9 +585,6 @@ private: int32_t GetTaskTimeout(const char* taskName, int32_t taskTimeOut); void GetPeerUdidHash(int32_t sessionId, std::string &peerUdidHash); void DeleteOffLineTimer(int32_t sessionId); - bool IsAllowDeviceBind(); - int32_t GetBindLevel(int32_t bindLevel); - std::string GetBundleName(JsonObject &jsonObject); int32_t GetBinderInfo(); void SetProcessInfo(); int32_t GetCloseSessionDelaySeconds(std::string &delaySecondsStr); @@ -602,8 +593,8 @@ private: bool IsSourceMsgValid(); void ProcessReqPublicKey(); int32_t GetTokenIdByBundleName(int32_t userId, std::string &bundleName, int64_t &tokenId); - bool CheckBindLevel(const JsonItemObject &jsonObj, const std::string &key, int32_t &bindLevel); void RegisterCleanNotifyCallback(CleanNotifyCallback cleanNotifyCallback); + void GetBindCallerInfo(); private: std::shared_ptr softbusConnector_; @@ -651,9 +642,8 @@ private: std::map> sessionKeyIdAsyncResult_; bool isWaitingJoinLnnCallback_ = false; CleanNotifyCallback cleanNotifyCallback_{nullptr}; - std::mutex callerInfoMutex_; - DmBindCallerInfo callerInfo_; - bool callerInfoReady_ = false; + std::mutex bindParamMutex_; + std::map bindParam_; }; } // namespace DistributedHardware } // namespace OHOS diff --git a/services/implementation/include/authentication_v2/auth_manager.h b/services/implementation/include/authentication_v2/auth_manager.h index f0cb9b39df20a62970951e641dc277237f01d039..c118394193a645ac632a5e299877e88f3e49d599 100644 --- a/services/implementation/include/authentication_v2/auth_manager.h +++ b/services/implementation/include/authentication_v2/auth_manager.h @@ -120,11 +120,10 @@ public: void RegisterCleanNotifyCallback(CleanNotifyCallback cleanNotifyCallback); void ClearSoftbusSessionCallback(); void PrepareSoftbusSessionCallback(); - void GetCallerInfo(DmBindCallerInfo &callerInfo); - void SetCallerInfo(const DmBindCallerInfo &callerInfo); protected: std::shared_ptr context_; + std::mutex bindParamMutex_; std::map bindParam_; PeerTargetId targetId_; @@ -146,6 +145,8 @@ private: int32_t AuthenticateDevice(const std::string &sessionName, int32_t authType, const std::string &deviceId, const std::string &extra); void ParseUltrasonicSide(const JsonObject &jsonObject); + void GetBindCallerInfo(); + int32_t GetBindLevel(int32_t bindLevel); }; class AuthSrcManager : public AuthManager { diff --git a/services/implementation/include/authentication_v2/dm_auth_context.h b/services/implementation/include/authentication_v2/dm_auth_context.h index e54240926f9a0da5ad65f3728af5f3da321b9dea..c3336ecf245893cae4e02e78747cc2e68720f42d 100644 --- a/services/implementation/include/authentication_v2/dm_auth_context.h +++ b/services/implementation/include/authentication_v2/dm_auth_context.h @@ -76,13 +76,6 @@ enum DmAuthScope { DM_AUTH_SCOPE_APP, }; -enum DmRole { - DM_ROLE_UNKNOWN = 0, - DM_ROLE_USER = 1, - DM_ROLE_SA, - DM_ROLE_FA, -}; - enum { DM_UNKNOWN_TYPE = 0, DM_SAME_ACCOUNT_TYPE = 1, diff --git a/services/implementation/include/authentication_v2/dm_auth_manager_base.h b/services/implementation/include/authentication_v2/dm_auth_manager_base.h index 2ceff22d20a5c9dc8f805652e4d53202bea1c077..708aad02e04686d9986ab264c392a20a82aeb0e1 100644 --- a/services/implementation/include/authentication_v2/dm_auth_manager_base.h +++ b/services/implementation/include/authentication_v2/dm_auth_manager_base.h @@ -102,15 +102,15 @@ extern const int32_t DM_AUTH_TYPE_MIN; extern const int32_t MIN_PIN_TOKEN; extern const int32_t MAX_PIN_TOKEN; -typedef struct DmBindCallerInfo { - int32_t userId = -1; - int32_t tokenId = -1; - std::string bundleName = ""; - std::string hostPkgLabel = ""; -} DmBindCallerInfo; - using CleanNotifyCallback = std::function; +enum DmRole { + DM_ROLE_UNKNOWN = 0, + DM_ROLE_USER = 1, + DM_ROLE_SA, + DM_ROLE_FA, +}; + class AuthManagerBase : public ISoftbusSessionCallback, public ISoftbusConnectorCallback, public IHiChainConnectorCallback, @@ -242,8 +242,7 @@ public: void EnableInsensibleSwitching(); void DisableInsensibleSwitching(); int32_t ParseAuthType(const std::map &bindParam, int32_t &authType); - virtual void GetCallerInfo(DmBindCallerInfo &callerInfo) = 0; - virtual void SetCallerInfo(const DmBindCallerInfo &callerInfo) = 0; + static bool CheckProcessNameInWhiteList(const std::string &processName); protected: bool NeedInsensibleSwitching(); bool isTransferReady_{true}; diff --git a/services/implementation/include/authentication_v2/dm_auth_state.h b/services/implementation/include/authentication_v2/dm_auth_state.h index 51ed72ec0255e4b9f328d3a3579548c2b138e547..b01040a6130fee2b1e5f8d2619ac784dede58e9e 100644 --- a/services/implementation/include/authentication_v2/dm_auth_state.h +++ b/services/implementation/include/authentication_v2/dm_auth_state.h @@ -154,7 +154,6 @@ public: void SetAclExtraInfo(std::shared_ptr context); void SetAclInfo(std::shared_ptr context); int32_t GetAclBindType(std::shared_ptr context, std::string credId); - static bool CheckProcessNameInWhiteList(const std::string &processName); int32_t GetOutputState(const std::string &processName, int32_t state); int32_t GetOutputReplay(const std::string &processName, int32_t replay); static uint64_t GetSysTimeMs(); diff --git a/services/implementation/include/device_manager_service_impl.h b/services/implementation/include/device_manager_service_impl.h index ada8d996659c88753bd805c16121bdb29422821a..2767fc1b08915cdca3711b1db6f01ca28f578a9b 100644 --- a/services/implementation/include/device_manager_service_impl.h +++ b/services/implementation/include/device_manager_service_impl.h @@ -60,6 +60,16 @@ struct Config { int32_t authenticationType{0}; }; +typedef struct DmBindCallerInfo { + int32_t userId = -1; + int32_t tokenId = -1; + int32_t bindLevel = -1; + bool isSystemSA = false; + std::string bundleName = ""; + std::string hostPkgLabel = ""; + std::string processName = ""; +} DmBindCallerInfo; + class DeviceManagerServiceImpl : public IDeviceManagerServiceImpl { public: DeviceManagerServiceImpl(); @@ -243,6 +253,12 @@ private: void CheckIsLastLnnAcl(DistributedDeviceProfile::AccessControlProfile profile, DistributedDeviceProfile::AccessControlProfile delProfile, DmOfflineParam &lnnAclParam, bool &isLastLnnAcl, const std::string &localUdid); + void BindTargetImpl(uint64_t tokenId, const std::string &pkgName, const PeerTargetId &targetId, + const std::map &bindParam); + void GetBindCallerInfo(DmBindCallerInfo &bindCallerInfo); + void SetBindCallerInfoToBindParam(const std::map &bindParam, + std::map &bindParamTmp, const DmBindCallerInfo &bindCallerInfo); + std::string GetBundleLable(const std::string &bundleName); private: std::shared_ptr authMgr_; // Old protocol only std::mutex authMgrMtx_; diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp index 4508176633793874238eb604d3ca11b6b6b614bd..046ff0ac26522053740b320f986529097a679c7d 100644 --- a/services/implementation/src/authentication/dm_auth_manager.cpp +++ b/services/implementation/src/authentication/dm_auth_manager.cpp @@ -20,13 +20,10 @@ #include #include -#include "bundle_mgr_interface.h" -#include "bundle_mgr_proxy.h" #include "iservice_registry.h" #if defined(SUPPORT_SCREENLOCK) #include "screenlock_manager.h" #endif -#include "system_ability_definition.h" #include "app_manager.h" #include "auth_message_processor.h" @@ -182,36 +179,9 @@ int32_t DmAuthManager::CheckAuthParamVaildExtra(const std::string &extra, const if (jsonObject.IsDiscarded() || !jsonObject.Contains(TAG_BIND_LEVEL)) { return DM_OK; } - int32_t bindLevel = INVALID_TYPE; - if (!CheckBindLevel(jsonObject, TAG_BIND_LEVEL, bindLevel)) { - LOGE("TAG_BIND_LEVEL is not integer string or int32."); - return ERR_DM_INPUT_PARA_INVALID; - } - if (static_cast(bindLevel) > APP || bindLevel < INVALID_TYPE) { - LOGE("bindlevel error %{public}d.", bindLevel); - return ERR_DM_INPUT_PARA_INVALID; - } - - if (static_cast(bindLevel) == USER && !IsAllowDeviceBind()) { - LOGE("not allowd user level bind bindlevel: %{public}d.", bindLevel); - return ERR_DM_INPUT_PARA_INVALID; - } return DM_OK; } -bool DmAuthManager::CheckBindLevel(const JsonItemObject &jsonObj, const std::string &key, int32_t &bindLevel) -{ - if (IsJsonValIntegerString(jsonObj, TAG_BIND_LEVEL)) { - bindLevel = std::atoi(jsonObj[TAG_BIND_LEVEL].Get().c_str()); - return true; - } - if (IsInt32(jsonObj, TAG_BIND_LEVEL)) { - bindLevel = jsonObj[TAG_BIND_LEVEL].Get(); - return true; - } - return false; -} - bool DmAuthManager::CheckHmlParamValid(JsonObject &jsonObject) { if (!IsString(jsonObject, PARAM_KEY_HML_ACTIONID)) { @@ -231,25 +201,6 @@ bool DmAuthManager::CheckHmlParamValid(JsonObject &jsonObject) return true; } -bool DmAuthManager::CheckProcessNameInWhiteList(const std::string &processName) -{ - LOGI("DmAuthManager::CheckProcessNameInWhiteList start"); - if (processName.empty()) { - LOGE("processName is empty"); - return false; - } - uint16_t index = 0; - for (; index < PROCESS_NAME_WHITE_LIST_NUM; ++index) { - std::string whitePkgName(PROCESS_NAME_WHITE_LIST[index]); - if (processName == whitePkgName) { - LOGI("processName = %{public}s in whiteList.", processName.c_str()); - return true; - } - } - LOGI("CheckProcessNameInWhiteList: %{public}s invalid.", processName.c_str()); - return false; -} - void DmAuthManager::GetAuthParam(const std::string &pkgName, int32_t authType, const std::string &deviceId, const std::string &extra) { @@ -265,6 +216,7 @@ void DmAuthManager::GetAuthParam(const std::string &pkgName, int32_t authType, authRequestContext_->deviceId = deviceId; authRequestContext_->addr = deviceId; authRequestContext_->dmVersion = DM_VERSION_5_0_5; + authRequestContext_->localUserId = MultipleUserConnector::GetFirstForegroundUserId(); authRequestContext_->localAccountId = MultipleUserConnector::GetOhosAccountIdByUserId(authRequestContext_->localUserId); authRequestContext_->isOnline = false; @@ -277,7 +229,6 @@ void DmAuthManager::GetAuthParam(const std::string &pkgName, int32_t authType, } ParseJsonObject(jsonObject); authRequestContext_->token = std::to_string(GenRandInt(MIN_PIN_TOKEN, MAX_PIN_TOKEN)); - authRequestContext_->bindLevel = GetBindLevel(authRequestContext_->bindLevel); } void DmAuthManager::ParseJsonObject(JsonObject &jsonObject) @@ -296,7 +247,6 @@ void DmAuthManager::ParseJsonObject(JsonObject &jsonObject) if (IsString(jsonObject, TAG_APP_THUMBNAIL2)) { authRequestContext_->appThumbnail = jsonObject[TAG_APP_THUMBNAIL2].Get(); } - CheckBindLevel(jsonObject, TAG_BIND_LEVEL, authRequestContext_->bindLevel); authRequestContext_->closeSessionDelaySeconds = 0; if (IsString(jsonObject, PARAM_CLOSE_SESSION_DELAY_SECONDS)) { std::string delaySecondsStr = jsonObject[PARAM_CLOSE_SESSION_DELAY_SECONDS].Get(); @@ -375,7 +325,7 @@ void DmAuthManager::InitAuthState(const std::string &pkgName, int32_t authType, LOGE("extra string not a json type."); return; } - GetCallerInfo(pkgName, jsonObject); + GetAuthParam(pkgName, authType, deviceId, extra); authMessageProcessor_->SetRequestContext(authRequestContext_); authRequestState_ = std::make_shared(); @@ -403,12 +353,10 @@ int32_t DmAuthManager::AuthenticateDevice(const std::string &pkgName, int32_t au LOGE("CheckAuthParamVaildExtra failed, param is invaild."); return ret; } + processInfo_.pkgName = pkgName; InitAuthState(pkgName, authType, deviceId, extra); + GetBindCallerInfo(); isAuthenticateDevice_ = true; - int32_t userId = -1; - MultipleUserConnector::GetCallerUserId(userId); - processInfo_.pkgName = pkgName; - processInfo_.userId = userId; if (authType == AUTH_TYPE_CRE) { LOGI("DmAuthManager::AuthenticateDevice for credential type, joinLNN directly."); softbusConnector_->JoinLnn(deviceId, true); @@ -1511,7 +1459,6 @@ void DmAuthManager::AuthenticateFinish() isAddingMember_ = false; isAuthenticateDevice_ = false; isAuthDevice_ = false; - ClearCallerInfo(); if (DeviceProfileConnector::GetInstance().GetTrustNumber(remoteDeviceId_) >= 1 && CompareVersion(remoteVersion_, std::string(DM_VERSION_4_1_5_1)) && softbusConnector_->CheckIsOnline(remoteDeviceId_) && authResponseContext_->isFinish) { @@ -2072,6 +2019,10 @@ int32_t DmAuthManager::BindTarget(const std::string &pkgName, const PeerTargetId if (bindParam.count(PARAM_KEY_CONN_ADDR_TYPE) != 0) { addrType = bindParam.at(PARAM_KEY_CONN_ADDR_TYPE); } + { + std::lock_guard lock(bindParamMutex_); + bindParam_ = bindParam; + } if (ParseConnectAddr(targetId, deviceId, addrType) == DM_OK) { return AuthenticateDevice(pkgName, authType, deviceId, ParseExtraFromMap(bindParam)); } else if (!targetId.deviceId.empty()) { @@ -2933,42 +2884,6 @@ int32_t DmAuthManager::CheckTrustState() return DM_OK; } -std::string DmAuthManager::GetBundleLable(const std::string &bundleName) -{ - auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - if (samgr == nullptr) { - LOGE("Get ability manager failed"); - return bundleName; - } - - sptr object = samgr->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); - if (object == nullptr) { - LOGE("object is NULL."); - return bundleName; - } - - sptr bms = iface_cast(object); - if (bms == nullptr) { - LOGE("bundle manager service is NULL."); - return bundleName; - } - - auto bundleResourceProxy = bms->GetBundleResourceProxy(); - if (bundleResourceProxy == nullptr) { - LOGE("GetBundleResourceProxy fail"); - return bundleName; - } - AppExecFwk::BundleResourceInfo resourceInfo; - auto result = bundleResourceProxy->GetBundleResourceInfo(bundleName, - static_cast(OHOS::AppExecFwk::ResourceFlag::GET_RESOURCE_INFO_ALL), resourceInfo); - if (result != ERR_OK) { - LOGE("GetBundleResourceInfo failed"); - return bundleName; - } - LOGI("bundle resource label is %{public}s ", (resourceInfo.label).c_str()); - return resourceInfo.label; -} - bool DmAuthManager::IsScreenLocked() { bool isLocked = false; @@ -3050,50 +2965,6 @@ int32_t DmAuthManager::GetTaskTimeout(const char* taskName, int32_t taskTimeOut) return taskTimeOut; } -bool DmAuthManager::IsAllowDeviceBind() -{ - if (AppManager::GetInstance().IsSystemSA()) { - return true; - } - return false; -} - -int32_t DmAuthManager::GetBindLevel(int32_t bindLevel) -{ -#ifdef DEVICE_MANAGER_COMMON_FLAG - LOGI("device_manager_common is true!"); - std::string processName = ""; - int32_t ret = AppManager::GetInstance().GetCallerProcessName(processName); - LOGI("GetBindLevel processName = %{public}s", GetAnonyString(processName).c_str()); - if (ret == DM_OK && CheckProcessNameInWhiteList(processName)) { - return USER; - } -#endif - if (IsAllowDeviceBind()) { - if (static_cast(bindLevel) == INVALIED_TYPE || static_cast(bindLevel) > APP || - static_cast(bindLevel) < USER) { - return USER; - } - return bindLevel; - } - if (static_cast(bindLevel) == INVALIED_TYPE || (static_cast(bindLevel) != APP && - static_cast(bindLevel) != SERVICE)) { - return APP; - } - return bindLevel; -} - -std::string DmAuthManager::GetBundleName(JsonObject &jsonObject) -{ - if (!jsonObject.IsDiscarded() && IsString(jsonObject, BUNDLE_NAME_KEY)) { - return jsonObject[BUNDLE_NAME_KEY].Get(); - } - bool isSystemSA = false; - std::string bundleName; - AppManager::GetInstance().GetCallerName(isSystemSA, bundleName); - return bundleName; -} - int32_t DmAuthManager::GetBinderInfo() { CHECK_NULL_RETURN(authResponseContext_, ERR_DM_POINT_NULL); @@ -3236,6 +3107,14 @@ void DmAuthManager::RequestReCheckMsgDone() bool DmAuthManager::IsSinkMsgValid() { + LOGI("sink remoteVersion %{public}s, remoteDeviceId %{public}s, remoteUserId %{public}d, + remoteHostPkgName %{public}s, remoteBindLevel %{public}d", remoteVersion_.c_str(), + GetAnonyString(remoteDeviceId_).c_str(), authResponseContext_->remoteUserId, + authResponseContext_->hostPkgName.c_str(), authResponseContext_->bindLevel); + LOGI("src version %{public}s, deviceId %{public}s, userId %{public}d, hostPkgName %{public}s, bindLevel %{public}d", + authResponseContext_->edition.c_str(), GetAnonyString(authResponseContext_->localDeviceId).c_str(), + authResponseContext_->localUserId, authResponseContext_->bundleName.c_str(), + authResponseContext_->localBindLevel); if (authResponseContext_->edition != remoteVersion_ || authResponseContext_->localDeviceId != remoteDeviceId_ || authResponseContext_->localUserId != authResponseContext_->remoteUserId || @@ -3379,47 +3258,28 @@ void DmAuthManager::RegisterCleanNotifyCallback(CleanNotifyCallback cleanNotifyC return; } -void DmAuthManager::GetCallerInfo(DmBindCallerInfo &callerInfo) -{ - (void)callerInfo; -} - -void DmAuthManager::SetCallerInfo(const DmBindCallerInfo &callerInfo) -{ - std::lock_guard lock(callerInfoMutex_); - callerInfo_.userId = callerInfo.userId; - callerInfo_.tokenId = callerInfo.tokenId; - callerInfo_.bundleName = callerInfo.bundleName; - callerInfo_.hostPkgLabel = callerInfo.hostPkgLabel; - callerInfoReady_ = true; -} - -void DmAuthManager::GetCallerInfo(const std::string &pkgName, JsonObject &jsonObject) +void DmAuthManager::GetBindCallerInfo() { + LOGI("start."); CHECK_NULL_VOID(authRequestContext_); - std::lock_guard lock(callerInfoMutex_); - if (callerInfoReady_) { - authRequestContext_->localUserId = callerInfo_.userId; - authRequestContext_->tokenId = static_cast(callerInfo_.tokenId); - authRequestContext_->bundleName = callerInfo_.bundleName; - authRequestContext_->hostPkgLabel = callerInfo_.hostPkgLabel; - } else { - authRequestContext_->hostPkgLabel = GetBundleLable(pkgName); - uint32_t tokenId = 0 ; - MultipleUserConnector::GetTokenIdAndForegroundUserId(tokenId, authRequestContext_->localUserId); - authRequestContext_->tokenId = static_cast(tokenId); - authRequestContext_->bundleName = GetBundleName(jsonObject); + { + std::lock_guard lock(bindParamMutex_); + if (bindParam_.find("bindCallerUserId") != bindParam_.end()) { + processInfo_.userId = std::atoi(bindParam_["bindCallerUserId"].c_str()); + } + if (bindParam_.find("bindCallerTokenId") != bindParam_.end()) { + authRequestContext_->tokenId = std::atoi(bindParam_["bindCallerTokenId"].c_str()); + } + if (bindParam_.find("bindCallerOldBindLevel") != bindParam_.end()) { + authRequestContext_->bindLevel = std::atoi(bindParam_["bindCallerOldBindLevel"].c_str()); + } + if (bindParam_.find("bindCallerBundleName") != bindParam_.end()) { + authRequestContext_->bundleName = bindParam_["bindCallerBundleName"]; + } + if (bindParam_.find("bindCallerHostPkgLabel") != bindParam_.end()) { + authRequestContext_->hostPkgLabel = bindParam_["bindCallerHostPkgLabel"]; + } } } - -void DmAuthManager::ClearCallerInfo() -{ - std::lock_guard lock(callerInfoMutex_); - callerInfo_.userId = -1; - callerInfo_.tokenId = -1; - callerInfo_.bundleName = ""; - callerInfo_.hostPkgLabel = ""; - callerInfoReady_ = false; -} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/implementation/src/authentication_v2/auth_manager.cpp b/services/implementation/src/authentication_v2/auth_manager.cpp index 662df9c9717a4c72ca4230e6cf130c74845a4783..e2799af276ee5df4a84802eb333c478ce9d60a6a 100644 --- a/services/implementation/src/authentication_v2/auth_manager.cpp +++ b/services/implementation/src/authentication_v2/auth_manager.cpp @@ -106,14 +106,6 @@ std::string ParseExtraFromMap(const std::map &bindPara return ConvertMapToJsonString(bindParam); } -bool IsAllowDeviceBind() -{ - if (AppManager::GetInstance().IsSystemSA()) { - return true; - } - return false; -} - } // namespace bool AuthManager::IsHmlSessionType(const std::string &sessionType) @@ -151,7 +143,10 @@ AuthManager::~AuthManager() context_->timer->DeleteAll(); LOGI("AuthManager context variables destroy successful."); } - bindParam_.clear(); + { + std::lock_guard lock(bindParamMutex_); + bindParam_.clear(); + } LOGI("DmAuthManager destructor"); } @@ -418,10 +413,6 @@ std::string AuthManager::GetBundleName(const JsonObject &jsonObject) void AuthManager::ParseJsonObject(const JsonObject &jsonObject) { - if (jsonObject.IsDiscarded()) { - return; - } - if (jsonObject[APP_OPERATION_KEY].IsString()) { context_->appOperation = jsonObject[APP_OPERATION_KEY].Get(); } @@ -437,10 +428,7 @@ void AuthManager::ParseJsonObject(const JsonObject &jsonObject) context_->connDelayCloseTime = GetCloseSessionDelaySeconds(delaySecondsStr); } - context_->accesser.bundleName = GetBundleName(jsonObject); - bindParam_[BUNDLE_NAME_KEY] = context_->accesser.bundleName; context_->accessee.bundleName = context_->accesser.bundleName; - if (jsonObject[TAG_PEER_BUNDLE_NAME].IsString() && !jsonObject[TAG_PEER_BUNDLE_NAME].Get().empty()) { context_->accessee.bundleName = jsonObject[TAG_PEER_BUNDLE_NAME].Get(); context_->accessee.oldBundleName = context_->accessee.bundleName; @@ -515,18 +503,25 @@ bool CheckBindLevel(const JsonItemObject &jsonObj, const std::string &key, int32 return false; } -int32_t GetBindLevel(int32_t bindLevel) +int32_t AuthManager::GetBindLevel(int32_t bindLevel) { -#ifdef DEVICE_MANAGER_COMMON_FLAG - LOGI("device_manager_common is true!"); + LOGI("start."); std::string processName = ""; - int32_t ret = AppManager::GetInstance().GetCallerProcessName(processName); - LOGI("GetBindLevel processName = %{public}s", GetAnonyString(processName).c_str()); - if (ret == DM_OK && DmAuthState::CheckProcessNameInWhiteList(processName)) { + bool isSystemSA = false; + { + std::lock_guard lock(bindParamMutex_); + if (bindParam_.find("bindCallerProcessName") != bindParam_.end()) { + processName = bindParam_["bindCallerProcessName"]; + } + if (bindParam_.find("bindCallerIsSystemSA") != bindParam_.end()) { + isSystemSA = static_cast(std::atoi(bindParam_["bindCallerIsSystemSA"].c_str())); + } + } + LOGI("processName = %{public}s, isSystemSA %{public}d.", GetAnonyString(processName).c_str(), isSystemSA); + if (processName != "" && AuthManagerBase::CheckProcessNameInWhiteList(processName)) { return USER; } -#endif - if (IsAllowDeviceBind()) { + if (isSystemSA) { if (static_cast(bindLevel) == INVALIED_TYPE || static_cast(bindLevel) > APP || static_cast(bindLevel) < USER) { return USER; @@ -548,14 +543,10 @@ void AuthManager::GetAuthParam(const std::string &pkgName, int32_t authType, GetDevUdid(localDeviceId, DEVICE_UUID_LENGTH); context_->accesser.deviceId = std::string(localDeviceId); context_->pkgName = pkgName; - context_->pkgLabel = GetBundleLabel(pkgName); context_->authType = (DmAuthType)authType; context_->accesser.deviceName = context_->listener->GetLocalDisplayDeviceNameForPrivacy(); context_->accesser.deviceType = context_->softbusConnector->GetLocalDeviceTypeId(); context_->accesser.isOnline = false; - uint32_t callingTokenId = 0; - MultipleUserConnector::GetCallingTokenId(callingTokenId); - context_->accesser.tokenId = static_cast(callingTokenId); context_->accessee.deviceId = deviceId; context_->accessee.addr = deviceId; @@ -571,17 +562,11 @@ void AuthManager::GetAuthParam(const std::string &pkgName, int32_t authType, context_->accesser.oldBindLevel = INVALIED_TYPE; CheckBindLevel(jsonObject, TAG_BIND_LEVEL, context_->accesser.oldBindLevel); context_->accesser.oldBindLevel = GetBindLevel(context_->accesser.oldBindLevel); - - context_->accesser.bindLevel = DmRole::DM_ROLE_FA; - if (AppManager::GetInstance().IsSystemApp()) { - context_->accesser.bindLevel = DmRole::DM_ROLE_FA; - } - if (AppManager::GetInstance().IsSystemSA()) { - context_->accesser.bindLevel = DmRole::DM_ROLE_SA; - } - if (DmAuthState::CheckProcessNameInWhiteList(context_->accesser.bundleName)) { - context_->accesser.bindLevel = DmRole::DM_ROLE_USER; + { + std::lock_guard lock(bindParamMutex_); + bindParam_["bindCallerOldBindLevel"] = std::to_string(context_->accesser.oldBindLevel); } + LOGI("bindCallerOldBindLevel %{public}d.", context_->accesser.oldBindLevel); } void AuthManager::InitAuthState(const std::string &pkgName, int32_t authType, @@ -607,12 +592,10 @@ void AuthManager::InitAuthState(const std::string &pkgName, int32_t authType, int32_t AuthManager::AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId, const std::string &extra) { - LOGI("AuthManager::AuthenticateDevice start auth type %{public}d.", authType); + LOGI("AuthManager::AuthenticateDevice start auth type %{public}d, extra %{public}s.", authType, extra.c_str()); SetAuthType(authType); - int32_t userId = -1; - MultipleUserConnector::GetCallerUserId(userId); context_->processInfo.pkgName = pkgName; - context_->processInfo.userId = userId; + GetBindCallerInfo(); int32_t ret = CheckAuthParamVaild(pkgName, authType, deviceId, extra); if (ret != DM_OK) { LOGE("AuthManager::AuthenticateDevice failed, param is invaild."); @@ -662,7 +645,10 @@ int32_t AuthManager::BindTarget(const std::string &pkgName, const PeerTargetId & return ERR_DM_INPUT_PARA_INVALID; } context_->peerTargetId = targetId_; - bindParam_ = bindParam; + { + std::lock_guard lock(bindParamMutex_); + bindParam_ = bindParam; + } if (!targetId.deviceId.empty()) { ret = AuthenticateDevice(pkgName, authType, targetId.deviceId, ParseExtraFromMap(bindParam)); if (ret != DM_OK) { @@ -1016,8 +1002,11 @@ void AuthManager::GetBindTargetParams(std::string &pkgName, PeerTargetId &target { pkgName = context_->pkgName; targetId = targetId_; - bindParam = bindParam_; + { + std::lock_guard lock(bindParamMutex_); + bindParam = bindParam_; + } LOGI("AuthManager::GetBindTargetParams get pkgName %{public}s to reuse", pkgName.c_str()); return; } @@ -1035,17 +1024,27 @@ void AuthManager::ClearSoftbusSessionCallback() void AuthManager::PrepareSoftbusSessionCallback() {} -void AuthManager::GetCallerInfo(DmBindCallerInfo &callerInfo) +void AuthManager::GetBindCallerInfo() { - callerInfo.userId = context_->accesser.userId; - callerInfo.tokenId = context_->accesser.tokenId; - callerInfo.bundleName = context_->accesser.bundleName; - callerInfo.hostPkgLabel = context_->pkgLabel; -} - -void AuthManager::SetCallerInfo(const DmBindCallerInfo &callerInfo) -{ - (void)callerInfo; + LOGI("start."); + { + std::lock_guard lock(bindParamMutex_); + if (bindParam_.find("bindCallerUserId") != bindParam_.end()) { + context_->processInfo.userId = std::atoi(bindParam_["bindCallerUserId"].c_str()); + } + if (bindParam_.find("bindCallerTokenId") != bindParam_.end()) { + context_->accesser.tokenId = std::atoi(bindParam_["bindCallerTokenId"].c_str()); + } + if (bindParam_.find("bindCallerBindLevel") != bindParam_.end()) { + context_->accesser.bindLevel = std::atoi(bindParam_["bindCallerBindLevel"].c_str()); + } + if (bindParam_.find("bindCallerBundleName") != bindParam_.end()) { + context_->accesser.bundleName = bindParam_["bindCallerBundleName"]; + } + if (bindParam_.find("bindCallerHostPkgLabel") != bindParam_.end()) { + context_->pkgLabel = bindParam_["bindCallerHostPkgLabel"]; + } + } } } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/services/implementation/src/authentication_v2/auth_stages/auth_negotiate.cpp b/services/implementation/src/authentication_v2/auth_stages/auth_negotiate.cpp index fa963619f93e7a21141146a7ec0cb9f52f42cee2..061259ec9fe9ed99c8cc41fe96bff67814715ad9 100644 --- a/services/implementation/src/authentication_v2/auth_stages/auth_negotiate.cpp +++ b/services/implementation/src/authentication_v2/auth_stages/auth_negotiate.cpp @@ -148,7 +148,7 @@ int32_t AuthSinkNegotiateStateMachine::RespQueryAcceseeIds(std::shared_ptraccessee.bundleName.c_str()); return ERR_DM_GET_TOKENID_FAILED; } - if (DmAuthState::CheckProcessNameInWhiteList(context->accessee.bundleName)) { + if (AuthManagerBase::CheckProcessNameInWhiteList(context->accessee.bundleName)) { context->accessee.bindLevel = DmRole::DM_ROLE_USER; } context->accessee.tokenIdHash = Crypto::GetTokenIdHash(std::to_string(context->accessee.tokenId)); diff --git a/services/implementation/src/authentication_v2/dm_auth_manager_base.cpp b/services/implementation/src/authentication_v2/dm_auth_manager_base.cpp index 49eb28e1781bf68134cc0407b4bae2ae8c0d4130..0c8e5cbc8d689865c0ac01de8a0b408160fabc8d 100644 --- a/services/implementation/src/authentication_v2/dm_auth_manager_base.cpp +++ b/services/implementation/src/authentication_v2/dm_auth_manager_base.cpp @@ -98,6 +98,17 @@ const int32_t SESSION_HEARTBEAT_TIMEOUT = 50; const int32_t PIN_AUTH_TIMEOUT = 60; const int32_t EVENT_TIMEOUT = 5000; // 5000 ms +constexpr int32_t OPEN_PROCESS_NAME_WHITE_LIST_NUM = 1; +constexpr int32_t CLOSE_PROCESS_NAME_WHITE_LIST_NUM = 4; +constexpr const static char* OPEN_PROCESS_NAME_WHITE_LIST[OPEN_PROCESS_NAME_WHITE_LIST_NUM] = { + "com.example.myapplication" +}; +constexpr const static char* CLOSE_PROCESS_NAME_WHITE_LIST[CLOSE_PROCESS_NAME_WHITE_LIST_NUM] = { + "CollaborationFwk", + "gameservice_server", + "wear_link_service", + "watch_system_service" +}; int32_t AuthManagerBase::AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId, const std::string &extra) @@ -510,5 +521,34 @@ int32_t AuthManagerBase::EndDream() LOGI("end dream success"); return DM_OK; } + +bool AuthManagerBase::CheckProcessNameInWhiteList(const std::string &processName) +{ + LOGI("AuthManagerBase::CheckProcessNameInWhiteList start"); + if (processName.empty()) { + LOGE("processName is empty"); + return false; + } + uint16_t index = 0; +#ifdef DEVICE_MANAGER_COMMON_FLAG + for (; index < OPEN_PROCESS_NAME_WHITE_LIST_NUM; ++index) { + std::string whitePkgName(OPEN_PROCESS_NAME_WHITE_LIST[index]); + if (processName == whitePkgName) { + LOGI("processName = %{public}s in whiteList.", processName.c_str()); + return true; + } + } +#else + for (; index < CLOSE_PROCESS_NAME_WHITE_LIST_NUM; ++index) { + std::string whitePkgName(CLOSE_PROCESS_NAME_WHITE_LIST[index]); + if (processName == whitePkgName) { + LOGI("processName = %{public}s in whiteList.", processName.c_str()); + return true; + } + } +#endif + LOGI("CheckProcessNameInWhiteList: %{public}s invalid.", processName.c_str()); + return false; +} } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/services/implementation/src/authentication_v2/dm_auth_state.cpp b/services/implementation/src/authentication_v2/dm_auth_state.cpp index e10b392e030c8b75bdf3ca8b6e860c37a705df54..87ed256a5fd075c1dcb1da1058a30b8f7ba43bf3 100644 --- a/services/implementation/src/authentication_v2/dm_auth_state.cpp +++ b/services/implementation/src/authentication_v2/dm_auth_state.cpp @@ -61,17 +61,6 @@ const std::map NEW_AND_OLD_REPLAY_MAPPING = { { SOFTBUS_OK, SOFTBUS_OK } }; -constexpr int32_t OPEN_PROCESS_NAME_WHITE_LIST_NUM = 1; -constexpr int32_t CLOSE_PROCESS_NAME_WHITE_LIST_NUM = 2; -constexpr const static char* OPEN_PROCESS_NAME_WHITE_LIST[OPEN_PROCESS_NAME_WHITE_LIST_NUM] = { - "com.example.myapplication" -}; -constexpr const static char* CLOSE_PROCESS_NAME_WHITE_LIST[CLOSE_PROCESS_NAME_WHITE_LIST_NUM] = { - "CollaborationFwk", - "gameservice_server" -}; - - int32_t DmAuthState::GetTaskTimeout(std::shared_ptr context, const char* taskName, int32_t taskTimeOut) { LOGI("GetTaskTimeout, taskName: %{public}s, authType_: %{public}d", taskName, context->authType); @@ -339,35 +328,6 @@ bool DmAuthState::HaveSameTokenId(std::shared_ptr context, const (srcTokenIdHash == context->accessee.tokenIdHash)); } -bool DmAuthState::CheckProcessNameInWhiteList(const std::string &processName) -{ - LOGI("DmAuthState::CheckProcessNameInWhiteList start"); - if (processName.empty()) { - LOGE("processName is empty"); - return false; - } - uint16_t index = 0; -#ifdef DEVICE_MANAGER_COMMON_FLAG - for (; index < OPEN_PROCESS_NAME_WHITE_LIST_NUM; ++index) { - std::string whitePkgName(OPEN_PROCESS_NAME_WHITE_LIST[index]); - if (processName == whitePkgName) { - LOGI("processName = %{public}s in whiteList.", processName.c_str()); - return true; - } - } -#else - for (; index < CLOSE_PROCESS_NAME_WHITE_LIST_NUM; ++index) { - std::string whitePkgName(CLOSE_PROCESS_NAME_WHITE_LIST[index]); - if (processName == whitePkgName) { - LOGI("processName = %{public}s in whiteList.", processName.c_str()); - return true; - } - } -#endif - LOGI("CheckProcessNameInWhiteList: %{public}s invalid.", processName.c_str()); - return false; -} - int32_t DmAuthState::GetOutputState(const std::string &processName, int32_t state) { LOGI("state %{public}d.", state); diff --git a/services/implementation/src/device_manager_service_impl.cpp b/services/implementation/src/device_manager_service_impl.cpp index 326615429cc0f29734cc6051867cbefddc3b1ca2..4c0ecebc429b0b1e0c476e9cfe2d25be3242d398 100644 --- a/services/implementation/src/device_manager_service_impl.cpp +++ b/services/implementation/src/device_manager_service_impl.cpp @@ -21,6 +21,8 @@ #include #include "app_manager.h" +#include "bundle_mgr_interface.h" +#include "bundle_mgr_proxy.h" #include "dm_error_type.h" #include "dm_anonymous.h" #include "dm_constants.h" @@ -37,6 +39,8 @@ #include "common_event_support.h" using namespace OHOS::EventFwk; #endif +#include "iservice_registry.h" +#include "system_ability_definition.h" namespace OHOS { namespace DistributedHardware { @@ -843,8 +847,6 @@ int32_t DeviceManagerServiceImpl::TransferSrcOldAuthMgr(std::shared_ptr std::map bindParam; auto authMgr = GetAuthMgrByTokenId(tokenId); authMgr->GetBindTargetParams(pkgName, peerTargetId, bindParam); - DmBindCallerInfo callerInfo; - authMgr->GetCallerInfo(callerInfo); int32_t authType = -1; authMgr->ParseAuthType(bindParam, authType); authMgrMap_.erase(tokenId); @@ -858,7 +860,6 @@ int32_t DeviceManagerServiceImpl::TransferSrcOldAuthMgr(std::shared_ptr return ret; } authMgr = nullptr; - authMgr_->SetCallerInfo(callerInfo); if (authMgr_->BindTarget(pkgName, peerTargetId, bindParam, sessionId, 0) != DM_OK) { LOGE("DeviceManagerServiceImpl::TransferSrcOldAuthMgr authManager BindTarget failed"); return ERR_DM_AUTH_FAILED; @@ -1536,14 +1537,9 @@ int32_t DeviceManagerServiceImpl::ParseConnectAddr(const PeerTargetId &targetId, return DM_OK; } -int32_t DeviceManagerServiceImpl::BindTarget(const std::string &pkgName, const PeerTargetId &targetId, - const std::map &bindParam) +void DeviceManagerServiceImpl::BindTargetImpl(uint64_t tokenId, const std::string &pkgName, + const PeerTargetId &targetId, const std::map &bindParam) { - if (pkgName.empty()) { - LOGE("BindTarget failed, pkgName is empty."); - return ERR_DM_INPUT_PARA_INVALID; - } - std::string deviceId = ""; PeerTargetId targetIdTmp = const_cast(targetId); if (ParseConnectAddr(targetId, deviceId, bindParam) == DM_OK) { @@ -1551,14 +1547,14 @@ int32_t DeviceManagerServiceImpl::BindTarget(const std::string &pkgName, const P } else { if (targetId.deviceId.empty()) { LOGE("DeviceManagerServiceImpl::BindTarget failed, ParseConnectAddr failed."); - return ERR_DM_INPUT_PARA_INVALID; + return; } } // Created only at the source end. The same target device will not be created repeatedly with the new protocol. std::shared_ptr curSession = GetOrCreateSession(targetIdTmp.deviceId, bindParam); if (curSession == nullptr) { LOGE("Failed to create the session. Target deviceId: %{public}s.", targetIdTmp.deviceId.c_str()); - return ERR_DM_AUTH_OPEN_SESSION_FAILED; + return; } // Logical session random number @@ -1568,7 +1564,8 @@ int32_t DeviceManagerServiceImpl::BindTarget(const std::string &pkgName, const P logicalSessionId = GenerateRandNum(sessionId); if (curSession->logicalSessionSet_.find(logicalSessionId) != curSession->logicalSessionSet_.end()) { LOGE("Failed to create the logical session."); - return ERR_DM_LOGIC_SESSION_CREATE_FAILED; + softbusConnector_->GetSoftbusSession()->CloseAuthSession(sessionId); + return; } } @@ -1577,7 +1574,8 @@ int32_t DeviceManagerServiceImpl::BindTarget(const std::string &pkgName, const P int32_t ret = InitAndRegisterAuthMgr(true, tokenId, curSession, logicalSessionId); if (ret != DM_OK) { LOGE("InitAndRegisterAuthMgr failed, ret %{public}d.", ret); - return ret; + softbusConnector_->GetSoftbusSession()->CloseAuthSession(sessionId); + return; } curSession->logicalSessionSet_.insert(logicalSessionId); curSession->logicalSessionCnt_.fetch_add(1); @@ -1586,14 +1584,39 @@ int32_t DeviceManagerServiceImpl::BindTarget(const std::string &pkgName, const P auto authMgr = GetAuthMgrByTokenId(tokenId); if (authMgr == nullptr) { - return ERR_DM_POINT_NULL; + CleanAuthMgrByLogicalSessionId(logicalSessionId); + return; } authMgr->SetBindTargetParams(targetId); if ((ret = authMgr->BindTarget(pkgName, targetIdTmp, bindParam, sessionId, logicalSessionId)) != DM_OK) { LOGE("authMgr BindTarget failed, ret %{public}d.", ret); CleanAuthMgrByLogicalSessionId(logicalSessionId); } - return ret; + LOGI("DeviceManagerServiceImpl BindTargetImpl thread end, tokenId %{public}" PRId64".", tokenId); + return; +} + +int32_t DeviceManagerServiceImpl::BindTarget(const std::string &pkgName, const PeerTargetId &targetId, + const std::map &bindParam) +{ + if (pkgName.empty()) { + LOGE("BindTarget failed, pkgName is empty."); + return ERR_DM_INPUT_PARA_INVALID; + } + DmBindCallerInfo bindCallerInfo; + GetBindCallerInfo(bindCallerInfo); + std::map bindParamTmp; + SetBindCallerInfoToBindParam(bindParam, bindParamTmp, bindCallerInfo); + uint64_t tokenId = IPCSkeleton::GetCallingTokenID(); + if (authMgrMap_.find(tokenId) == authMgrMap_.end()) { + std::thread newThread(&DeviceManagerServiceImpl::BindTargetImpl, this, tokenId, pkgName, + targetId, bindParamTmp); + newThread.detach(); + } else { + LOGE("BindTarget failed, this device is being bound. please try again later."); + return ERR_DM_AUTH_BUSINESS_BUSY; + } + return DM_OK; } int32_t DeviceManagerServiceImpl::DpAclAdd(const std::string &udid) @@ -2430,6 +2453,92 @@ void DeviceManagerServiceImpl::HandleCommonEventBroadCast(const std::vector(DmRole::DM_ROLE_FA); + if (AppManager::GetInstance().IsSystemApp()) { + bindLevel = static_cast(DmRole::DM_ROLE_FA); + } + if (AppManager::GetInstance().IsSystemSA()) { + bindLevel = static_cast(DmRole::DM_ROLE_SA); + } + if (AuthManagerBase::CheckProcessNameInWhiteList(bundleName)) { + bindLevel = static_cast(DmRole::DM_ROLE_USER); + } + std::string hostPkgLabel = GetBundleLable(bundleName); + bindCallerInfo.userId = userId; + bindCallerInfo.tokenId = callingTokenId; + bindCallerInfo.bindLevel = bindLevel; + bindCallerInfo.bundleName = bundleName; + bindCallerInfo.hostPkgLabel = hostPkgLabel; + bindCallerInfo.processName = processName; + bindCallerInfo.isSystemSA = isSystemSA; + LOGI("userId %{public}d, tokenId %{public}d, bindLevel %{public}d, bundleName %{public}s, hostPkgLabel %{public}s, + processName %{public}s, isSystemSA %{public}d", userId, callingTokenId, bindLevel, + GetAnonyString(bundleName).c_str(), GetAnonyString(hostPkgLabel).c_str(), GetAnonyString(processName).c_str(), + isSystemSA); +} + +std::string DeviceManagerServiceImpl::GetBundleLable(const std::string &bundleName) +{ + auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + LOGE("Get ability manager failed"); + return bundleName; + } + + sptr object = samgr->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); + if (object == nullptr) { + LOGE("object is NULL."); + return bundleName; + } + + sptr bms = iface_cast(object); + if (bms == nullptr) { + LOGE("bundle manager service is NULL."); + return bundleName; + } + + auto bundleResourceProxy = bms->GetBundleResourceProxy(); + if (bundleResourceProxy == nullptr) { + LOGE("GetBundleResourceProxy fail"); + return bundleName; + } + AppExecFwk::BundleResourceInfo resourceInfo; + auto result = bundleResourceProxy->GetBundleResourceInfo(bundleName, + static_cast(OHOS::AppExecFwk::ResourceFlag::GET_RESOURCE_INFO_ALL), resourceInfo); + if (result != ERR_OK) { + LOGE("GetBundleResourceInfo failed"); + return bundleName; + } + LOGI("bundle resource label is %{public}s ", (resourceInfo.label).c_str()); + return resourceInfo.label; +} + +void DeviceManagerServiceImpl::SetBindCallerInfoToBindParam(const std::map &bindParam, + std::map &bindParamTmp, const DmBindCallerInfo &bindCallerInfo) +{ + LOGI("start."); + bindParamTmp = const_cast &>(bindParam); + bindParamTmp["bindCallerUserId"] = std::to_string(bindCallerInfo.userId); + bindParamTmp["bindCallerTokenId"] = std::to_string(bindCallerInfo.tokenId); + bindParamTmp["bindCallerBindLevel"] = std::to_string(bindCallerInfo.bindLevel); + bindParamTmp["bindCallerBundleName"] = bindCallerInfo.bundleName; + bindParamTmp["bindCallerHostPkgLabel"] = bindCallerInfo.hostPkgLabel; + bindParamTmp["bindCallerProcessName"] = bindCallerInfo.processName; + bindParamTmp["bindCallerIsSystemSA"] = bindCallerInfo.isSystemSA; +} + extern "C" IDeviceManagerServiceImpl *CreateDMServiceObject(void) { return new DeviceManagerServiceImpl;