From 5c8eabc8cc4a41af47ae36ef75002e5ed683ea22 Mon Sep 17 00:00:00 2001 From: wyuanchao Date: Sat, 5 Mar 2022 10:25:09 +0800 Subject: [PATCH 1/2] codex Signed-off-by: wyuanchao --- frameworks/src/bundle_state_common.cpp | 4 ++++ frameworks/src/bundle_state_query.cpp | 24 +++++++++---------- .../innerkits/src/bundle_active_proxy.cpp | 8 +++---- services/common/include/bundle_active_core.h | 4 ++-- services/common/src/bundle_active_core.cpp | 4 ++-- services/common/src/bundle_active_service.cpp | 14 +++++++++-- .../include/bundle_active_event.h | 6 ++--- .../packageusage/src/bundle_active_event.cpp | 5 ---- 8 files changed, 38 insertions(+), 31 deletions(-) diff --git a/frameworks/src/bundle_state_common.cpp b/frameworks/src/bundle_state_common.cpp index 525b3d3..caded60 100644 --- a/frameworks/src/bundle_state_common.cpp +++ b/frameworks/src/bundle_state_common.cpp @@ -112,6 +112,10 @@ void BundleStateCommon::GetBundleStateInfoByIntervalForResult( void BundleStateCommon::GetBundleStateInfoForResult(napi_env env, const std::shared_ptr> &packageStats, napi_value result) { + if (packageStats == nullptr) { + BUNDLE_ACTIVE_LOGE("packageStats is invalid"); + return; + } for (const auto &item : *packageStats) { napi_value packageObject = nullptr; NAPI_CALL_RETURN_VOID(env, napi_create_object(env, &packageObject)); diff --git a/frameworks/src/bundle_state_query.cpp b/frameworks/src/bundle_state_query.cpp index 75a97be..8d84091 100644 --- a/frameworks/src/bundle_state_query.cpp +++ b/frameworks/src/bundle_state_query.cpp @@ -21,18 +21,18 @@ namespace OHOS { namespace DeviceUsageStats { -static const int32_t Is_Idle_State_MIN_PARAMS = 1; -static const int32_t Is_Idle_State_PARAMS = 2; -static const int32_t Priority_Group_MIN_PARAMS = 0; -static const int32_t Priority_Group_PARAMS = 1; -static const int32_t States_MIN_PARAMS = 2; -static const int32_t States_PARAMS = 3; -static const int32_t App_Usage_MIN_PARAMS_BY_INTERVAL = 3; -static const int32_t App_Usage_PARAMS_BY_INTERVAL = 4; -static const int32_t App_Usage_MIN_PARAMS = 2; -static const int32_t App_Usage_PARAMS = 3; -static const int32_t SECOND_ARG = 2; -static const int32_t THIRD_ARG = 3; +const u_int32_t Is_Idle_State_MIN_PARAMS = 1; +const u_int32_t Is_Idle_State_PARAMS = 2; +const u_int32_t Priority_Group_MIN_PARAMS = 0; +const u_int32_t Priority_Group_PARAMS = 1; +const u_int32_t States_MIN_PARAMS = 2; +const u_int32_t States_PARAMS = 3; +const u_int32_t App_Usage_MIN_PARAMS_BY_INTERVAL = 3; +const u_int32_t App_Usage_PARAMS_BY_INTERVAL = 4; +const u_int32_t App_Usage_MIN_PARAMS = 2; +const u_int32_t App_Usage_PARAMS = 3; +const u_int32_t SECOND_ARG = 2; +const u_int32_t THIRD_ARG = 3; napi_value ParseIsIdleStateParameters(const napi_env &env, const napi_callback_info &info, IsIdleStateParamsInfo ¶ms) diff --git a/interfaces/innerkits/src/bundle_active_proxy.cpp b/interfaces/innerkits/src/bundle_active_proxy.cpp index 068794f..31fd4e9 100644 --- a/interfaces/innerkits/src/bundle_active_proxy.cpp +++ b/interfaces/innerkits/src/bundle_active_proxy.cpp @@ -78,7 +78,7 @@ std::vector BundleActiveProxy::QueryPackageStats(const } result.push_back(*tmp); } - for (int i = 0; i < result.size(); i++) { + for (uint32_t i = 0; i < result.size(); i++) { BUNDLE_ACTIVE_LOGI("BundleActiveProxy::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", @@ -109,7 +109,7 @@ std::vector BundleActiveProxy::QueryEvents(const int64_t begi } result.push_back(*tmp); } - for (int i = 0; i < result.size(); i++) { + for (uint32_t i = 0; i < result.size(); i++) { BUNDLE_ACTIVE_LOGI("BundleActiveProxy::QueryEvents 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_); } @@ -153,7 +153,7 @@ std::vector BundleActiveProxy::QueryCurrentPackageStat } result.push_back(*tmp); } - for (int i = 0; i < result.size(); i++) { + for (uint32_t i = 0; i < result.size(); i++) { BUNDLE_ACTIVE_LOGI("BundleActiveProxy::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", @@ -184,7 +184,7 @@ std::vector BundleActiveProxy::QueryCurrentEvents(const int64 } result.push_back(*tmp); } - for (int i = 0; i < result.size(); i++) { + for (uint32_t i = 0; i < result.size(); i++) { BUNDLE_ACTIVE_LOGI("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_); } diff --git a/services/common/include/bundle_active_core.h b/services/common/include/bundle_active_core.h index 1956dc5..b84b7b5 100644 --- a/services/common/include/bundle_active_core.h +++ b/services/common/include/bundle_active_core.h @@ -34,8 +34,8 @@ namespace DeviceUsageStats { class BundleActiveReportHandlerObject { public: BundleActiveEvent event_; - int userId_; - std::string bundleName_; + int userId_ = -1; + std::string bundleName_ = ""; BundleActiveReportHandlerObject() {}; BundleActiveReportHandlerObject(const BundleActiveReportHandlerObject& orig); ~BundleActiveReportHandlerObject() {}; diff --git a/services/common/src/bundle_active_core.cpp b/services/common/src/bundle_active_core.cpp index 5f09345..6b7e312 100644 --- a/services/common/src/bundle_active_core.cpp +++ b/services/common/src/bundle_active_core.cpp @@ -30,7 +30,6 @@ BundleActiveReportHandlerObject::BundleActiveReportHandlerObject(const BundleAct event_.abilityId_ = orig.event_.abilityId_; event_.timeStamp_ = orig.event_.timeStamp_; event_.eventId_ = orig.event_.eventId_; - event_.isidle_ = orig.event_.isidle_; event_.continuousTaskAbilityName_ = orig.event_.continuousTaskAbilityName_; userId_ = orig.userId_; bundleName_ = orig.bundleName_; @@ -38,6 +37,7 @@ BundleActiveReportHandlerObject::BundleActiveReportHandlerObject(const BundleAct BundleActiveCore::BundleActiveCore() { + systemTimeShot_ = -1; } BundleActiveCore::~BundleActiveCore() @@ -157,7 +157,7 @@ void BundleActiveCore::InitBundleGroupController() std::vector osAccountInfos; GetAllActiveUser(osAccountInfos); bundleGroupController_->bundleGroupEnable_ = true; - for (int i = 0; i < osAccountInfos.size(); i++) { + for (uint32_t i = 0; i < osAccountInfos.size(); i++) { bundleGroupController_->PeriodCheckBundleState(osAccountInfos[i].GetLocalId()); } } diff --git a/services/common/src/bundle_active_service.cpp b/services/common/src/bundle_active_service.cpp index 9b7bfd2..1532f33 100644 --- a/services/common/src/bundle_active_service.cpp +++ b/services/common/src/bundle_active_service.cpp @@ -98,7 +98,12 @@ void BundleActiveService::InitNecessaryState() } else { return; } - shutdownCallback_ = new BundleActiveShutdownCallbackService(bundleActiveCore_); + try { + shutdownCallback_ = new BundleActiveShutdownCallbackService(bundleActiveCore_); + } catch(const std::bad_alloc &e) { + BUNDLE_ACTIVE_LOGE("Memory allocation failed"); + return; + } auto& powerManagerClient = OHOS::PowerMgr::PowerMgrClient::GetInstance(); powerManagerClient.RegisterShutdownCallback(shutdownCallback_); InitAppStateSubscriber(reportHandler_); @@ -170,7 +175,12 @@ void BundleActiveService::OnStop() auto& powerManagerClient = OHOS::PowerMgr::PowerMgrClient::GetInstance(); powerManagerClient.UnRegisterShutdownCallback(shutdownCallback_); } else { - shutdownCallback_ = new BundleActiveShutdownCallbackService(bundleActiveCore_); + try { + shutdownCallback_ = new BundleActiveShutdownCallbackService(bundleActiveCore_); + } catch(const std::bad_alloc &e) { + BUNDLE_ACTIVE_LOGE("Memory allocation failed"); + return; + } } auto& powerManagerClient = OHOS::PowerMgr::PowerMgrClient::GetInstance(); powerManagerClient.UnRegisterShutdownCallback(shutdownCallback_); diff --git a/services/packageusage/include/bundle_active_event.h b/services/packageusage/include/bundle_active_event.h index d438384..952b024 100644 --- a/services/packageusage/include/bundle_active_event.h +++ b/services/packageusage/include/bundle_active_event.h @@ -45,9 +45,8 @@ public: std::string continuousTaskAbilityName_; std::string abilityName_; std::string abilityId_; - int64_t timeStamp_; - int eventId_; - bool isidle_; + int64_t timeStamp_ = -1; + int eventId_ = -1; public: BundleActiveEvent() {}; @@ -58,7 +57,6 @@ public: std::string GetAbilityId(); int64_t GetTimeStamp(); int GetEventId(); - bool GetIsIdle(); virtual bool Marshalling(Parcel &parcel) const override; std::shared_ptr Unmarshalling(Parcel &parcel); }; diff --git a/services/packageusage/src/bundle_active_event.cpp b/services/packageusage/src/bundle_active_event.cpp index c29ebc3..92a203c 100644 --- a/services/packageusage/src/bundle_active_event.cpp +++ b/services/packageusage/src/bundle_active_event.cpp @@ -61,11 +61,6 @@ int BundleActiveEvent::GetEventId() return eventId_; } -bool BundleActiveEvent::GetIsIdle() -{ - return isidle_; -} - bool BundleActiveEvent::Marshalling(Parcel &parcel) const { if (parcel.WriteString(bundleName_) && -- Gitee From 7aa7abad6df701cec7af376fa499af3d9cb2a396 Mon Sep 17 00:00:00 2001 From: wyuanchao Date: Sat, 5 Mar 2022 14:38:05 +0800 Subject: [PATCH 2/2] codex Signed-off-by: wyuanchao --- frameworks/src/bundle_state_common.cpp | 2 +- services/common/src/bundle_active_stub.cpp | 2 +- .../common/src/bundle_active_usage_database.cpp | 12 ++++++------ .../include/bundle_active_group_common.h | 10 +++++----- .../include/bundle_active_group_controller.h | 2 +- .../include/bundle_active_group_handler.h | 4 ++-- .../include/bundle_active_package_history.h | 16 ++++++++-------- .../src/bundle_active_group_handler.cpp | 2 +- .../include/bundle_active_event_stats.h | 10 +++++----- .../src/bundle_active_stats_combiner.cpp | 2 +- .../src/bundle_active_user_service.cpp | 6 +++--- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/frameworks/src/bundle_state_common.cpp b/frameworks/src/bundle_state_common.cpp index caded60..6c8ec0b 100644 --- a/frameworks/src/bundle_state_common.cpp +++ b/frameworks/src/bundle_state_common.cpp @@ -113,7 +113,7 @@ void BundleStateCommon::GetBundleStateInfoForResult(napi_env env, const std::shared_ptr> &packageStats, napi_value result) { if (packageStats == nullptr) { - BUNDLE_ACTIVE_LOGE("packageStats is invalid"); + BUNDLE_ACTIVE_LOGE("wangyuanchao packageStats is invalid"); return; } for (const auto &item : *packageStats) { diff --git a/services/common/src/bundle_active_stub.cpp b/services/common/src/bundle_active_stub.cpp index 99beeea..03d42ab 100644 --- a/services/common/src/bundle_active_stub.cpp +++ b/services/common/src/bundle_active_stub.cpp @@ -50,7 +50,7 @@ int32_t BundleActiveStub::OnRemoteRequest(uint32_t code, MessageParcel& data, Me int64_t beginTime = data.ReadInt64(); int64_t endTime = data.ReadInt64(); result = QueryPackageStats(intervalType, beginTime, endTime); - size = result.size(); + size = static_cast(result.size()); BUNDLE_ACTIVE_LOGI("BundleActiveStub::OnRemoteRequest QUERY_USAGE_STATS result size is %{public}d", size); reply.WriteInt32(size); for (int i = 0; i < size; i++) { diff --git a/services/common/src/bundle_active_usage_database.cpp b/services/common/src/bundle_active_usage_database.cpp index 49330f0..3b715cd 100644 --- a/services/common/src/bundle_active_usage_database.cpp +++ b/services/common/src/bundle_active_usage_database.cpp @@ -131,7 +131,7 @@ void BundleActiveUsageDatabase::InitDatabaseTableInfo(int64_t currentTime) if (startIndex < BUNDLE_ACTIVE_SUCCESS) { continue; } - int32_t tableNumber = sortedTableArray_.at(i).size(); + int32_t tableNumber = static_cast(sortedTableArray_.at(i).size()); for (int32_t j = startIndex; j < tableNumber; j++) { DeleteInvalidTable(i, sortedTableArray_.at(i).at(startIndex)); sortedTableArray_.at(i).erase(sortedTableArray_.at(i).begin() + startIndex); @@ -704,12 +704,12 @@ shared_ptr BundleActiveUsageDatabase::GetCurrentUsageDa int userId) { lock_guard lock(databaseMutex_); - if (databaseType < 0 || databaseType >= sortedTableArray_.size()) { + if (databaseType < 0 || databaseType >= static_cast(sortedTableArray_.size())) { BUNDLE_ACTIVE_LOGE("databaseType is invalid, databaseType = %{public}d", databaseType); return nullptr; } - int tableNumber = sortedTableArray_.at(databaseType).size(); + uint32_t tableNumber = sortedTableArray_.at(databaseType).size(); if (tableNumber == TABLE_NOT_EXIST) { return nullptr; } @@ -865,9 +865,9 @@ int32_t BundleActiveUsageDatabase::GetOptimalIntervalType(int64_t beginTime, int lock_guard lock(databaseMutex_); int32_t optimalIntervalType = -1; int64_t leastTimeDiff = numeric_limits::max(); - for (int32_t i = sortedTableArray_.size() - 1; i >= 0; i--) { + for (int32_t i = static_cast(sortedTableArray_.size() - 1); i >= 0; i--) { int32_t index = NearIndexOnOrBeforeCurrentTime(beginTime, sortedTableArray_.at(i)); - int32_t size = sortedTableArray_.at(i).size(); + int32_t size = static_cast(sortedTableArray_.at(i).size()); if (index >= 0 && index < size) { int64_t diff = abs(sortedTableArray_.at(i).at(index) - beginTime); if (diff < leastTimeDiff) { @@ -998,7 +998,7 @@ vector BundleActiveUsageDatabase::QueryDatabaseUsageSt { lock_guard lock(databaseMutex_); vector databaseUsageStats; - if (databaseType < 0 || databaseType >= sortedTableArray_.size()) { + if (databaseType < 0 || databaseType >= static_cast(sortedTableArray_.size())) { BUNDLE_ACTIVE_LOGE("databaseType is invalid, databaseType = %{public}d", databaseType); return databaseUsageStats; } diff --git a/services/packagegroup/include/bundle_active_group_common.h b/services/packagegroup/include/bundle_active_group_common.h index f530520..3c08575 100644 --- a/services/packagegroup/include/bundle_active_group_common.h +++ b/services/packagegroup/include/bundle_active_group_common.h @@ -43,11 +43,11 @@ const int64_t DEFAULT_EVENT_TIMEOUT = ONE_HOUR; const int64_t DEFAULT_NOTIFY_EVENT_TIMEOUT = 12 * ONE_HOUR; const int64_t DEFAULT_SYSTEevent__TIMEOUT = 2 * ONE_HOUR; const int64_t DEFAULT_LONT_TIME_TASK_START_EVENT_TIMEOUT = 30 * ONE_MINUTE; -const int GROUP_CONTROL_REASON_MASK = 0xFF00; -const int GROUP_CONTROL_REASON_DEFAULT = 0x0100; -const int GROUP_CONTROL_REASON_TIMEOUT = 0x0200; -const int GROUP_CONTROL_REASON_USAGE = 0x0300; -const int GROUP_CONTROL_REASON_FORCED = 0x0400; +const u_int32_t GROUP_CONTROL_REASON_MASK = 0xFF00; +const u_int32_t GROUP_CONTROL_REASON_DEFAULT = 0x0100; +const u_int32_t GROUP_CONTROL_REASON_TIMEOUT = 0x0200; +const u_int32_t GROUP_CONTROL_REASON_USAGE = 0x0300; +const u_int32_t GROUP_CONTROL_REASON_FORCED = 0x0400; const int GROUP_CONTROL_REASON_CALCULATED = 0x0500; const int GROUP_EVENT_REASON_MASK = 0x00FF; const int GROUP_EVENT_REASON_SYSTEM = 0x0001; diff --git a/services/packagegroup/include/bundle_active_group_controller.h b/services/packagegroup/include/bundle_active_group_controller.h index c0589b7..7c8405d 100644 --- a/services/packagegroup/include/bundle_active_group_controller.h +++ b/services/packagegroup/include/bundle_active_group_controller.h @@ -42,7 +42,7 @@ public: using BundleFlag = OHOS::AppExecFwk::BundleFlag; using ApplicationFlag = OHOS::AppExecFwk::ApplicationFlag; OHOS::AppExecFwk::ApplicationFlag flag = OHOS::AppExecFwk::ApplicationFlag::GET_BASIC_APPLICATION_INFO; - bool bundleGroupEnable_; + bool bundleGroupEnable_ = true; bool debug_ = true; const int LEVEL_GROUP[4] = { ACTIVE_GROUP_ALIVE, diff --git a/services/packagegroup/include/bundle_active_group_handler.h b/services/packagegroup/include/bundle_active_group_handler.h index cb9ec0d..946582a 100644 --- a/services/packagegroup/include/bundle_active_group_handler.h +++ b/services/packagegroup/include/bundle_active_group_handler.h @@ -27,8 +27,8 @@ namespace OHOS { namespace DeviceUsageStats { class BundleActiveGroupHandlerObject { public: - std::string bundleName_; - int userId_; + std::string bundleName_ = ""; + int userId_ = -1; BundleActiveGroupHandlerObject() {}; BundleActiveGroupHandlerObject(const BundleActiveGroupHandlerObject& orig); ~BundleActiveGroupHandlerObject() {}; diff --git a/services/packagegroup/include/bundle_active_package_history.h b/services/packagegroup/include/bundle_active_package_history.h index c78c304..9803c45 100644 --- a/services/packagegroup/include/bundle_active_package_history.h +++ b/services/packagegroup/include/bundle_active_package_history.h @@ -22,14 +22,14 @@ namespace OHOS { namespace DeviceUsageStats { class BundleActivePackageHistory { public: - int64_t lastBootFromUsedTimeStamp_; - int64_t lastScreenUsedTimeStamp_; - int64_t lastGroupCalculatedTimeStamp_; - int lastCalculatedGroup_; - int currentGroup_; - int reasonInGroup_; - int64_t bundleAliveTimeoutTimeStamp_; - int64_t bundleDailyTimeoutTimeStamp_; + int64_t lastBootFromUsedTimeStamp_ = 0; + int64_t lastScreenUsedTimeStamp_ = 0; + int64_t lastGroupCalculatedTimeStamp_ = 0; + int lastCalculatedGroup_ = 0; + int currentGroup_ = 0; + int reasonInGroup_ = 0; + int64_t bundleAliveTimeoutTimeStamp_ = 0; + int64_t bundleDailyTimeoutTimeStamp_ = 0; BundleActivePackageHistory() {}; ~BundleActivePackageHistory() {}; }; diff --git a/services/packagegroup/src/bundle_active_group_handler.cpp b/services/packagegroup/src/bundle_active_group_handler.cpp index ce1e089..a51784d 100644 --- a/services/packagegroup/src/bundle_active_group_handler.cpp +++ b/services/packagegroup/src/bundle_active_group_handler.cpp @@ -64,7 +64,7 @@ void BundleActiveGroupHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointe BUNDLE_ACTIVE_LOGI("BundleActiveCore::GetAllActiveUser size is 0"); return; } - for (int i = 0; i < osAccountInfos.size(); i++) { + for (u_int32_t i = 0; i < osAccountInfos.size(); i++) { bundleActiveGroupController_->CheckEachBundleState(osAccountInfos[i].GetLocalId()); bundleActiveGroupController_->RestoreToDatabase(osAccountInfos[i].GetLocalId()); } diff --git a/services/packageusage/include/bundle_active_event_stats.h b/services/packageusage/include/bundle_active_event_stats.h index a2f3900..64843ee 100644 --- a/services/packageusage/include/bundle_active_event_stats.h +++ b/services/packageusage/include/bundle_active_event_stats.h @@ -23,11 +23,11 @@ namespace DeviceUsageStats { class BundleActiveEventStats { public: int eventId_; - int64_t beginTimeStamp_; - int64_t endTimeStamp_; - int64_t lastEventTime_; - int64_t totalTime_; - int count_; + int64_t beginTimeStamp_ = -1; + int64_t endTimeStamp_ = -1; + int64_t lastEventTime_ = -1; + int64_t totalTime_ = 0; + int count_ = 0; BundleActiveEventStats() {}; BundleActiveEventStats(const BundleActiveEventStats& orig); int GetEventId(); diff --git a/services/packageusage/src/bundle_active_stats_combiner.cpp b/services/packageusage/src/bundle_active_stats_combiner.cpp index 88ddd97..7bc2b83 100644 --- a/services/packageusage/src/bundle_active_stats_combiner.cpp +++ b/services/packageusage/src/bundle_active_stats_combiner.cpp @@ -35,7 +35,7 @@ void BundleActiveStatsCombiner::combine(const std::shared_ptr { BUNDLE_ACTIVE_LOGI("BundleActiveStatsCombiner::combine called"); int startIndex = stats->events_.FindBestIndex(beginTime); - int size = stats->events_.events_.size(); + int size = static_cast(stats->events_.events_.size()); for (int i = startIndex; i < size; i++) { accumulatedResult.push_back(stats->events_.events_[i]); } diff --git a/services/packageusage/src/bundle_active_user_service.cpp b/services/packageusage/src/bundle_active_user_service.cpp index cdc1639..bde22bc 100644 --- a/services/packageusage/src/bundle_active_user_service.cpp +++ b/services/packageusage/src/bundle_active_user_service.cpp @@ -162,7 +162,7 @@ void BundleActiveUserService::RestoreStats() BUNDLE_ACTIVE_LOGI("BundleActiveUserService::RestoreStats() called"); if (statsChanged_) { BUNDLE_ACTIVE_LOGI("BundleActiveUserService::RestoreStats() stat changed is true"); - for (int i = 0; i < currentStats_.size(); i++) { + for (uint32_t i = 0; i < currentStats_.size(); i++) { database_.UpdateUsageData(i, *(currentStats_[i])); } currentStats_[BundleActivePeriodStats::PERIOD_DAILY]->events_.Clear(); @@ -176,7 +176,7 @@ void BundleActiveUserService::LoadActiveStats(const int64_t timeStamp, const boo BundleActiveCalendar tmpCalendar(0); tmpCalendar.SetMilliseconds(timeStamp); tmpCalendar.TruncateTo(BundleActivePeriodStats::PERIOD_DAILY); - for (int intervalType = 0; intervalType < PERIOD_LENGTH.size(); intervalType++) { + for (uint32_t intervalType = 0; intervalType < PERIOD_LENGTH.size(); intervalType++) { if (!force && currentStats_[intervalType] != nullptr && currentStats_[intervalType]->beginTime_ == tmpCalendar.GetMilliseconds()) { continue; @@ -276,7 +276,7 @@ std::vector BundleActiveUserService::QueryPackageStats intervalType = BundleActivePeriodStats::PERIOD_DAILY; } } - if (intervalType < 0 || intervalType >= currentStats_.size()) { + if (intervalType < 0 || intervalType >= static_cast(currentStats_.size())) { return result; } -- Gitee