diff --git a/interfaces/kits/bundlestats/taihe/usage_statistics/idl/ohos.resourceschedule.usageStatistics.taihe b/interfaces/kits/bundlestats/taihe/usage_statistics/idl/ohos.resourceschedule.usageStatistics.taihe index 43f8e697e6d9aadd759b5c05f975c53c83b79870..1ad95b96e99b1d1e54e84eabc0c2c12d72f770a3 100644 --- a/interfaces/kits/bundlestats/taihe/usage_statistics/idl/ohos.resourceschedule.usageStatistics.taihe +++ b/interfaces/kits/bundlestats/taihe/usage_statistics/idl/ohos.resourceschedule.usageStatistics.taihe @@ -20,24 +20,24 @@ enum IntervalType: i32 {BY_OPTIMIZED = 0, BY_DAILY = 1, BY_WEEKLY = 2, BY_MONTHL enum GroupType: i32 {ALIVE_GROUP = 10, DAILY_GROUP = 20, FIXED_GROUP = 30, RARE_GROUP = 40, LIMITED_GROUP = 50, NEVER_GROUP = 60} struct BundleStatsInfo { - id: f64; - abilityInFgTotalTime: Optional; - abilityPrevAccessTime: Optional; - abilityPrevSeenTime: Optional; - abilitySeenTotalTime: Optional; + id: i32; + abilityInFgTotalTime: Optional; + abilityPrevAccessTime: Optional; + abilityPrevSeenTime: Optional; + abilitySeenTotalTime: Optional; bundleName: Optional; - fgAbilityAccessTotalTime: Optional; - fgAbilityPrevAccessTime: Optional; - infosBeginTime: Optional; - infosEndTime: Optional; - appIndex: Optional; + fgAbilityAccessTotalTime: Optional; + fgAbilityPrevAccessTime: Optional; + infosBeginTime: Optional; + infosEndTime: Optional; + appIndex: Optional; } struct HapFormInfo { formName: String; - formDimension: f64; - formId: f64; - formLastUsedTime: f64; - count: f64; + formDimension: i32; + formId: i64; + formLastUsedTime: i64; + count: i32; } struct HapModuleInfo { @@ -45,37 +45,37 @@ struct HapModuleInfo { bundleName: String; moduleName: String; abilityName: Optional; - appLabelId: Optional; - labelId: Optional; - descriptionId: Optional; - abilityLableId: Optional; - abilityDescriptionId: Optional; - abilityIconId: Optional; - launchedCount: f64; - lastModuleUsedTime: f64; + appLabelId: Optional; + labelId: Optional; + descriptionId: Optional; + abilityLableId: Optional; + abilityDescriptionId: Optional; + abilityIconId: Optional; + launchedCount: i32; + lastModuleUsedTime: i64; formRecords: Array; } struct DeviceEventStats { name: String; - eventId: f64; - count: f64; + eventId: i32; + count: i32; } struct BundleEvents { - appGroup: Optional; + appGroup: Optional; bundleName: Optional; indexOfLink: Optional; nameOfClass: Optional; - eventOccurredTime: Optional; - eventId: Optional; + eventOccurredTime: Optional; + eventId: Optional; } struct AppGroupCallbackInfo { - appOldGroup: f64; - appNewGroup: f64; - userId: f64; - changeReason: f64; + appOldGroup: i32; + appNewGroup: i32; + userId: i32; + changeReason: i64; bundleName: String; } @@ -87,12 +87,12 @@ function IsIdleStateSync(bundleName: String): bool; @gen_async("queryAppGroup") @gen_promise("queryAppGroup") @overload("queryAppGroupSync") -function QueryAppGroupSync(): f64; +function QueryAppGroupSync(): i32; @gen_async("queryAppGroup") @gen_promise("queryAppGroup") @overload("queryAppGroupSync") -function QueryAppGroupSyncByBundleName(bundleName: String): f64; +function QueryAppGroupSyncByBundleName(bundleName: String): i32; @gen_async("setAppGroup") @gen_promise("setAppGroup") @@ -100,35 +100,35 @@ function SetAppGroupSync(bundleName: String, newGroup: GroupType): void; @gen_async("queryBundleStatsInfos") @gen_promise("queryBundleStatsInfos") -function QueryBundleStatsInfosAsync(beginTime: f64, endTime: f64): @record Map; +function QueryBundleStatsInfosAsync(beginTime: i64, endTime: i64): @record Map; @gen_async("queryAppStatsInfos") @gen_promise("queryAppStatsInfos") -function QueryAppStatsInfosAsync(beginTime: f64, endTime: f64): @record Map>; +function QueryAppStatsInfosAsync(beginTime: i64, endTime: i64): @record Map>; @gen_async("queryLastUseTime") @gen_promise("queryLastUseTime") -function QueryLastUseTimeAsync(appInfos: @record Map>): @record Map>; +function QueryLastUseTimeAsync(appInfos: @record Map>): @record Map>; @gen_async("queryBundleStatsInfoByInterval") @gen_promise("queryBundleStatsInfoByInterval") -function QueryBundleStatsInfoByIntervalAsync(byInterval: IntervalType, beginTime: f64, endTime: f64): Array; +function QueryBundleStatsInfoByIntervalAsync(byInterval: IntervalType, beginTime: i64, endTime: i64): Array; @gen_async("queryBundleEvents") @gen_promise("queryBundleEvents") -function QueryBundleEventsAsync(beginTime: f64, endTime: f64): Array; +function QueryBundleEventsAsync(beginTime: i64, endTime: i64): Array; @gen_async("queryCurrentBundleEvents") @gen_promise("queryCurrentBundleEvents") -function QueryCurrentBundleEventsAsync(beginTime: f64, endTime: f64): Array; +function QueryCurrentBundleEventsAsync(beginTime: i64, endTime: i64): Array; @gen_async("queryDeviceEventStats") @gen_promise("queryDeviceEventStats") -function QueryDeviceEventStatsAsync(beginTime: f64, endTime: f64): Array; +function QueryDeviceEventStatsAsync(beginTime: i64, endTime: i64): Array; @gen_async("queryNotificationEventStats") @gen_promise("queryNotificationEventStats") -function QueryNotificationEventStatsAsync(beginTime: f64, endTime: f64): Array; +function QueryNotificationEventStatsAsync(beginTime: i64, endTime: i64): Array; @gen_async("queryModuleUsageRecords") @gen_promise("queryModuleUsageRecords") @@ -138,7 +138,7 @@ function QueryModuleUsageRecordsAsync(): Array; @gen_async("queryModuleUsageRecords") @gen_promise("queryModuleUsageRecords") @overload("queryModuleUsageRecordsAsync") -function QueryModuleUsageRecordsAsyncByMaxNum(maxNum: f64): Array; +function QueryModuleUsageRecordsAsyncByMaxNum(maxNum: i32): Array; @gen_async("registerAppGroupCallBack") @gen_promise("registerAppGroupCallBack") diff --git a/interfaces/kits/bundlestats/taihe/usage_statistics/include/bundle_state_idl_common.h b/interfaces/kits/bundlestats/taihe/usage_statistics/include/bundle_state_idl_common.h index 1e746cc002863896c9f861cc89057f692bf6ecd2..38a280cdd6c423ab8029a508aaafe7bbc6bff584 100644 --- a/interfaces/kits/bundlestats/taihe/usage_statistics/include/bundle_state_idl_common.h +++ b/interfaces/kits/bundlestats/taihe/usage_statistics/include/bundle_state_idl_common.h @@ -33,7 +33,7 @@ public: static void ParseBundleEvents(const BundleActiveEvent& bundleActiveEvent, ::ohos::resourceschedule::usageStatistics::BundleEvents& bundleEvent); static void MergePackageStats(BundleActivePackageStats& left, const BundleActivePackageStats& right); - static void ParseQueryInfosMap(const taihe::map>& appInfos, + static void ParseQueryInfosMap(const taihe::map>& appInfos, std::map>& queryInfos); static taihe::array<::ohos::resourceschedule::usageStatistics::HapFormInfo> ParseformRecords( const std::vector& formRecords); diff --git a/interfaces/kits/bundlestats/taihe/usage_statistics/src/bundle_state_idl_common.cpp b/interfaces/kits/bundlestats/taihe/usage_statistics/src/bundle_state_idl_common.cpp index ba675edb2f3a0616e47672f07e71e08b837eed0a..7e58a69508dde3a1af3c90e897319b07e56920f6 100644 --- a/interfaces/kits/bundlestats/taihe/usage_statistics/src/bundle_state_idl_common.cpp +++ b/interfaces/kits/bundlestats/taihe/usage_statistics/src/bundle_state_idl_common.cpp @@ -58,11 +58,11 @@ void BundleStateIDLCommon::ParseBundleStatsInfo(const BundleActivePackageStats& bundleStatsInfo.bundleName = taihe::optional(std::in_place, taihe::string(bundleActivePackageStats.bundleName_)); bundleStatsInfo.abilityPrevAccessTime = - taihe::optional(std::in_place, bundleActivePackageStats.lastTimeUsed_); + taihe::optional(std::in_place, bundleActivePackageStats.lastTimeUsed_); bundleStatsInfo.abilityInFgTotalTime = - taihe::optional(std::in_place, bundleActivePackageStats.totalInFrontTime_); + taihe::optional(std::in_place, bundleActivePackageStats.totalInFrontTime_); bundleStatsInfo.appIndex = - taihe::optional(std::in_place, bundleActivePackageStats.appIndex_); + taihe::optional(std::in_place, bundleActivePackageStats.appIndex_); } void BundleStateIDLCommon::ParseBundleEvents(const BundleActiveEvent& bundleActiveEvent, @@ -71,9 +71,9 @@ void BundleStateIDLCommon::ParseBundleEvents(const BundleActiveEvent& bundleActi bundleEvent.bundleName = taihe::optional(std::in_place, taihe::string(bundleActiveEvent.bundleName_)); bundleEvent.eventId = - taihe::optional(std::in_place, bundleActiveEvent.eventId_); + taihe::optional(std::in_place, bundleActiveEvent.eventId_); bundleEvent.eventOccurredTime = - taihe::optional(std::in_place, bundleActiveEvent.timeStamp_); + taihe::optional(std::in_place, bundleActiveEvent.timeStamp_); } void BundleStateIDLCommon::MergePackageStats(BundleActivePackageStats& left, const BundleActivePackageStats& right) @@ -90,13 +90,13 @@ void BundleStateIDLCommon::MergePackageStats(BundleActivePackageStats& left, con left.bundleStartedCount_ += right.bundleStartedCount_; } -void BundleStateIDLCommon::ParseQueryInfosMap(const taihe::map>& appInfos, +void BundleStateIDLCommon::ParseQueryInfosMap(const taihe::map>& appInfos, std::map>& queryInfos) { for (const auto& iter : appInfos) { std::vector appIndexVector; - for (double appIndex : iter.second) { - appIndexVector.push_back(static_cast(appIndex)); + for (int64_t appIndex : iter.second) { + appIndexVector.push_back(appIndex); } queryInfos.emplace(std::string(iter.first.c_str()), appIndexVector); } @@ -108,10 +108,10 @@ array BundleStateIDLCommon::ParseformRecords(const std::vector(formRecord.formDimension_), - .formId = static_cast(formRecord.formId_), - .formLastUsedTime = static_cast(formRecord.formLastUsedTime_), - .count = static_cast(formRecord.count_), + .formDimension = formRecord.formDimension_, + .formId = formRecord.formId_, + .formLastUsedTime = formRecord.formLastUsedTime_, + .count = formRecord.count_, }; HapFormInfoVector.push_back(HapFormInfo); } diff --git a/interfaces/kits/bundlestats/taihe/usage_statistics/src/ohos.resourceschedule.usageStatistics.impl.cpp b/interfaces/kits/bundlestats/taihe/usage_statistics/src/ohos.resourceschedule.usageStatistics.impl.cpp index 5a31c8f3755614852333300b1a3b2ac46e531d83..e4cce1b95d0255db56f7c4a8d649b99c7f29903e 100644 --- a/interfaces/kits/bundlestats/taihe/usage_statistics/src/ohos.resourceschedule.usageStatistics.impl.cpp +++ b/interfaces/kits/bundlestats/taihe/usage_statistics/src/ohos.resourceschedule.usageStatistics.impl.cpp @@ -116,16 +116,16 @@ bool IsIdleStateSync(string bundleName) return isBundleIdle; } -double QueryAppGroupSync() +int32_t QueryAppGroupSync() { int32_t appGroup = 0; std::string bundleName = ""; int32_t errCode = BundleActiveClient::GetInstance().QueryAppGroup(appGroup, bundleName); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); - return static_cast(DeviceUsageStats::GroupType::NEVER_GROUP); + return DeviceUsageStats::GroupType::NEVER_GROUP; } - return static_cast(appGroup); + return appGroup; } int32_t QueryAppGroupSyncByBundleName(string bundleName) @@ -134,34 +134,31 @@ int32_t QueryAppGroupSyncByBundleName(string bundleName) int32_t errCode = BundleActiveClient::GetInstance().QueryAppGroup(appGroup, std::string(bundleName.c_str())); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); - return static_cast(DeviceUsageStats::GroupType::NEVER_GROUP); + return DeviceUsageStats::GroupType::NEVER_GROUP; } - return static_cast(appGroup); + return appGroup; } -void SetAppGroupSync(string bundleName, double newGroup) +void SetAppGroupSync(string bundleName, int32_t newGroup) { - int32_t intNewGroup = static_cast(newGroup); - if (!CheckNewGroupType(intNewGroup)) { + if (!CheckNewGroupType(newGroup)) { return; } - int32_t errCode = BundleActiveClient::GetInstance().SetAppGroup(std::string(bundleName.c_str()), intNewGroup); + int32_t errCode = BundleActiveClient::GetInstance().SetAppGroup(std::string(bundleName.c_str()), newGroup); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); return; } } -map QueryBundleStatsInfosAsync(double beginTime, double endTime) +map QueryBundleStatsInfosAsync(int64_t beginTime, int64_t endTime) { - int64_t intBeginTime = static_cast(beginTime); - int64_t intEndTime = static_cast(endTime); map bundleStatsInfoMap; - if (!CheckBeginTimeAndEndTime(intBeginTime, intEndTime)) { + if (!CheckBeginTimeAndEndTime(beginTime, endTime)) { return bundleStatsInfoMap; } int32_t errCode = 0; - auto packageStatsMap = BundleStateIDLCommon::QueryBundleStatsInfos(intBeginTime, intEndTime, errCode); + auto packageStatsMap = BundleStateIDLCommon::QueryBundleStatsInfos(beginTime, endTime, errCode); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); return bundleStatsInfoMap; @@ -182,17 +179,15 @@ map QueryBundleStatsInfosAsync(double beginTime, double return bundleStatsInfoMap; } -map> QueryAppStatsInfosAsync(double beginTime, double endTime) +map> QueryAppStatsInfosAsync(int64_t beginTime, int64_t endTime) { - int64_t intBeginTime = static_cast(beginTime); - int64_t intEndTime = static_cast(endTime); map> appStatsInfosMap; - if (!CheckBeginTimeAndEndTime(intBeginTime, intEndTime)) { + if (!CheckBeginTimeAndEndTime(beginTime, endTime)) { return appStatsInfosMap; } int32_t errCode = 0; std::shared_ptr>> appStatsMap = nullptr; - appStatsMap = BundleStateIDLCommon::QueryAppStatsInfos(intBeginTime, intEndTime, errCode); + appStatsMap = BundleStateIDLCommon::QueryAppStatsInfos(beginTime, endTime, errCode); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); return appStatsInfosMap; @@ -206,7 +201,7 @@ map> QueryAppStatsInfosAsync(double beginTime, do std::vector packageStatsVector; for (auto packageStats: iter.second) { BundleStatsInfo bundleStatsInfo { - .id = static_cast(packageStats.userId_), + .id = packageStats.userId_, }; BundleStateIDLCommon::ParseBundleStatsInfo(packageStats, bundleStatsInfo); packageStatsVector.push_back(bundleStatsInfo); @@ -217,7 +212,7 @@ map> QueryAppStatsInfosAsync(double beginTime, do return appStatsInfosMap; } -map> QueryLastUseTimeAsync(map> appInfos) +map> QueryLastUseTimeAsync(map> appInfos) { map> appStatsInfosMap; std::map> queryInfos; @@ -238,7 +233,7 @@ map> QueryLastUseTimeAsync(map packageStatsVector; for (auto packageStats: iter.second) { BundleStatsInfo bundleStatsInfo { - .id = static_cast(packageStats.userId_), + .id = packageStats.userId_, }; BundleStateIDLCommon::ParseBundleStatsInfo(packageStats, bundleStatsInfo); packageStatsVector.push_back(bundleStatsInfo); @@ -250,21 +245,18 @@ map> QueryLastUseTimeAsync(map QueryBundleStatsInfoByIntervalAsync( - ::ohos::resourceschedule::usageStatistics::IntervalType byInterval, double beginTime, double endTime) + ::ohos::resourceschedule::usageStatistics::IntervalType byInterval, int64_t beginTime, int64_t endTime) { - int64_t intBeginTime = static_cast(beginTime); - int64_t intEndTime = static_cast(endTime); std::vector bundleStatsInfoVector; - if (!CheckBeginTimeAndEndTime(intBeginTime, intEndTime)) { + if (!CheckBeginTimeAndEndTime(beginTime, endTime)) { return array(bundleStatsInfoVector); } - int32_t interval = static_cast(byInterval); - if (!CheckInterval(interval)) { + if (!CheckInterval(byInterval)) { return array(bundleStatsInfoVector); } std::vector bundleActivePackageStats; int32_t errCode = BundleActiveClient::GetInstance().QueryBundleStatsInfoByInterval(bundleActivePackageStats, - interval, intBeginTime, intEndTime); + byInterval, beginTime, endTime); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); return array(bundleStatsInfoVector); @@ -279,17 +271,15 @@ array QueryBundleStatsInfoByIntervalAsync( return array(bundleStatsInfoVector); } -array QueryBundleEventsAsync(double beginTime, double endTime) +array QueryBundleEventsAsync(int64_t beginTime, int64_t endTime) { - int64_t intBeginTime = static_cast(beginTime); - int64_t intEndTime = static_cast(endTime); std::vector bundleEventVector; - if (!CheckBeginTimeAndEndTime(intBeginTime, intEndTime)) { + if (!CheckBeginTimeAndEndTime(beginTime, endTime)) { return array(bundleEventVector); } std::vector bundleActiveEvents; int32_t errCode = BundleActiveClient::GetInstance().QueryBundleEvents(bundleActiveEvents, - intBeginTime, intEndTime); + beginTime, endTime); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); return array(bundleEventVector); @@ -302,17 +292,15 @@ array QueryBundleEventsAsync(double beginTime, double endTime) return array(bundleEventVector); } -array QueryCurrentBundleEventsAsync(double beginTime, double endTime) +array QueryCurrentBundleEventsAsync(int64_t beginTime, int64_t endTime) { - int64_t intBeginTime = static_cast(beginTime); - int64_t intEndTime = static_cast(endTime); std::vector bundleEventVector; - if (!CheckBeginTimeAndEndTime(intBeginTime, intEndTime)) { + if (!CheckBeginTimeAndEndTime(beginTime, endTime)) { return array(bundleEventVector); } std::vector bundleActiveEvents; int32_t errCode = BundleActiveClient::GetInstance().QueryCurrentBundleEvents(bundleActiveEvents, - intBeginTime, intEndTime); + beginTime, endTime); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); return array(bundleEventVector); @@ -325,16 +313,14 @@ array QueryCurrentBundleEventsAsync(double beginTime, double endTi return array(bundleEventVector); } -array QueryDeviceEventStatsAsync(double beginTime, double endTime) +array QueryDeviceEventStatsAsync(int64_t beginTime, int64_t endTime) { - int64_t intBeginTime = static_cast(beginTime); - int64_t intEndTime = static_cast(endTime); std::vector deviceEventStatsVector; - if (!CheckBeginTimeAndEndTime(intBeginTime, intEndTime)) { + if (!CheckBeginTimeAndEndTime(beginTime, endTime)) { return array(deviceEventStatsVector); } std::vector bundleActiveEventStatsVector; - int32_t errCode = BundleActiveClient::GetInstance().QueryDeviceEventStats(intBeginTime, intEndTime, + int32_t errCode = BundleActiveClient::GetInstance().QueryDeviceEventStats(beginTime, endTime, bundleActiveEventStatsVector); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); @@ -343,25 +329,23 @@ array QueryDeviceEventStatsAsync(double beginTime, double endT for (auto &bundleActiveEventStats: bundleActiveEventStatsVector) { DeviceEventStats deviceEventStats { .name = bundleActiveEventStats.name_, - .eventId = static_cast(bundleActiveEventStats.eventId_), - .count = static_cast(bundleActiveEventStats.count_), + .eventId = bundleActiveEventStats.eventId_, + .count = bundleActiveEventStats.count_, }; deviceEventStatsVector.push_back(deviceEventStats); } return array(deviceEventStatsVector); } -array QueryNotificationEventStatsAsync(double beginTime, double endTime) +array QueryNotificationEventStatsAsync(int64_t beginTime, int64_t endTime) { - int64_t intBeginTime = static_cast(beginTime); - int64_t intEndTime = static_cast(endTime); std::vector deviceEventStatsVector; - if (!CheckBeginTimeAndEndTime(intBeginTime, intEndTime)) { + if (!CheckBeginTimeAndEndTime(beginTime, endTime)) { return array(deviceEventStatsVector); } std::vector bundleActiveEventStatsVector; - int32_t errCode = BundleActiveClient::GetInstance().QueryNotificationEventStats(intBeginTime, intEndTime, + int32_t errCode = BundleActiveClient::GetInstance().QueryNotificationEventStats(beginTime, endTime, bundleActiveEventStatsVector); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); @@ -370,8 +354,8 @@ array QueryNotificationEventStatsAsync(double beginTime, doubl for (auto &bundleActiveEventStats: bundleActiveEventStatsVector) { DeviceEventStats deviceEventStats { .name = bundleActiveEventStats.name_, - .eventId = static_cast(bundleActiveEventStats.eventId_), - .count = static_cast(bundleActiveEventStats.count_), + .eventId = bundleActiveEventStats.eventId_, + .count = bundleActiveEventStats.count_, }; deviceEventStatsVector.push_back(deviceEventStats); } @@ -392,8 +376,8 @@ array QueryModuleUsageRecordsAsync() HapModuleInfo hapModuleInfo { .bundleName = moduleRecord.bundleName_, .moduleName = moduleRecord.moduleName_, - .launchedCount = static_cast(moduleRecord.launchedCount_), - .lastModuleUsedTime = static_cast(moduleRecord.lastModuleUsedTime_), + .launchedCount = moduleRecord.launchedCount_, + .lastModuleUsedTime = moduleRecord.lastModuleUsedTime_, .formRecords = hapFromInfos, }; hapModuleInfos.emplace_back(hapModuleInfo); @@ -401,15 +385,14 @@ array QueryModuleUsageRecordsAsync() return array(hapModuleInfos); } -array QueryModuleUsageRecordsAsyncByMaxNum(double maxNum) +array QueryModuleUsageRecordsAsyncByMaxNum(int32_t maxNum) { - int32_t intMaxNum = static_cast(maxNum); std::vector hapModuleInfos; - if (!CheckMaxNum(intMaxNum)) { + if (!CheckMaxNum(maxNum)) { return array(hapModuleInfos); } std::vector moduleRecords; - int32_t errCode = BundleActiveClient::GetInstance().QueryModuleUsageRecords(intMaxNum, moduleRecords); + int32_t errCode = BundleActiveClient::GetInstance().QueryModuleUsageRecords(maxNum, moduleRecords); if (errCode != ERR_OK) { set_business_error(errCode, BundleStateIDLErrCode::GetErrorCode(errCode)); return array(hapModuleInfos); @@ -419,8 +402,8 @@ array QueryModuleUsageRecordsAsyncByMaxNum(double maxNum) HapModuleInfo hapModuleInfo { .bundleName = moduleRecord.bundleName_, .moduleName = moduleRecord.moduleName_, - .launchedCount = static_cast(moduleRecord.launchedCount_), - .lastModuleUsedTime = static_cast(moduleRecord.lastModuleUsedTime_), + .launchedCount = moduleRecord.launchedCount_, + .lastModuleUsedTime = moduleRecord.lastModuleUsedTime_, .formRecords = hapFromInfos, }; hapModuleInfos.emplace_back(hapModuleInfo); @@ -432,10 +415,10 @@ ErrCode GroupChangeObserver::OnAppGroupChanged(const DeviceUsageStats::AppGroupC { std::lock_guard autoLock(GroupChangeObserver::callbackMutex_); ohos::resourceschedule::usageStatistics::AppGroupCallbackInfo innerGroupInfo { - .appOldGroup = static_cast(appGroupCallbackInfo.GetOldGroup()), - .appNewGroup = static_cast(appGroupCallbackInfo.GetNewGroup()), - .userId = static_cast(appGroupCallbackInfo.GetUserId()), - .changeReason = static_cast(appGroupCallbackInfo.GetChangeReason()), + .appOldGroup = appGroupCallbackInfo.GetOldGroup(), + .appNewGroup = appGroupCallbackInfo.GetNewGroup(), + .userId = appGroupCallbackInfo.GetUserId(), + .changeReason = static_cast(appGroupCallbackInfo.GetChangeReason()), .bundleName = appGroupCallbackInfo.GetBundleName(), }; if (innerCallback_ != nullptr) {