From 2e4d550784b7ec54037d9e14029f9fc403442ddb Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Mon, 9 Dec 2024 17:25:33 +0800 Subject: [PATCH] Sensor adds maintenance logs Signed-off-by: wuzhihuitmac Change-Id: I0071f317af69fa9f3ce78217b674449dcdec6e9b --- frameworks/native/src/sensor_agent_proxy.cpp | 4 +-- frameworks/native/src/sensor_data_channel.cpp | 3 ++ .../src/sensor_file_descriptor_listener.cpp | 1 + .../native/src/sensor_service_client.cpp | 9 +++-- .../adapter/src/hdi_connection.cpp | 8 +++++ services/include/sensor_service.h | 3 +- services/src/client_info.cpp | 33 +++++++++++++------ services/src/sensor_data_processer.cpp | 7 ++-- services/src/sensor_manager.cpp | 17 +++++++--- services/src/sensor_service.cpp | 19 ++++++++--- .../common/src/sensor_basic_data_channel.cpp | 2 ++ 11 files changed, 78 insertions(+), 28 deletions(-) diff --git a/frameworks/native/src/sensor_agent_proxy.cpp b/frameworks/native/src/sensor_agent_proxy.cpp index 37fdd068..4a1fcf28 100644 --- a/frameworks/native/src/sensor_agent_proxy.cpp +++ b/frameworks/native/src/sensor_agent_proxy.cpp @@ -202,7 +202,7 @@ int32_t SensorAgentProxy::DeactivateSensor(int32_t sensorId, const SensorUser *u } auto status = unsubscribeMap_[sensorId].insert(user); if (!status.second) { - SEN_HILOGD("User has been unsubscribed"); + SEN_HILOGE("User has been unsubscribed"); } subscribeSet.erase(user); if (subscribeSet.empty()) { @@ -261,7 +261,7 @@ int32_t SensorAgentProxy::SubscribeSensor(int32_t sensorId, const SensorUser *us std::lock_guard subscribeLock(subscribeMutex_); auto status = subscribeMap_[sensorId].insert(user); if (!status.second) { - SEN_HILOGD("User has been subscribed"); + SEN_HILOGE("User has been subscribed"); } if (PrintSensorData::GetInstance().IsContinuousType(sensorId)) { PrintSensorData::GetInstance().SavePrintUserInfo(user->callback); diff --git a/frameworks/native/src/sensor_data_channel.cpp b/frameworks/native/src/sensor_data_channel.cpp index 4a2bfc13..4ea4674c 100644 --- a/frameworks/native/src/sensor_data_channel.cpp +++ b/frameworks/native/src/sensor_data_channel.cpp @@ -30,6 +30,7 @@ using namespace OHOS::AppExecFwk; int32_t SensorDataChannel::CreateSensorDataChannel(DataChannelCB callBack, void *data) { + SEN_HILOGI("In"); CHKPR(callBack, SENSOR_NATIVE_REGSITER_CB_ERR); dataCB_ = callBack; privateData_ = data; @@ -48,6 +49,7 @@ int32_t SensorDataChannel::RestoreSensorDataChannel() int32_t SensorDataChannel::InnerSensorDataChannel() { + SEN_HILOGI("In"); std::lock_guard eventRunnerLock(eventRunnerMutex_); // create basic data channel int32_t ret = CreateSensorBasicChannel(); @@ -74,6 +76,7 @@ int32_t SensorDataChannel::InnerSensorDataChannel() SEN_HILOGE("ListenedFdSet insert fd fail, fd:%{public}d", receiveFd); return ERROR; } + SEN_HILOGI("Done"); return ERR_OK; } diff --git a/frameworks/native/src/sensor_file_descriptor_listener.cpp b/frameworks/native/src/sensor_file_descriptor_listener.cpp index a3ea247a..b75aad92 100644 --- a/frameworks/native/src/sensor_file_descriptor_listener.cpp +++ b/frameworks/native/src/sensor_file_descriptor_listener.cpp @@ -82,6 +82,7 @@ void SensorFileDescriptorListener::ExcuteCallback(int32_t length) void SensorFileDescriptorListener::SetChannel(SensorDataChannel *channel) { + SEN_HILOGI("In"); channel_ = channel; } diff --git a/frameworks/native/src/sensor_service_client.cpp b/frameworks/native/src/sensor_service_client.cpp index ce8b778d..0e18619c 100644 --- a/frameworks/native/src/sensor_service_client.cpp +++ b/frameworks/native/src/sensor_service_client.cpp @@ -191,7 +191,7 @@ std::vector SensorServiceClient::GetSensorList() int32_t SensorServiceClient::TransferDataChannel(sptr sensorDataChannel) { - CALL_LOG_ENTER; + SEN_HILOGI("In"); CHKPR(sensorDataChannel, INVALID_POINTER); { std::lock_guard channelLock(channelMutex_); @@ -214,6 +214,7 @@ int32_t SensorServiceClient::TransferDataChannel(sptr sensorD #ifdef HIVIEWDFX_HITRACE_ENABLE FinishTrace(HITRACE_TAG_SENSORS); #endif // HIVIEWDFX_HITRACE_ENABLE + SEN_HILOGI("Done"); return ret; } @@ -301,24 +302,26 @@ void SensorServiceClient::ProcessDeathObserver(const wptr &object void SensorServiceClient::UpdateSensorInfoMap(int32_t sensorId, int64_t samplingPeriod, int64_t maxReportDelay) { - CALL_LOG_ENTER; + SEN_HILOGI("In"); SensorBasicInfo sensorInfo; sensorInfo.SetSamplingPeriodNs(samplingPeriod); sensorInfo.SetMaxReportDelayNs(maxReportDelay); sensorInfo.SetSensorState(true); std::lock_guard mapLock(mapMutex_); sensorInfoMap_[sensorId] = sensorInfo; + SEN_HILOGI("Done"); return; } void SensorServiceClient::DeleteSensorInfoItem(int32_t sensorId) { - CALL_LOG_ENTER; + SEN_HILOGI("In"); std::lock_guard mapLock(mapMutex_); auto it = sensorInfoMap_.find(sensorId); if (it != sensorInfoMap_.end()) { sensorInfoMap_.erase(it); } + SEN_HILOGI("Done"); return; } diff --git a/services/hdi_connection/adapter/src/hdi_connection.cpp b/services/hdi_connection/adapter/src/hdi_connection.cpp index e5a09d1b..27cb4a71 100644 --- a/services/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/hdi_connection/adapter/src/hdi_connection.cpp @@ -117,6 +117,7 @@ int32_t HdiConnection::GetSensorList(std::vector &sensorList) int32_t HdiConnection::EnableSensor(int32_t sensorId) { + SEN_HILOGI("In, sensorId:%{public}d", sensorId); CHKPR(g_sensorInterface, ERR_NO_INIT); int32_t ret = g_sensorInterface->Enable(sensorId); if (ret != 0) { @@ -128,11 +129,13 @@ int32_t HdiConnection::EnableSensor(int32_t sensorId) return ret; } SetSensorBasicInfoState(sensorId, true); + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); return ERR_OK; } int32_t HdiConnection::DisableSensor(int32_t sensorId) { + SEN_HILOGI("In, sensorId:%{public}d", sensorId); CHKPR(g_sensorInterface, ERR_NO_INIT); int32_t ret = g_sensorInterface->Disable(sensorId); if (ret != 0) { @@ -144,6 +147,7 @@ int32_t HdiConnection::DisableSensor(int32_t sensorId) return ret; } DeleteSensorBasicInfoState(sensorId); + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); return ERR_OK; } @@ -249,6 +253,7 @@ void HdiConnection::UpdateSensorBasicInfo(int32_t sensorId, int64_t samplingPeri void HdiConnection::SetSensorBasicInfoState(int32_t sensorId, bool state) { + SEN_HILOGI("In, sensorId:%{public}d", sensorId); std::lock_guard sensorInfoLock(g_sensorBasicInfoMutex); auto it = g_sensorBasicInfoMap.find(sensorId); if (it == g_sensorBasicInfoMap.end()) { @@ -256,15 +261,18 @@ void HdiConnection::SetSensorBasicInfoState(int32_t sensorId, bool state) return; } g_sensorBasicInfoMap[sensorId].SetSensorState(state); + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); } void HdiConnection::DeleteSensorBasicInfoState(int32_t sensorId) { + SEN_HILOGI("In, sensorId:%{public}d", sensorId); std::lock_guard sensorInfoLock(g_sensorBasicInfoMutex); auto it = g_sensorBasicInfoMap.find(sensorId); if (it != g_sensorBasicInfoMap.end()) { g_sensorBasicInfoMap.erase(sensorId); } + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); } void HdiConnection::RegisterHdiDeathRecipient() diff --git a/services/include/sensor_service.h b/services/include/sensor_service.h index 0e3ab6cd..5ff2a6c4 100644 --- a/services/include/sensor_service.h +++ b/services/include/sensor_service.h @@ -86,7 +86,8 @@ private: void UnregisterClientDeathRecipient(sptr sensorClient); bool InitSensorPolicy(); void ReportOnChangeData(int32_t sensorId); - void ReportSensorSysEvent(int32_t sensorId, bool enable, int32_t pid); + void ReportSensorSysEvent(int32_t sensorId, bool enable, int32_t pid, int64_t samplingPeriodNs = 0, + int64_t maxReportDelayNs = 0); ErrCode DisableSensor(int32_t sensorId, int32_t pid); bool RegisterPermCallback(int32_t sensorId); void UnregisterPermCallback(); diff --git a/services/src/client_info.cpp b/services/src/client_info.cpp index 4f9b6daa..921ab362 100644 --- a/services/src/client_info.cpp +++ b/services/src/client_info.cpp @@ -49,7 +49,7 @@ std::unordered_map> ClientInfo::userGrantPermMap_ bool ClientInfo::GetSensorState(int32_t sensorId) { - CALL_LOG_ENTER; + SEN_HILOGI("In, sensorId:%{public}d", sensorId); if (sensorId == INVALID_SENSOR_ID) { SEN_HILOGE("sensorId is invalid"); return false; @@ -100,7 +100,7 @@ SensorBasicInfo ClientInfo::GetBestSensorInfo(int32_t sensorId) bool ClientInfo::OnlyCurPidSensorEnabled(int32_t sensorId, int32_t pid) { - CALL_LOG_ENTER; + SEN_HILOGI("In, sensorId:%{public}d, pid:%{public}d", sensorId, pid); if ((sensorId == INVALID_SENSOR_ID) || (pid <= INVALID_PID)) { SEN_HILOGE("sensorId or pid is invalid"); return false; @@ -122,12 +122,13 @@ bool ClientInfo::OnlyCurPidSensorEnabled(int32_t sensorId, int32_t pid) } ret = true; } + SEN_HILOGI("Done, sensorId:%{public}d, pid:%{public}d", sensorId, pid); return ret; } bool ClientInfo::UpdateAppThreadInfo(int32_t pid, int32_t uid, AccessTokenID callerToken) { - CALL_LOG_ENTER; + SEN_HILOGI("In, pid:%{public}d", pid); if ((uid == INVALID_UID) || (pid <= INVALID_PID)) { SEN_HILOGE("uid or pid is invalid"); return false; @@ -144,12 +145,13 @@ bool ClientInfo::UpdateAppThreadInfo(int32_t pid, int32_t uid, AccessTokenID cal return ret.second; } appThreadInfoMap_[pid] = appThreadInfo; + SEN_HILOGI("Done, pid:%{public}d", pid); return true; } void ClientInfo::DestroyAppThreadInfo(int32_t pid) { - CALL_LOG_ENTER; + SEN_HILOGI("In, pid:%{public}d", pid); if (pid == INVALID_PID) { SEN_HILOGE("pid is invalid"); return; @@ -161,11 +163,12 @@ void ClientInfo::DestroyAppThreadInfo(int32_t pid) return; } appThreadInfoMap_.erase(appThreadInfoItr); + SEN_HILOGI("Done, pid:%{public}d", pid); } std::vector> ClientInfo::GetSensorChannelByUid(int32_t uid) { - CALL_LOG_ENTER; + SEN_HILOGI("In"); if (uid == INVALID_UID) { SEN_HILOGE("uid is invalid"); return {}; @@ -183,12 +186,13 @@ std::vector> ClientInfo::GetSensorChannelByUid(int3 } sensorChannel.push_back(channelIt->second); } + SEN_HILOGI("Done"); return sensorChannel; } sptr ClientInfo::GetSensorChannelByPid(int32_t pid) { - CALL_LOG_ENTER; + SEN_HILOGI("In, pid:%{public}d", pid); if (pid == INVALID_PID) { SEN_HILOGE("pid is invalid"); return nullptr; @@ -199,11 +203,13 @@ sptr ClientInfo::GetSensorChannelByPid(int32_t pid) SEN_HILOGE("There is no channel belong to the pid"); return nullptr; } + SEN_HILOGI("Done, pid:%{public}d", pid); return channelIt->second; } std::vector> ClientInfo::GetSensorChannel(int32_t sensorId) { + SEN_HILOGI("In, sensorId:%{public}d", sensorId); if (sensorId == INVALID_SENSOR_ID) { SEN_HILOGE("sensorId is invalid"); return {}; @@ -226,12 +232,13 @@ std::vector> ClientInfo::GetSensorChannel(int32_t s } sensorChannel.push_back(channelIt->second); } + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); return sensorChannel; } bool ClientInfo::UpdateSensorInfo(int32_t sensorId, int32_t pid, const SensorBasicInfo &sensorInfo) { - CALL_LOG_ENTER; + SEN_HILOGI("In, sensorId:%{public}d, pid:%{public}d", sensorId, pid); if ((sensorId == INVALID_SENSOR_ID) || (pid <= INVALID_PID) || (!sensorInfo.GetSensorState())) { SEN_HILOGE("Params are invalid"); return false; @@ -250,11 +257,13 @@ bool ClientInfo::UpdateSensorInfo(int32_t sensorId, int32_t pid, const SensorBas return ret.second; } it->second[pid] = sensorInfo; + SEN_HILOGI("Done, sensorId:%{public}d, pid:%{public}d", sensorId, pid); return true; } void ClientInfo::RemoveSubscriber(int32_t sensorId, uint32_t pid) { + SEN_HILOGI("In, sensorId:%{public}d, pid:%{public}u", sensorId, pid); std::lock_guard clientLock(clientMutex_); auto it = clientMap_.find(sensorId); if (it == clientMap_.end()) { @@ -265,11 +274,12 @@ void ClientInfo::RemoveSubscriber(int32_t sensorId, uint32_t pid) if (pidIt != it->second.end()) { it->second.erase(pidIt); } + SEN_HILOGI("Done, sensorId:%{public}d, pid:%{public}d", sensorId, pid); } bool ClientInfo::UpdateSensorChannel(int32_t pid, const sptr &channel) { - CALL_LOG_ENTER; + SEN_HILOGI("In, pid:%{public}d", pid); CHKPR(channel, false); if (pid <= INVALID_PID) { SEN_HILOGE("pid is invalid"); @@ -287,12 +297,13 @@ bool ClientInfo::UpdateSensorChannel(int32_t pid, const sptrsecond.size() == MIN_MAP_SIZE) { it = clientMap_.erase(it); } + SEN_HILOGI("Done, sensorId:%{public}d, pid:%{public}d", sensorId, pid); } bool ClientInfo::DestroySensorChannel(int32_t pid) diff --git a/services/src/sensor_data_processer.cpp b/services/src/sensor_data_processer.cpp index 8daa1907..f1e3b16d 100644 --- a/services/src/sensor_data_processer.cpp +++ b/services/src/sensor_data_processer.cpp @@ -170,6 +170,7 @@ void SensorDataProcesser::ReportData(sptr &channel, Sens } uint64_t periodCount = clientInfo_.ComputeBestPeriodCount(sensorId, channel); if (periodCount == 0UL) { + SEN_HILOGE("periodCount is zero"); return; } auto fifoCount = clientInfo_.ComputeBestFifoCount(sensorId, channel); @@ -257,9 +258,11 @@ void SensorDataProcesser::EventFilter(CircularEventBuf &eventsBuf) int32_t sensorId = eventsBuf.circularBuf[eventsBuf.readPos].sensorTypeId; std::vector> channelList = clientInfo_.GetSensorChannel(sensorId); for (auto &channel : channelList) { - if (channel->GetSensorStatus()) { - SendEvents(channel, eventsBuf.circularBuf[eventsBuf.readPos]); + if (!channel->GetSensorStatus()) { + SEN_HILOGW("Sensor status is not active"); + continue; } + SendEvents(channel, eventsBuf.circularBuf[eventsBuf.readPos]); } } diff --git a/services/src/sensor_manager.cpp b/services/src/sensor_manager.cpp index 18d7897b..523f25c2 100644 --- a/services/src/sensor_manager.cpp +++ b/services/src/sensor_manager.cpp @@ -50,7 +50,7 @@ void SensorManager::InitSensorMap(const std::unordered_map &sen bool SensorManager::SetBestSensorParams(int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) { - CALL_LOG_ENTER; + SEN_HILOGI("In, sensorId:%{public}d", sensorId); if (sensorId == INVALID_SENSOR_ID) { SEN_HILOGE("sensorId is invalid"); return false; @@ -70,12 +70,13 @@ bool SensorManager::SetBestSensorParams(int32_t sensorId, int64_t samplingPeriod SEN_HILOGE("SetBatch is failed"); return false; } + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); return true; } bool SensorManager::ResetBestSensorParams(int32_t sensorId) { - CALL_LOG_ENTER; + SEN_HILOGI("In, sensorId:%{public}d", sensorId); if (sensorId == INVALID_SENSOR_ID) { SEN_HILOGE("sensorId is invalid"); return false; @@ -87,6 +88,7 @@ bool SensorManager::ResetBestSensorParams(int32_t sensorId) SEN_HILOGE("SetBatch is failed"); return false; } + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); return true; } @@ -111,17 +113,19 @@ void SensorManager::InitSensorMap(const std::unordered_map &sen bool SensorManager::SaveSubscriber(int32_t sensorId, uint32_t pid, int64_t samplingPeriodNs, int64_t maxReportDelayNs) { + SEN_HILOGI("In, sensorId:%{public}d, pid:%{public}u", sensorId, pid); SensorBasicInfo sensorInfo = GetSensorInfo(sensorId, samplingPeriodNs, maxReportDelayNs); if (!clientInfo_.UpdateSensorInfo(sensorId, pid, sensorInfo)) { SEN_HILOGE("UpdateSensorInfo is failed"); return false; } + SEN_HILOGI("Done, sensorId:%{public}d, pid:%{public}u", sensorId, pid); return true; } SensorBasicInfo SensorManager::GetSensorInfo(int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) { - CALL_LOG_ENTER; + SEN_HILOGI("In, sensorId:%{public}d", sensorId); SensorBasicInfo sensorInfo; std::lock_guard sensorMapLock(sensorMapMutex_); auto it = sensorMap_.find(sensorId); @@ -144,12 +148,13 @@ SensorBasicInfo SensorManager::GetSensorInfo(int32_t sensorId, int64_t samplingP sensorInfo.SetSamplingPeriodNs(curSamplingPeriodNs); sensorInfo.SetMaxReportDelayNs(curReportDelayNs); sensorInfo.SetSensorState(true); + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); return sensorInfo; } bool SensorManager::IsOtherClientUsingSensor(int32_t sensorId, int32_t clientPid) { - CALL_LOG_ENTER; + SEN_HILOGI("In, sensorId:%{public}d, clientPid:%{public}d", sensorId, clientPid); if (clientInfo_.OnlyCurPidSensorEnabled(sensorId, clientPid)) { SEN_HILOGD("Only current client using this sensor"); return false; @@ -161,12 +166,13 @@ bool SensorManager::IsOtherClientUsingSensor(int32_t sensorId, int32_t clientPid } #endif // HDF_DRIVERS_INTERFACE_SENSOR SEN_HILOGD("Other client is using this sensor"); + SEN_HILOGI("Done, sensorId:%{public}d, clientPid:%{public}d", sensorId, clientPid); return true; } ErrCode SensorManager::AfterDisableSensor(int32_t sensorId) { - CALL_LOG_ENTER; + SEN_HILOGI("In, sensorId:%{public}d", sensorId); clientInfo_.ClearSensorInfo(sensorId); if (sensorId == PROXIMITY_SENSOR_ID) { SensorData sensorData; @@ -177,6 +183,7 @@ ErrCode SensorManager::AfterDisableSensor(int32_t sensorId) clientInfo_.StoreEvent(sensorData); } } + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); return ERR_OK; } diff --git a/services/src/sensor_service.cpp b/services/src/sensor_service.cpp index 155c4e12..5aadddc1 100644 --- a/services/src/sensor_service.cpp +++ b/services/src/sensor_service.cpp @@ -182,7 +182,8 @@ void SensorService::OnStop() #endif // MEMMGR_ENABLE } -void SensorService::ReportSensorSysEvent(int32_t sensorId, bool enable, int32_t pid) +void SensorService::ReportSensorSysEvent(int32_t sensorId, bool enable, int32_t pid, int64_t samplingPeriodNs, + int64_t maxReportDelayNs) { std::string packageName(""); AccessTokenID tokenId = clientInfo_.GetTokenIdByPid(pid); @@ -196,13 +197,16 @@ void SensorService::ReportSensorSysEvent(int32_t sensorId, bool enable, int32_t HiSysEventWrite(HiSysEvent::Domain::SENSOR, "ENABLE_SENSOR", HiSysEvent::EventType::STATISTIC, "LEVEL", logLevel, "UID", uid, "PKG_NAME", packageName, "TYPE", sensorId); #endif // HIVIEWDFX_HISYSEVENT_ENABLE - SEN_HILOGI("PackageName:%{public}s open the sensor, sensorId:%{public}d", packageName.c_str(), sensorId); + SEN_HILOGI("PackageName:%{public}s open the sensor, sensorId:%{public}d, pid:%{public}d, " + "samplingPeriodNs:%{public}" PRId64 ", samplingPeriodNs:%{public}" PRId64, packageName.c_str(), + sensorId, pid, samplingPeriodNs, maxReportDelayNs); } else { #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "DISABLE_SENSOR", HiSysEvent::EventType::STATISTIC, "LEVEL", logLevel, "UID", uid, "PKG_NAME", packageName, "TYPE", sensorId); #endif // HIVIEWDFX_HISYSEVENT_ENABLE - SEN_HILOGI("PackageName:%{public}s close the sensor, sensorId:%{public}d", packageName.c_str(), sensorId); + SEN_HILOGI("PackageName:%{public}s close the sensor, sensorId:%{public}d, pid:%{public}d", + packageName.c_str(), sensorId, pid); } } @@ -235,6 +239,7 @@ void SensorService::ReportOnChangeData(int32_t sensorId) ErrCode SensorService::SaveSubscriber(int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) { + SEN_HILOGI("In, sensorId:%{public}d", sensorId); if (!sensorManager_.SaveSubscriber(sensorId, GetCallingPid(), samplingPeriodNs, maxReportDelayNs)) { SEN_HILOGE("SaveSubscriber failed"); return UPDATE_SENSOR_INFO_ERR; @@ -249,6 +254,7 @@ ErrCode SensorService::SaveSubscriber(int32_t sensorId, int64_t samplingPeriodNs return SET_SENSOR_CONFIG_ERR; } #endif // HDF_DRIVERS_INTERFACE_SENSOR + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); return ERR_OK; } @@ -289,7 +295,7 @@ ErrCode SensorService::EnableSensor(int32_t sensorId, int64_t samplingPeriodNs, SEN_HILOGE("SaveSubscriber failed"); return ret; } - ReportSensorSysEvent(sensorId, true, pid); + ReportSensorSysEvent(sensorId, true, pid, samplingPeriodNs, maxReportDelayNs); if (ret != ERR_OK) { SEN_HILOGE("ret:%{public}d", ret); } @@ -298,6 +304,7 @@ ErrCode SensorService::EnableSensor(int32_t sensorId, int64_t samplingPeriodNs, ReportActiveInfo(sensorId, pid); } PrintSensorData::GetInstance().ResetHdiCounter(sensorId); + SEN_HILOGI("Done, sensorId:%{public}d", sensorId); return ERR_OK; } auto ret = SaveSubscriber(sensorId, samplingPeriodNs, maxReportDelayNs); @@ -317,7 +324,7 @@ ErrCode SensorService::EnableSensor(int32_t sensorId, int64_t samplingPeriodNs, if ((!g_isRegister) && (RegisterPermCallback(sensorId))) { g_isRegister = true; } - ReportSensorSysEvent(sensorId, true, pid); + ReportSensorSysEvent(sensorId, true, pid, samplingPeriodNs, maxReportDelayNs); if (isReportActiveInfo_) { ReportActiveInfo(sensorId, pid); } @@ -380,6 +387,7 @@ std::vector SensorService::GetSensorList() ErrCode SensorService::TransferDataChannel(const sptr &sensorBasicDataChannel, const sptr &sensorClient) { + SEN_HILOGI("In"); CHKPR(sensorBasicDataChannel, ERR_NO_INIT); auto pid = GetCallingPid(); auto uid = GetCallingUid(); @@ -394,6 +402,7 @@ ErrCode SensorService::TransferDataChannel(const sptr &s } sensorBasicDataChannel->SetSensorStatus(true); RegisterClientDeathRecipient(sensorClient, pid); + SEN_HILOGI("Done"); return ERR_OK; } diff --git a/utils/common/src/sensor_basic_data_channel.cpp b/utils/common/src/sensor_basic_data_channel.cpp index b92af95d..7cd3109f 100644 --- a/utils/common/src/sensor_basic_data_channel.cpp +++ b/utils/common/src/sensor_basic_data_channel.cpp @@ -47,6 +47,7 @@ SensorBasicDataChannel::SensorBasicDataChannel() : sendFd_(-1), receiveFd_(-1), int32_t SensorBasicDataChannel::CreateSensorBasicChannel() { + SEN_HILOGI("In"); std::unique_lock lock(fdLock_); if ((sendFd_ != -1) || (receiveFd_ != -1)) { SEN_HILOGD("Already create socketpair"); @@ -89,6 +90,7 @@ int32_t SensorBasicDataChannel::CreateSensorBasicChannel() } sendFd_ = socketPair[0]; receiveFd_ = socketPair[1]; + SEN_HILOGI("Done"); return ERR_OK; CLOSE_SOCK: -- Gitee