From 5582adcf0a6a1798af13baa5a3a499e59d302af1 Mon Sep 17 00:00:00 2001 From: lixiangpeng5 Date: Fri, 27 Sep 2024 14:10:58 +0000 Subject: [PATCH 1/3] fix sensorlist get process Signed-off-by: lixiangpeng5 Change-Id: I5a7700572a0805c2ba6e9112b2f7106cef5625cf --- frameworks/native/src/sensor_service_client.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/frameworks/native/src/sensor_service_client.cpp b/frameworks/native/src/sensor_service_client.cpp index e9ac0131..21243bea 100644 --- a/frameworks/native/src/sensor_service_client.cpp +++ b/frameworks/native/src/sensor_service_client.cpp @@ -114,7 +114,6 @@ bool SensorServiceClient::IsValid(int32_t sensorId) int32_t ret = InitServiceClient(); if (ret != ERR_OK) { SEN_HILOGE("InitServiceClient failed, ret:%{public}d", ret); - return false; } std::lock_guard clientLock(clientMutex_); if (sensorList_.empty()) { @@ -267,7 +266,6 @@ void SensorServiceClient::ProcessDeathObserver(const wptr &object SEN_HILOGI("dataChannel_ is nullptr"); { std::lock_guard clientLock(clientMutex_); - sensorList_.clear(); sensorServer_ = nullptr; } if (InitServiceClient() != ERR_OK) { @@ -280,7 +278,6 @@ void SensorServiceClient::ProcessDeathObserver(const wptr &object dataChannel_->RestoreSensorDataChannel(); { std::lock_guard clientLock(clientMutex_); - sensorList_.clear(); sensorServer_ = nullptr; } if (InitServiceClient() != ERR_OK) { -- Gitee From d3960d2a736876fbffebfddded6c3134c3f4a93e Mon Sep 17 00:00:00 2001 From: lixiangpeng5 Date: Sat, 28 Sep 2024 08:42:27 +0000 Subject: [PATCH 2/3] add receive fd check Signed-off-by: lixiangpeng5 Change-Id: Ic4eb79e11a81626cb20900a62b1c2ed08344dbe7 --- frameworks/native/src/sensor_file_descriptor_listener.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frameworks/native/src/sensor_file_descriptor_listener.cpp b/frameworks/native/src/sensor_file_descriptor_listener.cpp index e3e0c9c9..33e98790 100644 --- a/frameworks/native/src/sensor_file_descriptor_listener.cpp +++ b/frameworks/native/src/sensor_file_descriptor_listener.cpp @@ -53,6 +53,11 @@ void SensorFileDescriptorListener::OnReadable(int32_t fileDescriptor) return; } CHKPV(channel_); + int32_t receiveFd = channel_->GetReceiveDataFd(); + if (receiveFd < 0) { + SEN_HILOGE("receiveFd:%{public}d", receiveFd); + return; + } if (receiveDataBuff_ == nullptr) { SEN_HILOGE("Receive data buff_ is null"); return; -- Gitee From 94be0db2f66192f1526044ef45631f944ad32593 Mon Sep 17 00:00:00 2001 From: lixiangpeng5 Date: Sat, 28 Sep 2024 09:18:32 +0000 Subject: [PATCH 3/3] restore Signed-off-by: lixiangpeng5 Change-Id: Id2bb6acc757b207cd3161f622e3b49df0c23eaad --- frameworks/native/src/sensor_file_descriptor_listener.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/frameworks/native/src/sensor_file_descriptor_listener.cpp b/frameworks/native/src/sensor_file_descriptor_listener.cpp index 33e98790..e3e0c9c9 100644 --- a/frameworks/native/src/sensor_file_descriptor_listener.cpp +++ b/frameworks/native/src/sensor_file_descriptor_listener.cpp @@ -53,11 +53,6 @@ void SensorFileDescriptorListener::OnReadable(int32_t fileDescriptor) return; } CHKPV(channel_); - int32_t receiveFd = channel_->GetReceiveDataFd(); - if (receiveFd < 0) { - SEN_HILOGE("receiveFd:%{public}d", receiveFd); - return; - } if (receiveDataBuff_ == nullptr) { SEN_HILOGE("Receive data buff_ is null"); return; -- Gitee