diff --git a/services/common/src/bundle_active_config_reader.cpp b/services/common/src/bundle_active_config_reader.cpp index 3b3de1e5ac0fd299d1030ef5bd3917aaf8c59cc4..1d563ffa20a2e9d792115eb06bcce5a549aae08b 100644 --- a/services/common/src/bundle_active_config_reader.cpp +++ b/services/common/src/bundle_active_config_reader.cpp @@ -87,13 +87,15 @@ void BundleActiveConfigReader::LoadConfigFile(const char *filePath) BUNDLE_ACTIVE_LOGE("file is empty %{private}s", filePath); return; } +// LCOV_EXCL_START LoadApplicationUsePeriodically(root); LoadAppHighFreqPeriodThresholdConfig(root); LoadMaxDataSize(root); cJSON_Delete(root); +// LCOV_EXCL_STOP } - +// LCOV_EXCL_START void BundleActiveConfigReader::LoadApplicationUsePeriodically(cJSON* root) { cJSON *appUsePeriodicallyRoot = cJSON_GetObjectItem(root, APPLICATION_USE_PERIODICALLY_KEY); @@ -154,6 +156,7 @@ void BundleActiveConfigReader::LoadMaxDataSize(cJSON* root) } maxDataSize_ = static_cast(maxDataSizeItem->valueint); } +// LCOV_EXCL_STOP bool BundleActiveConfigReader::GetJsonFromFile(const char *filePath, cJSON *&root) { @@ -168,17 +171,17 @@ bool BundleActiveConfigReader::GetJsonFromFile(const char *filePath, cJSON *&roo BUNDLE_ACTIVE_LOGE("load string from %{private}s failed", realPath.c_str()); return false; } +// LCOV_EXCL_START if (data.empty()) { return false; } root = cJSON_Parse(data.c_str()); -// LCOV_EXCL_START if (!root) { BUNDLE_ACTIVE_LOGE("parse %{private}s json error", realPath.c_str()); return false; } -// LCOV_EXCL_STOP return true; +// LCOV_EXCL_STOP } bool BundleActiveConfigReader::ConvertFullPath(const std::string& partialPath, std::string& fullPath) @@ -205,7 +208,7 @@ AppHighFrequencyPeriodThresholdConfig BundleActiveConfigReader::GetAppHighFreque { return appHighFreqPeriodThresholdConfig_; } - +// LCOV_EXCL_START uint64_t BundleActiveConfigReader::GetMaxDataSize() { if (maxDataSize_ == 0) { @@ -239,5 +242,6 @@ bool BundleActiveConfigReader::IsValidNumber(cJSON* item) { return item != nullptr && cJSON_IsNumber(item); } +// LCOV_EXCL_STOP } // namespace DeviceUsageStats } // namespace OHOS \ No newline at end of file diff --git a/services/common/src/bundle_active_event_reporter.cpp b/services/common/src/bundle_active_event_reporter.cpp index 63853d6b0346fd5e181cdf3deb8a14ec73007e7a..89f5cfc4fbfcc2d032f76402838faf38fde1da5f 100644 --- a/services/common/src/bundle_active_event_reporter.cpp +++ b/services/common/src/bundle_active_event_reporter.cpp @@ -44,11 +44,14 @@ void BundleActiveEventReporter::ReportFileSizeEvent() void BundleActiveEventReporter::SubmitDelayTask(int64_t delayTime) { +// LCOV_EXCL_START ffrt::submit([]() { BundleActiveEventReporter::GetInstance().ReportFileSizeDaily(); }, ffrt::task_attr().delay(delayTime)); +// LCOV_EXCL_STOP } +// LCOV_EXCL_START void BundleActiveEventReporter::ReportFileSizeDaily() { std::string lastReportTime; @@ -91,5 +94,6 @@ void BundleActiveEventReporter::ReportFileSizeInner() SaveStringToFile(fileSizeRecorderName_, std::to_string(nowMicroTime)); SubmitDelayTask(ONE_DAY_MICRO_SECOND); } +// LCOV_EXCL_STOP } // namespace ResourceSchedule } // namespace OHOS \ No newline at end of file diff --git a/services/common/src/bundle_active_service.cpp b/services/common/src/bundle_active_service.cpp index d256d4c09a62408da42dc9d7e29c14fb0fc4ac2b..d5a3023d0afab16163ad853e26f9d7696a1c4f14 100644 --- a/services/common/src/bundle_active_service.cpp +++ b/services/common/src/bundle_active_service.cpp @@ -232,6 +232,7 @@ bool BundleActiveService::SubscribeContinuousTask() return true; } +// LCOV_EXCL_START void BundleActiveService::OnStop() { #ifdef DEVICE_USAGES_STATISTICS_POWERMANGER_ENABLE @@ -247,6 +248,7 @@ void BundleActiveService::OnStop() BUNDLE_ACTIVE_LOGI("[Server] OnStop"); ready_ = false; } +// LCOV_EXCL_STOP ErrCode BundleActiveService::ReportEvent(const BundleActiveEvent& event, int32_t userId) { @@ -803,6 +805,7 @@ void BundleActiveService::QueryModuleRecordInfos(BundleActiveModuleRecord& modul BUNDLE_ACTIVE_LOGE("GetApplicationInfo failed!"); return; } +// LCOV_EXCL_START BundleInfo bundleInfo; getInfoIsSuccess = BundleActiveBundleMgrHelper::GetInstance()->GetBundleInfo(moduleRecord.bundleName_, BundleFlag::GET_BUNDLE_WITH_EXTENSION_INFO, bundleInfo, moduleRecord.userId_); @@ -824,6 +827,7 @@ void BundleActiveService::QueryModuleRecordInfos(BundleActiveModuleRecord& modul } } } +// LCOV_EXCL_STOP } void BundleActiveService::SerModuleProperties(const HapModuleInfo& hapModuleInfo, @@ -918,6 +922,7 @@ int32_t BundleActiveService::DumpEvents(const std::vector &dumpOpti if (static_cast(dumpOption.size()) != EVENTS_PARAM) { return ret; } +// LCOV_EXCL_START int64_t beginTime = BundleActiveUtil::StringToInt64(dumpOption[2]); int64_t endTime = BundleActiveUtil::StringToInt64(dumpOption[3]); int32_t userId = BundleActiveUtil::StringToInt32(dumpOption[4]); @@ -926,6 +931,7 @@ int32_t BundleActiveService::DumpEvents(const std::vector &dumpOpti dumpInfo.emplace_back(oneEvent.ToString()); } return ret; +// LCOV_EXCL_STOP } int32_t BundleActiveService::DumpPackageUsage(const std::vector &dumpOption, @@ -945,9 +951,11 @@ int32_t BundleActiveService::DumpPackageUsage(const std::vector &du bundleActiveCore_->QueryBundleStatsInfos( tempPackageUsage, userId, intervalType, beginTime, endTime, ""); auto packageUsageResult = MergePackageStats(tempPackageUsage); +// LCOV_EXCL_START for (auto& onePackageRecord : packageUsageResult) { dumpInfo.emplace_back(onePackageRecord.ToString()); } +// LCOV_EXCL_STOP return ret; } @@ -959,6 +967,7 @@ int32_t BundleActiveService::DumpModuleUsage(const std::vector &dum if (static_cast(dumpOption.size()) != MODULE_USAGE_PARAM) { return ret; } +// LCOV_EXCL_START int32_t maxNum = BundleActiveUtil::StringToInt32(dumpOption[2]); int32_t userId = BundleActiveUtil::StringToInt32(dumpOption[3]); BUNDLE_ACTIVE_LOGI("M is %{public}d, u is %{public}d", maxNum, userId); @@ -974,6 +983,7 @@ int32_t BundleActiveService::DumpModuleUsage(const std::vector &dum } } return ret; +// LCOV_EXCL_STOP } int32_t BundleActiveService::DumpHighFreqHourUsage(const std::vector& dumpOption, @@ -983,6 +993,7 @@ int32_t BundleActiveService::DumpHighFreqHourUsage(const std::vector(dumpOption.size()) != HIGH_FREQUENCY_HOUR_USAGE_PARAM) { return ret; } +// LCOV_EXCL_START int32_t userId = BundleActiveUtil::StringToInt64(dumpOption[2]); std::vector appFreqHours; ret = bundleActiveCore_->QueryHighFrequencyPeriodBundle(appFreqHours, userId); @@ -991,6 +1002,7 @@ int32_t BundleActiveService::DumpHighFreqHourUsage(const std::vector