diff --git a/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp b/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp index 4315873bf6aca73d7cd18e0b4c65e362f223b874..8a20a16a37bdb6a25f259cf275f5215543d3ff70 100644 --- a/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp @@ -36,7 +36,7 @@ sptr eventCallback_ = nullptr; std::map sensorBasicInfoMap_; std::mutex sensorBasicInfoMutex_; constexpr int32_t GET_HDI_SERVICE_COUNT = 10; -constexpr uint32_t WAIT_MS = 100; +constexpr uint32_t WAIT_MS = 300; } ZReportDataCb HdiConnection::reportDataCb_ = nullptr; @@ -64,6 +64,7 @@ int32_t HdiConnection::ConnectHdi() } HiLog::Error(LABEL, "%{public}s connect v1_0 hdi failed", __func__); return ERR_NO_INIT; + HiLog::Debug(LABEL, "%{public}s end", __func__); } int32_t HdiConnection::GetSensorList(std::vector& sensorList) @@ -79,7 +80,7 @@ int32_t HdiConnection::GetSensorList(std::vector& sensorList) HiLog::Error(LABEL, "%{public}s get sensor list failed", __func__); return ret; } - for (int32_t i = 0; i < static_cast(sensorInfos.size()); i++) { + for (size_t i = 0; i < sensorInfos.size(); i++) { const std::string sensorName(sensorInfos[i].sensorName); const std::string vendorName(sensorInfos[i].vendorName); const std::string firmwareVersion(sensorInfos[i].firmwareVersion); @@ -99,6 +100,7 @@ int32_t HdiConnection::GetSensorList(std::vector& sensorList) sensorList.push_back(sensor); } return ERR_OK; + HiLog::Debug(LABEL, "%{public}s end", __func__); } int32_t HdiConnection::EnableSensor(int32_t sensorId) @@ -159,6 +161,7 @@ int32_t HdiConnection::SetMode(int32_t sensorId, int32_t mode) return ret; } return ERR_OK; + HiLog::Debug(LABEL, "%{public}s end", __func__); } int32_t HdiConnection::SetOption(int32_t sensorId, int32_t option) @@ -174,6 +177,7 @@ int32_t HdiConnection::SetOption(int32_t sensorId, int32_t option) return ret; } return ERR_OK; + HiLog::Debug(LABEL, "%{public}s end", __func__); } int32_t HdiConnection::RegisteDataReport(ZReportDataCb cb, sptr reportDataCallback) @@ -191,6 +195,7 @@ int32_t HdiConnection::RegisteDataReport(ZReportDataCb cb, sptr HdiConnection::getReportDataCallback() @@ -231,6 +238,7 @@ sptr HdiConnection::getReportDataCallback() HiLog::Error(LABEL, "%{public}s reportDataCallback_ cannot be null", __func__); } return reportDataCallback_; + HiLog::Debug(LABEL, "%{public}s end", __func__); } void HdiConnection::updateSensorBasicInfo(int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) @@ -285,6 +293,7 @@ void HdiConnection::UnregisterHdiDeathRecipient() return; } sensorInterface_->AsObject()->RemoveDeathRecipient(hdiDeathObserver_); + HiLog::Debug(LABEL, "%{public}s end", __func__); } void HdiConnection::ProcessDeathObserver(const wptr &object) @@ -298,6 +307,7 @@ void HdiConnection::ProcessDeathObserver(const wptr &object) hdiService->RemoveDeathRecipient(hdiDeathObserver_); eventCallback_ = nullptr; reconnect(); + HiLog::Debug(LABEL, "%{public}s end", __func__); } void HdiConnection::reconnect() @@ -334,6 +344,7 @@ void HdiConnection::reconnect() HiLog::Error(LABEL, "%{public}s enable sensor fail, sensorTypeId: %{public}d", __func__, sensorTypeId); } } + HiLog::Debug(LABEL, "%{public}s end", __func__); } } // namespace Sensors } // namespace OHOS diff --git a/services/sensor/src/sensor_service.cpp b/services/sensor/src/sensor_service.cpp index 97724d87a52b08a74d7656a8553c17880106bdfb..9740ffa089745529776de030854d7338cb54c5ae 100644 --- a/services/sensor/src/sensor_service.cpp +++ b/services/sensor/src/sensor_service.cpp @@ -82,12 +82,8 @@ void SensorService::OnStart() HiLog::Error(LABEL, "%{public}s failed, sensorDataProcesser_ cannot be null", __func__); return; } - if (!InitSensorPolicy()) { - HiLog::Error(LABEL, "%{public}s Init sensor policy error", __func__); - } - bool isPublished = SystemAbility::Publish(this); - if (!isPublished) { + if (!SystemAbility::Publish(this)) { HiLog::Error(LABEL, "%{public}s publish SensorService error", __func__); return; } @@ -139,11 +135,6 @@ bool SensorService::InitSensorList() return true; } -bool SensorService::InitSensorPolicy() -{ - return true; -} - void SensorService::OnStop() { HiLog::Debug(LABEL, "%{public}s begin", __func__);