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 9d36936ef8483d37882b3a98ff7026a41025aeb6..82d40b46a5137f7e0ce9d4651b0248937b5b4d44 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 4a709238e404ab155ff1e7d537371a2366b1fa5e..13078a3cda62618b0f814451997588f19d727fe5 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 5cf62a06223dbc9accae992ce4c86c808c23287e..b5288ccb0f4516c927880d7fa1f25525344e3a8b 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));