Signed-off-by: xinking129 <xinxin13@huawei.com>
This commit is contained in:
xinking129
2024-03-23 15:50:58 +08:00
parent ade8ff668b
commit d442e88426
6 changed files with 25 additions and 37 deletions
+2 -2
View File
@@ -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}
@@ -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> &abilityRecord, AbilityState state);
int ResolveAbility(const std::shared_ptr<AbilityRecord> &targetAbility, const AbilityRequest &abilityRequest);
std::shared_ptr<AbilityRecord> GetAbilityRecordByName(const AppExecFwk::ElementName &element);
std::shared_ptr<AbilityRecord> GetAbilityRecordByNameFromCurrentMissionLists(const AppExecFwk::ElementName &element) const;
std::shared_ptr<AbilityRecord> GetAbilityRecordByNameFromCurrentMissionLists(
const AppExecFwk::ElementName &element) const;
std::vector<std::shared_ptr<AbilityRecord>> GetAbilityRecordsByName(const AppExecFwk::ElementName &element);
int CallAbilityLocked(const AbilityRequest &abilityRequest);
void UpdateMissionSnapshot(const std::shared_ptr<AbilityRecord> &abilityRecord) const;
@@ -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<AbilityRecord> MissionListManager::GetAbilityRecordByName(const
return defaultSingleList_->GetAbilityRecordByName(element);
}
std::shared_ptr<AbilityRecord> MissionListManager::GetAbilityRecordByNameFromCurrentMissionLists(const AppExecFwk::ElementName &element) const
std::shared_ptr<AbilityRecord> 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<std::shared_ptr<AbilityRecord>> MissionListManager::GetAbilityRecordsByName(
@@ -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);
}
+2 -2
View File
@@ -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 {
+3 -4
View File
@@ -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<EventName, std::string> eventNameToStrMap_ = {
std::map<EventName, std::string>::value_type(EventName::START_PRIVATE_ABILITY, "START_PRIVATE_ABILITY"),
std::map<EventName, std::string>::value_type(EventName::RESTART_PROCESS_BY_SAME_APP,
"RESTART_PROCESS_BY_SAME_APP"),
std::map<EventName, std::string>::value_type(EventName::START_STANDARD_ABILITYS, "START_STANDARD_ABILITYS"),
std::map<EventName, std::string>::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,