From d442e884266eab0638b8db800ffcc221d60e4367 Mon Sep 17 00:00:00 2001 From: xinking129 Date: Sat, 23 Mar 2024 15:50:58 +0800 Subject: [PATCH] hebin Signed-off-by: xinking129 --- hisysevent.yaml | 4 +-- .../abilitymgr/include/mission_list_manager.h | 5 ++-- .../abilitymgr/src/mission_list_manager.cpp | 26 ++++++------------- .../ui_ability_lifecycle_manager.cpp | 16 +++++------- services/common/include/event_report.h | 4 +-- services/common/src/event_report.cpp | 7 +++-- 6 files changed, 25 insertions(+), 37 deletions(-) diff --git a/hisysevent.yaml b/hisysevent.yaml index e1523484ce..f5003c57a3 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -321,7 +321,7 @@ RESTART_PROCESS_BY_SAME_APP: PROCESS_NAME: {type: STRING, desc: process name} BUNDLE_NAME: {type: STRING, desc: bundle name} -START_STANDARD_ABILITYS: +START_STANDARD_ABILITIES: __BASE: {type: BEHAVIOR, level: MINOR, tag: PowerStats, desc: start more than one standard ability} USER_ID: {type: INT32, desc: userId} BUNDLE_NAME: {type: STRING, desc: bundle name} diff --git a/services/abilitymgr/include/mission_list_manager.h b/services/abilitymgr/include/mission_list_manager.h index 9a6b7ee17b..b224f3fe39 100644 --- a/services/abilitymgr/include/mission_list_manager.h +++ b/services/abilitymgr/include/mission_list_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -470,7 +470,8 @@ private: void CompleteForegroundFailed(const std::shared_ptr &abilityRecord, AbilityState state); int ResolveAbility(const std::shared_ptr &targetAbility, const AbilityRequest &abilityRequest); std::shared_ptr GetAbilityRecordByName(const AppExecFwk::ElementName &element); - std::shared_ptr GetAbilityRecordByNameFromCurrentMissionLists(const AppExecFwk::ElementName &element) const; + std::shared_ptr GetAbilityRecordByNameFromCurrentMissionLists( + const AppExecFwk::ElementName &element) const; std::vector> GetAbilityRecordsByName(const AppExecFwk::ElementName &element); int CallAbilityLocked(const AbilityRequest &abilityRequest); void UpdateMissionSnapshot(const std::shared_ptr &abilityRecord) const; diff --git a/services/abilitymgr/src/mission_list_manager.cpp b/services/abilitymgr/src/mission_list_manager.cpp index aa851152e7..9c6429649e 100644 --- a/services/abilitymgr/src/mission_list_manager.cpp +++ b/services/abilitymgr/src/mission_list_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -558,17 +558,16 @@ bool MissionListManager::CreateOrReusedMissionInfo(const AbilityRequest &ability reUsedMissionInfo = true; } HILOG_INFO("result:%{public}d", reUsedMissionInfo); - BuildInnerMissionInfo(info, missionName, abilityRequest); auto abilityRecord = GetAbilityRecordByNameFromCurrentMissionLists(abilityRequest.want.GetElement()); - if(reUsedMissionInfo == false && abilityRecord != nullptr) { + if (reUsedMissionInfo == false && abilityRecord != nullptr) { auto abilityInfo = abilityRequest.abilityInfo; EventInfo eventInfo; eventInfo.userId = abilityRequest.userId; eventInfo.abilityName = abilityInfo.name; eventInfo.bundleName = abilityInfo.bundleName; eventInfo.moduleName = abilityInfo.moduleName; - EventReport::SendAbilityEvent(EventName::START_STANDARD_ABILITYS, HiSysEventType::BEHAVIOR, eventInfo); + EventReport::SendAbilityEvent(EventName::START_STANDARD_ABILITIES, HiSysEventType::BEHAVIOR, eventInfo); } return reUsedMissionInfo; @@ -3234,36 +3233,27 @@ std::shared_ptr MissionListManager::GetAbilityRecordByName(const return defaultSingleList_->GetAbilityRecordByName(element); } -std::shared_ptr MissionListManager::GetAbilityRecordByNameFromCurrentMissionLists(const AppExecFwk::ElementName &element) const +std::shared_ptr MissionListManager::GetAbilityRecordByNameFromCurrentMissionLists( + const AppExecFwk::ElementName &element) const { // find in currentMissionLists_ for (auto missionList : currentMissionLists_) { if (missionList != nullptr) { - HILOG_DEBUG("SXN missionList != nullptr"); auto ability = missionList->GetAbilityRecordByName(element); if (ability != nullptr) { - HILOG_DEBUG("SXN ability != nullptr"); return ability; } - HILOG_DEBUG("SXN ability == nullptr"); } - HILOG_DEBUG("SXN missionList == nullptr"); } + // find in defaultStandardList_ auto defaultStandardAbility = defaultStandardList_->GetAbilityRecordByName(element); if (defaultStandardAbility != nullptr) { return defaultStandardAbility; } - // return nullptr; - - // find in launcherMissionList_ - auto ability = launcherList_->GetAbilityRecordByName(element); - if (ability != nullptr) { - return ability; - } - // find in default singlelist_ - return defaultSingleList_->GetAbilityRecordByName(element); + // find in launcherMissionList_ + return launcherList_->GetAbilityRecordByName(element); } std::vector> MissionListManager::GetAbilityRecordsByName( diff --git a/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp b/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp index 2dee279e8c..a5a5e53c06 100644 --- a/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp +++ b/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -101,25 +101,23 @@ int UIAbilityLifecycleManager::StartUIAbility(AbilityRequest &abilityRequest, sp return ERR_OK; } } + if (iter == sessionAbilityMap_.end()) { - HILOG_DEBUG("sxn StartUIAbility iter == sessionAbilityMap_.end()"); auto abilityInfo = abilityRequest.abilityInfo; - HILOG_DEBUG("sxn StartUIAbility abilityInfo.bundleName: %{public}s", abilityInfo.bundleName.c_str()); - HILOG_DEBUG("sxn StartUIAbility abilityInfo.name: %{public}s", abilityInfo.name.c_str()); for (auto [persistentId, record] : sessionAbilityMap_) { auto recordAbilityInfo = record->GetAbilityInfo(); - HILOG_DEBUG("sxn StartUIAbility recordAbilityInfo.bundleName: %{public}s", recordAbilityInfo.bundleName.c_str()); - HILOG_DEBUG("sxn StartUIAbility recordAbilityInfo.name: %{public}s", recordAbilityInfo.name.c_str()); - if (abilityInfo.bundleName == recordAbilityInfo.bundleName && abilityInfo.name == recordAbilityInfo.name){ + if (abilityInfo.bundleName == recordAbilityInfo.bundleName && abilityInfo.name == recordAbilityInfo.name && + abilityInfo.moduleName == recordAbilityInfo.moduleName) { EventInfo eventInfo; eventInfo.userId = abilityRequest.userId; eventInfo.abilityName = abilityInfo.name; eventInfo.bundleName = abilityInfo.bundleName; eventInfo.moduleName = abilityInfo.moduleName; - EventReport::SendAbilityEvent(EventName::START_STANDARD_ABILITYS, HiSysEventType::BEHAVIOR, eventInfo); + EventReport::SendAbilityEvent( + EventName::START_STANDARD_ABILITIES, HiSysEventType::BEHAVIOR, eventInfo); + break; } } - sessionAbilityMap_.emplace(sessionInfo->persistentId, uiAbilityRecord); } diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 930afb4582..c8d4b91434 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -94,7 +94,7 @@ enum class EventName { FA_SHOW_ON_LOCK, START_PRIVATE_ABILITY, RESTART_PROCESS_BY_SAME_APP, - START_STANDARD_ABILITYS + START_STANDARD_ABILITIES }; class EventReport { diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index 04ad4c51d3..803368b366 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -83,7 +83,7 @@ const std::map eventNameToStrMap_ = { std::map::value_type(EventName::START_PRIVATE_ABILITY, "START_PRIVATE_ABILITY"), std::map::value_type(EventName::RESTART_PROCESS_BY_SAME_APP, "RESTART_PROCESS_BY_SAME_APP"), - std::map::value_type(EventName::START_STANDARD_ABILITYS, "START_STANDARD_ABILITYS"), + std::map::value_type(EventName::START_STANDARD_ABILITIES, "START_STANDARD_ABILITIES"), }; } @@ -286,8 +286,7 @@ void EventReport::SendAbilityEvent(const EventName &eventName, HiSysEventType ty EVENT_KEY_BUNDLE_TYPE, eventInfo.bundleType, EVENT_KEY_CALLER_BUNDLE_NAME, eventInfo.callerBundleName); break; - case EventName::START_STANDARD_ABILITYS: - HILOG_DEBUG("SXN SendAbilityEvent START_STANDARD_ABILITYS"); + case EventName::START_STANDARD_ABILITIES: HiSysEventWrite( HiSysEvent::Domain::AAFWK, name,