diff --git a/hisysevent.yaml b/hisysevent.yaml index 3a22ba600ed55f430939d65976697ab071908f45..501e37ea819668877be272ae13c95c8499c9f90d 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -109,7 +109,6 @@ TERMINATE_ABILITY_ERROR: __BASE: {type: FAULT, level: MINOR, tag: ability, desc: terminate ability error} USER_ID: {type: INT32, desc: userId} ERROR_CODE: {type: INT32, desc: error code} - APP_INDEX: {type: INT32, desc: app index} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} @@ -202,7 +201,6 @@ STARTUP_TASK_ERROR: START_ABILITY: __BASE: {type: BEHAVIOR, level: MINOR, tag: PowerStats, desc: start ability} USER_ID: {type: INT32, desc: userId} - APP_INDEX: {type: INT32, desc: app index} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} @@ -212,28 +210,23 @@ CLOSE_ABILITY: TERMINATE_ABILITY: __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: terminate ability} - APP_INDEX: {type: INT32, desc: app index} BUNDLE_NAME: {type: STRING, desc: bundle name} ABILITY_NAME: {type: STRING, desc: ability name} ABILITY_ONFOREGROUND: __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: ability onForeground} - APP_INDEX: {type: INT32, desc: app index} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} BUNDLE_TYPE: {type: INT32, desc: 'type of componment, atomic service or normal app'} CALLER_BUNDLENAME: {type: STRING, desc: caller bundle name} - LIFE_CYCLE_STATE: {type: STRING, desc: life cycle state} ABILITY_ONBACKGROUND: __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: ability onBackground} - APP_INDEX: {type: INT32, desc: app index} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} BUNDLE_TYPE: {type: INT32, desc: 'type of componment, atomic service or normal app'} - LIFE_CYCLE_STATE: {type: STRING, desc: life cycle state} ABILITY_ONACTIVE: __BASE: {type: BEHAVIOR, level: MINOR, desc: ability onActive} diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 9cb30a266e2a05e7c1f2233bb53d2152310b46ca..71186c196b354c6809bd0e0e01c452c793eb5d60 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -2528,7 +2528,6 @@ private: int AddStartControlParam(Want &want, const sptr &callerToken); AAFwk::EventInfo BuildEventInfo(const Want &want, int32_t userId); - AAFwk::EventInfo BuildEventInfoByAbilityRecord(const std::shared_ptr &abilityRecord); #ifdef WITH_DLP int CheckDlpForExtension( diff --git a/services/abilitymgr/src/ability_connect_manager.cpp b/services/abilitymgr/src/ability_connect_manager.cpp index ded73f065ec9c8edd252195a05fd5a4dffd816ab..5aea084f0f4c514b95f69d7a640b1ed7bef51119 100644 --- a/services/abilitymgr/src/ability_connect_manager.cpp +++ b/services/abilitymgr/src/ability_connect_manager.cpp @@ -2207,7 +2207,9 @@ void AbilityConnectManager::TerminateAbilityWindowLocked(const std::shared_ptrGetURI().c_str(), sessionInfo->persistentId, abilitystateStr.c_str()); - EventInfo eventInfo = BuildEventInfo(abilityRecord); + EventInfo eventInfo; + eventInfo.bundleName = abilityRecord->GetAbilityInfo().bundleName; + eventInfo.abilityName = abilityRecord->GetAbilityInfo().name; EventReport::SendAbilityEvent(EventName::TERMINATE_ABILITY, HiSysEventType::BEHAVIOR, eventInfo); std::lock_guard guard(serialMutex_); eventInfo.errCode = TerminateAbilityInner(abilityRecord->GetToken()); @@ -3647,7 +3649,6 @@ EventInfo AbilityConnectManager::BuildEventInfo(const std::shared_ptr COMMON_PICKER_TYPE = { "share", "action" @@ -261,17 +259,6 @@ bool IsEmbeddableStart(int32_t screenMode) return screenMode == AAFwk::EMBEDDED_FULL_SCREEN_MODE || screenMode == AAFwk::EMBEDDED_HALF_SCREEN_MODE; } - -void SendUIAbilityEvent(EventInfo &eventInfo, const int32_t state) -{ - if (state == static_cast(AppExecFwk::AbilityState::ABILITY_STATE_FOREGROUND)) { - eventInfo.lifeCycleState = LIFE_CYCLE_STATE_FOREGROUND_DONE; - SendAbilityEvent(EventName::ABILITY_ONFOREGROUND, HiSysEventType::BEHAVIOR, eventInfo); - } else if (state == static_cast(AppExecFwk::AbilityState::ABILITY_STATE_BACKGROUND)) { - eventInfo.lifeCycleState = LIFE_CYCLE_STATE_BACKGROUND_DONE; - SendAbilityEvent(EventName::ABILITY_ONBACKGROUND, HiSysEventType::BEHAVIOR, eventInfo); - } -} } // namespace using namespace std::chrono; @@ -4375,8 +4362,7 @@ int AbilityManagerService::BackToCallerAbilityWithResult(const sptr &token, int resultCode, const Want *resultWant) { XCOLLIE_TIMER_LESS(__PRETTY_FUNCTION__); - auto abilityRecord = Token::GetAbilityRecordByToken(token); - EventInfo eventInfo = BuildEventInfoByAbilityRecord(abilityRecord); + EventInfo eventInfo; SendAbilityEvent(EventName::CLOSE_ABILITY, HiSysEventType::BEHAVIOR, eventInfo); return TerminateAbilityWithFlag(token, resultCode, resultWant, false); } @@ -4562,7 +4548,9 @@ int AbilityManagerService::CloseUIAbilityBySCB(const sptr &sessionI return ERR_WOULD_BLOCK; } - EventInfo eventInfo = BuildEventInfoByAbilityRecord(abilityRecord); + EventInfo eventInfo; + eventInfo.bundleName = abilityRecord->GetAbilityInfo().bundleName; + eventInfo.abilityName = abilityRecord->GetAbilityInfo().name; SendAbilityEvent(EventName::CLOSE_ABILITY, HiSysEventType::BEHAVIOR, eventInfo); if (isUserRequestedExit) { CHECK_POINTER_AND_RETURN(appExitReasonHelper_, ERR_NULL_OBJECT); @@ -5121,36 +5109,6 @@ EventInfo AbilityManagerService::BuildEventInfo(const Want &want, int32_t userId eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - std::vector abilityRunningInfos; - auto result = GetAbilityRunningInfos(abilityRunningInfos); - if (result != ERR_OK) { - return eventInfo; - } - for (const auto& info : abilityRunningInfos) { - if (info.ability.GetBundleName() == eventInfo.bundleName && - info.ability.GetModuleName() == eventInfo.moduleName && - info.ability.GetAbilityName() == eventInfo.abilityName) { - eventInfo.appIndex = info.appCloneIndex; - } - } - return eventInfo; -} - -EventInfo AbilityManagerService::BuildEventInfoByAbilityRecord(const std::shared_ptr &abilityRecord) -{ - EventInfo eventInfo; - if (abilityRecord == nullptr) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "null abilityRecord"); - return eventInfo; - } - auto want = abilityRecord->GetWant(); - eventInfo.userId = abilityRecord->GetUid() / BASE_USER_RANGE; - eventInfo.bundleName = want.GetElement().GetBundleName(); - eventInfo.moduleName = want.GetElement().GetModuleName(); - eventInfo.abilityName = want.GetElement().GetAbilityName(); - eventInfo.callerBundleName = want.GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME); - eventInfo.bundleType = static_cast(abilityRecord->GetApplicationInfo().bundleType); - eventInfo.appIndex = abilityRecord->GetAppIndex(); return eventInfo; } @@ -7178,10 +7136,6 @@ void AbilityManagerService::OnAbilityRequestDone(const sptr &toke } default: { int32_t ownerUserId = abilityRecord->GetOwnerMissionUserId(); - if (type == AppExecFwk::AbilityType::PAGE) { - auto eventInfo = BuildEventInfoByAbilityRecord(abilityRecord); - SendUIAbilityEvent(eventInfo, state); - } if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { auto uiAbilityManager = GetUIAbilityManagerByUserId(ownerUserId); CHECK_POINTER(uiAbilityManager); @@ -14275,8 +14229,10 @@ void AbilityManagerService::ReportCleanSession(const sptr &sessionI (void)DelayedSingleton::GetInstance()-> DeleteAbilityRecoverInfo(abilityInfo.applicationInfo.accessTokenId, abilityInfo.moduleName, abilityName); - EventInfo eventInfo = BuildEventInfoByAbilityRecord(abilityRecord); + EventInfo eventInfo; eventInfo.errCode = errCode; + eventInfo.bundleName = abilityRecord->GetAbilityInfo().bundleName; + eventInfo.abilityName = abilityRecord->GetAbilityInfo().name; SendAbilityEvent(EventName::CLOSE_ABILITY, HiSysEventType::BEHAVIOR, eventInfo); if (eventInfo.errCode != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "failed to terminate ability: %{public}d", eventInfo.errCode); diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 3aa160cf0ff3e9786876aebec0ee75fcd794cbad..66b0da64e2364694b6034d06a22acb7d30ab20af 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -2085,7 +2085,6 @@ private: const std::shared_ptr &appRecord, const int32_t pid, const int32_t callerUid); int32_t SubmitDfxFaultTask(const FaultData &faultData, const std::string &bundleName, const std::shared_ptr &appRecord, const int32_t pid); - void SendAbilityEvent(const std::shared_ptr &abilityRecord, const AbilityState &state); void AddAbilityStageForSpecified(std::shared_ptr appRecord); void GetKernelPermissions(uint32_t accessTokenId, JITPermissionsMap &permissionsMap); void SendAppSpawnUninstallDebugHapMsg(int32_t userId); diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 3464ff962a930b27fcdaf3d2f0f60a4f15d0fc14..e9d5092b6149c7e083dbed9ed9a673b15b16a7ee 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -312,8 +312,6 @@ constexpr const char* NATIVESPAWN_STARTED = "startup.service.ctl.nativespawn.pid // Max child process number limitation for pc device. constexpr int32_t PC_MAX_CHILD_PROCESS_NUM = 50; constexpr int32_t USER100 = 100; -constexpr const char* LIFE_CYCLE_STATE_START_FOREGROUND = "start foreground"; -constexpr const char* LIFE_CYCLE_STATE_START_BACKGROUND = "start background"; const std::string LARGE_SCREEN = "large_screen"; int32_t GetUserIdByUid(int32_t uid) @@ -3245,9 +3243,6 @@ void AppMgrServiceInner::UpdateAbilityState(const sptr &token, co return; } auto type = abilityRecord->GetAbilityInfo()->type; - if (type == AppExecFwk::AbilityType::PAGE) { - SendAbilityEvent(abilityRecord, state); - } if (type == AppExecFwk::AbilityType::SERVICE && (state == AbilityState::ABILITY_STATE_CREATE || state == AbilityState::ABILITY_STATE_TERMINATED || @@ -10117,44 +10112,6 @@ bool AppMgrServiceInner::IsSpecifiedModuleLoaded(const AAFwk::Want &want, const return moduleRecord->IsLoaded(); } -void AppMgrServiceInner::SendAbilityEvent(const std::shared_ptr &abilityRecord, - const AbilityState &state) -{ - if (abilityRecord == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null abilityRecord"); - return; - } - - auto abilityInfo = abilityRecord->GetAbilityInfo(); - if (abilityInfo == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null abilityInfo"); - return; - } - - auto want = abilityRecord->GetWant(); - if (want == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null want"); - return; - } - - AAFwk::EventInfo eventInfo; - eventInfo.abilityName = abilityRecord->GetName(); - eventInfo.moduleName = abilityRecord->GetModuleName(); - eventInfo.bundleName = abilityRecord->GetBundleName(); - eventInfo.bundleType = static_cast(abilityInfo->applicationInfo.bundleType); - eventInfo.appIndex = abilityInfo->applicationInfo.appIndex; - if (state == AppExecFwk::AbilityState::ABILITY_STATE_FOREGROUND) { - eventInfo.callerBundleName = want->GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME); - eventInfo.lifeCycleState = LIFE_CYCLE_STATE_START_FOREGROUND; - AAFwk::EventReport::SendAbilityEvent(AAFwk::EventName::ABILITY_ONFOREGROUND, - HiSysEventType::BEHAVIOR, eventInfo); - } else if (state == AppExecFwk::AbilityState::ABILITY_STATE_BACKGROUND) { - eventInfo.lifeCycleState = LIFE_CYCLE_STATE_START_BACKGROUND; - AAFwk::EventReport::SendAbilityEvent(AAFwk::EventName::ABILITY_ONBACKGROUND, - HiSysEventType::BEHAVIOR, eventInfo); - } -} - int32_t AppMgrServiceInner::LaunchAbility(sptr token) { auto appRecord = GetAppRunningRecordByAbilityToken(token); diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 09135bb2e5fe14d70a57e81f7948ff2bb91f72e7..4f62d7e60aae41ed2e336708c1c8ba00a6edc4b3 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -50,7 +50,6 @@ struct EventInfo { int32_t preloadMode = 0; int32_t appIndex = -1; int32_t persistentId = 0; - std::string lifeCycleState; uint32_t versionCode = 0; uint32_t callerVersionCode = -1; int64_t time = 0; @@ -169,7 +168,6 @@ private: static void LogAbilityOnForegroundEvent(const std::string &name, HiSysEventType type, const EventInfo &eventInfo); static void LogAbilityOnBackgroundEvent(const std::string &name, HiSysEventType type, const EventInfo &eventInfo); static void LogAbilityOnActiveEvent(const std::string &name, HiSysEventType type, const EventInfo &eventInfo); - static void LogAbilityOnInactiveEvent(const std::string &name, HiSysEventType type, const EventInfo &eventInfo); static void LogStartStandardEvent(const std::string &name, HiSysEventType type, const EventInfo &eventInfo); static void LogStartAbilityByAppLinking(const std::string &name, HiSysEventType type, const EventInfo &eventInfo); static void LogUIExtensionErrorEvent(const std::string &name, HiSysEventType type, const EventInfo &eventInfo); diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index 2ea04fd823e246ecc3a77f401aba197ae067971b..b22b942c38ea393630d93ec6ed1553759cf7b974 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -61,7 +61,6 @@ constexpr const char *EVENT_KEY_REASON = "REASON"; constexpr const char *EVENT_KEY_SUB_REASON = "SUB_REASON"; constexpr const char *INVALID_EVENT_NAME = "INVALIDEVENTNAME"; constexpr const char *EVENT_KEY_APP_INDEX = "APP_INDEX"; -constexpr const char *EVENT_KEY_LIFE_CYCLE_STATE = "LIFE_CYCLE_STATE"; constexpr const char *EVENT_KEY_ERR_REASON = "ERR_REASON"; constexpr const char *EVENT_KEY_LIFE_CYCLE = "LIFE_CYCLE"; constexpr const char *EVENT_KEY_PERSISTENT_ID = "PERSISTENT_ID"; @@ -137,7 +136,6 @@ void EventReport::LogErrorEvent(const std::string &name, HiSysEventType type, co name, type, EVENT_KEY_USERID, eventInfo.userId, - EVENT_KEY_APP_INDEX, eventInfo.appIndex, EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, @@ -166,7 +164,6 @@ void EventReport::LogStartAbilityEvent(const std::string &name, HiSysEventType t name, type, EVENT_KEY_USERID, eventInfo.userId, - EVENT_KEY_APP_INDEX, eventInfo.appIndex, EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); @@ -178,7 +175,6 @@ void EventReport::LogTerminateAbilityEvent(const std::string &name, HiSysEventTy HiSysEvent::Domain::AAFWK, name, type, - EVENT_KEY_APP_INDEX, eventInfo.appIndex, EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); } @@ -189,13 +185,11 @@ void EventReport::LogAbilityOnForegroundEvent(const std::string &name, HiSysEven HiSysEvent::Domain::AAFWK, name, type, - EVENT_KEY_APP_INDEX, eventInfo.appIndex, EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, EVENT_KEY_BUNDLE_TYPE, eventInfo.bundleType, - EVENT_KEY_CALLER_BUNDLE_NAME, eventInfo.callerBundleName, - EVENT_KEY_LIFE_CYCLE_STATE, eventInfo.lifeCycleState); + EVENT_KEY_CALLER_BUNDLE_NAME, eventInfo.callerBundleName); } void EventReport::LogAbilityOnBackgroundEvent(const std::string &name, HiSysEventType type, const EventInfo &eventInfo) @@ -204,12 +198,10 @@ void EventReport::LogAbilityOnBackgroundEvent(const std::string &name, HiSysEven HiSysEvent::Domain::AAFWK, name, type, - EVENT_KEY_APP_INDEX, eventInfo.appIndex, EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, - EVENT_KEY_BUNDLE_TYPE, eventInfo.bundleType, - EVENT_KEY_LIFE_CYCLE_STATE, eventInfo.lifeCycleState); + EVENT_KEY_BUNDLE_TYPE, eventInfo.bundleType); } void EventReport::LogAbilityOnActiveEvent(const std::string &name, HiSysEventType type, const EventInfo &eventInfo) @@ -226,18 +218,6 @@ void EventReport::LogAbilityOnActiveEvent(const std::string &name, HiSysEventTyp EVENT_KEY_CALLER_BUNDLE_NAME, eventInfo.callerBundleName); } -void EventReport::LogAbilityOnInactiveEvent(const std::string &name, HiSysEventType type, const EventInfo &eventInfo) -{ - HiSysEventWrite( - HiSysEvent::Domain::AAFWK, - name, - type, - EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, - EVENT_KEY_MODULE_NAME, eventInfo.moduleName, - EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, - EVENT_KEY_BUNDLE_TYPE, eventInfo.bundleType); -} - void EventReport::LogStartStandardEvent(const std::string &name, HiSysEventType type, const EventInfo &eventInfo) { TAG_LOGD(AAFwkTag::DEFAULT, "EventInfo: [%{public}d, %{public}s, %{public}s, %{public}s]", @@ -348,10 +328,8 @@ void EventReport::SendAbilityEvent(const EventName &eventName, HiSysEventType ty LogAbilityOnForegroundEvent(name, type, eventInfo); break; case EventName::ABILITY_ONBACKGROUND: - LogAbilityOnBackgroundEvent(name, type, eventInfo); - break; case EventName::ABILITY_ONINACTIVE: - LogAbilityOnInactiveEvent(name, type, eventInfo); + LogAbilityOnBackgroundEvent(name, type, eventInfo); break; case EventName::ABILITY_ONACTIVE: LogAbilityOnActiveEvent(name, type, eventInfo);