From cea03ad522a4f64cf2e44a5e657a5954d57743cf Mon Sep 17 00:00:00 2001 From: houdisheng Date: Wed, 16 Feb 2022 19:12:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- interfaces/innerkits/src/bundle_active_client.cpp | 1 + services/common/include/bundle_active_event.h | 8 +++----- .../common/include/bundle_active_package_stats.h | 13 ++++++------- .../common/include/bundle_active_user_service.h | 2 +- services/common/src/bundle_active_package_stats.cpp | 3 --- services/common/src/bundle_active_period_stats.cpp | 3 +-- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/interfaces/innerkits/src/bundle_active_client.cpp b/interfaces/innerkits/src/bundle_active_client.cpp index 86a86e5..ad842b5 100644 --- a/interfaces/innerkits/src/bundle_active_client.cpp +++ b/interfaces/innerkits/src/bundle_active_client.cpp @@ -44,6 +44,7 @@ bool BundleActiveClient::GetBundleActiveProxy() } return true; } + int BundleActiveClient::ReportEvent(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId, const int& eventId) { diff --git a/services/common/include/bundle_active_event.h b/services/common/include/bundle_active_event.h index 4f5f2d9..d5a0c02 100644 --- a/services/common/include/bundle_active_event.h +++ b/services/common/include/bundle_active_event.h @@ -22,15 +22,13 @@ namespace OHOS { namespace BundleActive { class BundleActiveEvent { public: - //external events - static const int ABILITY_FOREGROUND = 2;//onForeground() called, ability is in front. - static const int ABILITY_BACKGROUND = 3;//onBackground() called, ability is in background. - static const int ABILITY_STOP = 4;//onStop() called, ability is destroyed. + static const int ABILITY_FOREGROUND = 2; + static const int ABILITY_BACKGROUND = 3; + static const int ABILITY_STOP = 4; static const int LONG_TIME_TASK_STARTTED = 5; static const int LONG_TIME_TASK_STOPPED = 6; static const int SYSTEM_INTERACTIVE = 7; static const int USER_INTERACTIVE = 8; - //internal events static const int END_OF_THE_DAY = 9; static const int DEVICE_SHUTDOWN = 10; static const int DEVICE_STARTUP = 11; diff --git a/services/common/include/bundle_active_package_stats.h b/services/common/include/bundle_active_package_stats.h index 9d0c9f3..1cbc4f5 100644 --- a/services/common/include/bundle_active_package_stats.h +++ b/services/common/include/bundle_active_package_stats.h @@ -21,21 +21,20 @@ namespace OHOS { namespace BundleActive { -//bundles statistics, including Abilityies and frontservices. class BundleActivePackageStats { public: std::string bundleName_; - int64_t beginTimeStamp_; //start time of counting - int64_t endTimeStamp_; //stop time of counting - int64_t lastTimeUsed_; //the timestamp of last launch - int64_t totalTimeInFront_; // the total time of using the bundle + int64_t beginTimeStamp_; + int64_t endTimeStamp_; + int64_t lastTimeUsed_; + int64_t totalTimeInFront_; int64_t lastTimeLongTimeTaskUsed_; int64_t totalTimeLongTimeTaskUsed_; int launchedCount_; int bundleLaunchedCount_; int lastEvent_; - std::map abilities_; // key is abilityId, value is the last event of this ability. Restore all abilities' last event of bundle. - std::map frontServices_; // restore the frontservices' names using by bundle. + std::map abilities_; + std::map frontServices_; BundleActivePackageStats() {}; BundleActivePackageStats(const BundleActivePackageStats& orig); std::string GetBundleName(); diff --git a/services/common/include/bundle_active_user_service.h b/services/common/include/bundle_active_user_service.h index ef43c92..df03bbf 100644 --- a/services/common/include/bundle_active_user_service.h +++ b/services/common/include/bundle_active_user_service.h @@ -27,7 +27,7 @@ namespace BundleActive { class BundleActiveUserService { public: - BundleActiveUserService(int userId);//,/*database定义待补充*/ BundleActiveService listener/*刷数据库监听器接口实现类*/); + BundleActiveUserService(int userId); private: int incrementBundleLaunch_; int userId_; diff --git a/services/common/src/bundle_active_package_stats.cpp b/services/common/src/bundle_active_package_stats.cpp index a4e595a..fe22898 100644 --- a/services/common/src/bundle_active_package_stats.cpp +++ b/services/common/src/bundle_active_package_stats.cpp @@ -123,7 +123,6 @@ void BundleActivePackageStats::UpdateAbility(const int64_t timeStamp, const int it = abilities_.find(abilityId); if (it != abilities_.end()) { int lastEventId = it->second; - //When we recieve a new event, first update the time stats according to the last event in map. switch (lastEventId) { case BundleActiveEvent::ABILITY_FOREGROUND: IncrementTimeUsed(timeStamp); @@ -156,8 +155,6 @@ void BundleActivePackageStats::UpdateLongTimeTask(std::string longTimeTaskName, if (eventId != BundleActiveEvent::LONG_TIME_TASK_STARTTED && eventId != BundleActiveEvent::LONG_TIME_TASK_STOPPED) { return; } - - //When we recieve a new event, first update the time stats according to the last service event in map. std::map::iterator it; it = frontServices_.find(longTimeTaskName); if (it != frontServices_.end()) { diff --git a/services/common/src/bundle_active_period_stats.cpp b/services/common/src/bundle_active_period_stats.cpp index 7a9108a..d73d0b9 100644 --- a/services/common/src/bundle_active_period_stats.cpp +++ b/services/common/src/bundle_active_period_stats.cpp @@ -20,8 +20,7 @@ namespace OHOS { namespace BundleActive { BundleActivePackageStats& BundleActivePeriodStats::GetOrCreateUsageStats(std::string bundleName) { - std::map::iterator it; - it = bundleStats_.find(bundleName); + std::map::iterator it = bundleStats_.find(bundleName); if (it == bundleStats_.end()) { BundleActivePackageStats newStats; newStats.beginTimeStamp_ = beginTime_; -- Gitee From 9f6777f1a95126e4dd9363298550930d0954c961 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Thu, 17 Feb 2022 09:41:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=89=A9=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- .../innerkits/include/bundle_active_client.h | 7 ++++--- .../innerkits/include/bundle_active_proxy.h | 5 +++-- interfaces/innerkits/src/bundle_active_client.cpp | 4 +++- interfaces/innerkits/src/bundle_active_proxy.cpp | 2 +- services/common/include/bundle_active_event.h | 4 ++-- .../common/include/bundle_active_event_list.h | 2 +- .../common/include/bundle_active_event_stats.h | 2 +- .../common/include/bundle_active_event_tracker.h | 5 +++-- .../common/include/bundle_active_package_stats.h | 6 ++---- .../common/include/bundle_active_period_stats.h | 6 +++--- .../common/include/bundle_active_user_service.h | 8 ++++---- services/common/src/bundle_active_event_list.cpp | 1 - .../common/src/bundle_active_package_stats.cpp | 15 +++++++-------- .../common/src/bundle_active_period_stats.cpp | 9 +++++---- .../common/src/bundle_active_user_service.cpp | 6 +++--- services/include/bundle_active_service.h | 4 ++-- services/include/bundle_active_stub.h | 2 +- ...active_iservice.h => ibundle_active_service.h} | 7 ++++--- services/src/bundle_active_stub.cpp | 4 ++-- 19 files changed, 51 insertions(+), 48 deletions(-) rename services/include/{bundle_active_iservice.h => ibundle_active_service.h} (90%) diff --git a/interfaces/innerkits/include/bundle_active_client.h b/interfaces/innerkits/include/bundle_active_client.h index 1576288..0a44623 100644 --- a/interfaces/innerkits/include/bundle_active_client.h +++ b/interfaces/innerkits/include/bundle_active_client.h @@ -16,13 +16,14 @@ #ifndef BUNDLE_ACTIVE_CLIENT_H #define BUNDLE_ACTIVE_CLIENT_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" namespace OHOS { namespace BundleActive { class BundleActiveClient { public: - int ReportEvent(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId, const int& eventId); + int ReportEvent(std::string& bundleName, std::string& abilityName, const int& abilityId, + const int& userId, const int& eventId); int IsBundleIdle(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId); int Query(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId); static BundleActiveClient& GetInstance(); @@ -34,6 +35,6 @@ private: bool GetBundleActiveProxy(); sptr bundleActiveProxy; }; -} +} } #endif \ No newline at end of file diff --git a/interfaces/innerkits/include/bundle_active_proxy.h b/interfaces/innerkits/include/bundle_active_proxy.h index ac9d22c..b449be2 100644 --- a/interfaces/innerkits/include/bundle_active_proxy.h +++ b/interfaces/innerkits/include/bundle_active_proxy.h @@ -16,13 +16,14 @@ #ifndef BUNDLE_ACTIVE_PROXY_H #define BUNDLE_ACTIVE_PROXY_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" namespace OHOS { namespace BundleActive { class BundleActiveProxy : public IRemoteProxy { public: - int ReportEvent(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId, const int& eventId) override; + int ReportEvent(std::string& bundleName, std::string& abilityName, const int& abilityId, + const int& userId, const int& eventId) override; int IsBundleIdle(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId) override; int Query(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId) override; diff --git a/interfaces/innerkits/src/bundle_active_client.cpp b/interfaces/innerkits/src/bundle_active_client.cpp index ad842b5..eb90b0f 100644 --- a/interfaces/innerkits/src/bundle_active_client.cpp +++ b/interfaces/innerkits/src/bundle_active_client.cpp @@ -63,7 +63,9 @@ int BundleActiveClient::IsBundleIdle(std::string& bundleName, std::string& abili return bundleActiveProxy->IsBundleIdle(bundleName, abilityName, abilityId, userId); } -int BundleActiveClient::Query(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId) { +int BundleActiveClient::Query(std::string& bundleName, std::string& abilityName, const int& abilityId, + const int& userId) +{ if (!GetBundleActiveProxy()) { return -1; } diff --git a/interfaces/innerkits/src/bundle_active_proxy.cpp b/interfaces/innerkits/src/bundle_active_proxy.cpp index d19611d..04ae360 100644 --- a/interfaces/innerkits/src/bundle_active_proxy.cpp +++ b/interfaces/innerkits/src/bundle_active_proxy.cpp @@ -15,7 +15,7 @@ #include "bundle_active_proxy.h" -namespace OHOS{ +namespace OHOS { namespace BundleActive { int BundleActiveProxy::ReportEvent(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId, const int& eventId) diff --git a/services/common/include/bundle_active_event.h b/services/common/include/bundle_active_event.h index d5a0c02..0ec081d 100644 --- a/services/common/include/bundle_active_event.h +++ b/services/common/include/bundle_active_event.h @@ -16,7 +16,7 @@ #ifndef BUNDLE_ACTIVE_EVENT_H #define BUNDLE_ACTIVE_EVENT_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" namespace OHOS { namespace BundleActive { @@ -29,7 +29,7 @@ public: static const int LONG_TIME_TASK_STOPPED = 6; static const int SYSTEM_INTERACTIVE = 7; static const int USER_INTERACTIVE = 8; - static const int END_OF_THE_DAY = 9; + static const int END_OF_THE_DAY = 9; static const int DEVICE_SHUTDOWN = 10; static const int DEVICE_STARTUP = 11; static const int FLUSH_TO_DISK = 12; diff --git a/services/common/include/bundle_active_event_list.h b/services/common/include/bundle_active_event_list.h index 1ac946e..17ede3f 100644 --- a/services/common/include/bundle_active_event_list.h +++ b/services/common/include/bundle_active_event_list.h @@ -16,7 +16,7 @@ #ifndef BUNDLE_ACTIVE_EVENT_LIST_H #define BUNDLE_ACTIVE_EVENT_LIST_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" #include "bundle_active_event.h" namespace OHOS { diff --git a/services/common/include/bundle_active_event_stats.h b/services/common/include/bundle_active_event_stats.h index e446985..8400c92 100644 --- a/services/common/include/bundle_active_event_stats.h +++ b/services/common/include/bundle_active_event_stats.h @@ -16,7 +16,7 @@ #ifndef BUNDLE_ACTIVE_EVENT_STATS_H #define BUNDLE_ACTIVE_EVENT_STATS_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" namespace OHOS { namespace BundleActive { diff --git a/services/common/include/bundle_active_event_tracker.h b/services/common/include/bundle_active_event_tracker.h index 19af858..0866a4c 100644 --- a/services/common/include/bundle_active_event_tracker.h +++ b/services/common/include/bundle_active_event_tracker.h @@ -16,7 +16,7 @@ #ifndef BUNDLE_ACTIVE_EVENT_TRACKER_H #define BUNDLE_ACTIVE_EVENT_TRACKER_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" #include "bundle_active_event_stats.h" namespace OHOS { @@ -29,7 +29,8 @@ public: int64_t count_; void CommitTime(const int64_t timeStamp); void Update(int64_t timeStamp); - void AddToEventStats(std::vector& eventStatsList, const int eventId, const int64_t beginTime, const int64_t endTime); + void AddToEventStats(std::vector& eventStatsList, const int eventId, + const int64_t beginTime, const int64_t endTime); BundleActiveEventTracker() {}; }; } diff --git a/services/common/include/bundle_active_package_stats.h b/services/common/include/bundle_active_package_stats.h index 1cbc4f5..c893a1b 100644 --- a/services/common/include/bundle_active_package_stats.h +++ b/services/common/include/bundle_active_package_stats.h @@ -16,7 +16,7 @@ #ifndef bundle_active_package_stats_H #define bundle_active_package_stats_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" #include "bundle_active_event.h" namespace OHOS { @@ -55,10 +55,8 @@ private: bool HasFrontAbility(); bool AnyFrontServiceStarted(); void UpdateAbility(const int64_t timeStamp, const int eventId, const int abilityId); - void UpdateLongTimeTask(std::string longTimeTaskName, + void UpdateLongTimeTask(std::string longTimeTaskName, const int64_t timeStamp, const int eventId); - - }; } } diff --git a/services/common/include/bundle_active_period_stats.h b/services/common/include/bundle_active_period_stats.h index 29952ad..fb64d5e 100644 --- a/services/common/include/bundle_active_period_stats.h +++ b/services/common/include/bundle_active_period_stats.h @@ -16,7 +16,7 @@ #ifndef bundle_active_period_stats_H #define bundle_active_period_stats_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" #include "bundle_active_event.h" #include "bundle_active_package_stats.h" #include "bundle_active_event_list.h" @@ -48,7 +48,8 @@ public: BundleActiveEventTracker keyguardHiddenTracker_; BundleActivePackageStats& GetOrCreateUsageStats(std::string bundleName); BundleActiveEvent BuildEvent(std::string bundleName, std::string longTimeTaskName); - void Update(std::string bundleName, std::string longTimeTaskName, const int64_t timeStamp, const int eventId, const int abilityId); + void Update(std::string bundleName, std::string longTimeTaskName, const int64_t timeStamp, const int eventId, + const int abilityId); void AddEvent(BundleActiveEvent event); void UpdateScreenInteractive(const int64_t timeStamp); void UpdateScreenNonInteractive(const int64_t timeStamp); @@ -59,7 +60,6 @@ private: void CommitTime(const int64_t timeStamp); void AddEventStatsTo(std::vector& eventStatsList); std::string GetCachedString(std::string str); - }; } } diff --git a/services/common/include/bundle_active_user_service.h b/services/common/include/bundle_active_user_service.h index df03bbf..0f9bba3 100644 --- a/services/common/include/bundle_active_user_service.h +++ b/services/common/include/bundle_active_user_service.h @@ -16,7 +16,7 @@ #ifndef BUNDLE_ACTIVE_USER_SERVICE_H #define BUNDLE_ACTIVE_USER_SERVICE_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" #include "bundle_active_event.h" #include "bundle_active_package_stats.h" #include "bundle_active_period_stats.h" @@ -24,7 +24,6 @@ namespace OHOS { namespace BundleActive { - class BundleActiveUserService { public: BundleActiveUserService(int userId); @@ -34,8 +33,9 @@ private: std::vector currentStats_; bool statsChanged_; std::string lastBackgroundBundle_; - inline static const std::vector PERIOD_LENGTH = {BundleActivePeriodStats::DAY_IN_MILLIS, BundleActivePeriodStats::WEEK_IN_MILLIS, - BundleActivePeriodStats::MONTH_IN_MILLIS, BundleActivePeriodStats::YEAR_IN_MILLIS}; + inline static const std::vector PERIOD_LENGTH = {BundleActivePeriodStats::DAY_IN_MILLIS, + BundleActivePeriodStats::WEEK_IN_MILLIS, BundleActivePeriodStats::MONTH_IN_MILLIS, + BundleActivePeriodStats::YEAR_IN_MILLIS}; void NotifyStatsChanged(); void ReportEvent(BundleActiveEvent event); }; diff --git a/services/common/src/bundle_active_event_list.cpp b/services/common/src/bundle_active_event_list.cpp index 4c027dc..3e4b715 100644 --- a/services/common/src/bundle_active_event_list.cpp +++ b/services/common/src/bundle_active_event_list.cpp @@ -19,7 +19,6 @@ namespace OHOS { namespace BundleActive { BundleActiveEventList::BundleActiveEventList() { - } int BundleActiveEventList::Size() diff --git a/services/common/src/bundle_active_package_stats.cpp b/services/common/src/bundle_active_package_stats.cpp index fe22898..2ba32ca 100644 --- a/services/common/src/bundle_active_package_stats.cpp +++ b/services/common/src/bundle_active_package_stats.cpp @@ -78,7 +78,8 @@ int BundleActivePackageStats::GetBundleLaunchedCount() return bundleLaunchedCount_; } -bool BundleActivePackageStats::HasFrontAbility() { +bool BundleActivePackageStats::HasFrontAbility() +{ for (auto ability : abilities_) { if (ability.second == BundleActiveEvent::ABILITY_FOREGROUND) { return true; @@ -115,12 +116,11 @@ void BundleActivePackageStats::IncrementBundleLaunchedCount() void BundleActivePackageStats::UpdateAbility(const int64_t timeStamp, const int eventId, const int abilityId) { - if (eventId != BundleActiveEvent::ABILITY_FOREGROUND && eventId != BundleActiveEvent::ABILITY_BACKGROUND && + if (eventId != BundleActiveEvent::ABILITY_FOREGROUND && eventId != BundleActiveEvent::ABILITY_BACKGROUND && eventId != BundleActiveEvent::ABILITY_STOP) { return; } - std::map::iterator it; - it = abilities_.find(abilityId); + std::map::iterator it = abilities_.find(abilityId); if (it != abilities_.end()) { int lastEventId = it->second; switch (lastEventId) { @@ -149,14 +149,13 @@ void BundleActivePackageStats::UpdateAbility(const int64_t timeStamp, const int } } -void BundleActivePackageStats::UpdateLongTimeTask(std::string longTimeTaskName, +void BundleActivePackageStats::UpdateLongTimeTask(std::string longTimeTaskName, const int64_t timeStamp, const int eventId) { if (eventId != BundleActiveEvent::LONG_TIME_TASK_STARTTED && eventId != BundleActiveEvent::LONG_TIME_TASK_STOPPED) { return; } - std::map::iterator it; - it = frontServices_.find(longTimeTaskName); + std::map::iterator it = frontServices_.find(longTimeTaskName); if (it != frontServices_.end()) { int lastEventId = it->second; switch (lastEventId) { @@ -169,7 +168,7 @@ void BundleActivePackageStats::UpdateLongTimeTask(std::string longTimeTaskName, switch (eventId) { case BundleActiveEvent::LONG_TIME_TASK_STARTTED: - if(!AnyFrontServiceStarted()) { + if (!AnyFrontServiceStarted()) { lastTimeLongTimeTaskUsed_ = timeStamp; } frontServices_[longTimeTaskName] = eventId; diff --git a/services/common/src/bundle_active_period_stats.cpp b/services/common/src/bundle_active_period_stats.cpp index d73d0b9..d740634 100644 --- a/services/common/src/bundle_active_period_stats.cpp +++ b/services/common/src/bundle_active_period_stats.cpp @@ -91,17 +91,18 @@ void BundleActivePeriodStats::UpdateKeyguardHidden(const int64_t timeStamp) keyguardShownTracker_.CommitTime(timeStamp); } -void BundleActivePeriodStats::AddEventStatsTo(std::vector& eventStatsList) { +void BundleActivePeriodStats::AddEventStatsTo(std::vector& eventStatsList) +{ interactiveTracker_.AddToEventStats(eventStatsList, BundleActiveEvent::SCREEN_INTERACTIVE, beginTime_, endTime_); - noninteractiveTracker_.AddToEventStats(eventStatsList, BundleActiveEvent::SCREEN_NON_INTERACTIVE, beginTime_, endTime_); + noninteractiveTracker_.AddToEventStats(eventStatsList, BundleActiveEvent::SCREEN_NON_INTERACTIVE, + beginTime_, endTime_); keyguardShownTracker_.AddToEventStats(eventStatsList, BundleActiveEvent::KEYGUARD_SHOWN, beginTime_, endTime_); keyguardHiddenTracker_.AddToEventStats(eventStatsList, BundleActiveEvent::KEYGUARD_HIDDEN, beginTime_, endTime_); } std::string BundleActivePeriodStats::GetCachedString(std::string str) { - std::set::iterator it; - it = packetNamesCache_.find(str); + std::set::iterator it = packetNamesCache_.find(str); if (it == packetNamesCache_.end()) { packetNamesCache_.insert(str); return str; diff --git a/services/common/src/bundle_active_user_service.cpp b/services/common/src/bundle_active_user_service.cpp index 293367d..932fcc2 100644 --- a/services/common/src/bundle_active_user_service.cpp +++ b/services/common/src/bundle_active_user_service.cpp @@ -44,8 +44,7 @@ void BundleActiveUserService::ReportEvent(BundleActiveEvent event) } } for (int i = 0; i < currentStats_.size(); i++) { - switch (event.eventId_) - { + switch (event.eventId_) { case BundleActiveEvent::SCREEN_INTERACTIVE: currentStats_[i].UpdateScreenInteractive(event.timeStamp_); break; @@ -59,7 +58,8 @@ void BundleActiveUserService::ReportEvent(BundleActiveEvent event) currentStats_[i].UpdateKeyguardHidden(event.timeStamp_); break; default: - currentStats_[i].Update(event.bundleName_, event.longTimeTaskName_, event.timeStamp_, event.eventId_, event.abilityId_); + currentStats_[i].Update(event.bundleName_, event.longTimeTaskName_, event.timeStamp_, + event.eventId_, event.abilityId_); if (incrementBundleLaunch_) { currentStats_[i].bundleStats_[event.bundleName_].IncrementBundleLaunchedCount(); } diff --git a/services/include/bundle_active_service.h b/services/include/bundle_active_service.h index 537c899..44a9eb6 100644 --- a/services/include/bundle_active_service.h +++ b/services/include/bundle_active_service.h @@ -16,7 +16,7 @@ #ifndef BUNDLE_ACTIVE_SERVICE_H #define BUNDLE_ACTIVE_SERVICE_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" #include "bundle_active_stub.h" namespace OHOS { @@ -37,6 +37,6 @@ protected: void OnStart() override; void OnStop() override; }; -} +} } #endif \ No newline at end of file diff --git a/services/include/bundle_active_stub.h b/services/include/bundle_active_stub.h index ad15217..c8e758c 100644 --- a/services/include/bundle_active_stub.h +++ b/services/include/bundle_active_stub.h @@ -16,7 +16,7 @@ #ifndef BUNDLE_ACTIVE_STUB_H #define BUNDLE_ACTIVE_STUB_H -#include "bundle_active_iservice.h" +#include "ibundle_active_service.h" namespace OHOS { namespace BundleActive { diff --git a/services/include/bundle_active_iservice.h b/services/include/ibundle_active_service.h similarity index 90% rename from services/include/bundle_active_iservice.h rename to services/include/ibundle_active_service.h index 2f77dc5..68bca28 100644 --- a/services/include/bundle_active_iservice.h +++ b/services/include/ibundle_active_service.h @@ -34,11 +34,12 @@ namespace OHOS { namespace BundleActive { - class IBundleActiveService : public IRemoteBroker { public: - virtual int ReportEvent(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId, const int& eventId) = 0; - virtual int IsBundleIdle(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId) = 0; + virtual int ReportEvent(std::string& bundleName, std::string& abilityName, const int& abilityId, + const int& userId, const int& eventId) = 0; + virtual int IsBundleIdle(std::string& bundleName, std::string& abilityName, const int& abilityId, + const int& userId) = 0; virtual int Query(std::string& bundleName, std::string& abilityName, const int& abilityId, const int& userId) = 0; public: diff --git a/services/src/bundle_active_stub.cpp b/services/src/bundle_active_stub.cpp index b9f333a..7f2337c 100644 --- a/services/src/bundle_active_stub.cpp +++ b/services/src/bundle_active_stub.cpp @@ -21,7 +21,7 @@ namespace BundleActive { int32_t BundleActiveStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel &reply, MessageOption &option) { - switch(code) { + switch (code) { case REPORT_EVENT: { std::string bundleName = data.ReadString(); std::string ablityName = data.ReadString(); @@ -45,7 +45,7 @@ int32_t BundleActiveStub::OnRemoteRequest(uint32_t code, MessageParcel& data, Me int abilityId = data.ReadInt32(); int userId = data.ReadInt32(); int result = Query(bundleName, ablityName, abilityId, userId); - return reply.WriteInt32(result); + return reply.WriteInt32(result); } default: -- Gitee