From 20ef33be3467f3fe308a9856227cf726e221f217 Mon Sep 17 00:00:00 2001 From: renguang1116 Date: Sun, 30 Jan 2022 19:38:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9PIN=E7=A0=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20Signed-off-by:=20renguang1116=20?= 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 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'); -- Gitee From 173dcf463d6e91e33f56cf7e8a36a257e53297f2 Mon Sep 17 00:00:00 2001 From: renguang1116 Date: Sun, 30 Jan 2022 20:17:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcrash=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20Signed-off-by:=20renguang1116=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ext/profile/src/profile_connector.cpp | 6 ++++++ .../src/devicestate/dm_device_state_manager.cpp | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) 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/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