!114 虚拟驱动缓存信息中没有设备id,导致有两台或以上设备时,一台设备上下线影响另外一台设备的正常使用

Merge pull request !114 from zhangchuang/master
This commit is contained in:
openharmony_ci
2023-12-02 09:21:27 +00:00
committed by Gitee
16 changed files with 303 additions and 415 deletions
@@ -149,21 +149,6 @@ void DistributedInputHandler::UnRegisterPluginListener()
this->m_listener = nullptr;
}
int32_t DistributedInputHandler::GetDeviceInfo(std::string &deviceId)
{
std::unique_lock<std::mutex> my_lock(operationMutex_);
auto localNode = std::make_unique<NodeBasicInfo>();
int32_t retCode = GetLocalNodeDeviceInfo("ohos.dhardware", localNode.get());
if (retCode != 0) {
DHLOGE("Could not get device id.");
return ERR_DH_INPUT_HANDLER_GET_DEVICE_ID_FAIL;
}
deviceId = localNode->networkId;
DHLOGI("device id is %s", GetAnonyString(deviceId).c_str());
return DH_SUCCESS;
}
bool DistributedInputHandler::InitCollectEventsThread()
{
pthread_attr_t attr;
@@ -190,15 +175,12 @@ void *DistributedInputHandler::CollectEventsThread(void *param)
DHLOGE("CollectEventsThread setname failed.");
}
DistributedInputHandler *pThis = reinterpret_cast<DistributedInputHandler *>(param);
std::string deviceId;
pThis->GetDeviceInfo(deviceId);
pThis->StartInputMonitorDeviceThread(deviceId);
pThis->StartInputMonitorDeviceThread();
DHLOGI("DistributedInputHandler::CollectEventsThread exist!");
return nullptr;
}
void DistributedInputHandler::StartInputMonitorDeviceThread(const std::string deviceId)
void DistributedInputHandler::StartInputMonitorDeviceThread()
{
if (inputHub_ == nullptr) {
DHLOGE("inputHub_ not initialized");