From 54c55be869dbb1f92a835a18a9e25ef366221b4c Mon Sep 17 00:00:00 2001 From: cff-gite Date: Tue, 16 Jan 2024 09:07:48 +0800 Subject: [PATCH 1/4] =?UTF-8?q?sensor=E6=97=A5=E5=BF=97=E8=BD=BB=E9=87=8F?= =?UTF-8?q?=E5=8C=96=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: I1258229fdb7d09fb1acca4bb5a74a58b638813c2 --- frameworks/js/napi/src/sensor_napi_error.cpp | 6 +++--- frameworks/native/src/fd_listener.cpp | 4 +++- frameworks/native/src/native_sensor.cpp | 4 +++- frameworks/native/src/sensor_agent.cpp | 5 ++--- frameworks/native/src/sensor_agent_proxy.cpp | 4 ++-- frameworks/native/src/sensor_algorithm.cpp | 6 ++---- frameworks/native/src/sensor_client_stub.cpp | 6 ++---- frameworks/native/src/sensor_data_channel.cpp | 3 ++- frameworks/native/src/sensor_file_descriptor_listener.cpp | 4 +++- frameworks/native/src/sensor_service_client.cpp | 4 +++- frameworks/native/src/sensor_service_proxy.cpp | 7 +++---- .../hdi_connection/adapter/src/compatible_connection.cpp | 7 +++---- services/hdi_connection/adapter/src/hdi_connection.cpp | 4 +++- .../hdi_connection/adapter/src/sensor_event_callback.cpp | 4 +++- services/hdi_connection/hardware/src/hdi_service_impl.cpp | 5 ++++- .../interface/src/sensor_hdi_connection.cpp | 4 +++- services/src/client_info.cpp | 4 +++- services/src/flush_info_record.cpp | 4 +++- services/src/sensor_data_processer.cpp | 4 +++- services/src/sensor_dump.cpp | 4 +++- services/src/sensor_manager.cpp | 4 +++- services/src/sensor_power_policy.cpp | 3 ++- services/src/sensor_service.cpp | 4 +++- services/src/sensor_service_stub.cpp | 6 +++--- services/src/stream_server.cpp | 4 +++- .../getactivesensorinfos_fuzzer.cpp | 4 +++- .../interfaces/register_fuzzer/register_fuzzer.cpp | 4 +++- .../resumesensors_fuzzer/resumesensors_fuzzer.cpp | 4 +++- .../suspendsensors_fuzzer/suspendsensors_fuzzer.cpp | 4 +++- .../interfaces/unregister_fuzzer/unregister_fuzzer.cpp | 4 +++- test/unittest/common/src/system_info.cpp | 4 +++- .../unittest/interfaces/inner_api/drop_detection_test.cpp | 4 +++- test/unittest/interfaces/inner_api/head_posture_test.cpp | 4 +++- test/unittest/interfaces/inner_api/posture_test.cpp | 4 +++- test/unittest/interfaces/inner_api/sensor_agent_test.cpp | 4 +++- .../interfaces/inner_api/sensor_algorithm_test.cpp | 4 +++- test/unittest/interfaces/inner_api/sensor_power_test.cpp | 4 +++- test/unittest/interfaces/kits/sensor_native_test.cpp | 4 +++- utils/common/src/active_info.cpp | 6 +++--- utils/common/src/permission_util.cpp | 7 +++---- utils/common/src/report_data_callback.cpp | 6 +++--- utils/common/src/sensor.cpp | 8 ++++---- utils/common/src/sensor_basic_data_channel.cpp | 4 +++- utils/ipc/src/stream_session.cpp | 6 +++--- utils/ipc/src/stream_socket.cpp | 5 ++--- .../core/algorithm/conversion/src/conversion_fft.cpp | 4 +++- .../core/algorithm/conversion/src/conversion_filter.cpp | 4 +++- .../core/algorithm/conversion/src/conversion_mfcc.cpp | 4 +++- vibration_convert/core/algorithm/conversion/src/fft.cpp | 4 +++- .../frequency_estimation/src/frequency_estimation.cpp | 4 +++- .../intensity_processor/src/intensity_processor.cpp | 4 +++- vibration_convert/core/algorithm/onset/src/onset.cpp | 4 +++- .../core/algorithm/peak_finder/src/peak_finder.cpp | 4 +++- vibration_convert/core/native/src/audio_parsing.cpp | 4 +++- .../core/native/src/generate_vibration_json_file.cpp | 6 +++--- .../core/native/src/vibration_convert_core.cpp | 4 +++- .../core/native/test/unittest/generate_json_test.cpp | 7 +++---- vibration_convert/core/utils/src/audio_utils.cpp | 4 +++- vibration_convert/core/utils/src/utils.cpp | 4 +++- .../interfaces/js/src/vibrator_convert_js.cpp | 4 +++- .../interfaces/js/src/vibrator_convert_napi_utils.cpp | 4 +++- 61 files changed, 178 insertions(+), 99 deletions(-) mode change 100755 => 100644 frameworks/js/napi/src/sensor_napi_error.cpp mode change 100755 => 100644 test/unittest/interfaces/inner_api/sensor_agent_test.cpp mode change 100755 => 100644 test/unittest/interfaces/inner_api/sensor_algorithm_test.cpp mode change 100755 => 100644 test/unittest/interfaces/kits/sensor_native_test.cpp mode change 100755 => 100644 utils/common/src/sensor_basic_data_channel.cpp diff --git a/frameworks/js/napi/src/sensor_napi_error.cpp b/frameworks/js/napi/src/sensor_napi_error.cpp old mode 100755 new mode 100644 index e9918fdf..fa3c948e --- a/frameworks/js/napi/src/sensor_napi_error.cpp +++ b/frameworks/js/napi/src/sensor_napi_error.cpp @@ -17,11 +17,11 @@ #include +#undef LOG_TAG +#define LOG_TAG "SensorJsAPI" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, SENSOR_LOG_DOMAIN, "SensorJsAPI"}; -} // namespace napi_value CreateBusinessError(const napi_env &env, const int32_t errCode, const std::string &errMessage) { napi_value businessError = nullptr; diff --git a/frameworks/native/src/fd_listener.cpp b/frameworks/native/src/fd_listener.cpp index ef5364a1..4b8cbe1d 100644 --- a/frameworks/native/src/fd_listener.cpp +++ b/frameworks/native/src/fd_listener.cpp @@ -20,11 +20,13 @@ #include "sensor_errors.h" #include "stream_socket.h" +#undef LOG_TAG +#define LOG_TAG "FdListener" + namespace OHOS { namespace Sensors { using namespace OHOS::AppExecFwk; namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "FdListener" }; constexpr int32_t MAX_DATA_BUF_SIZE = 256; } // namespace diff --git a/frameworks/native/src/native_sensor.cpp b/frameworks/native/src/native_sensor.cpp index bfcd647e..6dafdf50 100644 --- a/frameworks/native/src/native_sensor.cpp +++ b/frameworks/native/src/native_sensor.cpp @@ -21,10 +21,12 @@ #include "sensor_agent.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorCapiAPI" + using OHOS::HiviewDFX::HiLog; using OHOS::HiviewDFX::HiLogLabel; namespace { -const HiLogLabel LABEL = {LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorCapiAPI"}; const uint32_t FLOAT_SIZE = 4; } diff --git a/frameworks/native/src/sensor_agent.cpp b/frameworks/native/src/sensor_agent.cpp index 30466b52..710d1d71 100644 --- a/frameworks/native/src/sensor_agent.cpp +++ b/frameworks/native/src/sensor_agent.cpp @@ -18,6 +18,8 @@ #include "sensor_agent_proxy.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorNativeAPI" using OHOS::HiviewDFX::HiLog; using OHOS::HiviewDFX::HiLogLabel; using OHOS::Sensors::SensorAgentProxy; @@ -25,9 +27,6 @@ using OHOS::Sensors::SERVICE_EXCEPTION; using OHOS::Sensors::PARAMETER_ERROR; using OHOS::Sensors::PERMISSION_DENIED; using OHOS::Sensors::NON_SYSTEM_API; -namespace { -constexpr HiLogLabel LABEL = {LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorNativeAPI"}; -} // namespace static int32_t NormalizeErrCode(int32_t code) { diff --git a/frameworks/native/src/sensor_agent_proxy.cpp b/frameworks/native/src/sensor_agent_proxy.cpp index 40ac118d..5bbcec9f 100644 --- a/frameworks/native/src/sensor_agent_proxy.cpp +++ b/frameworks/native/src/sensor_agent_proxy.cpp @@ -20,12 +20,12 @@ #include "securec.h" #include "sensor_errors.h" #include "sensor_service_client.h" - +#undef LOG_TAG +#define LOG_TAG "SensorAgentProxy" using namespace OHOS::HiviewDFX; namespace OHOS { namespace Sensors { namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorAgentProxy" }; constexpr uint32_t MAX_SENSOR_LIST_SIZE = 0Xffff; std::mutex sensorInfoMutex_; SensorInfo *sensorInfos_ = nullptr; diff --git a/frameworks/native/src/sensor_algorithm.cpp b/frameworks/native/src/sensor_algorithm.cpp index 4f7980f8..4b1d5521 100644 --- a/frameworks/native/src/sensor_algorithm.cpp +++ b/frameworks/native/src/sensor_algorithm.cpp @@ -20,14 +20,12 @@ #include "sensor_errors.h" #include "sensor_utils.h" +#undef LOG_TAG +#define LOG_TAG "SensorAlgorithmAPI" using OHOS::HiviewDFX::HiLog; using OHOS::HiviewDFX::HiLogLabel; using namespace OHOS::Sensors; -namespace { -constexpr HiLogLabel LABEL = {LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorAlgorithmAPI"}; -} // namespace - int32_t SensorAlgorithm::CreateQuaternion(std::vector rotationVector, std::vector &quaternion) { if (static_cast(rotationVector.size()) < ROTATION_VECTOR_LENGTH diff --git a/frameworks/native/src/sensor_client_stub.cpp b/frameworks/native/src/sensor_client_stub.cpp index 96416f2e..48db50b6 100644 --- a/frameworks/native/src/sensor_client_stub.cpp +++ b/frameworks/native/src/sensor_client_stub.cpp @@ -18,14 +18,12 @@ #include "message_parcel.h" #include "sensor_log.h" +#undef LOG_TAG +#define LOG_TAG "SensorClientStub" namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorClientStub" }; -} // namespace - int32_t SensorClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { diff --git a/frameworks/native/src/sensor_data_channel.cpp b/frameworks/native/src/sensor_data_channel.cpp index 76588289..141ee803 100644 --- a/frameworks/native/src/sensor_data_channel.cpp +++ b/frameworks/native/src/sensor_data_channel.cpp @@ -21,12 +21,13 @@ #include "sensor_errors.h" #include "sensor_file_descriptor_listener.h" +#undef LOG_TAG +#define LOG_TAG "SensorDataChannel" namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace OHOS::AppExecFwk; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorDataChannel" }; const std::string LISTENER_THREAD_NAME = "OS_SenConsumer"; } // namespace diff --git a/frameworks/native/src/sensor_file_descriptor_listener.cpp b/frameworks/native/src/sensor_file_descriptor_listener.cpp index aad73354..e3e0c9c9 100644 --- a/frameworks/native/src/sensor_file_descriptor_listener.cpp +++ b/frameworks/native/src/sensor_file_descriptor_listener.cpp @@ -19,13 +19,15 @@ #include "sensor_errors.h" #include "sys/socket.h" +#undef LOG_TAG +#define LOG_TAG "SensorFileDescriptorListener" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace OHOS::AppExecFwk; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorFileDescriptorListener" }; constexpr int32_t RECEIVE_DATA_SIZE = 100; } // namespace diff --git a/frameworks/native/src/sensor_service_client.cpp b/frameworks/native/src/sensor_service_client.cpp index 11d78225..a2f02e9c 100644 --- a/frameworks/native/src/sensor_service_client.cpp +++ b/frameworks/native/src/sensor_service_client.cpp @@ -29,12 +29,14 @@ #include "system_ability_definition.h" #include "rust_binding.h" +#undef LOG_TAG +#define LOG_TAG "SensorServiceClient" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorServiceClient" }; constexpr int32_t GET_SERVICE_MAX_COUNT = 3; constexpr uint32_t WAIT_MS = 200; #ifdef OHOS_BUILD_ENABLE_RUST diff --git a/frameworks/native/src/sensor_service_proxy.cpp b/frameworks/native/src/sensor_service_proxy.cpp index b85a484a..18790f4a 100644 --- a/frameworks/native/src/sensor_service_proxy.cpp +++ b/frameworks/native/src/sensor_service_proxy.cpp @@ -23,14 +23,13 @@ #include "sensor_errors.h" #include "sensor_parcel.h" +#undef LOG_TAG +#define LOG_TAG "SensorServiceProxy" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorServiceProxy" }; -} // namespace - SensorServiceProxy::SensorServiceProxy(const sptr &impl) : IRemoteProxy(impl) {} diff --git a/services/hdi_connection/adapter/src/compatible_connection.cpp b/services/hdi_connection/adapter/src/compatible_connection.cpp index 1e9712b9..f7096eaa 100644 --- a/services/hdi_connection/adapter/src/compatible_connection.cpp +++ b/services/hdi_connection/adapter/src/compatible_connection.cpp @@ -19,14 +19,13 @@ #include "securec.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "CompatibleConnection" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "CompatibleConnection" }; -} // namespace - ReportDataCb CompatibleConnection::reportDataCb_ = nullptr; sptr CompatibleConnection::reportDataCallback_ = nullptr; int32_t CompatibleConnection::ConnectHdi() diff --git a/services/hdi_connection/adapter/src/hdi_connection.cpp b/services/hdi_connection/adapter/src/hdi_connection.cpp index 300b1b1f..cd10fc40 100644 --- a/services/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/hdi_connection/adapter/src/hdi_connection.cpp @@ -26,6 +26,9 @@ #include "sensor_errors.h" #include "sensor_event_callback.h" +#undef LOG_TAG +#define LOG_TAG "HdiConnection" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; @@ -33,7 +36,6 @@ using OHOS::HDI::Sensor::V2_0::ISensorInterface; using OHOS::HDI::Sensor::V2_0::ISensorCallback; using OHOS::HDI::Sensor::V2_0::HdfSensorInformation; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "HdiConnection" }; sptr g_sensorInterface = nullptr; sptr g_eventCallback = nullptr; std::map g_sensorBasicInfoMap; diff --git a/services/hdi_connection/adapter/src/sensor_event_callback.cpp b/services/hdi_connection/adapter/src/sensor_event_callback.cpp index 89286b61..734e6de7 100644 --- a/services/hdi_connection/adapter/src/sensor_event_callback.cpp +++ b/services/hdi_connection/adapter/src/sensor_event_callback.cpp @@ -19,11 +19,13 @@ #include "sensor_data_event.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "HdiConnection" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "HdiConnection" }; std::unique_ptr HdiConnection_ = std::make_unique(); constexpr int32_t HEADPOSTURE_DATA_SIZE = 20; } // namespace diff --git a/services/hdi_connection/hardware/src/hdi_service_impl.cpp b/services/hdi_connection/hardware/src/hdi_service_impl.cpp index ae58f1e8..d1701357 100644 --- a/services/hdi_connection/hardware/src/hdi_service_impl.cpp +++ b/services/hdi_connection/hardware/src/hdi_service_impl.cpp @@ -21,12 +21,15 @@ #include #include "sensor_errors.h" + +#undef LOG_TAG +#define LOG_TAG "HdiServiceImpl" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "HdiServiceImpl" }; constexpr int64_t SAMPLING_INTERVAL_NS = 200000000; constexpr float TARGET_SUM = 9.8F * 9.8F; constexpr float MAX_RANGE = 9999.0F; diff --git a/services/hdi_connection/interface/src/sensor_hdi_connection.cpp b/services/hdi_connection/interface/src/sensor_hdi_connection.cpp index 2280924e..37e07270 100644 --- a/services/hdi_connection/interface/src/sensor_hdi_connection.cpp +++ b/services/hdi_connection/interface/src/sensor_hdi_connection.cpp @@ -21,6 +21,9 @@ #include "hdi_connection.h" #include "hitrace_meter.h" #include "sensor_errors.h" + +#undef LOG_TAG +#define LOG_TAG "SensorHdiConnection" std::mutex OHOS::Sensors::ISensorHdiConnection::dataMutex_; std::condition_variable OHOS::Sensors::ISensorHdiConnection::dataCondition_; @@ -28,7 +31,6 @@ namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorHdiConnection" }; #ifdef BUILD_VARIANT_ENG constexpr float MAX_RANGE = 9999.0; constexpr float POWER = 20.0; diff --git a/services/src/client_info.cpp b/services/src/client_info.cpp index 649b15cf..f70d9e6d 100644 --- a/services/src/client_info.cpp +++ b/services/src/client_info.cpp @@ -25,12 +25,14 @@ #include "sensor_hdi_connection.h" #endif // HDF_DRIVERS_INTERFACE_SENSOR +#undef LOG_TAG +#define LOG_TAG "ClientInfo" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "ClientInfo" }; constexpr int32_t INVALID_SENSOR_ID = -1; constexpr int32_t INVALID_PID = -1; constexpr int32_t INVALID_UID = -1; diff --git a/services/src/flush_info_record.cpp b/services/src/flush_info_record.cpp index 1d840746..b39c1495 100644 --- a/services/src/flush_info_record.cpp +++ b/services/src/flush_info_record.cpp @@ -17,12 +17,14 @@ #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "FlushInfoRecord" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "FlushInfoRecord" }; constexpr int32_t CHANNEL_NO_FLUSH = -1; } // namespace diff --git a/services/src/sensor_data_processer.cpp b/services/src/sensor_data_processer.cpp index 47e83bb9..9a23c4e3 100644 --- a/services/src/sensor_data_processer.cpp +++ b/services/src/sensor_data_processer.cpp @@ -26,12 +26,14 @@ #include "sensor_errors.h" #include "system_ability_definition.h" +#undef LOG_TAG +#define LOG_TAG "SensorDataProcesser" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorDataProcesser" }; const std::string SENSOR_REPORT_THREAD_NAME = "OS_SenProducer"; } // namespace diff --git a/services/src/sensor_dump.cpp b/services/src/sensor_dump.cpp index 8e4b5c75..01feacb2 100644 --- a/services/src/sensor_dump.cpp +++ b/services/src/sensor_dump.cpp @@ -26,11 +26,13 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorDump" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorDump" }; constexpr int32_t MAX_DUMP_PARAMETERS = 32; #ifdef BUILD_VARIANT_ENG constexpr uint32_t MAX_DUMP_DATA_SIZE = 10; diff --git a/services/src/sensor_manager.cpp b/services/src/sensor_manager.cpp index fe870cb8..941dd45d 100644 --- a/services/src/sensor_manager.cpp +++ b/services/src/sensor_manager.cpp @@ -23,11 +23,13 @@ #include "sensor_data_event.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorManager" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorManager" }; #ifdef HDF_DRIVERS_INTERFACE_SENSOR constexpr int32_t INVALID_SENSOR_ID = -1; #endif // HDF_DRIVERS_INTERFACE_SENSOR diff --git a/services/src/sensor_power_policy.cpp b/services/src/sensor_power_policy.cpp index 0a90ad24..82bbf157 100644 --- a/services/src/sensor_power_policy.cpp +++ b/services/src/sensor_power_policy.cpp @@ -20,13 +20,14 @@ #ifdef OHOS_BUILD_ENABLE_RUST #include "rust_binding.h" #endif // OHOS_BUILD_ENABLE_RUST +#undef LOG_TAG +#define LOG_TAG "SensorPowerPolicy" namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorPowerPolicy" }; constexpr int32_t INVALID_SENSOR_ID = -1; constexpr int64_t MAX_EVENT_COUNT = 1000; ClientInfo &clientInfo_ = ClientInfo::GetInstance(); diff --git a/services/src/sensor_service.cpp b/services/src/sensor_service.cpp index 45ca8992..5979dcf5 100644 --- a/services/src/sensor_service.cpp +++ b/services/src/sensor_service.cpp @@ -29,11 +29,13 @@ #include "sensor_errors.h" #include "system_ability_definition.h" +#undef LOG_TAG +#define LOG_TAG "SensorService" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorService" }; auto g_sensorService = SensorDelayedSpSingleton::GetInstance(); const bool G_REGISTER_RESULT = SystemAbility::MakeAndRegisterAbility(g_sensorService.GetRefPtr()); constexpr int32_t INVALID_PID = -1; diff --git a/services/src/sensor_service_stub.cpp b/services/src/sensor_service_stub.cpp index 21a6e9a5..b4a692a3 100644 --- a/services/src/sensor_service_stub.cpp +++ b/services/src/sensor_service_stub.cpp @@ -30,12 +30,12 @@ #include "sensor_errors.h" #include "sensor_parcel.h" +#undef LOG_TAG +#define LOG_TAG "SensorServiceStub" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorServiceStub" }; -} // namespace SensorServiceStub::SensorServiceStub() { diff --git a/services/src/stream_server.cpp b/services/src/stream_server.cpp index 5a55d8c5..27176c12 100644 --- a/services/src/stream_server.cpp +++ b/services/src/stream_server.cpp @@ -21,10 +21,12 @@ #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "StreamServer" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "StreamServer" }; constexpr int32_t INVALID_PID = -1; constexpr int32_t INVALID_FD = -1; } // namespace diff --git a/test/fuzztest/interfaces/getactivesensorinfos_fuzzer/getactivesensorinfos_fuzzer.cpp b/test/fuzztest/interfaces/getactivesensorinfos_fuzzer/getactivesensorinfos_fuzzer.cpp index 1ea7754f..57d545e6 100644 --- a/test/fuzztest/interfaces/getactivesensorinfos_fuzzer/getactivesensorinfos_fuzzer.cpp +++ b/test/fuzztest/interfaces/getactivesensorinfos_fuzzer/getactivesensorinfos_fuzzer.cpp @@ -24,13 +24,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "GetActiveSensorInfosFuzzTest" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "GetActiveSensorInfosFuzzTest" }; constexpr size_t DATA_MIN_SIZE = 4; } // namespace diff --git a/test/fuzztest/interfaces/register_fuzzer/register_fuzzer.cpp b/test/fuzztest/interfaces/register_fuzzer/register_fuzzer.cpp index d4f646da..22fd4928 100644 --- a/test/fuzztest/interfaces/register_fuzzer/register_fuzzer.cpp +++ b/test/fuzztest/interfaces/register_fuzzer/register_fuzzer.cpp @@ -24,13 +24,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "RegisterFuzzTest" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "RegisterFuzzTest" }; constexpr size_t DATA_MIN_SIZE = 4; } // namespace diff --git a/test/fuzztest/interfaces/resumesensors_fuzzer/resumesensors_fuzzer.cpp b/test/fuzztest/interfaces/resumesensors_fuzzer/resumesensors_fuzzer.cpp index 9bf068f4..a924edb5 100644 --- a/test/fuzztest/interfaces/resumesensors_fuzzer/resumesensors_fuzzer.cpp +++ b/test/fuzztest/interfaces/resumesensors_fuzzer/resumesensors_fuzzer.cpp @@ -23,13 +23,15 @@ #include "sensor_agent.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "ResumeSensorsFuzzTest" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "ResumeSensorsFuzzTest" }; constexpr size_t DATA_MIN_SIZE = 4; } // namespace diff --git a/test/fuzztest/interfaces/suspendsensors_fuzzer/suspendsensors_fuzzer.cpp b/test/fuzztest/interfaces/suspendsensors_fuzzer/suspendsensors_fuzzer.cpp index 5bdd8c38..8e459440 100644 --- a/test/fuzztest/interfaces/suspendsensors_fuzzer/suspendsensors_fuzzer.cpp +++ b/test/fuzztest/interfaces/suspendsensors_fuzzer/suspendsensors_fuzzer.cpp @@ -23,13 +23,15 @@ #include "sensor_agent.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SuspendSensorsFuzzTest" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SuspendSensorsFuzzTest" }; constexpr size_t DATA_MIN_SIZE = 4; } // namespace diff --git a/test/fuzztest/interfaces/unregister_fuzzer/unregister_fuzzer.cpp b/test/fuzztest/interfaces/unregister_fuzzer/unregister_fuzzer.cpp index 0255dd70..86cdfb7f 100644 --- a/test/fuzztest/interfaces/unregister_fuzzer/unregister_fuzzer.cpp +++ b/test/fuzztest/interfaces/unregister_fuzzer/unregister_fuzzer.cpp @@ -24,13 +24,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "UnregisterFuzzTest" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "UnregisterFuzzTest" }; constexpr size_t DATA_MIN_SIZE = 4; } // namespace diff --git a/test/unittest/common/src/system_info.cpp b/test/unittest/common/src/system_info.cpp index af7b9754..d3fa641c 100644 --- a/test/unittest/common/src/system_info.cpp +++ b/test/unittest/common/src/system_info.cpp @@ -26,12 +26,14 @@ #include "securec.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SYSTEM_INFO" + namespace OHOS { namespace Sensors { namespace SYSTEM_INFO { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SYSTEM_INFO" }; constexpr int32_t LOCATION = 14; constexpr int32_t TIME_WAIT_FOR_OP = 1000; constexpr int32_t DEFAULT_PID = -1; diff --git a/test/unittest/interfaces/inner_api/drop_detection_test.cpp b/test/unittest/interfaces/inner_api/drop_detection_test.cpp index 071fc4d7..3abd6a52 100644 --- a/test/unittest/interfaces/inner_api/drop_detection_test.cpp +++ b/test/unittest/interfaces/inner_api/drop_detection_test.cpp @@ -22,13 +22,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "DropDetectionTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "DropDetectionTest" }; std::atomic_bool g_existDropDetection = false; } // namespace diff --git a/test/unittest/interfaces/inner_api/head_posture_test.cpp b/test/unittest/interfaces/inner_api/head_posture_test.cpp index 463f8f98..9c8855d7 100644 --- a/test/unittest/interfaces/inner_api/head_posture_test.cpp +++ b/test/unittest/interfaces/inner_api/head_posture_test.cpp @@ -22,13 +22,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "HeadPostureTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "HeadPostureTest" }; std::atomic_bool g_existHeadPosture = false; } // namespace diff --git a/test/unittest/interfaces/inner_api/posture_test.cpp b/test/unittest/interfaces/inner_api/posture_test.cpp index bd7b1484..887d15fa 100644 --- a/test/unittest/interfaces/inner_api/posture_test.cpp +++ b/test/unittest/interfaces/inner_api/posture_test.cpp @@ -22,13 +22,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "PostureTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "PostureTest" }; constexpr float ANGLE_MAX = 180.0F; constexpr float ANGLE_MIN = 0.0F; std::atomic_bool g_existPosture = false; diff --git a/test/unittest/interfaces/inner_api/sensor_agent_test.cpp b/test/unittest/interfaces/inner_api/sensor_agent_test.cpp old mode 100755 new mode 100644 index a3a5dced..9f215d26 --- a/test/unittest/interfaces/inner_api/sensor_agent_test.cpp +++ b/test/unittest/interfaces/inner_api/sensor_agent_test.cpp @@ -25,6 +25,9 @@ #include "sensor_errors.h" #include "system_info.h" +#undef LOG_TAG +#define LOG_TAG "SensorAgentTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; @@ -33,7 +36,6 @@ using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorAgentTest" }; constexpr int32_t SENSOR_ID { 1 }; constexpr int32_t INVALID_VALUE { -1 }; diff --git a/test/unittest/interfaces/inner_api/sensor_algorithm_test.cpp b/test/unittest/interfaces/inner_api/sensor_algorithm_test.cpp old mode 100755 new mode 100644 index db163c9c..c0917f0c --- a/test/unittest/interfaces/inner_api/sensor_algorithm_test.cpp +++ b/test/unittest/interfaces/inner_api/sensor_algorithm_test.cpp @@ -19,13 +19,15 @@ #include "sensor_algorithm.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorAlgorithmTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorAlgorithmTest" }; constexpr int32_t QUATERNION_LENGTH = 4; constexpr int32_t ROTATION_VECTOR_LENGTH = 3; constexpr int32_t THREE_DIMENSIONAL_MATRIX_LENGTH = 9; diff --git a/test/unittest/interfaces/inner_api/sensor_power_test.cpp b/test/unittest/interfaces/inner_api/sensor_power_test.cpp index 6116bb75..1d3a96be 100644 --- a/test/unittest/interfaces/inner_api/sensor_power_test.cpp +++ b/test/unittest/interfaces/inner_api/sensor_power_test.cpp @@ -27,6 +27,9 @@ #include "sensor_agent.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorPowerTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; @@ -35,7 +38,6 @@ using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorPowerTest" }; constexpr int32_t SENSOR_ID { 1 }; constexpr int32_t INVALID_VALUE { -1 }; } // namespace diff --git a/test/unittest/interfaces/kits/sensor_native_test.cpp b/test/unittest/interfaces/kits/sensor_native_test.cpp old mode 100755 new mode 100644 index 1755d6c2..69293ab3 --- a/test/unittest/interfaces/kits/sensor_native_test.cpp +++ b/test/unittest/interfaces/kits/sensor_native_test.cpp @@ -25,6 +25,9 @@ #include "oh_sensor.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorAgentTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; @@ -33,7 +36,6 @@ using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorAgentTest" }; constexpr Sensor_Type SENSOR_ID { SENSOR_TYPE_ACCELEROMETER }; constexpr uint32_t SENSOR_NAME_LENGTH_MAX = 64; constexpr int64_t SENSOR_SAMPLE_PERIOD = 200000000; diff --git a/utils/common/src/active_info.cpp b/utils/common/src/active_info.cpp index 2236dd10..d6fb346f 100644 --- a/utils/common/src/active_info.cpp +++ b/utils/common/src/active_info.cpp @@ -17,12 +17,12 @@ #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "ActiveInfo" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "ActiveInfo" }; -} // namespace ActiveInfo::ActiveInfo(int32_t pid, int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) :pid_(pid), sensorId_(sensorId), samplingPeriodNs_(samplingPeriodNs), maxReportDelayNs_(maxReportDelayNs) diff --git a/utils/common/src/permission_util.cpp b/utils/common/src/permission_util.cpp index 2d2f5a46..b8424a24 100644 --- a/utils/common/src/permission_util.cpp +++ b/utils/common/src/permission_util.cpp @@ -20,14 +20,13 @@ #include "sensor_agent_type.h" #include "sensor_log.h" +#undef LOG_TAG +#define LOG_TAG "PermissionUtil" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = {LOG_CORE, SENSOR_LOG_DOMAIN, "PermissionUtil"}; -} // namespace - std::unordered_map PermissionUtil::sensorPermissions_ = { { SENSOR_TYPE_ID_ACCELEROMETER, ACCELEROMETER_PERMISSION }, { SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, ACCELEROMETER_PERMISSION }, diff --git a/utils/common/src/report_data_callback.cpp b/utils/common/src/report_data_callback.cpp index 438619a7..99892636 100644 --- a/utils/common/src/report_data_callback.cpp +++ b/utils/common/src/report_data_callback.cpp @@ -16,13 +16,13 @@ #include "report_data_callback.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "ReportDataCallback" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = {LOG_CORE, SENSOR_LOG_DOMAIN, "ReportDataCallback"}; -} // namespace ReportDataCallback::ReportDataCallback() { eventsBuf_.circularBuf = new (std::nothrow) SensorData[CIRCULAR_BUF_LEN]; diff --git a/utils/common/src/sensor.cpp b/utils/common/src/sensor.cpp index bd20895a..32f1c2f9 100644 --- a/utils/common/src/sensor.cpp +++ b/utils/common/src/sensor.cpp @@ -16,14 +16,14 @@ #include "sensor.h" #include "sensor_errors.h" + +#undef LOG_TAG +#define LOG_TAG "Sensor" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "Sensor" }; -} // namespace - Sensor::Sensor() : sensorId_(0), sensorTypeId_(0), diff --git a/utils/common/src/sensor_basic_data_channel.cpp b/utils/common/src/sensor_basic_data_channel.cpp old mode 100755 new mode 100644 index b09a687e..1e01b867 --- a/utils/common/src/sensor_basic_data_channel.cpp +++ b/utils/common/src/sensor_basic_data_channel.cpp @@ -22,12 +22,14 @@ #include "hisysevent.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorBasicChannel" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorBasicChannel" }; constexpr int32_t SENSOR_READ_DATA_SIZE = sizeof(SensorData) * 100; constexpr int32_t DEFAULT_CHANNEL_SIZE = 2 * 1024; constexpr int32_t SOCKET_PAIR_SIZE = 2; diff --git a/utils/ipc/src/stream_session.cpp b/utils/ipc/src/stream_session.cpp index 546b02f0..39f0b8c4 100644 --- a/utils/ipc/src/stream_session.cpp +++ b/utils/ipc/src/stream_session.cpp @@ -22,11 +22,11 @@ #include "sensor_errors.h" #include "stream_socket.h" +#undef LOG_TAG +#define LOG_TAG "StreamSession" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "StreamSession" }; -} // namespace StreamSession::StreamSession(const std::string &programName, const int32_t fd, const int32_t uid, const int32_t pid) : programName_(programName) diff --git a/utils/ipc/src/stream_socket.cpp b/utils/ipc/src/stream_socket.cpp index 2ec9cc03..48c3fed9 100644 --- a/utils/ipc/src/stream_socket.cpp +++ b/utils/ipc/src/stream_socket.cpp @@ -22,9 +22,8 @@ namespace OHOS { namespace Sensors { #ifndef OHOS_BUILD_ENABLE_RUST -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "StreamSocket" }; -} // namespace +#undef LOG_TAG +#define LOG_TAG "StreamSocket" #endif // OHOS_BUILD_ENABLE_RUST StreamSocket::StreamSocket() {} diff --git a/vibration_convert/core/algorithm/conversion/src/conversion_fft.cpp b/vibration_convert/core/algorithm/conversion/src/conversion_fft.cpp index 92939717..4ef39a0a 100644 --- a/vibration_convert/core/algorithm/conversion/src/conversion_fft.cpp +++ b/vibration_convert/core/algorithm/conversion/src/conversion_fft.cpp @@ -19,10 +19,12 @@ #include "sensors_errors.h" #include "utils.h" +#undef LOG_TAG +#define LOG_TAG "ConversionFFT" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "ConversionFFT" }; constexpr int32_t SPECTRUM_COUNT_MAX { 8192 }; constexpr int32_t MAX_FFT_SIZE { 10240 }; } // namespace diff --git a/vibration_convert/core/algorithm/conversion/src/conversion_filter.cpp b/vibration_convert/core/algorithm/conversion/src/conversion_filter.cpp index f3915b07..261a9528 100644 --- a/vibration_convert/core/algorithm/conversion/src/conversion_filter.cpp +++ b/vibration_convert/core/algorithm/conversion/src/conversion_filter.cpp @@ -17,10 +17,12 @@ #include "sensor_log.h" +#undef LOG_TAG +#define LOG_TAG "ConversionFilter" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "ConversionFilter" }; constexpr double CUT_OFF_MIN { 10.0 }; constexpr double VALIDE_RESONANCE_MAX { 0.999999 }; constexpr double AMOUNT_RESONANCE_MIN { 1.0 }; diff --git a/vibration_convert/core/algorithm/conversion/src/conversion_mfcc.cpp b/vibration_convert/core/algorithm/conversion/src/conversion_mfcc.cpp index 72691f40..6982f4df 100644 --- a/vibration_convert/core/algorithm/conversion/src/conversion_mfcc.cpp +++ b/vibration_convert/core/algorithm/conversion/src/conversion_mfcc.cpp @@ -20,10 +20,12 @@ #include "sensors_errors.h" #include "utils.h" +#undef LOG_TAG +#define LOG_TAG "ConversionMfcc" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "ConversionMfcc" }; constexpr double BANDS_MIN_THRESHOLD { 0.000001 }; constexpr uint32_t MEL_FILTERS_OR_COEFFS_MAX { 4096 * 4096 }; } // namespace diff --git a/vibration_convert/core/algorithm/conversion/src/fft.cpp b/vibration_convert/core/algorithm/conversion/src/fft.cpp index f57c6609..703162f1 100644 --- a/vibration_convert/core/algorithm/conversion/src/fft.cpp +++ b/vibration_convert/core/algorithm/conversion/src/fft.cpp @@ -24,10 +24,12 @@ #include "sensor_log.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "Fft" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "Fft" }; constexpr uint32_t MAX_FAST_BITS { 16 }; constexpr int32_t NUM_SAMPLES_MIN { 2 }; constexpr double HAMMING_WND_UP { 0.54 }; diff --git a/vibration_convert/core/algorithm/frequency_estimation/src/frequency_estimation.cpp b/vibration_convert/core/algorithm/frequency_estimation/src/frequency_estimation.cpp index e2020d00..f9b562a9 100644 --- a/vibration_convert/core/algorithm/frequency_estimation/src/frequency_estimation.cpp +++ b/vibration_convert/core/algorithm/frequency_estimation/src/frequency_estimation.cpp @@ -22,10 +22,12 @@ #include "sensor_log.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "FrequencyEstimation" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "FrequencyEstimation" }; constexpr double BASE_SEMITONE { 69.0 }; constexpr double PITCH_INTERVAL_MIN { 12.0 }; constexpr double LA_FREQUENCE { 440.0 }; diff --git a/vibration_convert/core/algorithm/intensity_processor/src/intensity_processor.cpp b/vibration_convert/core/algorithm/intensity_processor/src/intensity_processor.cpp index 406f825d..6bcf8f86 100644 --- a/vibration_convert/core/algorithm/intensity_processor/src/intensity_processor.cpp +++ b/vibration_convert/core/algorithm/intensity_processor/src/intensity_processor.cpp @@ -19,10 +19,12 @@ #include "sensor_log.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "IntensityProcessor" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "IntensityProcessor" }; constexpr double VOLUME_DB_COEF { 10.0 }; } // namespace diff --git a/vibration_convert/core/algorithm/onset/src/onset.cpp b/vibration_convert/core/algorithm/onset/src/onset.cpp index 5f0d9a3a..1d6d07a5 100644 --- a/vibration_convert/core/algorithm/onset/src/onset.cpp +++ b/vibration_convert/core/algorithm/onset/src/onset.cpp @@ -25,10 +25,12 @@ #include "sensors_errors.h" #include "utils.h" +#undef LOG_TAG +#define LOG_TAG "Onset" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "Onset" }; // Effective threshold of note envelope constexpr double C_ONSET_ENV_VALIDE_THRESHOLD = 0.0001; constexpr double POWER_DB_COEF = 10.0; diff --git a/vibration_convert/core/algorithm/peak_finder/src/peak_finder.cpp b/vibration_convert/core/algorithm/peak_finder/src/peak_finder.cpp index 9ea09d51..6dd3e397 100644 --- a/vibration_convert/core/algorithm/peak_finder/src/peak_finder.cpp +++ b/vibration_convert/core/algorithm/peak_finder/src/peak_finder.cpp @@ -23,10 +23,12 @@ #include "sensors_errors.h" #include "utils.h" +#undef LOG_TAG +#define LOG_TAG "PeakFinder" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "PeakFinder" }; constexpr size_t MAX_N { 32 }; constexpr int32_t PEAKS_MIN_SAMPLE_COUNT { 512 }; constexpr double REMOVE_RATIO { 0.1 }; diff --git a/vibration_convert/core/native/src/audio_parsing.cpp b/vibration_convert/core/native/src/audio_parsing.cpp index 1dc57ff0..1abf1d8b 100644 --- a/vibration_convert/core/native/src/audio_parsing.cpp +++ b/vibration_convert/core/native/src/audio_parsing.cpp @@ -30,10 +30,12 @@ #include "vibration_convert_core.h" #include "vibration_convert_type.h" +#undef LOG_TAG +#define LOG_TAG "AudioParsing" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, Sensors::SENSOR_LOG_DOMAIN, "AudioParsing"}; constexpr int32_t MIN_SAMPLE_COUNT = 4096; constexpr uint32_t AUDIO_DATA_CONVERSION_FACTOR = INT32_MAX; constexpr int32_t AUDIO_DATA_MAX_NUMBER = 100000; diff --git a/vibration_convert/core/native/src/generate_vibration_json_file.cpp b/vibration_convert/core/native/src/generate_vibration_json_file.cpp index 6135a008..3dcc64e8 100644 --- a/vibration_convert/core/native/src/generate_vibration_json_file.cpp +++ b/vibration_convert/core/native/src/generate_vibration_json_file.cpp @@ -24,11 +24,11 @@ #include "sensor_log.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "GenerateVibrationJsonFile" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, Sensors::SENSOR_LOG_DOMAIN, "GenerateVibrationJsonFile" }; -} int32_t GenerateVibrationJsonFile::GenerateJsonFile(std::vector &hapticEvents) { diff --git a/vibration_convert/core/native/src/vibration_convert_core.cpp b/vibration_convert/core/native/src/vibration_convert_core.cpp index dc08e3cf..5cd5a787 100644 --- a/vibration_convert/core/native/src/vibration_convert_core.cpp +++ b/vibration_convert/core/native/src/vibration_convert_core.cpp @@ -21,10 +21,12 @@ #include "sensors_errors.h" #include "vibration_convert_core.h" +#undef LOG_TAG +#define LOG_TAG "VibrationConvertCore" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "VibrationConvertCore" }; constexpr double AMP_INVALIDE_DELTA { 0.001 }; constexpr int32_t FRAGMENT_MIN_LEN { 32 }; constexpr double COEF { 0.01 }; diff --git a/vibration_convert/core/native/test/unittest/generate_json_test.cpp b/vibration_convert/core/native/test/unittest/generate_json_test.cpp index 88735acb..f0e430da 100644 --- a/vibration_convert/core/native/test/unittest/generate_json_test.cpp +++ b/vibration_convert/core/native/test/unittest/generate_json_test.cpp @@ -26,15 +26,14 @@ #include "vibration_convert_core.h" #include "vibration_convert_type.h" +#undef LOG_TAG +#define LOG_TAG "GenerateJsonFileTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; using namespace OHOS::HiviewDFX; -namespace { - constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "GenerateJsonFileTest" }; -} // namespace - class GenerateJsonFileTest : public testing::Test { public: static void SetUpTestCase(); diff --git a/vibration_convert/core/utils/src/audio_utils.cpp b/vibration_convert/core/utils/src/audio_utils.cpp index 428c816a..4445058a 100644 --- a/vibration_convert/core/utils/src/audio_utils.cpp +++ b/vibration_convert/core/utils/src/audio_utils.cpp @@ -16,10 +16,12 @@ #include "audio_utils.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "AudioUtils" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, Sensors::SENSOR_LOG_DOMAIN, "AudioUtils"}; constexpr int32_t MTOF_ARRAY_SIZE = 128; // This is a lookup table for converting midi to frequency constexpr double MTOF_ARRAY[MTOF_ARRAY_SIZE + 1] = { diff --git a/vibration_convert/core/utils/src/utils.cpp b/vibration_convert/core/utils/src/utils.cpp index 275218cc..65a7d22a 100644 --- a/vibration_convert/core/utils/src/utils.cpp +++ b/vibration_convert/core/utils/src/utils.cpp @@ -28,10 +28,12 @@ #include "sensor_log.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "Utils" + namespace OHOS { namespace Sensors { namespace{ -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "Utils" }; constexpr double PERCENTAGE_RANGE = 100.0; constexpr int32_t VOICE_MIN_INTENSITY_NORM = 25; constexpr size_t MAX_SIZE = 26460000; diff --git a/vibration_convert/interfaces/js/src/vibrator_convert_js.cpp b/vibration_convert/interfaces/js/src/vibrator_convert_js.cpp index 2740d5e5..617dec03 100644 --- a/vibration_convert/interfaces/js/src/vibrator_convert_js.cpp +++ b/vibration_convert/interfaces/js/src/vibrator_convert_js.cpp @@ -22,10 +22,12 @@ #include "sensor_napi_error.h" #include "vibrator_convert_napi_utils.h" +#undef LOG_TAG +#define LOG_TAG "VibratorConvert" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "VibratorConvert" }; const char* CONVERT = "convert"; const char* CONVERT_CLASS = "convert_class"; } // namespace diff --git a/vibration_convert/interfaces/js/src/vibrator_convert_napi_utils.cpp b/vibration_convert/interfaces/js/src/vibrator_convert_napi_utils.cpp index d1021c81..d5e86df7 100644 --- a/vibration_convert/interfaces/js/src/vibrator_convert_napi_utils.cpp +++ b/vibration_convert/interfaces/js/src/vibrator_convert_napi_utils.cpp @@ -25,10 +25,12 @@ #include "sensor_napi_error.h" #include "vibration_convert_type.h" +#undef LOG_TAG +#define LOG_TAG "VibratorConvertNapiUtils" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, SENSOR_LOG_DOMAIN, "VibratorConvertNapiUtils"}; constexpr int32_t RESULT_LENGTH = 2; constexpr int64_t INVALID_FILE_SIZE = -1; } // namespace -- Gitee From 51b9857449700a5ec6e04da05b46ec74eb1615a2 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Tue, 16 Jan 2024 09:12:42 +0800 Subject: [PATCH 2/4] =?UTF-8?q?sensor=E6=97=A5=E5=BF=97=E8=BD=BB=E9=87=8F?= =?UTF-8?q?=E5=8C=96=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: I820407024578b5923531935484ae50592dfa8072 --- utils/common/include/sensor_errors.h | 11 +++++------ utils/common/include/sensor_log.h | 16 ++++++++-------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/utils/common/include/sensor_errors.h b/utils/common/include/sensor_errors.h index 50e1d826..cb181d28 100644 --- a/utils/common/include/sensor_errors.h +++ b/utils/common/include/sensor_errors.h @@ -126,21 +126,20 @@ enum { class InnerFunctionTracer { public: - InnerFunctionTracer(const OHOS::HiviewDFX::HiLogLabel &label, const char *func) - : label_ { label }, func_ { func } + InnerFunctionTracer(const char *func) + : func_ { func } { - OHOS::HiviewDFX::HiLog::Debug(label_, "in %{public}s, enter", func_); + HILOG_DEBUG(LOG_CORE, "in %{public}s, enter", func_); } ~InnerFunctionTracer() { - OHOS::HiviewDFX::HiLog::Debug(label_, "in %{public}s, leave", func_); + HILOG_DEBUG(LOG_CORE, "in %{public}s, leave", func_); } private: - const OHOS::HiviewDFX::HiLogLabel &label_; const char *func_ { nullptr }; }; -#define CALL_LOG_ENTER InnerFunctionTracer ___innerFuncTracer___ { LABEL, __FUNCTION__ } +#define CALL_LOG_ENTER InnerFunctionTracer ___innerFuncTracer___ { __FUNCTION__ } #ifdef DEBUG_CODE_TEST #define CHKPL(cond, ...) \ diff --git a/utils/common/include/sensor_log.h b/utils/common/include/sensor_log.h index 1d39432d..48be0a91 100644 --- a/utils/common/include/sensor_log.h +++ b/utils/common/include/sensor_log.h @@ -19,9 +19,9 @@ namespace OHOS { namespace Sensors { -namespace { -constexpr uint32_t SENSOR_LOG_DOMAIN = 0xD002700; -} // namespace +#undef LOG_DOMAIN +#define LOG_DOMAIN 0xD002700 + #ifndef SENSOR_FUNC_FMT #define SENSOR_FUNC_FMT "in %{public}s, " #endif @@ -31,19 +31,19 @@ constexpr uint32_t SENSOR_LOG_DOMAIN = 0xD002700; #endif #define SEN_HILOGD(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Debug(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_DEBUG(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define SEN_HILOGI(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Info(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_INFO(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define SEN_HILOGW(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Warn(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_WARN(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define SEN_HILOGE(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Error(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_ERROR(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define SENSOR_LOGF(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Fatal(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_FATAL(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ } while (0) } // namespace Sensors } // namespace OHOS -- Gitee From f70927a81366b653206a45482e564ec86cb5ab4a Mon Sep 17 00:00:00 2001 From: cff-gite Date: Wed, 17 Jan 2024 09:03:27 +0800 Subject: [PATCH 3/4] =?UTF-8?q?sensor=E6=97=A5=E5=BF=97=E8=BD=BB=E9=87=8F?= =?UTF-8?q?=E5=8C=96=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: Ib6de21688af19060cdb32f479a874fb2f265563d --- frameworks/js/napi/include/async_callback_info.h | 4 +++- utils/ipc/include/circle_stream_buffer.h | 4 +++- utils/ipc/include/net_packet.h | 4 +++- utils/ipc/include/stream_buffer.h | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/frameworks/js/napi/include/async_callback_info.h b/frameworks/js/napi/include/async_callback_info.h index cdddb94b..fe9b012a 100644 --- a/frameworks/js/napi/include/async_callback_info.h +++ b/frameworks/js/napi/include/async_callback_info.h @@ -24,12 +24,14 @@ #include "sensor_errors.h" #include "sensor_log.h" +#undef LOG_TAG +#define LOG_TAG "SensorJsAPI" + namespace OHOS { namespace Sensors { using std::vector; using std::string; using namespace OHOS::HiviewDFX; -static constexpr HiLogLabel LABEL = {LOG_CORE, SENSOR_LOG_DOMAIN, "SensorJsAPI"}; constexpr int32_t THREE_DIMENSIONAL_MATRIX_LENGTH = 9; constexpr static int32_t DATA_LENGTH = 16; constexpr int32_t CALLBACK_NUM = 3; diff --git a/utils/ipc/include/circle_stream_buffer.h b/utils/ipc/include/circle_stream_buffer.h index 5857314e..1d71d059 100644 --- a/utils/ipc/include/circle_stream_buffer.h +++ b/utils/ipc/include/circle_stream_buffer.h @@ -18,10 +18,12 @@ #include "stream_buffer.h" +#undef LOG_TAG +#define LOG_TAG "CircleStreamBuffer" + namespace OHOS { namespace Sensors { class CircleStreamBuffer : public StreamBuffer { - static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "CircleStreamBuffer" }; public: CircleStreamBuffer() = default; ~CircleStreamBuffer() = default; diff --git a/utils/ipc/include/net_packet.h b/utils/ipc/include/net_packet.h index 3be9a567..c12bc9ab 100644 --- a/utils/ipc/include/net_packet.h +++ b/utils/ipc/include/net_packet.h @@ -19,6 +19,9 @@ #include "proto.h" #include "stream_buffer.h" +#undef LOG_TAG +#define LOG_TAG "NetPacket" + #pragma pack(1) using PACKHEAD = struct PackHead { OHOS::Sensors::MessageId idMsg; @@ -29,7 +32,6 @@ using PACKHEAD = struct PackHead { namespace OHOS { namespace Sensors { class NetPacket : public StreamBuffer { - static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "NetPacket" }; public: explicit NetPacket(MessageId msgId); NetPacket(const NetPacket &pkt); diff --git a/utils/ipc/include/stream_buffer.h b/utils/ipc/include/stream_buffer.h index 32406655..8db8a871 100644 --- a/utils/ipc/include/stream_buffer.h +++ b/utils/ipc/include/stream_buffer.h @@ -29,10 +29,12 @@ #include "rust_binding.h" #endif // OHOS_BUILD_ENABLE_RUST +#undef LOG_TAG +#define LOG_TAG "StreamBuffer" + namespace OHOS { namespace Sensors { class StreamBuffer { - static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "StreamBuffer" }; public: StreamBuffer() = default; explicit StreamBuffer(const StreamBuffer &buf); -- Gitee From df9a0cd33a1e2ea7cf9aff2afa75d147ac401999 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Thu, 18 Jan 2024 10:05:40 +0800 Subject: [PATCH 4/4] =?UTF-8?q?sensor=E6=97=A5=E5=BF=97=E8=BD=BB=E9=87=8F?= =?UTF-8?q?=E5=8C=96=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: Ibf473e8c7f9fb02b749d4b3b5a24f97b71dcc98a --- frameworks/native/src/native_sensor.cpp | 2 -- frameworks/native/src/sensor_agent.cpp | 2 -- frameworks/native/src/sensor_algorithm.cpp | 2 -- 3 files changed, 6 deletions(-) diff --git a/frameworks/native/src/native_sensor.cpp b/frameworks/native/src/native_sensor.cpp index 6dafdf50..bd27c5f4 100644 --- a/frameworks/native/src/native_sensor.cpp +++ b/frameworks/native/src/native_sensor.cpp @@ -24,8 +24,6 @@ #undef LOG_TAG #define LOG_TAG "SensorCapiAPI" -using OHOS::HiviewDFX::HiLog; -using OHOS::HiviewDFX::HiLogLabel; namespace { const uint32_t FLOAT_SIZE = 4; } diff --git a/frameworks/native/src/sensor_agent.cpp b/frameworks/native/src/sensor_agent.cpp index 710d1d71..3a8d0e4f 100644 --- a/frameworks/native/src/sensor_agent.cpp +++ b/frameworks/native/src/sensor_agent.cpp @@ -20,8 +20,6 @@ #undef LOG_TAG #define LOG_TAG "SensorNativeAPI" -using OHOS::HiviewDFX::HiLog; -using OHOS::HiviewDFX::HiLogLabel; using OHOS::Sensors::SensorAgentProxy; using OHOS::Sensors::SERVICE_EXCEPTION; using OHOS::Sensors::PARAMETER_ERROR; diff --git a/frameworks/native/src/sensor_algorithm.cpp b/frameworks/native/src/sensor_algorithm.cpp index 4b1d5521..be96d336 100644 --- a/frameworks/native/src/sensor_algorithm.cpp +++ b/frameworks/native/src/sensor_algorithm.cpp @@ -22,8 +22,6 @@ #undef LOG_TAG #define LOG_TAG "SensorAlgorithmAPI" -using OHOS::HiviewDFX::HiLog; -using OHOS::HiviewDFX::HiLogLabel; using namespace OHOS::Sensors; int32_t SensorAlgorithm::CreateQuaternion(std::vector rotationVector, std::vector &quaternion) -- Gitee