diff --git a/interfaces/innerkits/src/bundle_active_proxy.cpp b/interfaces/innerkits/src/bundle_active_proxy.cpp index 068794f08f8d3a55148f756c3c173d4647faba60..d441f4ff74024cb487bf0b3109ed999b41971223 100644 --- a/interfaces/innerkits/src/bundle_active_proxy.cpp +++ b/interfaces/innerkits/src/bundle_active_proxy.cpp @@ -25,9 +25,6 @@ int BundleActiveProxy::ReportEvent(std::string& bundleName, std::string& ability MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(GetDescriptor())) { - return -1; - } data.WriteString(bundleName); data.WriteString(abilityName); data.WriteString(abilityId); @@ -45,9 +42,6 @@ bool BundleActiveProxy::IsBundleIdle(const std::string& bundleName) MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(GetDescriptor())) { - return false; - } data.WriteString(bundleName); Remote() -> SendRequest(IS_BUNDLE_IDLE, data, reply, option); int32_t result = reply.ReadInt32(); @@ -61,15 +55,12 @@ std::vector BundleActiveProxy::QueryPackageStats(const MessageParcel data; MessageParcel reply; MessageOption option; - std::vector result; - if (!data.WriteInterfaceToken(GetDescriptor())) { - return result; - } data.WriteInt32(intervalType); data.WriteInt64(beginTime); data.WriteInt64(endTime); Remote() -> SendRequest(QUERY_USAGE_STATS, data, reply, option); int32_t size = reply.ReadInt32(); + std::vector result; std::shared_ptr tmp; for (int i = 0; i < size; i++) { tmp = tmp->Unmarshalling(reply); @@ -93,14 +84,11 @@ std::vector BundleActiveProxy::QueryEvents(const int64_t begi MessageParcel data; MessageParcel reply; MessageOption option; - std::vector result; - if (!data.WriteInterfaceToken(GetDescriptor())) { - return result; - } data.WriteInt64(beginTime); data.WriteInt64(endTime); Remote() -> SendRequest(QUERY_EVENTS, data, reply, option); int32_t size = reply.ReadInt32(); + std::vector result; std::shared_ptr tmp; for (int i = 0; i < size; i++) { tmp = tmp->Unmarshalling(reply); @@ -121,9 +109,6 @@ void BundleActiveProxy::SetBundleGroup(const std::string& bundleName, int newGro MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(GetDescriptor())) { - return; - } data.WriteString(bundleName); data.WriteInt32(newGroup); data.WriteInt32(userId); @@ -136,15 +121,12 @@ std::vector BundleActiveProxy::QueryCurrentPackageStat MessageParcel data; MessageParcel reply; MessageOption option; - std::vector result; - if (!data.WriteInterfaceToken(GetDescriptor())) { - return result; - } data.WriteInt32(intervalType); data.WriteInt64(beginTime); data.WriteInt64(endTime); Remote() -> SendRequest(QUERY_CURRENT_USAGE_STATS, data, reply, option); int32_t size = reply.ReadInt32(); + std::vector result; std::shared_ptr tmp; for (int i = 0; i < size; i++) { tmp = tmp->Unmarshalling(reply); @@ -168,14 +150,11 @@ std::vector BundleActiveProxy::QueryCurrentEvents(const int64 MessageParcel data; MessageParcel reply; MessageOption option; - std::vector result; - if (!data.WriteInterfaceToken(GetDescriptor())) { - return result; - } data.WriteInt64(beginTime); data.WriteInt64(endTime); Remote() -> SendRequest(QUERY_CURRENT_EVENTS, data, reply, option); int32_t size = reply.ReadInt32(); + std::vector result; std::shared_ptr tmp; for (int i = 0; i < size; i++) { tmp = tmp->Unmarshalling(reply); @@ -196,9 +175,6 @@ int BundleActiveProxy::QueryPackageGroup() MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(GetDescriptor())) { - return -1; - } Remote() -> SendRequest(QUERY_BUNDLE_GROUP, data, reply, option); int32_t packageGroup = reply.ReadInt32(); BUNDLE_ACTIVE_LOGI("BundleActiveProxy::QueryPackageGroup result is %{public}d", packageGroup); diff --git a/services/common/include/bundle_active_log.h b/services/common/include/bundle_active_log.h index d2056ed9be501c14e76f70e5a8a272eb00499274..3a24733e5bdcb7d4b3e7a591a94caeb327f7a355 100644 --- a/services/common/include/bundle_active_log.h +++ b/services/common/include/bundle_active_log.h @@ -19,7 +19,7 @@ #include "hilog/log.h" #define LOG_TAG_BUNDLE_ACTIVE "BUNDLE_ACTIVE" -#define LOG_TAG_DOMAIN_ID_BUNDLE_ACTIVE 0xD001700 +#define LOG_TAG_DOMAIN_ID_BUNDLE_ACTIVE 0xD001701 static constexpr OHOS::HiviewDFX::HiLogLabel BUNDLE_ACTIVE_LOG_LABEL = { LOG_CORE, diff --git a/services/common/include/bundle_active_service.h b/services/common/include/bundle_active_service.h index 3b5ee1ba6b9e8ecd56cdccc348a2287cd1f0742f..c0ec21705dda6664982e55965135d2de37b46d7f 100644 --- a/services/common/include/bundle_active_service.h +++ b/services/common/include/bundle_active_service.h @@ -54,8 +54,6 @@ public: protected: void OnStart() override; void OnStop() override; - void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; - void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; private: std::shared_ptr bundleActiveCore_; @@ -64,7 +62,10 @@ private: std::shared_ptr continuousTaskObserver_; sptr sptrBundleMgr_; sptr shutdownCallback_; + std::shared_ptr runner_; + std::shared_ptr handler_; int ConvertIntervalType(const int intervalType); + void InitNecessaryState(); bool GetBundleMgrProxy(); bool CheckBundleIsSystemAppAndHasPermission(const int uid, const int userId); void InitAppStateSubscriber(const std::shared_ptr& reportHandler); diff --git a/services/common/src/bundle_active_app_state_obsever.cpp b/services/common/src/bundle_active_app_state_obsever.cpp index 2e458c1333a8d1a84876bb314852fffabee1db70..cf613c603e7959b4bb3655f184412fa940b4ea1b 100644 --- a/services/common/src/bundle_active_app_state_obsever.cpp +++ b/services/common/src/bundle_active_app_state_obsever.cpp @@ -48,7 +48,7 @@ void BundleActiveAppStateObserver::OnAbilityStateChanged(const AbilityStateData tmpHandlerObject.event_.bundleName_ = abilityStateData.bundleName; tmpHandlerObject.event_.abilityName_ = abilityStateData.abilityName; tmpHandlerObject.event_.abilityId_ = abilityStateData.abilityName; - tmpHandlerObject.event_.ContinuousTaskAbilityName_ = ""; + tmpHandlerObject.event_.continuousTaskAbilityName_ = ""; tmpHandlerObject.userId_ = userId; sptr timer = MiscServices::TimeServiceClient::GetInstance(); tmpHandlerObject.event_.timeStamp_ = timer->GetBootTimeMs(); diff --git a/services/common/src/bundle_active_continuous_task_observer.cpp b/services/common/src/bundle_active_continuous_task_observer.cpp index 4db0837bcf76ce3b3a0d445ef7c3842a538c3633..459524f71a7aebecae2d4bbb9c9a7902f4dfdc28 100644 --- a/services/common/src/bundle_active_continuous_task_observer.cpp +++ b/services/common/src/bundle_active_continuous_task_observer.cpp @@ -92,7 +92,7 @@ void BundleActiveContinuousTaskObserver::ReportContinuousTaskEvent( tmpHandlerObject.event_.bundleName_ = bundleName; tmpHandlerObject.event_.abilityName_ = ""; tmpHandlerObject.event_.abilityId_ = abilityId; - tmpHandlerObject.event_.ContinuousTaskAbilityName_ = abiliytName; + tmpHandlerObject.event_.continuousTaskAbilityName_ = abiliytName; tmpHandlerObject.userId_ = userId; sptr timer = MiscServices::TimeServiceClient::GetInstance(); tmpHandlerObject.event_.timeStamp_ = timer->GetBootTimeMs(); diff --git a/services/common/src/bundle_active_core.cpp b/services/common/src/bundle_active_core.cpp index d0f7505562f576f7f9295b473152ce3513ac47bc..5f09345ebfd4174517bbd07d0b47d6d3450f5fe7 100644 --- a/services/common/src/bundle_active_core.cpp +++ b/services/common/src/bundle_active_core.cpp @@ -31,6 +31,7 @@ BundleActiveReportHandlerObject::BundleActiveReportHandlerObject(const BundleAct 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_; } @@ -195,6 +196,7 @@ void BundleActiveCore::OnBundleUninstalled(const int userId, const std::string& return; } service->DeleteUninstalledBundleStats(bundleName); + bundleGroupController_->OnBundleUninstalled(userId, bundleName); } void BundleActiveCore::OnStatsChanged() diff --git a/services/common/src/bundle_active_service.cpp b/services/common/src/bundle_active_service.cpp index 9d7728a5485a1916bfd195e5e482a6280c350b90..9b7bfd26662bbd3b9cbac0a797f3e3e7b34d34e5 100644 --- a/services/common/src/bundle_active_service.cpp +++ b/services/common/src/bundle_active_service.cpp @@ -28,6 +28,7 @@ namespace DeviceUsageStats { static const int PERIOD_BEST_JS = 0; static const int PERIOD_YEARLY_JS = 4; static const int PERIOD_BEST_SERVICE = 4; +static const int DELAY_TIME = 2000; REGISTER_SYSTEM_ABILITY_BY_ID(BundleActiveService, DEVICE_USAGE_STATISTICS_SYS_ABILITY_ID, true); using namespace OHOS::Security::AccessToken; using AccessTokenKit = OHOS::Security::AccessToken::AccessTokenKit; @@ -36,68 +37,77 @@ const std::string NEEDED_PERMISSION = "ohos.permission.BUNDLE_ACTIVE_INFO"; void BundleActiveService::OnStart() { BUNDLE_ACTIVE_LOGI("BundleActiveService::OnStart() called"); + runner_ = AppExecFwk::EventRunner::Create("device_usage_stats_init_handler"); + if (runner_ == nullptr) { + BUNDLE_ACTIVE_LOGI("BundleActiveService runner create failed!"); + return; + } + handler_ = std::make_shared(runner_); + if (handler_ == nullptr) { + BUNDLE_ACTIVE_LOGI("BundleActiveService handler create failed!"); + return; + } + + InitNecessaryState(); int ret = Publish(this); if (!ret) { BUNDLE_ACTIVE_LOGE("[Server] OnStart, Register SystemAbility[1907] FAIL."); return; } - AddSystemAbilityListener(POWER_MANAGER_SERVICE_ID); - AddSystemAbilityListener(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); - AddSystemAbilityListener(APP_MGR_SERVICE_ID); - AddSystemAbilityListener(BACKGROUND_TASK_MANAGER_SERVICE_ID); BUNDLE_ACTIVE_LOGI("[Server] OnStart, Register SystemAbility[1907] SUCCESS."); return; } -void BundleActiveService::OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) +void BundleActiveService::InitNecessaryState() { - BUNDLE_ACTIVE_LOGI("BundleActiveService::OnAddSystemAbility called, SAID is %{public}d", systemAbilityId); - if (systemAbilityId == POWER_MANAGER_SERVICE_ID) { - if (bundleActiveCore_ == nullptr) { - bundleActiveCore_ = std::make_shared(); - bundleActiveCore_->Init(); + sptr systemAbilityManager + = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (systemAbilityManager == nullptr + || systemAbilityManager->CheckSystemAbility(APP_MGR_SERVICE_ID) == nullptr + || systemAbilityManager->CheckSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID) == nullptr + || systemAbilityManager->CheckSystemAbility(POWER_MANAGER_SERVICE_ID) == nullptr + || systemAbilityManager->CheckSystemAbility(COMMON_EVENT_SERVICE_ID) == nullptr + || systemAbilityManager->CheckSystemAbility(BACKGROUND_TASK_MANAGER_SERVICE_ID) == nullptr + || systemAbilityManager->CheckSystemAbility(TIME_SERVICE_ID) == nullptr) { + BUNDLE_ACTIVE_LOGI("request system service is not ready yet!"); + auto task = [this]() { this->InitNecessaryState(); }; + handler_->PostTask(task, DELAY_TIME); + return; + } + + if (bundleActiveCore_ == nullptr) { + bundleActiveCore_ = std::make_shared(); + bundleActiveCore_->Init(); + } + if (reportHandler_ == nullptr) { + std::string threadName = "bundle_active_report_handler"; + auto runner = AppExecFwk::EventRunner::Create(threadName); + if (runner == nullptr) { + BUNDLE_ACTIVE_LOGE("report handler is null"); + return; } + reportHandler_ = std::make_shared(runner); if (reportHandler_ == nullptr) { - std::string threadName = "bundle_active_report_handler"; - auto runner = AppExecFwk::EventRunner::Create(threadName); - if (runner == nullptr) { - BUNDLE_ACTIVE_LOGE("report handler is null"); - return; - } - reportHandler_ = std::make_shared(runner); - if (reportHandler_ == nullptr) { - return; - } - reportHandler_->Init(bundleActiveCore_); - } - if (reportHandler_ != nullptr && bundleActiveCore_ != nullptr) { - BUNDLE_ACTIVE_LOGI("core and handler is not null"); - bundleActiveCore_->SetHandler(reportHandler_); - } else { return; } - shutdownCallback_ = new BundleActiveShutdownCallbackService(bundleActiveCore_); - auto& powerManagerClient = OHOS::PowerMgr::PowerMgrClient::GetInstance(); - powerManagerClient.RegisterShutdownCallback(shutdownCallback_); - InitAppStateSubscriber(reportHandler_); - InitContinuousSubscriber(reportHandler_); - } - if (systemAbilityId == APP_MGR_SERVICE_ID) { - if (reportHandler_ != nullptr) { - SubscribeAppState(); - } + reportHandler_->Init(bundleActiveCore_); } - if (systemAbilityId == BACKGROUND_TASK_MANAGER_SERVICE_ID) { - if (reportHandler_ != nullptr) { - SubscribeContinuousTask(); - } - } - if (systemAbilityId == BUNDLE_MGR_SERVICE_SYS_ABILITY_ID) { - bundleActiveCore_->InitBundleGroupController(); + if (reportHandler_ != nullptr && bundleActiveCore_ != nullptr) { + BUNDLE_ACTIVE_LOGI("core and handler is not null"); + bundleActiveCore_->SetHandler(reportHandler_); + } else { + return; } + shutdownCallback_ = new BundleActiveShutdownCallbackService(bundleActiveCore_); + auto& powerManagerClient = OHOS::PowerMgr::PowerMgrClient::GetInstance(); + powerManagerClient.RegisterShutdownCallback(shutdownCallback_); + InitAppStateSubscriber(reportHandler_); + InitContinuousSubscriber(reportHandler_); + bundleActiveCore_->InitBundleGroupController(); + SubscribeAppState(); + SubscribeContinuousTask(); } - OHOS::sptr BundleActiveService::GetAppManagerInstance() { OHOS::sptr systemAbilityManager = @@ -154,10 +164,6 @@ bool BundleActiveService::SubscribeContinuousTask() return true; } -void BundleActiveService::OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) -{ -} - void BundleActiveService::OnStop() { if (shutdownCallback_ != nullptr) { @@ -181,7 +187,7 @@ int BundleActiveService::ReportEvent(std::string& bundleName, std::string& abili tmpHandlerObject.event_.abilityName_ = abilityName; tmpHandlerObject.event_.abilityId_ = abilityId; tmpHandlerObject.event_.eventId_ = eventId; - tmpHandlerObject.event_.ContinuousTaskAbilityName_ = continuousTask; + tmpHandlerObject.event_.continuousTaskAbilityName_ = continuousTask; tmpHandlerObject.userId_ = userId; sptr timer = MiscServices::TimeServiceClient::GetInstance(); tmpHandlerObject.event_.timeStamp_ = timer->GetBootTimeMs(); @@ -204,8 +210,12 @@ bool BundleActiveService::IsBundleIdle(const std::string& bundleName) OHOS::ErrCode ret = OHOS::AccountSA::OsAccountManager::GetOsAccountLocalIdFromUid(callingUid, userId); if (ret == ERR_OK && userId != -1) { BUNDLE_ACTIVE_LOGI("BundleActiveService::IsBundleIdle user id is %{public}d", userId); - bool isSystemAppAndHasPermission = CheckBundleIsSystemAppAndHasPermission(callingUid, userId); - if (isSystemAppAndHasPermission == true) { + if (!GetBundleMgrProxy()) { + BUNDLE_ACTIVE_LOGE("Get bundle manager proxy failed!"); + return true; + } + bool bundleIsSystemApp = sptrBundleMgr_->CheckIsSystemAppByUid(callingUid); + if (bundleIsSystemApp == true) { result = bundleActiveCore_->IsBundleIdle(bundleName, userId); } } diff --git a/services/common/src/bundle_active_stub.cpp b/services/common/src/bundle_active_stub.cpp index 99beeea269752e3665563d37f46b87acfcf356ee..d254db2d8b9decd99ae5e4f7adce13b81a677e4d 100644 --- a/services/common/src/bundle_active_stub.cpp +++ b/services/common/src/bundle_active_stub.cpp @@ -22,9 +22,6 @@ namespace DeviceUsageStats { int32_t BundleActiveStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel &reply, MessageOption &option) { - if (data.ReadInterfaceToken() != GetDescriptor()) { - return -1; - } switch (code) { case REPORT_EVENT: { std::string bundleName = data.ReadString(); diff --git a/services/packagegroup/include/bundle_active_group_controller.h b/services/packagegroup/include/bundle_active_group_controller.h index a8a2ec16592c0863cde80e483bdd5b0f548814df..c0589b7218e011eefed595c774d53f8e83ba8ac6 100644 --- a/services/packagegroup/include/bundle_active_group_controller.h +++ b/services/packagegroup/include/bundle_active_group_controller.h @@ -73,6 +73,7 @@ public: void CheckIdleStatsOneTime(); void PeriodCheckBundleState(const int userId); void OnUserRemoved(const int userId); + void OnBundleUninstalled(const int userId, const std::string bundleName); void OnScreenChanged(const bool& isScreenOn, const int64_t bootFromTimeStamp); void SetBundleGroup(const std::string& bundleName, const int userId, int newGroup, int reason, const int64_t bootBasedTimeStamp, const bool& resetTimeout); diff --git a/services/packagegroup/include/bundle_active_group_handler.h b/services/packagegroup/include/bundle_active_group_handler.h index 2bf694bf78af9a76ccbfaa258e5dd3afa3284de8..cb9ec0ddfb1df08d979a49472428dba0b5ebefde 100644 --- a/services/packagegroup/include/bundle_active_group_handler.h +++ b/services/packagegroup/include/bundle_active_group_handler.h @@ -48,7 +48,7 @@ public: static const int MSG_CHECK_BUNDLE_STATE = 0; static const int MSG_ONE_TIME_CHECK_BUNDLE_STATE = 1; static const int MSG_CHECK_IDLE_STATE = 2; - static const int CHECK_IDLE_INTERVAL = THREE_HOUR; + static const int CHECK_IDLE_INTERVAL = TEN_MINUTE; private: std::shared_ptr bundleActiveGroupController_; diff --git a/services/packagegroup/src/bundle_active_group_controller.cpp b/services/packagegroup/src/bundle_active_group_controller.cpp index 9a4ed7cd29aa5f66bc6ae42c01a53acc0adc6ec6..ca79fead8deee27763ffbc680d3a25f559bdab55 100644 --- a/services/packagegroup/src/bundle_active_group_controller.cpp +++ b/services/packagegroup/src/bundle_active_group_controller.cpp @@ -60,6 +60,17 @@ void BundleActiveGroupController::SetHandlerAndCreateUserHistory( activeGroupHandler_ = groupHandler; } +void BundleActiveGroupController::OnBundleUninstalled(const int userId, const std::string bundleName) +{ + std::lock_guard lock(mutex_); + auto oneUserHistory = bundleUserHistory_->GetUserHistory(userId, false); + if (oneUserHistory == nullptr) { + return; + } + oneUserHistory->erase(bundleName); + bundleUserHistory_->WriteBundleUsage(userId); +} + bool BundleActiveGroupController::GetBundleMgrProxy() { if (!sptrBundleMgr_) { diff --git a/services/packageusage/include/bundle_active_event.h b/services/packageusage/include/bundle_active_event.h index e0d6a8fe1167dce0adaa5b17036df6e15cfc65aa..d4383847f81b245fb187f80c20657e8457648471 100644 --- a/services/packageusage/include/bundle_active_event.h +++ b/services/packageusage/include/bundle_active_event.h @@ -42,7 +42,7 @@ public: static const int NOTIFICATION_SEEN = 17; inline static const std::string DEVICE_EVENT_PACKAGE_NAME = "openharmony"; std::string bundleName_; - std::string ContinuousTaskAbilityName_; + std::string continuousTaskAbilityName_; std::string abilityName_; std::string abilityId_; int64_t timeStamp_; diff --git a/services/packageusage/src/bundle_active_package_stats.cpp b/services/packageusage/src/bundle_active_package_stats.cpp index b081c3db29acb27b5c53080885df26dc244b4620..01048a2b0e44e06a530a8a0b6ec9a09c42fec7f8 100644 --- a/services/packageusage/src/bundle_active_package_stats.cpp +++ b/services/packageusage/src/bundle_active_package_stats.cpp @@ -189,7 +189,7 @@ void BundleActivePackageStats::UpdateLongTimeTask(const std::string& longTimeTas switch (eventId) { case BundleActiveEvent::LONG_TIME_TASK_STARTTED: - if (AnyLongTimeTaskStarted()) { + if (!AnyLongTimeTaskStarted()) { lastContiniousTaskUsed_ = timeStamp; } longTimeTasks_[longTimeTaskName] = eventId; diff --git a/services/packageusage/src/bundle_active_period_stats.cpp b/services/packageusage/src/bundle_active_period_stats.cpp index a3eb4817474c5923ab7f8427a075e0bcbaac5381..e9f0b71438341d108b880aa82ee92f659dea36fc 100644 --- a/services/packageusage/src/bundle_active_period_stats.cpp +++ b/services/packageusage/src/bundle_active_period_stats.cpp @@ -47,7 +47,7 @@ BundleActiveEvent BundleActivePeriodStats::BuildEvent(std::string bundleName, st BundleActiveEvent newEvent; newEvent.bundleName_ = bundleName; if (!timeTaskName.empty()) { - newEvent.ContinuousTaskAbilityName_ = timeTaskName; + newEvent.continuousTaskAbilityName_ = timeTaskName; } return newEvent; } @@ -75,8 +75,8 @@ void BundleActivePeriodStats::Update(const std::string bundleName, const std::st void BundleActivePeriodStats::AddEvent(BundleActiveEvent event) { event.bundleName_ = GetCachedString(event.bundleName_); - if (!event.ContinuousTaskAbilityName_.empty()) { - event.ContinuousTaskAbilityName_ = GetCachedString(event.ContinuousTaskAbilityName_); + if (!event.continuousTaskAbilityName_.empty()) { + event.continuousTaskAbilityName_ = GetCachedString(event.continuousTaskAbilityName_); } events_.Insert(event); if (event.timeStamp_ > endTime_) { diff --git a/services/packageusage/src/bundle_active_user_service.cpp b/services/packageusage/src/bundle_active_user_service.cpp index 7e4efcf5c5c0e1aabce16ccab5ea1c8eb601f371..cdc163937ced6cc91e990018a7f2ce21eb1920db 100644 --- a/services/packageusage/src/bundle_active_user_service.cpp +++ b/services/packageusage/src/bundle_active_user_service.cpp @@ -123,7 +123,7 @@ void BundleActiveUserService::ReportEvent(const BundleActiveEvent& event) it->UpdateKeyguardHidden(event.timeStamp_); break; default: - it->Update(event.bundleName_, event.ContinuousTaskAbilityName_, event.timeStamp_, event.eventId_, + it->Update(event.bundleName_, event.continuousTaskAbilityName_, event.timeStamp_, event.eventId_, event.abilityId_); if (incrementBundleLaunch) { BUNDLE_ACTIVE_LOGI(" BundleActiveUserService::ReportEvent increase bundle started count"); @@ -150,7 +150,7 @@ void BundleActiveUserService::ReportForFlushAndShutdown(const BundleActiveEvent& RenewStatsInMemory(event.timeStamp_); } for (auto it : currentStats_) { - it->Update(event.bundleName_, event.ContinuousTaskAbilityName_, event.timeStamp_, event.eventId_, + it->Update(event.bundleName_, event.continuousTaskAbilityName_, event.timeStamp_, event.eventId_, event.abilityId_); } BUNDLE_ACTIVE_LOGI("BundleActiveUserService::ReportForFlushAndShutdown called notify"); @@ -257,7 +257,7 @@ void BundleActiveUserService::RenewStatsInMemory(const int64_t timeStamp) if (continueServices.find(continueBundleName) != continueServices.end()) { for (std::map::iterator it = continueServices[continueBundleName].begin(); it != continueServices[continueBundleName].end(); it++) { - (*itInterval)->Update(continueBundleName, it->first, beginTime, it->second, 0); + (*itInterval)->Update(continueBundleName, it->first, beginTime, it->second, ""); } } NotifyStatsChanged();