From 1054bbff733cd6a3720b804473b30d0ddcd989cf Mon Sep 17 00:00:00 2001 From: houdisheng Date: Sun, 13 Mar 2022 18:24:54 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4handler?= =?UTF-8?q?=E5=88=B7=E7=9B=98=E4=BA=8B=E4=BB=B6=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=84=E7=90=86handler=E5=88=B7=E7=9B=98?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- services/common/include/bundle_active_core.h | 2 +- services/common/src/bundle_active_core.cpp | 25 +++++++++---------- .../include/bundle_active_report_handler.h | 9 +++---- .../src/bundle_active_report_handler.cpp | 11 ++++---- .../src/bundle_active_user_service.cpp | 5 ++-- 5 files changed, 25 insertions(+), 27 deletions(-) diff --git a/services/common/include/bundle_active_core.h b/services/common/include/bundle_active_core.h index d5fc211..192c3a3 100644 --- a/services/common/include/bundle_active_core.h +++ b/services/common/include/bundle_active_core.h @@ -142,7 +142,7 @@ private: void RegisterSubscriber(); std::shared_ptr commonEventSubscriber_; void RestoreAllData(); - int lastUsedUser_; + int currentUsedUser_; }; } } diff --git a/services/common/src/bundle_active_core.cpp b/services/common/src/bundle_active_core.cpp index ef0ade2..5b5c1bd 100644 --- a/services/common/src/bundle_active_core.cpp +++ b/services/common/src/bundle_active_core.cpp @@ -52,7 +52,7 @@ BundleActiveCore::BundleActiveCore() { systemTimeShot_ = -1; realTimeShot_ = -1; - lastUsedUser_ = -1; + currentUsedUser_ = -1; } BundleActiveCore::~BundleActiveCore() @@ -224,8 +224,7 @@ void BundleActiveCore::OnStatsChanged(const int userId) std::shared_ptr handlerobjToPtr = std::make_shared(tmpHandlerObject); auto event = AppExecFwk::InnerEvent::Get(BundleActiveReportHandler::MSG_FLUSH_TO_DISK, handlerobjToPtr); - if (handler_.lock()->HasInnerEvent(static_cast(BundleActiveReportHandler::MSG_FLUSH_TO_DISK)) == - false) { + if (handler_.lock()->HasInnerEvent(static_cast(userId)) == false) { BUNDLE_ACTIVE_LOGI("OnStatsChanged send flush to disk event for user %{public}d", userId); handler_.lock()->SendEvent(event, FLUSH_INTERVAL); } @@ -282,7 +281,7 @@ void BundleActiveCore::RestoreToDatabaseLocked(const int userId) } if (!handler_.expired()) { BUNDLE_ACTIVE_LOGI("RestoreToDatabaseLocked remove flush to disk event"); - handler_.lock()->RemoveEvent(BundleActiveReportHandler::MSG_FLUSH_TO_DISK); + handler_.lock()->RemoveEvent(BundleActiveReportHandler::MSG_FLUSH_TO_DISK, userId); } } @@ -345,7 +344,7 @@ int64_t BundleActiveCore::CheckTimeChangeAndGetWallTime(int userId) it->second->LoadActiveStats(actualSystemTime, true, true); if (!handler_.expired()) { BUNDLE_ACTIVE_LOGI("CheckTimeChangeAndGetWallTime remove flush to disk event"); - handler_.lock()->RemoveEvent(BundleActiveReportHandler::MSG_FLUSH_TO_DISK); + handler_.lock()->RemoveEvent(BundleActiveReportHandler::MSG_FLUSH_TO_DISK, userId); } } realTimeShot_ = actualRealTime; @@ -377,10 +376,10 @@ void BundleActiveCore::OnUserRemoved(const int userId) void BundleActiveCore::OnUserSwitched(const int userId) { sptr timer = MiscServices::TimeServiceClient::GetInstance(); - auto it = userStatServices_.find(lastUsedUser_); + auto it = userStatServices_.find(currentUsedUser_); if (it != userStatServices_.end()) { if (it != userStatServices_.end()) { - BUNDLE_ACTIVE_LOGI("restore old user id %{public}d data when switch user", lastUsedUser_); + BUNDLE_ACTIVE_LOGI("restore old user id %{public}d data when switch user", currentUsedUser_); BundleActiveEvent event; event.eventId_ = BundleActiveEvent::FLUSH; int64_t actualRealTime = timer->GetBootTimeMs(); @@ -392,7 +391,7 @@ void BundleActiveCore::OnUserSwitched(const int userId) } if (!handler_.expired()) { BUNDLE_ACTIVE_LOGI("OnUserSwitched remove flush to disk event"); - handler_.lock()->RemoveEvent(BundleActiveReportHandler::MSG_FLUSH_TO_DISK); + handler_.lock()->RemoveEvent(BundleActiveReportHandler::MSG_FLUSH_TO_DISK, currentUsedUser_); } std::vector activatedOsAccountIds; GetAllActiveUser(activatedOsAccountIds); @@ -402,9 +401,9 @@ void BundleActiveCore::OnUserSwitched(const int userId) } for (uint32_t i = 0; i < activatedOsAccountIds.size(); i++) { BUNDLE_ACTIVE_LOGI("start to period check for userId %{public}d", activatedOsAccountIds[i]); - bundleGroupController_->OnUserSwitched(activatedOsAccountIds[i], lastUsedUser_); + bundleGroupController_->OnUserSwitched(activatedOsAccountIds[i], currentUsedUser_); } - lastUsedUser_ = userId; + currentUsedUser_ = userId; } int BundleActiveCore::ReportEvent(BundleActiveEvent& event, const int userId) @@ -413,9 +412,9 @@ int BundleActiveCore::ReportEvent(BundleActiveEvent& event, const int userId) if (userId == 0 || userId == -1) { return -1; } - if (lastUsedUser_ == -1) { - lastUsedUser_ = userId; - BUNDLE_ACTIVE_LOGI("last used id change to %{public}d", lastUsedUser_); + if (currentUsedUser_ == -1) { + currentUsedUser_ = userId; + BUNDLE_ACTIVE_LOGI("last used id change to %{public}d", currentUsedUser_); } sptr timer = MiscServices::TimeServiceClient::GetInstance(); diff --git a/services/packageusage/include/bundle_active_report_handler.h b/services/packageusage/include/bundle_active_report_handler.h index ad2714d..f0fcdaa 100644 --- a/services/packageusage/include/bundle_active_report_handler.h +++ b/services/packageusage/include/bundle_active_report_handler.h @@ -36,11 +36,10 @@ public: void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; void Init(const std::shared_ptr& bundleActiveCore); static const int MSG_REPORT_EVENT = 0; - static const int MSG_REPORT_EVENT_TO_ALL_USER = 1; - static const int MSG_FLUSH_TO_DISK = 2; - static const int MSG_REMOVE_USER = 3; - static const int MSG_BUNDLE_UNINSTALLED = 4; - static const int MSG_SWITCH_USER = 5; + static const int MSG_FLUSH_TO_DISK = 1; + static const int MSG_REMOVE_USER = 2; + static const int MSG_BUNDLE_UNINSTALLED = 3; + static const int MSG_SWITCH_USER = 4; private: std::shared_ptr bundleActiveCore_; diff --git a/services/packageusage/src/bundle_active_report_handler.cpp b/services/packageusage/src/bundle_active_report_handler.cpp index 3fc4a79..cbbfdf7 100644 --- a/services/packageusage/src/bundle_active_report_handler.cpp +++ b/services/packageusage/src/bundle_active_report_handler.cpp @@ -42,16 +42,15 @@ void BundleActiveReportHandler::ProcessEvent(const AppExecFwk::InnerEvent::Point bundleActiveCore_->ReportEvent(tmpHandlerobj.event_, tmpHandlerobj.userId_); break; } - case MSG_REPORT_EVENT_TO_ALL_USER: { - auto ptrToHandlerobj = event->GetSharedObject(); - BundleActiveReportHandlerObject tmpHandlerobj = *ptrToHandlerobj; - bundleActiveCore_->ReportEventToAllUserId(tmpHandlerobj.event_); - break; - } case MSG_FLUSH_TO_DISK: { BUNDLE_ACTIVE_LOGI("FLUSH TO DISK HANDLE"); auto ptrToHandlerobj = event->GetSharedObject(); BundleActiveReportHandlerObject tmpHandlerobj = *ptrToHandlerobj; + if (tmpHandlerobj.userId_ != bundleActiveCore_->currentUsedUser_) { + BUNDLE_ACTIVE_LOGE("flush user is %{public}d, not last user %{public}d, return", + tmpHandlerobj.userId_, bundleActiveCore_->currentUsedUser_); + return; + } bundleActiveCore_->RestoreToDatabase(tmpHandlerobj.userId_); break; } diff --git a/services/packageusage/src/bundle_active_user_service.cpp b/services/packageusage/src/bundle_active_user_service.cpp index 670e854..fa02643 100644 --- a/services/packageusage/src/bundle_active_user_service.cpp +++ b/services/packageusage/src/bundle_active_user_service.cpp @@ -86,8 +86,9 @@ void BundleActiveUserService::NotifyNewUpdate() void BundleActiveUserService::ReportEvent(const BundleActiveEvent& event) { - BUNDLE_ACTIVE_LOGI("ReportEvent, B time is %{public}lld, E time is %{public}lld", - currentStats_[0]->beginTime_, dailyExpiryDate_.GetMilliseconds()); + BUNDLE_ACTIVE_LOGI("ReportEvent, B time is %{public}lld, E time is %{public}lld, userId is %{public}d," + "event is %{public}d", + currentStats_[0]->beginTime_, dailyExpiryDate_.GetMilliseconds(), userId_, event.eventId_); if (event.timeStamp_ >= dailyExpiryDate_.GetMilliseconds()) { BUNDLE_ACTIVE_LOGI("ReportEvent later than daily expire, renew data in memory"); RenewStatsInMemory(event.timeStamp_); -- Gitee From cc151455899f5ddf2936aa16a359f83e73bca65a Mon Sep 17 00:00:00 2001 From: houdisheng Date: Sun, 13 Mar 2022 18:33:59 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4handler?= =?UTF-8?q?=E5=88=B7=E7=9B=98=E4=BA=8B=E4=BB=B6=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=84=E7=90=86handler=E5=88=B7=E7=9B=98?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- services/packageusage/src/bundle_active_report_handler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/packageusage/src/bundle_active_report_handler.cpp b/services/packageusage/src/bundle_active_report_handler.cpp index cbbfdf7..e116809 100644 --- a/services/packageusage/src/bundle_active_report_handler.cpp +++ b/services/packageusage/src/bundle_active_report_handler.cpp @@ -49,6 +49,7 @@ void BundleActiveReportHandler::ProcessEvent(const AppExecFwk::InnerEvent::Point if (tmpHandlerobj.userId_ != bundleActiveCore_->currentUsedUser_) { BUNDLE_ACTIVE_LOGE("flush user is %{public}d, not last user %{public}d, return", tmpHandlerobj.userId_, bundleActiveCore_->currentUsedUser_); + RemoveEvent(BundleActiveReportHandler::MSG_FLUSH_TO_DISK, tmpHandlerobj.userId_); return; } bundleActiveCore_->RestoreToDatabase(tmpHandlerobj.userId_); -- Gitee From 362305c1d3847fe0bae1b15597a43d3bb96cad70 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Sun, 13 Mar 2022 19:16:38 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4handler?= =?UTF-8?q?=E5=88=B7=E7=9B=98=E4=BA=8B=E4=BB=B6=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=84=E7=90=86handler=E5=88=B7=E7=9B=98?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- services/common/include/bundle_active_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/common/include/bundle_active_core.h b/services/common/include/bundle_active_core.h index 192c3a3..99d3728 100644 --- a/services/common/include/bundle_active_core.h +++ b/services/common/include/bundle_active_core.h @@ -125,6 +125,7 @@ public: // when service stop, call it to unregister commen event and shutdown call back. void UnRegisterSubscriber(); int64_t GetSystemTimeMs(); + int currentUsedUser_; private: static const int64_t FLUSH_INTERVAL = TWO_MINUTE; @@ -142,7 +143,6 @@ private: void RegisterSubscriber(); std::shared_ptr commonEventSubscriber_; void RestoreAllData(); - int currentUsedUser_; }; } } -- Gitee From dc076c11ecf364f0fadf547afad9fc683640188a Mon Sep 17 00:00:00 2001 From: houdisheng Date: Sun, 13 Mar 2022 21:40:49 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4handler?= =?UTF-8?q?=E5=88=B7=E7=9B=98=E4=BA=8B=E4=BB=B6=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=84=E7=90=86handler=E5=88=B7=E7=9B=98?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- services/common/src/bundle_active_core.cpp | 1 + services/packageusage/src/bundle_active_user_service.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/services/common/src/bundle_active_core.cpp b/services/common/src/bundle_active_core.cpp index 5b5c1bd..11ff64a 100644 --- a/services/common/src/bundle_active_core.cpp +++ b/services/common/src/bundle_active_core.cpp @@ -404,6 +404,7 @@ void BundleActiveCore::OnUserSwitched(const int userId) bundleGroupController_->OnUserSwitched(activatedOsAccountIds[i], currentUsedUser_); } currentUsedUser_ = userId; + OnStatsChanged(userId); } int BundleActiveCore::ReportEvent(BundleActiveEvent& event, const int userId) diff --git a/services/packageusage/src/bundle_active_user_service.cpp b/services/packageusage/src/bundle_active_user_service.cpp index fa02643..931d54f 100644 --- a/services/packageusage/src/bundle_active_user_service.cpp +++ b/services/packageusage/src/bundle_active_user_service.cpp @@ -133,7 +133,9 @@ void BundleActiveUserService::ReportEvent(const BundleActiveEvent& event) break; } } - NotifyStatsChanged(); + if (event.eventId_ != BundleActiveEvent::FLUSH) { + NotifyStatsChanged(); + } } void BundleActiveUserService::ReportForShutdown(const BundleActiveEvent& event) -- Gitee From 52738700e350d16278edabaea7b608f22fcb488a Mon Sep 17 00:00:00 2001 From: houdisheng Date: Mon, 14 Mar 2022 09:47:24 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=9D=83=E9=99=90=E4=B8=BAsystem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- init/device_usage_statistics_service.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/device_usage_statistics_service.cfg b/init/device_usage_statistics_service.cfg index c197a76..2154baa 100644 --- a/init/device_usage_statistics_service.cfg +++ b/init/device_usage_statistics_service.cfg @@ -9,8 +9,8 @@ "services" : [{ "name" : "device_usage_stats_service", "path" : ["/system/bin/sa_main", "/system/profile/device_usage_stats_service.xml"], - "uid" : "root", - "gid" : ["root", "shell"] + "uid" : "system", + "gid" : ["system", "shell"] } ] } \ No newline at end of file -- Gitee From 84b739b671f00d2375d536ed8414902ddbc6f097 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Mon, 14 Mar 2022 11:03:17 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=8E=BB=E9=99=A4debug=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- services/common/include/bundle_active_constant.h | 3 ++- services/common/include/bundle_active_core.h | 2 +- services/common/src/bundle_active_core.cpp | 2 +- .../packagegroup/include/bundle_active_group_controller.h | 2 +- .../packagegroup/include/bundle_active_group_handler.h | 2 +- services/packageusage/include/bundle_active_calendar.h | 8 ++++---- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/services/common/include/bundle_active_constant.h b/services/common/include/bundle_active_constant.h index 2e3bd8c..721da94 100644 --- a/services/common/include/bundle_active_constant.h +++ b/services/common/include/bundle_active_constant.h @@ -59,7 +59,8 @@ const int BOOT_BASED_DURATION_COLUMN_INDEX = 0; const int SCREEN_ON_DURATION_COLUMN_INDEX = 1; const int DURATION_FLAG_COLUMN_INDEX = 2; const int TWO_SECONDS = 2 * 1000; -const int64_t SIX_DAY_IN_MILLIS_MAX = 1 * 6 * 10 * 60 * 1000; +const int64_t SIX_DAY_IN_MILLIS_MAX = 6 * 24 * 60 * 60 * 1000; +const int64_t THIRTY_MINUTE = 30 * 60 * 1000; const int64_t LAST_TIME_IN_MILLIS_MIN = 0; const int64_t EVENT_TIME_IN_MILLIS_MIN = 0; const int64_t EVENT_BEGIN_TIME_INITIAL_VALUE = -1; diff --git a/services/common/include/bundle_active_core.h b/services/common/include/bundle_active_core.h index 99d3728..bd1601e 100644 --- a/services/common/include/bundle_active_core.h +++ b/services/common/include/bundle_active_core.h @@ -128,7 +128,7 @@ public: int currentUsedUser_; private: - static const int64_t FLUSH_INTERVAL = TWO_MINUTE; + static const int64_t FLUSH_INTERVAL = THIRTY_MINUTE; static const int64_t TIME_CHANGE_THRESHOLD_MILLIS = TWO_SECONDS; const int DEFAULT_USER_ID = -1; std::map visibleActivities_; diff --git a/services/common/src/bundle_active_core.cpp b/services/common/src/bundle_active_core.cpp index 11ff64a..65d56b8 100644 --- a/services/common/src/bundle_active_core.cpp +++ b/services/common/src/bundle_active_core.cpp @@ -391,7 +391,7 @@ void BundleActiveCore::OnUserSwitched(const int userId) } if (!handler_.expired()) { BUNDLE_ACTIVE_LOGI("OnUserSwitched remove flush to disk event"); - handler_.lock()->RemoveEvent(BundleActiveReportHandler::MSG_FLUSH_TO_DISK, currentUsedUser_); + handler_.lock()->RemoveEvent(BundleActiveReportHandler::MSG_FLUSH_TO_DISK); } std::vector activatedOsAccountIds; GetAllActiveUser(activatedOsAccountIds); diff --git a/services/packagegroup/include/bundle_active_group_controller.h b/services/packagegroup/include/bundle_active_group_controller.h index ee2f45c..74e67a4 100644 --- a/services/packagegroup/include/bundle_active_group_controller.h +++ b/services/packagegroup/include/bundle_active_group_controller.h @@ -43,7 +43,7 @@ public: using ApplicationFlag = OHOS::AppExecFwk::ApplicationFlag; OHOS::AppExecFwk::ApplicationFlag flag = OHOS::AppExecFwk::ApplicationFlag::GET_BASIC_APPLICATION_INFO; bool bundleGroupEnable_ = true; - bool debug_ = true; + bool debug_ = false; const int LEVEL_GROUP[4] = { ACTIVE_GROUP_ALIVE, ACTIVE_GROUP_DAILY, diff --git a/services/packagegroup/include/bundle_active_group_handler.h b/services/packagegroup/include/bundle_active_group_handler.h index f498c65..737a9db 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 = ONE_MINUTE; + static const int CHECK_IDLE_INTERVAL = THREE_HOUR; private: std::shared_ptr bundleActiveGroupController_; diff --git a/services/packageusage/include/bundle_active_calendar.h b/services/packageusage/include/bundle_active_calendar.h index 2e7a2f4..745d56e 100644 --- a/services/packageusage/include/bundle_active_calendar.h +++ b/services/packageusage/include/bundle_active_calendar.h @@ -23,10 +23,10 @@ namespace DeviceUsageStats { class BundleActiveCalendar { public: static const int64_t ONE_SECOND_MILLISECONDS = 1000; - static const int64_t DAY_MILLISECONDS = (int64_t)1 * 1 * 10 * 60 * 1000; - static const int64_t WEEK_MILLISECONDS = (int64_t)1 * 1 * 20 * 60 * 1000; - static const int64_t MONTH_MILLISECONDS = (int64_t)1 * 1 * 30 * 60 * 1000; - static const int64_t YEAR_MILLISECONDS = (int64_t)1 * 1 * 40 * 60 * 1000; + static const int64_t DAY_MILLISECONDS = (int64_t)1 * 24 * 60 * 60 * 1000; + static const int64_t WEEK_MILLISECONDS = (int64_t)7 * 24 * 60 * 60 * 1000; + static const int64_t MONTH_MILLISECONDS = (int64_t)30 * 24 * 60 * 60 * 1000; + static const int64_t YEAR_MILLISECONDS = (int64_t)365 * 24 * 60 * 60 * 1000; BundleActiveCalendar(const int64_t timeStamp); BundleActiveCalendar() { -- Gitee From c39d9073fa64d655270e185e340dd401521e2f4b Mon Sep 17 00:00:00 2001 From: houdisheng Date: Mon, 14 Mar 2022 11:09:32 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E5=92=8C=E5=8F=98=E9=87=8F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- .../packagegroup/include/bundle_active_group_controller.h | 2 +- .../packagegroup/src/bundle_active_group_controller.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/services/packagegroup/include/bundle_active_group_controller.h b/services/packagegroup/include/bundle_active_group_controller.h index 74e67a4..63d3b05 100644 --- a/services/packagegroup/include/bundle_active_group_controller.h +++ b/services/packagegroup/include/bundle_active_group_controller.h @@ -84,7 +84,7 @@ public: int IsBundleIdle(const std::string& bundleName, const int userId); int QueryPackageGroup(const int userId, const std::string& bundleName); void ShutDown(const int64_t bootBasedTimeStamp, const int userId); - void OnUserSwitched(const int userId, const int lastUsedUser); + void OnUserSwitched(const int userId, const int currentUsedUser); private: std::mutex mutex_; diff --git a/services/packagegroup/src/bundle_active_group_controller.cpp b/services/packagegroup/src/bundle_active_group_controller.cpp index 9278329..0f5ae55 100644 --- a/services/packagegroup/src/bundle_active_group_controller.cpp +++ b/services/packagegroup/src/bundle_active_group_controller.cpp @@ -50,11 +50,11 @@ void BundleActiveGroupController::OnUserRemoved(const int userId) } } -void BundleActiveGroupController::OnUserSwitched(const int userId, const int lastUsedUser) +void BundleActiveGroupController::OnUserSwitched(const int userId, const int currentUsedUser) { - BUNDLE_ACTIVE_LOGI("last time check for user %{public}d", lastUsedUser); - CheckEachBundleState(lastUsedUser); - bundleUserHistory_->WriteBundleUsage(lastUsedUser); + BUNDLE_ACTIVE_LOGI("last time check for user %{public}d", currentUsedUser); + CheckEachBundleState(currentUsedUser); + bundleUserHistory_->WriteBundleUsage(currentUsedUser); std::lock_guard lock(mutex_); if (!activeGroupHandler_.expired()) { activeGroupHandler_.lock()->RemoveEvent(BundleActiveGroupHandler::MSG_CHECK_IDLE_STATE); -- Gitee