diff --git a/common/include/ipc/standard/ipc_cmd_register.h b/common/include/ipc/standard/ipc_cmd_register.h index 650a69950a4531611b59455633eb4b58cfa36c51..885abc550e7ad2cdd3ecdf2e1e230214b36147a6 100644 --- a/common/include/ipc/standard/ipc_cmd_register.h +++ b/common/include/ipc/standard/ipc_cmd_register.h @@ -18,6 +18,7 @@ #include #include +#include #include #include "device_manager_ipc_interface_code.h" @@ -76,6 +77,7 @@ public: */ void RegisterSetRequestFunc(int32_t cmdCode, SetIpcRequestFunc setIpcRequestFunc) { + std::lock_guard autoLock(setIpcRequestFuncMapLock_); setIpcRequestFuncMap_.emplace(cmdCode, setIpcRequestFunc); }; @@ -86,6 +88,7 @@ public: */ void RegisterReadResponseFunc(int32_t cmdCode, ReadResponseFunc readResponseFunc) { + std::lock_guard autoLock(readResponseFuncMapLock_); readResponseFuncMap_.emplace(cmdCode, readResponseFunc); }; @@ -96,6 +99,7 @@ public: */ void RegisterCmdProcessFunc(int32_t cmdCode, OnIpcCmdFunc onIpcCmdFunc) { + std::lock_guard autoLock(onIpcCmdFuncMapLock_); onIpcCmdFuncMap_.emplace(cmdCode, onIpcCmdFunc); }; @@ -121,8 +125,11 @@ public: int32_t OnIpcCmd(int32_t cmdCode, MessageParcel &data, MessageParcel &reply); private: + std::mutex setIpcRequestFuncMapLock_; std::unordered_map setIpcRequestFuncMap_; + std::mutex readResponseFuncMapLock_; std::unordered_map readResponseFuncMap_; + std::mutex onIpcCmdFuncMapLock_; std::unordered_map onIpcCmdFuncMap_; }; } // namespace DistributedHardware diff --git a/common/src/ipc/standard/ipc_cmd_register.cpp b/common/src/ipc/standard/ipc_cmd_register.cpp index 4f18a43bb1c777786955612f1b7fde37128a1676..082a4e8d4229c790015060011401f88a1dc49b6b 100644 --- a/common/src/ipc/standard/ipc_cmd_register.cpp +++ b/common/src/ipc/standard/ipc_cmd_register.cpp @@ -41,21 +41,21 @@ int32_t IpcCmdRegister::SetRequest(int32_t cmdCode, std::shared_ptr pBas LOGE("IpcCmdRegister::SetRequest cmdCode param invalid!"); return ERR_DM_UNSUPPORTED_IPC_COMMAND; } - - if (setIpcRequestFuncMap_.count(cmdCode) == 0) { - LOGE("cmdCode:%{public}d not register SetRequestFunc", cmdCode); - return ERR_DM_UNSUPPORTED_IPC_COMMAND; - } - - auto setRequestMapIter = setIpcRequestFuncMap_.find(cmdCode); - if (setRequestMapIter != setIpcRequestFuncMap_.end()) { - SetIpcRequestFunc ptr = setRequestMapIter->second; + SetIpcRequestFunc ptr = nullptr; + { + std::lock_guard autoLock(setIpcRequestFuncMapLock_); + auto setRequestMapIter = setIpcRequestFuncMap_.find(cmdCode); + if (setRequestMapIter == setIpcRequestFuncMap_.end()) { + LOGE("cmdCode:%{public}d not register SetRequestFunc", cmdCode); + return ERR_DM_UNSUPPORTED_IPC_COMMAND; + } + ptr = setRequestMapIter->second; if (ptr == nullptr) { LOGE("IpcCmdRegister::SetRequest setRequestMapIter->second is null"); return ERR_DM_POINT_NULL; } - ret = (setRequestMapIter->second)(pBaseReq, data); } + ret = (ptr)(pBaseReq, data); return ret; } @@ -65,15 +65,21 @@ int32_t IpcCmdRegister::ReadResponse(int32_t cmdCode, MessageParcel &reply, std: LOGE("IpcCmdRegister::ReadResponse cmdCode param invalid!"); return ERR_DM_UNSUPPORTED_IPC_COMMAND; } - auto readResponseMapIter = readResponseFuncMap_.find(cmdCode); - if (readResponseMapIter == readResponseFuncMap_.end()) { - LOGE("cmdCode:%{public}d not register ReadResponseFunc", cmdCode); - return ERR_DM_UNSUPPORTED_IPC_COMMAND; - } - if (readResponseMapIter->second == nullptr) { - return ERR_DM_POINT_NULL; + ReadResponseFunc ptr = nullptr; + { + std::lock_guard autoLock(readResponseFuncMapLock_); + auto readResponseMapIter = readResponseFuncMap_.find(cmdCode); + if (readResponseMapIter == readResponseFuncMap_.end()) { + LOGE("cmdCode:%{public}d not register ReadResponseFunc", cmdCode); + return ERR_DM_UNSUPPORTED_IPC_COMMAND; + } + ptr = readResponseMapIter->second; + if (ptr == nullptr) { + LOGE("IpcCmdRegister::ReadResponse readResponseMapIter->second is null"); + return ERR_DM_POINT_NULL; + } } - return (readResponseMapIter->second)(reply, pBaseRsp); + return (ptr)(reply, pBaseRsp); } int32_t IpcCmdRegister::OnIpcCmd(int32_t cmdCode, MessageParcel &data, MessageParcel &reply) @@ -82,15 +88,21 @@ int32_t IpcCmdRegister::OnIpcCmd(int32_t cmdCode, MessageParcel &data, MessagePa LOGE("IpcCmdRegister::OnIpcCmd cmdCode param invalid!"); return ERR_DM_UNSUPPORTED_IPC_COMMAND; } - auto onIpcCmdMapIter = onIpcCmdFuncMap_.find(cmdCode); - if (onIpcCmdMapIter == onIpcCmdFuncMap_.end()) { - LOGE("cmdCode:%{public}d not register OnIpcCmdFunc", cmdCode); - return ERR_DM_UNSUPPORTED_IPC_COMMAND; - } - if (onIpcCmdMapIter->second == nullptr) { - return ERR_DM_POINT_NULL; + OnIpcCmdFunc ptr = nullptr; + { + std::lock_guard autoLock(onIpcCmdFuncMapLock_); + auto onIpcCmdMapIter = onIpcCmdFuncMap_.find(cmdCode); + if (onIpcCmdMapIter == onIpcCmdFuncMap_.end()) { + LOGE("cmdCode:%{public}d not register OnIpcCmdFunc", cmdCode); + return ERR_DM_UNSUPPORTED_IPC_COMMAND; + } + ptr = onIpcCmdMapIter->second; + if (ptr == nullptr) { + LOGE("IpcCmdRegister::OnIpcCmd onIpcCmdMapIter->second is null"); + return ERR_DM_POINT_NULL; + } } - return (onIpcCmdMapIter->second)(data, reply); + return (ptr)(data, reply); } } // namespace DistributedHardware } // namespace OHOS diff --git a/interfaces/kits/js/include/native_devicemanager_js.h b/interfaces/kits/js/include/native_devicemanager_js.h index 496f0b47b8b51bca0d6bd193a2b9ac70b16387d9..ebe81431fe2a7b46669188b4756b19db70c56851 100644 --- a/interfaces/kits/js/include/native_devicemanager_js.h +++ b/interfaces/kits/js/include/native_devicemanager_js.h @@ -32,7 +32,7 @@ #include "napi/native_node_api.h" #include "nlohmann/json.hpp" #define DM_NAPI_BUF_LENGTH (256) -#define DM_NAPI_CREDENTIAL_BUF_LENGTH (12000) +#define DM_NAPI_CREDENTIAL_BUF_LENGTH (64000) #define DM_NAPI_DESCRIPTION_BUF_LENGTH (16384) struct AsyncCallbackInfo { diff --git a/interfaces/kits/js/src/native_devicemanager_js.cpp b/interfaces/kits/js/src/native_devicemanager_js.cpp index 6b37f55c24bdf3405ba14002c1ca7b8ff169b826..228e551635cd90d2ac8f7d8fc53194f5dd94edc2 100644 --- a/interfaces/kits/js/src/native_devicemanager_js.cpp +++ b/interfaces/kits/js/src/native_devicemanager_js.cpp @@ -842,6 +842,7 @@ void DeviceManagerNapi::OnCredentialResult(int32_t &action, const std::string &c if (handler != nullptr) { napi_call_function(env_, nullptr, handler, DM_NAPI_ARGS_ONE, &result, &callResult); napi_delete_reference(env_, creAsyncCallbackInfo_.callback); + creAsyncCallbackInfo_.callback = nullptr; } else { LOGE("handler is nullptr"); } diff --git a/services/implementation/src/ability/standard/dm_dialog_manager.cpp b/services/implementation/src/ability/standard/dm_dialog_manager.cpp index 1953e5de97633b044f8cb2c81e1ac79fab61ec6c..9ff2a9e0d9647d9ed9d3f4d76320696055cdb71f 100644 --- a/services/implementation/src/ability/standard/dm_dialog_manager.cpp +++ b/services/implementation/src/ability/standard/dm_dialog_manager.cpp @@ -201,6 +201,7 @@ void DmDialogManager::DialogAbilityConnection::OnAbilityConnectDone( param["deviceType"] = DmDialogManager::GetDeviceType(); param[TAG_TARGET_DEVICE_NAME] = DmDialogManager::GetTargetDeviceName(); param[TAG_HOST_PKGLABEL] = DmDialogManager::GetHostPkgLabel(); + param["disableUpGesture"] = 1; std::string paramStr = param.dump(); data.WriteString16(Str8ToStr16(paramStr)); LOGI("show dm dialog is begin"); diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp index 715e23cb35c32f98804f22c4925b2bbdff9e8fe6..0f24eb1e2ad65adc02889075b33354434acccbfd 100644 --- a/services/implementation/src/authentication/dm_auth_manager.cpp +++ b/services/implementation/src/authentication/dm_auth_manager.cpp @@ -2502,6 +2502,7 @@ int32_t DmAuthManager::CheckTrustState() CompatiblePutAcl(); } softbusConnector_->JoinLnn(authResponseContext_->deviceId); + authResponseContext_->state = AuthState::AUTH_REQUEST_FINISH; authRequestState_->TransitionTo(std::make_shared()); return ALREADY_BIND; } diff --git a/services/service/include/device_manager_service_listener.h b/services/service/include/device_manager_service_listener.h index 6ca02a843f407a3cd6e390e43c1928bce06d8532..fb97451b315340dc64dd4972b6f4e1e70e897468 100644 --- a/services/service/include/device_manager_service_listener.h +++ b/services/service/include/device_manager_service_listener.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include "dm_device_info.h" @@ -82,6 +82,7 @@ private: void ProcessAppStateChange(const std::string &pkgName, const DmDeviceState &state, const DmDeviceInfo &info, const DmDeviceBasicInfo &deviceBasicInfo); std::string ComposeOnlineKey(const std::string &pkgName, const std::string &devId); + void RemoveOnlinePkgName(const DmDeviceInfo &info); #if !(defined(__LITEOS_M__) || defined(LITE_DEVICE)) int32_t ConfuseUdidHash(const std::string &pkgName, DmDeviceInfo &deviceInfo); int32_t ConvertUdidHashToAnoy(const std::string &pkgName, const std::string &udidHash, std::string &result); @@ -89,8 +90,8 @@ private: private: #if !defined(__LITEOS_M__) IpcServerListener ipcServerListener_; - static std::mutex alreadyOnlineSetLock_; - static std::unordered_set alreadyOnlineSet_; + static std::mutex alreadyOnlinePkgNameLock_; + static std::unordered_map alreadyOnlinePkgName_; #endif }; } // namespace DistributedHardware diff --git a/services/service/src/device_manager_service_listener.cpp b/services/service/src/device_manager_service_listener.cpp index c1cb39ab05d3b6ce89e11837e3d7cfd7af500e23..94ae46d64a90a734bd90460436ef734411e83b4d 100644 --- a/services/service/src/device_manager_service_listener.cpp +++ b/services/service/src/device_manager_service_listener.cpp @@ -43,9 +43,8 @@ namespace OHOS { namespace DistributedHardware { -std::mutex DeviceManagerServiceListener::alreadyOnlineSetLock_; -std::unordered_set DeviceManagerServiceListener::alreadyOnlineSet_ = {}; -const int32_t LAST_APP_ONLINE_NUMS = 7; +std::mutex DeviceManagerServiceListener::alreadyOnlinePkgNameLock_; +std::unordered_map DeviceManagerServiceListener::alreadyOnlinePkgName_ = {}; void DeviceManagerServiceListener::ConvertDeviceInfoToDeviceBasicInfo(const std::string &pkgName, const DmDeviceInfo &info, DmDeviceBasicInfo &deviceBasicInfo) { @@ -109,12 +108,8 @@ void DeviceManagerServiceListener::ProcessDeviceStateChange(const DmDeviceState std::shared_ptr pRsp = std::make_shared(); std::vector PkgNameVec = ipcServerListener_.GetAllPkgName(); if (state == DEVICE_STATE_OFFLINE) { + RemoveOnlinePkgName(info); for (const auto &it : PkgNameVec) { - std::string notifyKey = ComposeOnlineKey(it, std::string(info.deviceId)); - { - std::lock_guard autoLock(alreadyOnlineSetLock_); - alreadyOnlineSet_.erase(notifyKey); - } SetDeviceInfo(pReq, it, state, info, deviceBasicInfo); ipcServerListener_.SendRequest(SERVER_DEVICE_STATE_NOTIFY, pReq, pRsp); } @@ -124,11 +119,11 @@ void DeviceManagerServiceListener::ProcessDeviceStateChange(const DmDeviceState std::string notifyKey = ComposeOnlineKey(it, std::string(info.deviceId)); DmDeviceState notifyState = state; { - std::lock_guard autoLock(alreadyOnlineSetLock_); - if (alreadyOnlineSet_.find(notifyKey) != alreadyOnlineSet_.end()) { + std::lock_guard autoLock(alreadyOnlinePkgNameLock_); + if (alreadyOnlinePkgName_.find(notifyKey) != alreadyOnlinePkgName_.end()) { notifyState = DmDeviceState::DEVICE_INFO_CHANGED; } else { - alreadyOnlineSet_.insert(notifyKey); + alreadyOnlinePkgName_[notifyKey] = info; } } SetDeviceInfo(pReq, it, notifyState, info, deviceBasicInfo); @@ -155,22 +150,19 @@ void DeviceManagerServiceListener::ProcessAppStateChange(const std::string &pkgN for (const auto &it : notifyPkgnames) { std::string notifyKey = it + "_" + info.deviceId; { - std::lock_guard autoLock(alreadyOnlineSetLock_); - if (alreadyOnlineSet_.find(notifyKey) != alreadyOnlineSet_.end()) { + std::lock_guard autoLock(alreadyOnlinePkgNameLock_); + if (alreadyOnlinePkgName_.find(notifyKey) != alreadyOnlinePkgName_.end()) { continue; } - alreadyOnlineSet_.insert(notifyKey); + alreadyOnlinePkgName_[notifyKey] = info; } SetDeviceInfo(pReq, it, state, info, deviceBasicInfo); ipcServerListener_.SendRequest(SERVER_DEVICE_STATE_NOTIFY, pReq, pRsp); } } if (state == DEVICE_STATE_OFFLINE) { - if (alreadyOnlineSet_.size() == LAST_APP_ONLINE_NUMS) { - { - std::lock_guard autoLock(alreadyOnlineSetLock_); - alreadyOnlineSet_.clear(); - } + if (!SoftbusCache::GetInstance().CheckIsOnline(std::string(info.deviceId))) { + RemoveOnlinePkgName(info); for (const auto &it : notifyPkgnames) { SetDeviceInfo(pReq, it, state, info, deviceBasicInfo); ipcServerListener_.SendRequest(SERVER_DEVICE_STATE_NOTIFY, pReq, pRsp); @@ -178,9 +170,9 @@ void DeviceManagerServiceListener::ProcessAppStateChange(const std::string &pkgN } else { std::string notifyKey = pkgName + "_" + info.deviceId; { - std::lock_guard autoLock(alreadyOnlineSetLock_); - if (alreadyOnlineSet_.find(notifyKey) != alreadyOnlineSet_.end()) { - alreadyOnlineSet_.erase(notifyKey); + std::lock_guard autoLock(alreadyOnlinePkgNameLock_); + if (alreadyOnlinePkgName_.find(notifyKey) != alreadyOnlinePkgName_.end()) { + alreadyOnlinePkgName_.erase(notifyKey); } } SetDeviceInfo(pReq, pkgName, state, info, deviceBasicInfo); @@ -476,5 +468,20 @@ int32_t DeviceManagerServiceListener::ConvertUdidHashToAnoy(const std::string &p return DM_OK; } #endif + +void DeviceManagerServiceListener::RemoveOnlinePkgName(const DmDeviceInfo &info) +{ + LOGI("udidHash: %{public}s.", GetAnonyString(info.deviceId).c_str()); + { + std::lock_guard autoLock(alreadyOnlinePkgNameLock_); + for (auto item = alreadyOnlinePkgName_.begin(); item != alreadyOnlinePkgName_.end();) { + if (std::string(item->second.deviceId) == std::string(info.deviceId)) { + item = alreadyOnlinePkgName_.erase(item); + } else { + ++item; + } + } + } +} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/softbuscache/include/dm_softbus_cache.h b/services/softbuscache/include/dm_softbus_cache.h index b315a87d6199b41005f4d96c5abd34fdbac2ae5b..d455be14843ccf49a6bddc6b5f0afc9cdc803999 100644 --- a/services/softbuscache/include/dm_softbus_cache.h +++ b/services/softbuscache/include/dm_softbus_cache.h @@ -45,6 +45,7 @@ public: int32_t GetLocalDeviceInfo(DmDeviceInfo &nodeInfo); int32_t GetDevInfoByNetworkId(const std::string &networkId, DmDeviceInfo &nodeInfo); void UpDataLocalDevInfo(); + bool CheckIsOnline(const std::string &udidHash); private: int32_t GetUdidByNetworkId(const char *networkId, std::string &udid); int32_t GetUuidByNetworkId(const char *networkId, std::string &uuid); diff --git a/services/softbuscache/src/dm_softbus_cache.cpp b/services/softbuscache/src/dm_softbus_cache.cpp index a7c9a7e39b3f6b195f61c7ed5c1679c138de92d8..cf95652b5969196c68f342de0ced330258c795e7 100644 --- a/services/softbuscache/src/dm_softbus_cache.cpp +++ b/services/softbuscache/src/dm_softbus_cache.cpp @@ -371,5 +371,20 @@ int32_t SoftbusCache::GetDevInfoFromBus(const std::string &networkId, DmDeviceIn GetAnonyString(devInfo.deviceName).c_str(), devInfo.deviceTypeId); return ret; } + +bool SoftbusCache::CheckIsOnline(const std::string &deviceId) +{ + LOGI("deviceId %{public}s.", GetAnonyString(deviceId).c_str()); + { + std::lock_guard mutexLock(deviceInfosMutex_); + for (const auto &item : deviceInfo_) { + if (std::string(item.second.second.deviceId) == deviceId) { + LOGI("CheckIsOnline is true."); + return true; + } + } + } + return false; +} } // namespace DistributedHardware } // namespace OHOS diff --git a/test/unittest/UTTest_device_manager_service_listener.cpp b/test/unittest/UTTest_device_manager_service_listener.cpp index f082355c35fedd39d8cb9da23ec7e4fa4628a372..77a8944df02a9490362899881d9d5bf60cf3b171 100644 --- a/test/unittest/UTTest_device_manager_service_listener.cpp +++ b/test/unittest/UTTest_device_manager_service_listener.cpp @@ -63,7 +63,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnDeviceStateChange_001, testing::ext .deviceTypeId = 1, }; listener_->OnDeviceStateChange(pkgName, state, info); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), false); } /** @@ -84,7 +84,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnDeviceStateChange_002, testing::ext .deviceTypeId = 1, }; listener_->OnDeviceStateChange(pkgName, state, info); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -102,7 +102,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnAuthResult_001, testing::ext::TestS int32_t status = 3; int32_t reason = 2006; listener_->OnAuthResult(pkgName, deviceId, token, status, reason); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -120,7 +120,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnAuthResult_002, testing::ext::TestS int32_t status = 8; int32_t reason = 2006; listener_->OnAuthResult(pkgName, deviceId, token, status, reason); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -138,7 +138,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnAuthResult_003, testing::ext::TestS int32_t status = -1; int32_t reason = 2006; listener_->OnAuthResult(pkgName, deviceId, token, status, reason); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -159,7 +159,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnDeviceFound_001, testing::ext::Test }; uint16_t subscribeId = 1; listener_->OnDeviceFound(pkgName, subscribeId, info); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -176,7 +176,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnDiscoveryFailed_001, testing::ext:: uint16_t subscribeId = 1; int32_t failedReason = 1; listener_->OnDiscoveryFailed(pkgName, subscribeId, failedReason); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -191,7 +191,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnDiscoverySuccess_001, testing::ext: std::string pkgName = "com.ohos.helloworld"; uint16_t subscribeId = 1; listener_->OnDiscoverySuccess(pkgName, subscribeId); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -208,7 +208,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnPublishResult_001, testing::ext::Te int32_t publishId = 1; int32_t failedReason = 1; listener_->OnPublishResult(pkgName, publishId, failedReason); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -224,7 +224,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnPublishResult_002, testing::ext::Te int32_t publishId = 1; int32_t failedReason = 0; listener_->OnPublishResult(pkgName, publishId, failedReason); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -239,7 +239,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnUiCall_001, testing::ext::TestSize. std::string pkgName = "com.ohos.helloworld"; std::string paramJson = "ahaha"; listener_->OnUiCall(pkgName, paramJson); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -254,7 +254,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnCredentialResult_001, testing::ext: int32_t action = 1; std::string resultInfo = "resultInfo"; listener_->OnCredentialResult(pkgName, action, resultInfo); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -271,7 +271,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnBindResult_001, testing::ext::TestS int32_t status = 1; std::string content = "content"; listener_->OnBindResult(pkgName, targetId, result, status, content); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -288,7 +288,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnBindResult_002, testing::ext::TestS int32_t status = 8; std::string content = "content"; listener_->OnBindResult(pkgName, targetId, result, status, content); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -305,7 +305,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnBindResult_003, testing::ext::TestS int32_t status = -1; std::string content = "content"; listener_->OnBindResult(pkgName, targetId, result, status, content); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -321,7 +321,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnUnbindResult_001, testing::ext::Tes int32_t result = 0; std::string content = "content"; listener_->OnUnbindResult(pkgName, targetId, result, content); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -355,7 +355,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnDeviceFound_002, testing::ext::Test uint16_t subscribeId = 1; DmDeviceBasicInfo info; listener_->OnDeviceFound(pkgName, subscribeId, info); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -371,7 +371,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnPinHolderCreate_001, testing::ext:: DmPinType pinType = static_cast(1); std::string payload = "payload"; listener_->OnPinHolderCreate(pkgName, deviceId, pinType, payload); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -386,7 +386,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnPinHolderDestroy_001, testing::ext: DmPinType pinType = static_cast(1); std::string payload = "payload"; listener_->OnPinHolderDestroy(pkgName, pinType, payload); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -400,7 +400,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnCreateResult_001, testing::ext::Tes std::string pkgName = "com.ohos.helloworld"; int32_t result = 0; listener_->OnCreateResult(pkgName, result); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -414,7 +414,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnDestroyResult_001, testing::ext::Te std::string pkgName = "com.ohos.helloworld"; int32_t result = 0; listener_->OnDestroyResult(pkgName, result); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } /** @@ -430,7 +430,7 @@ HWTEST_F(DeviceManagerServiceListenerTest, OnPinHolderEvent_001, testing::ext::T int32_t result = 0; std::string content = "content"; listener_->OnPinHolderEvent(pkgName, event, result, content); - EXPECT_EQ(listener_->alreadyOnlineSet_.empty(), false); + EXPECT_EQ(listener_->alreadyOnlinePkgName_.empty(), true); } } // namespace } // namespace DistributedHardware