From cc1f0135de96027d3cc3e4feffdd6d0f937432a6 Mon Sep 17 00:00:00 2001 From: xujunyang Date: Tue, 29 Jul 2025 16:25:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=97=B6=E5=8C=BA=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E9=87=8F=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xujunyang --- services/time/src/time_service_notify.cpp | 6 +++++- services/timer/src/timer_manager.cpp | 26 +++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/services/time/src/time_service_notify.cpp b/services/time/src/time_service_notify.cpp index 997e990c..3f4e19ef 100644 --- a/services/time/src/time_service_notify.cpp +++ b/services/time/src/time_service_notify.cpp @@ -50,7 +50,11 @@ bool TimeServiceNotify::PublishEvents(int64_t eventTime, const IntentWant &want, TIME_HILOGE(TIME_MODULE_SERVICE, "failed to Publish event %{public}s", want.GetAction().c_str()); return false; } - TIME_SIMPLIFY_HILOGI(TIME_MODULE_SERVICE, "Publish %{public}s ", want.GetAction().c_str()); + if (want.GetAction() == CommonEventSupport::COMMON_EVENT_TIME_TICK) { + TIME_SIMPLIFY_HILOGI(TIME_MODULE_SERVICE, "Publish TICK"); + } else if (want.GetAction() != COMMON_EVENT_TIMER_TRIGGER) { + TIME_SIMPLIFY_HILOGI(TIME_MODULE_SERVICE, "Publish %{public}s ", want.GetAction().c_str()); + } return true; } diff --git a/services/timer/src/timer_manager.cpp b/services/timer/src/timer_manager.cpp index e073290c..05090f7d 100644 --- a/services/timer/src/timer_manager.cpp +++ b/services/timer/src/timer_manager.cpp @@ -65,7 +65,7 @@ constexpr const char* AUTO_RESTORE_TIMER_APPS = "persist.time.auto_restore_timer constexpr const char* SCHEDULED_POWER_ON_APPS = "persist.time.scheduled_power_on_apps"; constexpr int64_t TEN_YEARS_TO_SECOND = 10 * 365 * 24 * 60 * 60; #endif -constexpr const char* NO_LOG_APP = "wifi_manager_service"; +constexpr std::array NO_LOG_APP_LIST = { "wifi_manager_service", "telephony" }; #ifdef RDB_ENABLE static const std::vector ALL_DATA = { "timerId", "type", "flag", "windowLength", "interval", \ @@ -271,14 +271,11 @@ int32_t TimerManager::StartTimer(uint64_t timerId, uint64_t triggerTime) return E_TIME_NOT_FOUND; } timerInfo = it->second; - if (timerInfo->bundleName != NO_LOG_APP || - timerInfo->type == RTC_WAKEUP || timerInfo->type == ELAPSED_REALTIME_WAKEUP) { - TIME_HILOGI(TIME_MODULE_SERVICE, - "id: %{public}" PRIu64 " typ:%{public}d len: %{public}" PRId64 " int: %{public}" PRId64 " " - "flg :%{public}d trig: %{public}s uid:%{public}d pid:%{public}d", - timerId, timerInfo->type, timerInfo->windowLength, timerInfo->interval, timerInfo->flag, - std::to_string(triggerTime).c_str(), IPCSkeleton::GetCallingUid(), IPCSkeleton::GetCallingPid()); - } + TIME_HILOGI(TIME_MODULE_SERVICE, + "id: %{public}" PRIu64 " typ:%{public}d len: %{public}" PRId64 " int: %{public}" PRId64 " " + "flg :%{public}d trig: %{public}s uid:%{public}d pid:%{public}d", + timerId, timerInfo->type, timerInfo->windowLength, timerInfo->interval, timerInfo->flag, + std::to_string(triggerTime).c_str(), IPCSkeleton::GetCallingUid(), IPCSkeleton::GetCallingPid()); { // To prevent the same ID from being started repeatedly, // the later start overwrites the earlier start. @@ -740,6 +737,13 @@ bool TimerManager::ProcTriggerTimer(std::shared_ptr &alarm, } } +bool IsNoLog(std::shared_ptr alarm) +{ + return (std::find(NO_LOG_APP_LIST.begin(), NO_LOG_APP_LIST.end(), alarm->bundleName) != NO_LOG_APP_LIST.end()) + && (alarm->repeatInterval != std::chrono::milliseconds(0)) + && (!alarm->wakeup); +} + // needs to acquire the lock `mutex_` before calling this method bool TimerManager::TriggerTimersLocked(std::vector> &triggerList, std::chrono::steady_clock::time_point nowElapsed) @@ -767,7 +771,7 @@ bool TimerManager::TriggerTimersLocked(std::vector> & for (unsigned int i = 0; i < n; ++i) { auto alarm = batch->Get(i); triggerList.push_back(alarm); - if (alarm->bundleName != NO_LOG_APP || alarm->wakeup) { + if (!IsNoLog(alarm)) { TIME_SIMPLIFY_HILOGW(TIME_MODULE_SERVICE, "uid: %{public}d id:%{public}" PRId64 " name:%{public}s" " wk:%{public}u", alarm->uid, alarm->id, alarm->bundleName.c_str(), alarm->wakeup); @@ -919,7 +923,7 @@ void TimerManager::InsertAndBatchTimerLocked(std::shared_ptr alarm) int64_t whichBatch = (alarm->flags & static_cast(STANDALONE)) ? -1 : AttemptCoalesceLocked(alarm->whenElapsed, alarm->maxWhenElapsed); - if (alarm->bundleName != NO_LOG_APP || alarm->wakeup) { + if (!IsNoLog(alarm)) { TIME_SIMPLIFY_HILOGW(TIME_MODULE_SERVICE, "bat: %{public}" PRId64 " id:%{public}" PRIu64 " " "we:%{public}lld mwe:%{public}lld", whichBatch, alarm->id, alarm->whenElapsed.time_since_epoch().count(), -- Gitee