From 25e6634b2aa090f9867609e908d0b836b1d34ba6 Mon Sep 17 00:00:00 2001 From: zff Date: Wed, 6 Apr 2022 14:30:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E7=B3=BB=E7=BB=9F=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=94=AF=E6=8C=8164=E4=BD=8D=E9=9B=86=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close: #I5113F Signed-off-by: zff Change-Id: Idd8ca86769a543baacf2ce91904f19bb4dce6993 --- frameworks/src/bundle_state_query.cpp | 22 +++++++++---------- .../innerkits/src/bundle_active_proxy.cpp | 12 +++++----- services/common/src/bundle_active_core.cpp | 12 +++++----- services/common/src/bundle_active_service.cpp | 4 ++-- .../src/bundle_active_usage_database.cpp | 11 ++++++---- .../src/bundle_active_group_controller.cpp | 5 +++-- .../src/bundle_active_user_history.cpp | 8 ++++--- .../src/bundle_active_user_service.cpp | 20 ++++++++++------- 8 files changed, 54 insertions(+), 40 deletions(-) diff --git a/frameworks/src/bundle_state_query.cpp b/frameworks/src/bundle_state_query.cpp index 278d2bf..6e82bab 100644 --- a/frameworks/src/bundle_state_query.cpp +++ b/frameworks/src/bundle_state_query.cpp @@ -340,7 +340,7 @@ napi_value ParseStatesParameters(const napi_env &env, const napi_callback_info & } if ((params.errorCode == ERR_OK) && (params.endTime <= params.beginTime)) { BUNDLE_ACTIVE_LOGE("ParseStatesParameters endTime(%{public}lld) <= beginTime(%{public}lld)", - params.endTime, params.beginTime); + (long long)params.endTime, (long long)params.beginTime); params.errorCode = ERR_USAGE_STATS_TIME_INTERVAL; } @@ -380,10 +380,10 @@ napi_value QueryCurrentBundleActiveStates(napi_env env, napi_callback_info info) asyncCallbackInfo->asyncWork = nullptr; asyncCallbackInfo->beginTime = params.beginTime; BUNDLE_ACTIVE_LOGI("QueryCurrentBundleActiveStates asyncCallbackInfo->beginTime: %{public}lld", - asyncCallbackInfo->beginTime); + (long long)asyncCallbackInfo->beginTime); asyncCallbackInfo->endTime = params.endTime; BUNDLE_ACTIVE_LOGI("QueryCurrentBundleActiveStates asyncCallbackInfo->endTime: %{public}lld", - asyncCallbackInfo->endTime); + (long long)asyncCallbackInfo->endTime); BundleStateCommon::SettingCallbackPromiseInfo(env, params.callback, asyncCallbackInfo->info, promise); napi_value resourceName = nullptr; @@ -455,10 +455,10 @@ napi_value QueryBundleActiveStates(napi_env env, napi_callback_info info) asyncCallbackInfo->asyncWork = nullptr; asyncCallbackInfo->beginTime = params.beginTime; BUNDLE_ACTIVE_LOGI("QueryBundleActiveStates asyncCallbackInfo->beginTime: %{public}lld", - asyncCallbackInfo->beginTime); + (long long)asyncCallbackInfo->beginTime); asyncCallbackInfo->endTime = params.endTime; BUNDLE_ACTIVE_LOGI("QueryBundleActiveStates asyncCallbackInfo->endTime: %{public}lld", - asyncCallbackInfo->endTime); + (long long)asyncCallbackInfo->endTime); BundleStateCommon::SettingCallbackPromiseInfo(env, params.callback, asyncCallbackInfo->info, promise); napi_value resourceName = nullptr; @@ -547,7 +547,7 @@ napi_value ParseAppUsageParametersByInterval(const napi_env &env, const napi_cal } if ((params.errorCode == ERR_OK) && (params.endTime <= params.beginTime)) { BUNDLE_ACTIVE_LOGE("ParseAppUsageParametersByInterval endTime(%{public}lld) <= beginTime(%{public}lld)", - params.endTime, params.beginTime); + (long long)params.endTime, (long long)params.beginTime); params.errorCode = ERR_USAGE_STATS_TIME_INTERVAL; } @@ -590,10 +590,10 @@ napi_value QueryBundleStateInfoByInterval(napi_env env, napi_callback_info info) asyncCallbackInfo->intervalType); asyncCallbackInfo->beginTime = params.beginTime; BUNDLE_ACTIVE_LOGI("QueryBundleStateInfoByInterval asyncCallbackInfo->beginTime: %{public}lld", - asyncCallbackInfo->beginTime); + (long long)asyncCallbackInfo->beginTime); asyncCallbackInfo->endTime = params.endTime; BUNDLE_ACTIVE_LOGI("QueryBundleStateInfoByInterval asyncCallbackInfo->endTime: %{public}lld", - asyncCallbackInfo->endTime); + (long long)asyncCallbackInfo->endTime); BundleStateCommon::SettingCallbackPromiseInfo(env, params.callback, asyncCallbackInfo->info, promise); napi_value resourceName = nullptr; napi_create_string_latin1(env, "QueryBundleStateInfoByInterval", NAPI_AUTO_LENGTH, &resourceName); @@ -669,7 +669,7 @@ napi_value ParseAppUsageParameters(const napi_env &env, const napi_callback_info } if ((params.errorCode == ERR_OK) && (params.endTime <= params.beginTime)) { BUNDLE_ACTIVE_LOGE("ParseAppUsageParameters endTime(%{public}lld) <= beginTime(%{public}lld)", - params.endTime, params.beginTime); + (long long)params.endTime, (long long)params.beginTime); params.errorCode = ERR_USAGE_STATS_TIME_INTERVAL; } @@ -709,10 +709,10 @@ napi_value QueryBundleStateInfos(napi_env env, napi_callback_info info) asyncCallbackInfo->asyncWork = nullptr; asyncCallbackInfo->beginTime = params.beginTime; BUNDLE_ACTIVE_LOGI("QueryBundleStateInfos asyncCallbackInfo->beginTime: %{public}lld", - asyncCallbackInfo->beginTime); + (long long)asyncCallbackInfo->beginTime); asyncCallbackInfo->endTime = params.endTime; BUNDLE_ACTIVE_LOGI("QueryBundleStateInfos asyncCallbackInfo->endTime: %{public}lld", - asyncCallbackInfo->endTime); + (long long)asyncCallbackInfo->endTime); BundleStateCommon::SettingCallbackPromiseInfo(env, params.callback, asyncCallbackInfo->info, promise); napi_value resourceName = nullptr; napi_create_string_latin1(env, "QueryBundleStateInfos", NAPI_AUTO_LENGTH, &resourceName); diff --git a/interfaces/innerkits/src/bundle_active_proxy.cpp b/interfaces/innerkits/src/bundle_active_proxy.cpp index 440e8e6..6cd144a 100644 --- a/interfaces/innerkits/src/bundle_active_proxy.cpp +++ b/interfaces/innerkits/src/bundle_active_proxy.cpp @@ -77,8 +77,9 @@ std::vector BundleActiveProxy::QueryPackageStats(const BUNDLE_ACTIVE_LOGI("QueryPackageStats result idx is %{public}d, bundleName_ is %{public}s, " "lastTimeUsed_ is %{public}lld, lastContiniousTaskUsed_ is %{public}lld, " "totalInFrontTime_ is %{public}lld, totalContiniousTaskUsedTime_ is %{public}lld", - i + 1, result[i].bundleName_.c_str(), result[i].lastTimeUsed_, result[i].lastContiniousTaskUsed_, - result[i].totalInFrontTime_, result[i].totalContiniousTaskUsedTime_); + i + 1, result[i].bundleName_.c_str(), + (long long)result[i].lastTimeUsed_, (long long)result[i].lastContiniousTaskUsed_, + (long long)result[i].totalInFrontTime_, (long long)result[i].totalContiniousTaskUsedTime_); } return result; } @@ -154,8 +155,9 @@ std::vector BundleActiveProxy::QueryCurrentPackageStat BUNDLE_ACTIVE_LOGI("QueryPackageStats result idx is %{public}d, bundleName_ is %{public}s, " "lastTimeUsed_ is %{public}lld, lastContiniousTaskUsed_ is %{public}lld, " "totalInFrontTime_ is %{public}lld, totalContiniousTaskUsedTime_ is %{public}lld", - i + 1, result[i].bundleName_.c_str(), result[i].lastTimeUsed_, result[i].lastContiniousTaskUsed_, - result[i].totalInFrontTime_, result[i].totalContiniousTaskUsedTime_); + i + 1, result[i].bundleName_.c_str(), + (long long)result[i].lastTimeUsed_, (long long)result[i].lastContiniousTaskUsed_, + (long long)result[i].totalInFrontTime_, (long long)result[i].totalContiniousTaskUsedTime_); } return result; } @@ -184,7 +186,7 @@ std::vector BundleActiveProxy::QueryCurrentEvents(const int64 for (uint32_t i = 0; i < result.size(); i++) { BUNDLE_ACTIVE_LOGI("QueryCurrentEvents event id is %{public}d, bundle name is %{public}s," "time stamp is %{public}lld", - result[i].eventId_, result[i].bundleName_.c_str(), result[i].timeStamp_); + result[i].eventId_, result[i].bundleName_.c_str(), (long long)result[i].timeStamp_); } return result; } diff --git a/services/common/src/bundle_active_core.cpp b/services/common/src/bundle_active_core.cpp index 49a3efa..254d3db 100644 --- a/services/common/src/bundle_active_core.cpp +++ b/services/common/src/bundle_active_core.cpp @@ -142,7 +142,7 @@ void BundleActiveCore::Init() realTimeShot_ = timer->GetBootTimeMs(); systemTimeShot_ = GetSystemTimeMs(); bundleGroupController_ = std::make_shared(debugCore_); - BUNDLE_ACTIVE_LOGI("system time shot is %{public}lld", systemTimeShot_); + BUNDLE_ACTIVE_LOGI("system time shot is %{public}lld", (long long)systemTimeShot_); } void BundleActiveCore::InitBundleGroupController() @@ -333,7 +333,8 @@ int64_t BundleActiveCore::CheckTimeChangeAndGetWallTime(int userId) } BUNDLE_ACTIVE_LOGI("asystime is %{public}lld, artime is %{public}lld, esystime is %{public}lld, " "diff is %{public}lld", - actualSystemTime, actualRealTime, expectedSystemTime, diffSystemTime); + (long long)actualSystemTime, (long long)actualRealTime, + (long long)expectedSystemTime, (long long)diffSystemTime); if (std::abs(diffSystemTime) > TIME_CHANGE_THRESHOLD_MILLIS) { // 时区变换逻辑 auto it = userStatServices_.find(userId); @@ -407,7 +408,7 @@ void BundleActiveCore::OnUserSwitched(const int userId) int BundleActiveCore::ReportEvent(BundleActiveEvent& event, const int userId) { - BUNDLE_ACTIVE_LOGI("FLUSH interval is %{public}lld, debug is %{public}d", flushInterval_, debugCore_); + BUNDLE_ACTIVE_LOGI("FLUSH interval is %{public}lld, debug is %{public}d", (long long)flushInterval_, debugCore_); std::lock_guard lock(mutex_); if (userId == 0 || userId == -1) { return -1; @@ -426,7 +427,8 @@ int BundleActiveCore::ReportEvent(BundleActiveEvent& event, const int userId) } BUNDLE_ACTIVE_LOGI("report event called, bundle name %{public}s time %{public}lld userId %{public}d, " - "eventid %{public}d, in lock range", event.bundleName_.c_str(), event.timeStamp_, userId, event.eventId_); + "eventid %{public}d, in lock range", event.bundleName_.c_str(), + (long long)event.timeStamp_, userId, event.eventId_); int64_t timeNow = CheckTimeChangeAndGetWallTime(userId); if (timeNow == -1) { return -1; @@ -485,7 +487,7 @@ std::vector BundleActiveCore::QueryPackageStats(const return result; } BUNDLE_ACTIVE_LOGI("QueryPackageStats begin time is %{public}lld, end time is %{public}lld, " - "intervaltype is %{public}d", beginTime, endTime, intervalType); + "intervaltype is %{public}d", (long long)beginTime, (long long)endTime, intervalType); if (beginTime > timeNow || beginTime >= endTime) { BUNDLE_ACTIVE_LOGI("QueryPackageStats time span illegal"); return result; diff --git a/services/common/src/bundle_active_service.cpp b/services/common/src/bundle_active_service.cpp index 786e978..ff42fe9 100644 --- a/services/common/src/bundle_active_service.cpp +++ b/services/common/src/bundle_active_service.cpp @@ -316,7 +316,7 @@ std::vector BundleActiveService::QueryCurrentPackageSt bundleName); } } - BUNDLE_ACTIVE_LOGI("QueryCurrentPackageStats result size is %{public}d", result.size()); + BUNDLE_ACTIVE_LOGI("QueryCurrentPackageStats result size is %{public}zu", result.size()); return result; } @@ -340,7 +340,7 @@ std::vector BundleActiveService::QueryCurrentEvents(const int result = bundleActiveCore_->QueryEvents(userId, beginTime, endTime, bundleName); } } - BUNDLE_ACTIVE_LOGI("QueryCurrentEvents result size is %{public}d", result.size()); + BUNDLE_ACTIVE_LOGI("QueryCurrentEvents result size is %{public}zu", result.size()); return result; } diff --git a/services/common/src/bundle_active_usage_database.cpp b/services/common/src/bundle_active_usage_database.cpp index d765491..afcd666 100644 --- a/services/common/src/bundle_active_usage_database.cpp +++ b/services/common/src/bundle_active_usage_database.cpp @@ -1130,7 +1130,7 @@ void BundleActiveUsageDatabase::RenewTableTime(int64_t changedTime) vector tableArray = sortedTableArray_.at(i); for (unsigned int j = 0; j < tableArray.size(); j++) { int64_t newTime = tableArray.at(j) + changedTime; - BUNDLE_ACTIVE_LOGI("new table time is %{public}lld", newTime); + BUNDLE_ACTIVE_LOGI("new table time is %{public}lld", (long long)newTime); if (newTime < 0) { DeleteInvalidTable(i, tableArray.at(j)); } else { @@ -1209,7 +1209,8 @@ vector BundleActiveUsageDatabase::QueryDatabaseUsageSt return databaseUsageStats; } if (endTime <= beginTime) { - BUNDLE_ACTIVE_LOGE("endTime(%{public}lld) <= beginTime(%{public}lld)", endTime, beginTime); + BUNDLE_ACTIVE_LOGE("endTime(%{public}lld) <= beginTime(%{public}lld)", + (long long)endTime, (long long)beginTime); return databaseUsageStats; } int32_t startIndex = NearIndexOnOrBeforeCurrentTime(beginTime, sortedTableArray_.at(databaseType)); @@ -1301,12 +1302,14 @@ vector BundleActiveUsageDatabase::QueryDatabaseEvents(int64_t return databaseEvents; } if (endTime <= beginTime) { - BUNDLE_ACTIVE_LOGE("endTime(%{public}lld) <= beginTime(%{public}lld)", endTime, beginTime); + BUNDLE_ACTIVE_LOGE("endTime(%{public}lld) <= beginTime(%{public}lld)", + (long long)endTime, (long long)beginTime); return databaseEvents; } int64_t eventTableTime = ParseStartTime(eventTableName_); if (endTime < eventTableTime) { - BUNDLE_ACTIVE_LOGE("endTime(%{public}lld) <= eventTableTime(%{public}lld)", endTime, eventTableTime); + BUNDLE_ACTIVE_LOGE("endTime(%{public}lld) <= eventTableTime(%{public}lld)", + (long long)endTime, (long long)eventTableTime); return databaseEvents; } vector queryCondition; diff --git a/services/packagegroup/src/bundle_active_group_controller.cpp b/services/packagegroup/src/bundle_active_group_controller.cpp index e11ec5d..5805f09 100644 --- a/services/packagegroup/src/bundle_active_group_controller.cpp +++ b/services/packagegroup/src/bundle_active_group_controller.cpp @@ -84,7 +84,7 @@ void BundleActiveGroupController::SetHandlerAndCreateUserHistory( { if (bundleUserHistory_ == nullptr) { BUNDLE_ACTIVE_LOGI("SetHandlerAndCreateUserHistory bundleUserHistory_ is null, " - "called constructor, bootstamp is %{public}lld", bootFromTimeStamp); + "called constructor, bootstamp is %{public}lld", (long long)bootFromTimeStamp); bundleUserHistory_ = std::make_shared(bootFromTimeStamp); } OnScreenChanged(IsScreenOn(), bootFromTimeStamp); @@ -326,7 +326,8 @@ void BundleActiveGroupController::SetBundleGroup(const std::string& bundleName, bootBasedTimeStampAdjusted) { BUNDLE_ACTIVE_LOGI("%{public}s should be decreased, but time out in alive is not expire! now is %{public}lld," "timeout is %{public}lld", - bundleName.c_str(), bootBasedTimeStampAdjusted, oneBundleHistory->bundleAliveTimeoutTimeStamp_); + bundleName.c_str(), + (long long)bootBasedTimeStampAdjusted, (long long)oneBundleHistory->bundleAliveTimeoutTimeStamp_); newGroup = ACTIVE_GROUP_ALIVE; reason = oneBundleHistory->reasonInGroup_; } else if (newGroup > ACTIVE_GROUP_DAILY && oneBundleHistory->bundleDailyTimeoutTimeStamp_ > diff --git a/services/packagegroup/src/bundle_active_user_history.cpp b/services/packagegroup/src/bundle_active_user_history.cpp index c8f0a8b..93faaa2 100644 --- a/services/packagegroup/src/bundle_active_user_history.cpp +++ b/services/packagegroup/src/bundle_active_user_history.cpp @@ -78,7 +78,7 @@ int BundleActiveUserHistory::GetLevelIndex(const string& bundleName, const int u int64_t bootFromDiff = GetBootBasedTimeStamp(bootBasedTimeStamp) - oneBundleHistory->lastBootFromUsedTimeStamp_; BUNDLE_ACTIVE_LOGI("screendiff is %{public}lld, bootfromdiff is %{public}lld, bundle name is %{public}s," "userid is %{public}d", - screenDiff, bootFromDiff, bundleName.c_str(), userId); + (long long)screenDiff, (long long)bootFromDiff, bundleName.c_str(), userId); for (int i = 3; i >= 0; i--) { if (screenDiff >= screenTimeLevel[i] && bootFromDiff >= bootFromTimeLevel[i]) { return i; @@ -240,9 +240,11 @@ void BundleActiveUserHistory::PrintData(int userId) BUNDLE_ACTIVE_LOGI("bundle name is %{public}s, lastBootFromUsedTimeStamp_ is %{public}lld, " "lastScreenUsedTimeStamp_ is %{public}lld, currentGroup_ is %{public}d, reasonInGroup_ is %{public}d, " "daily time out %{public}lld, alive time out %{public}lld", oneBundleUsage.first.c_str(), - oneBundleUsage.second->lastBootFromUsedTimeStamp_, oneBundleUsage.second->lastScreenUsedTimeStamp_, + (long long)oneBundleUsage.second->lastBootFromUsedTimeStamp_, + (long long)oneBundleUsage.second->lastScreenUsedTimeStamp_, oneBundleUsage.second->currentGroup_, oneBundleUsage.second->reasonInGroup_, - oneBundleUsage.second->bundleDailyTimeoutTimeStamp_, oneBundleUsage.second->bundleAliveTimeoutTimeStamp_); + (long long)oneBundleUsage.second->bundleDailyTimeoutTimeStamp_, + (long long)oneBundleUsage.second->bundleAliveTimeoutTimeStamp_); } } } // namespace DeviceUsageStats diff --git a/services/packageusage/src/bundle_active_user_service.cpp b/services/packageusage/src/bundle_active_user_service.cpp index bc6605d..0e4646b 100644 --- a/services/packageusage/src/bundle_active_user_service.cpp +++ b/services/packageusage/src/bundle_active_user_service.cpp @@ -37,10 +37,11 @@ void BundleActiveUserService::Init(const int64_t timeStamp) currentDailyStats->AddEvent(startupEvent); for (auto it : currentDailyStats->events_.events_) { BUNDLE_ACTIVE_LOGI("Init event id is %{public}d, time stamp is %{public}lld", - it.eventId_, it.timeStamp_); + it.eventId_, (long long)it.timeStamp_); } BUNDLE_ACTIVE_LOGI("Init currentDailyStats begintime is %{public}lld, " - "expire time is %{public}lld", currentDailyStats->beginTime_, dailyExpiryDate_.GetMilliseconds()); + "expire time is %{public}lld", (long long)currentDailyStats->beginTime_, + (long long)dailyExpiryDate_.GetMilliseconds()); } } @@ -94,7 +95,7 @@ void BundleActiveUserService::NotifyNewUpdate() void BundleActiveUserService::ReportEvent(const BundleActiveEvent& event) { BUNDLE_ACTIVE_LOGI("ReportEvent, B time is %{public}lld, E time is %{public}lld, userId is %{public}d,", - currentStats_[0]->beginTime_, dailyExpiryDate_.GetMilliseconds(), userId_); + (long long)currentStats_[0]->beginTime_, (long long)dailyExpiryDate_.GetMilliseconds(), userId_); event.PrintEvent(); if (event.timeStamp_ >= dailyExpiryDate_.GetMilliseconds()) { BUNDLE_ACTIVE_LOGI("ReportEvent later than daily expire, renew data in memory"); @@ -205,11 +206,12 @@ void BundleActiveUserService::LoadActiveStats(const int64_t timeStamp, const boo currentStats_[intervalType].reset(); // 当前interval stat置空 if (stats != nullptr) { // 找出最近的stats BUNDLE_ACTIVE_LOGI("LoadActiveStats inter type is %{public}d, " - "bundle size is %{public}d", intervalType, stats->bundleStats_.size()); + "bundle size is %{public}zu", intervalType, stats->bundleStats_.size()); // 如果当前时间在stats的统计时间范围内,则可以从数据库加载数据 BUNDLE_ACTIVE_LOGI("interval type is %{public}d, database stat BEGIN time is %{public}lld, " "timestamp is %{public}lld, expect end is %{public}lld", - intervalType, stats->beginTime_, timeStamp, stats->beginTime_ + periodLength_[intervalType]); + intervalType, (long long)stats->beginTime_, (long long)timeStamp, + (long long)stats->beginTime_ + periodLength_[intervalType]); if (timeStamp > stats->beginTime_ && timeStamp < stats->beginTime_ + periodLength_[intervalType]) { currentStats_[intervalType] = stats; } @@ -236,7 +238,8 @@ void BundleActiveUserService::LoadActiveStats(const int64_t timeStamp, const boo } listener_.OnStatsReload(); BUNDLE_ACTIVE_LOGI("LoadActiveStats current expire time is %{public}lld, " - "begin time is %{public}lld", dailyExpiryDate_.GetMilliseconds(), tmpCalendar.GetMilliseconds()); + "begin time is %{public}lld", (long long)dailyExpiryDate_.GetMilliseconds(), + (long long)tmpCalendar.GetMilliseconds()); } void BundleActiveUserService::RenewStatsInMemory(const int64_t timeStamp) @@ -415,7 +418,8 @@ void BundleActiveUserService::PrintInMemPackageStats(const int idx) int64_t totalTimeContinuousTaskUsed = it.second->totalContiniousTaskUsedTime_; BUNDLE_ACTIVE_LOGI("bundle stat is, totaltime is %{public}lld, lastTimeUsed is %{public}lld" "total continuous task is %{public}lld, lastTimeContinuousTaskUsed is %{public}lld", - totalUsedTime, lastTimeUsed, totalTimeContinuousTaskUsed, lastTimeContinuousTaskUsed); + (long long)totalUsedTime, (long long)lastTimeUsed, + (long long)totalTimeContinuousTaskUsed, (long long)lastTimeContinuousTaskUsed); } } @@ -432,7 +436,7 @@ void BundleActiveUserService::PrintInMemEventStats() int64_t timestamp = currentStats_[idx]->events_.events_[i].timeStamp_; BUNDLE_ACTIVE_LOGI("In mem, event stat is, abilityid is %{public}s, abilityname is %{public}s, " "bundlename is %{public}s, eventid is %{public}d, timestamp is %{public}lld", - abilityId.c_str(), abilityname.c_str(), bundlename.c_str(), eventid, timestamp); + abilityId.c_str(), abilityname.c_str(), bundlename.c_str(), eventid, (long long)timestamp); } } -- Gitee From 0564762e30e2dd2b015bcba32106c8bc7fb0b7ed Mon Sep 17 00:00:00 2001 From: zhangfanfan2 Date: Wed, 6 Apr 2022 08:28:28 +0000 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E7=B3=BB=E7=BB=9F=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=94=AF=E6=8C=8164=E4=BD=8D=E9=9B=86=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close: #I5113F Signed-off-by: zff --- services/packageusage/src/bundle_active_event.cpp | 2 +- .../packageusage/src/bundle_active_user_service.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/services/packageusage/src/bundle_active_event.cpp b/services/packageusage/src/bundle_active_event.cpp index eb55933..575e02a 100644 --- a/services/packageusage/src/bundle_active_event.cpp +++ b/services/packageusage/src/bundle_active_event.cpp @@ -120,7 +120,7 @@ void BundleActiveEvent::PrintEvent() const "module name is %{public}s, " "form name is %{public}s, form dimension is %{public}d, form id is %{public}lld, event id is %{public}d", bundleName_.c_str(), abilityName_.c_str(), continuousTaskAbilityName_.c_str(), moduleName_.c_str(), - formName_.c_str(), formDimension_, formId_, eventId_); + formName_.c_str(), formDimension_, (long long)formId_, eventId_); } bool BundleActiveEvent::Marshalling(Parcel &parcel) const diff --git a/services/packageusage/src/bundle_active_user_service.cpp b/services/packageusage/src/bundle_active_user_service.cpp index 0e4646b..0c7ee7a 100644 --- a/services/packageusage/src/bundle_active_user_service.cpp +++ b/services/packageusage/src/bundle_active_user_service.cpp @@ -327,7 +327,8 @@ std::vector BundleActiveUserService::QueryPackageStats return result; } int64_t truncatedEndTime = std::min(currentStats->beginTime_, endTime); - BUNDLE_ACTIVE_LOGI("Query package data in db from %{public}lld to %{public}lld", beginTime, truncatedEndTime); + BUNDLE_ACTIVE_LOGI("Query package data in db from %{public}lld to %{public}lld", + (long long)beginTime, (long long)truncatedEndTime); result = database_.QueryDatabaseUsageStats(intervalType, beginTime, truncatedEndTime, userId); BUNDLE_ACTIVE_LOGI("Query package data in db result size is %{public}d", static_cast(result.size())); if (debugUserService_) { @@ -369,7 +370,7 @@ std::vector BundleActiveUserService::QueryEvents(const int64_ } BUNDLE_ACTIVE_LOGI("Query event bundle name is %{public}s", bundleName.c_str()); result = database_.QueryDatabaseEvents(beginTime, endTime, userId, bundleName); - BUNDLE_ACTIVE_LOGI("Query event data in db result size is %{public}d", result.size()); + BUNDLE_ACTIVE_LOGI("Query event data in db result size is %{public}zu", result.size()); if (debugUserService_) { PrintInMemEventStats(); } @@ -447,12 +448,13 @@ void BundleActiveUserService::PrintInMemFormStats() BUNDLE_ACTIVE_LOGI("bundle name is %{public}s, module name is %{public}s, " "lastusedtime is %{public}lld, launchcount is %{public}d", oneModule.second->bundleName_.c_str(), oneModule.second->moduleName_.c_str(), - oneModule.second->lastModuleUsedTime_, oneModule.second->launchedCount_); + (long long)oneModule.second->lastModuleUsedTime_, oneModule.second->launchedCount_); BUNDLE_ACTIVE_LOGI("combined info is %{public}s", oneModule.first.c_str()); for (const auto& oneForm : oneModule.second->formRecords_) { BUNDLE_ACTIVE_LOGI("form name is %{public}s, form dimension is %{public}d, form id is %{public}lld, " "lasttouchtime is %{public}lld, touchcount is %{public}d", oneForm.formName_.c_str(), - oneForm.formDimension_, oneForm.formId_, oneForm.formLastUsedTime_, oneForm.count_); + oneForm.formDimension_, (long long)oneForm.formId_, + (long long)oneForm.formLastUsedTime_, oneForm.count_); } } } -- Gitee From 14ec6b2b87e61e564ec13d23a056fa18edc0c83f Mon Sep 17 00:00:00 2001 From: zhangfanfan2 Date: Wed, 6 Apr 2022 08:59:10 +0000 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E7=B3=BB=E7=BB=9F=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=94=AF=E6=8C=8164=E4=BD=8D=E9=9B=86=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close: #I5113F Signed-off-by: zff --- services/packageusage/src/bundle_active_user_service.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/packageusage/src/bundle_active_user_service.cpp b/services/packageusage/src/bundle_active_user_service.cpp index 0c7ee7a..2c15f8e 100644 --- a/services/packageusage/src/bundle_active_user_service.cpp +++ b/services/packageusage/src/bundle_active_user_service.cpp @@ -327,8 +327,6 @@ std::vector BundleActiveUserService::QueryPackageStats return result; } int64_t truncatedEndTime = std::min(currentStats->beginTime_, endTime); - BUNDLE_ACTIVE_LOGI("Query package data in db from %{public}lld to %{public}lld", - (long long)beginTime, (long long)truncatedEndTime); result = database_.QueryDatabaseUsageStats(intervalType, beginTime, truncatedEndTime, userId); BUNDLE_ACTIVE_LOGI("Query package data in db result size is %{public}d", static_cast(result.size())); if (debugUserService_) { -- Gitee