From c5556c76535c7ae41de138485c7589941c5110ad Mon Sep 17 00:00:00 2001 From: lichen <123456> Date: Sun, 6 Feb 2022 12:05:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E5=8F=82=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ext/input_pin_dialog/dialog_ui/js/pages/index/index.js | 2 +- ext/profile/src/profile_connector.cpp | 6 ++++++ .../src/authentication/dm_auth_manager.cpp | 2 +- .../src/dependency/hichain/hichain_connector.cpp | 1 + .../src/devicestate/dm_device_state_manager.cpp | 2 -- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js b/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js index 9d36936ef..82d40b46a 100644 --- a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js +++ b/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js @@ -17,7 +17,7 @@ export default { var input= this.$element('input').value; console.info('click confirm end'); console.info('input: ' + input); - callNativeHandler(input, "0"); + callNativeHandler("EVENT_INPUT", "0"); }, onCancel() { console.info('click cancel'); diff --git a/ext/profile/src/profile_connector.cpp b/ext/profile/src/profile_connector.cpp index 4a709238e..13078a3cd 100644 --- a/ext/profile/src/profile_connector.cpp +++ b/ext/profile/src/profile_connector.cpp @@ -15,11 +15,14 @@ #include "profile_connector.h" +#include + #include "dm_constants.h" #include "dm_log.h" namespace OHOS { namespace DistributedHardware { +static std::mutex callbackMutex_; std::map> ProfileEventCallback::profileConnectorCallback_ = {}; std::shared_ptr ProfileConnector::profileEventCallback_ = std::make_shared(); @@ -75,6 +78,7 @@ int32_t ProfileEventCallback::RegisterProfileCallback(const std::string &pkgName std::shared_ptr callback) { LOGI("ProfileEventCallback::RegisterProfileCallback"); + std::lock_guard locker(callbackMutex_); profileConnectorCallback_.emplace(pkgName, callback); return DM_OK; } @@ -82,6 +86,7 @@ int32_t ProfileEventCallback::RegisterProfileCallback(const std::string &pkgName int32_t ProfileEventCallback::UnRegisterProfileCallback(const std::string &pkgName) { LOGI("ProfileEventCallback::UnRegisterProfileCallback"); + std::lock_guard locker(callbackMutex_); profileConnectorCallback_.erase(pkgName); return DM_OK; } @@ -95,6 +100,7 @@ void ProfileEventCallback::OnSyncCompleted(const SyncResult &syncResults) SyncStatus = iterResult.second; } LOGI("ProfileEventCallback::OnSyncCompleted, deviceId = %s", deviceId.c_str()); + std::lock_guard locker(callbackMutex_); for (auto &iter : profileConnectorCallback_) { iter.second->OnProfileComplete(iter.first, deviceId); } diff --git a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp index 6bc37f975..21fca1e94 100644 --- a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp +++ b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp @@ -325,6 +325,7 @@ void DmAuthManager::OnGroupCreated(int64_t requestId, const std::string &groupId softbusConnector_->GetSoftbusSession()->SendData(authResponseContext_->sessionId, message); return; } + authResponseContext_->code = GeneratePincode(); authResponseContext_->groupId = groupId; authMessageProcessor_->SetResponseContext(authResponseContext_); std::string message = authMessageProcessor_->CreateSimpleMessage(MSG_TYPE_RESP_AUTH); @@ -680,7 +681,6 @@ void DmAuthManager::ShowConfigDialog() void DmAuthManager::ShowAuthInfoDialog() { LOGI("DmAuthManager::ShowAuthInfoDialog start"); - authResponseContext_->code = GeneratePincode(); std::shared_ptr ptr; if (authenticationMap_.find(1) == authenticationMap_.end()) { LOGE("DmAuthManager::authenticationMap_ is null"); diff --git a/services/devicemanagerservice/src/dependency/hichain/hichain_connector.cpp b/services/devicemanagerservice/src/dependency/hichain/hichain_connector.cpp index ab7b0d162..fc6fed38b 100644 --- a/services/devicemanagerservice/src/dependency/hichain/hichain_connector.cpp +++ b/services/devicemanagerservice/src/dependency/hichain/hichain_connector.cpp @@ -196,6 +196,7 @@ int32_t HiChainConnector::AddMember(std::string deviceId, std::string &connectIn std::string tmpStr = jsonObj.dump(); int64_t requestId = jsonObject[TAG_REQUEST_ID]; int32_t ret = deviceGroupManager_->addMemberToGroup(requestId, DM_PKG_NAME.c_str(), tmpStr.c_str()); + LOGI("HiChainConnector::tmpStr:%s", tmpStr.c_str()); LOGI("HiChainConnector::AddMember completed"); return ret; } diff --git a/services/devicemanagerservice/src/devicestate/dm_device_state_manager.cpp b/services/devicemanagerservice/src/devicestate/dm_device_state_manager.cpp index 5cf62a062..b5288ccb0 100644 --- a/services/devicemanagerservice/src/devicestate/dm_device_state_manager.cpp +++ b/services/devicemanagerservice/src/devicestate/dm_device_state_manager.cpp @@ -55,7 +55,6 @@ void DmDeviceStateManager::OnDeviceOnline(const std::string &pkgName, const DmDe remoteDeviceInfos_[uuid] = saveInfo; LOGI("RegisterProfileListener in, deviceId = %s, deviceUdid = %s, uuid = %s", info.deviceId, deviceUdid.c_str(), uuid.c_str()); - profileAdapter->RegisterProfileListener(pkgName, deviceUdid, shared_from_this()); LOGI("RegisterProfileListener out"); } } @@ -72,7 +71,6 @@ void DmDeviceStateManager::OnDeviceOffline(const std::string &pkgName, const DmD if (profileAdapter == nullptr) { LOGE("OnDeviceOffline profile adapter is null"); } else { - profileAdapter->UnRegisterProfileListener(pkgName); std::string uuid; SoftbusConnector::GetUuidByNetworkId(info.deviceId, uuid); auto iter = remoteDeviceInfos_.find(std::string(info.deviceId)); -- Gitee