From eb85a6b18f66b7630814eaf7773d706436f89f67 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Sat, 26 Feb 2022 14:54:28 +0800 Subject: [PATCH 1/2] Submit ablity multi instance DFX function Signed-off-by: wanchengzhen --- .../abilitymgr/include/mission_list_manager.h | 8 + .../src/ability_manager_service.cpp | 6 +- .../abilitymgr/src/mission_list_manager.cpp | 57 +++++-- services/appmgr/BUILD.gn | 1 + .../include/app_mgr_service_event_handler.h | 6 +- .../appmgr/include/app_mgr_service_inner.h | 4 +- services/appmgr/include/app_running_record.h | 1 + services/appmgr/src/app_mgr_service_inner.cpp | 151 ++++++++++++++++-- services/appmgr/src/app_running_record.cpp | 26 ++- .../ams_ability_running_record_test/BUILD.gn | 1 + .../ams_app_death_recipient_test/BUILD.gn | 1 + .../unittest/ams_app_life_cycle_test/BUILD.gn | 1 + .../ams_app_running_record_test/BUILD.gn | 1 + .../unittest/ams_app_workflow_test/BUILD.gn | 1 + .../ams_recent_app_list_test/BUILD.gn | 1 + .../BUILD.gn | 1 + .../ams_service_event_drive_test/BUILD.gn | 1 + .../BUILD.gn | 1 + .../ams_service_startup_test/BUILD.gn | 1 + .../BUILD.gn | 1 + services/test/moduletest/common/ams/BUILD.gn | 1 + 21 files changed, 240 insertions(+), 32 deletions(-) diff --git a/services/abilitymgr/include/mission_list_manager.h b/services/abilitymgr/include/mission_list_manager.h index 00e9b20baee..9c224d7a8eb 100644 --- a/services/abilitymgr/include/mission_list_manager.h +++ b/services/abilitymgr/include/mission_list_manager.h @@ -99,6 +99,13 @@ public: */ void EnqueueWaittingAbility(const AbilityRequest &abilityRequest); + /** + * push front waitting ability to queue. + * + * @param abilityRequest, the request of ability. + */ + void EnqueueWaittingAbilityToFront(const AbilityRequest &abilityRequest); + /** * start waitting ability. */ @@ -293,6 +300,7 @@ public: void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag); + void OnStartSpecifiedAbilityTimeoutResponse(const AAFwk::Want &want); /** * resolve the call ipc of ability for schudeling oncall. * diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 742d682aef5..97162560ef0 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -3662,7 +3662,11 @@ void AbilityManagerService::OnAcceptWantResponse( void AbilityManagerService::OnStartSpecifiedAbilityTimeoutResponse(const AAFwk::Want &want) { - return; + HILOG_DEBUG("%{public}s called.", __func__); + if (!currentMissionListManager_) { + return; + } + currentMissionListManager_->OnStartSpecifiedAbilityTimeoutResponse(want); } int AbilityManagerService::GetAbilityRunningInfos(std::vector &info) diff --git a/services/abilitymgr/src/mission_list_manager.cpp b/services/abilitymgr/src/mission_list_manager.cpp index 0883b317598..3cc10f0bd15 100644 --- a/services/abilitymgr/src/mission_list_manager.cpp +++ b/services/abilitymgr/src/mission_list_manager.cpp @@ -91,7 +91,7 @@ int MissionListManager::StartAbility(const std::shared_ptr &curre { auto isSpecified = (abilityRequest.abilityInfo.launchMode == AppExecFwk::LaunchMode::SPECIFIED); if (isSpecified) { - EnqueueWaittingAbility(abilityRequest); + EnqueueWaittingAbilityToFront(abilityRequest); DelayedSingleton::GetInstance()->StartSpecifiedAbility( abilityRequest.want, abilityRequest.abilityInfo); return 0; @@ -202,6 +202,19 @@ void MissionListManager::EnqueueWaittingAbility(const AbilityRequest &abilityReq return; } +void MissionListManager::EnqueueWaittingAbilityToFront(const AbilityRequest &abilityRequest) +{ + std::lock_guard guard(managerLock_); + std::queue abilityQueue; + abilityQueue.push(abilityRequest); + waittingAbilityQueue_.swap(abilityQueue); + while (!abilityQueue.empty()) { + AbilityRequest tempAbilityRequest = abilityQueue.front(); + abilityQueue.pop(); + waittingAbilityQueue_.push(tempAbilityRequest); + } +} + void MissionListManager::StartWaittingAbility() { std::lock_guard guard(managerLock_); @@ -2072,24 +2085,46 @@ void MissionListManager::OnAcceptWantResponse(const AAFwk::Want &want, const std auto currentTopAbility = GetCurrentTopAbilityLocked(); auto callerAbility = GetAbilityRecordByToken(abilityRequest.callerToken); - auto mission = GetMissionBySpecifiedFlag(flag); - if (mission) { - auto ability = mission->GetAbilityRecord(); - if (!ability) { + if (!flag.empty()) { + auto mission = GetMissionBySpecifiedFlag(flag); + if (mission) { + auto ability = mission->GetAbilityRecord(); + if (!ability) { + return; + } + ability->SetWant(abilityRequest.want); + ability->SetIsNewWant(true); + + auto isCallerFromLauncher = (callerAbility && callerAbility->IsLauncherAbility()); + MoveMissionToFront(mission->GetMissionId(), isCallerFromLauncher); return; } - ability->SetWant(abilityRequest.want); - ability->SetIsNewWant(true); - - auto isCallerFromLauncher = (callerAbility && callerAbility->IsLauncherAbility()); - MoveMissionToFront(mission->GetMissionId(), isCallerFromLauncher); - return; } abilityRequest.specifiedFlag = flag; StartAbilityLocked(currentTopAbility, callerAbility, abilityRequest); } +void MissionListManager::OnStartSpecifiedAbilityTimeoutResponse(const AAFwk::Want &want) +{ + HILOG_DEBUG("%{public}s called.", __func__); + std::lock_guard guard(managerLock_); + if (waittingAbilityQueue_.empty()) { + return; + } + waittingAbilityQueue_.pop(); + + if (waittingAbilityQueue_.empty()) { + return; + } + AbilityRequest abilityRequest = waittingAbilityQueue_.front(); + waittingAbilityQueue_.pop(); + + auto currentTopAbility = GetCurrentTopAbilityLocked(); + auto callerAbility = GetAbilityRecordByToken(abilityRequest.callerToken); + StartAbility(currentTopAbility, callerAbility, abilityRequest); +} + std::shared_ptr MissionListManager::GetMissionBySpecifiedFlag(const std::string &flag) const { std::shared_ptr mission = nullptr; diff --git a/services/appmgr/BUILD.gn b/services/appmgr/BUILD.gn index 0ef3e87b239..5712d87b74b 100644 --- a/services/appmgr/BUILD.gn +++ b/services/appmgr/BUILD.gn @@ -132,6 +132,7 @@ ohos_shared_library("libams") { "bytrace_standard:bytrace_core", "ces_standard:cesfwk_core", "ces_standard:cesfwk_innerkits", + "hisysevent_native:libhisysevent", "hicollie_native:libhicollie", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/services/appmgr/include/app_mgr_service_event_handler.h b/services/appmgr/include/app_mgr_service_event_handler.h index 4ae9f1a416f..aa56fe625d5 100644 --- a/services/appmgr/include/app_mgr_service_event_handler.h +++ b/services/appmgr/include/app_mgr_service_event_handler.h @@ -32,11 +32,13 @@ public: static constexpr uint32_t TERMINATE_ABILITY_TIMEOUT_MSG = 0; static constexpr uint32_t TERMINATE_APPLICATION_TIMEOUT_MSG = 1; static constexpr uint32_t ADD_ABILITY_STAGE_INFO_TIMEOUT_MSG = 2; - static constexpr uint32_t START_MULTI_INSTANCES_ABILITY_MSG = 3; + static constexpr uint32_t START_SPECIFIED_ABILITY_TIMEOUT_MSG = 3; + static constexpr uint32_t START_PROCESS_SPECIFIED_ABILITY_TIMEOUT_MSG = 4; static constexpr uint32_t TERMINATE_ABILITY_TIMEOUT = 500; static constexpr uint32_t TERMINATE_APPLICATION_TIMEOUT = 500; static constexpr uint32_t ADD_ABILITY_STAGE_INFO_TIMEOUT = 3000; // ms - static constexpr uint32_t START_MULTI_INSTANCES_ABILITY_TIMEOUT = 3000; // ms + static constexpr uint32_t START_SPECIFIED_ABILITY_TIMEOUT = 3000; // ms + static constexpr uint32_t START_PROCESS_SPECIFIED_ABILITY_TIMEOUT = 5000; // ms private: std::weak_ptr appMgr_; }; diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index d498c3b1a23..9f5233a8bfe 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -50,7 +50,6 @@ namespace OHOS { namespace AppExecFwk { using OHOS::AAFwk::Want; - class AppMgrServiceInner : public std::enable_shared_from_this { public: AppMgrServiceInner(); @@ -794,7 +793,8 @@ private: * @return */ void NotifyAppStatus(const std::string &bundleName, const std::string &eventData); - + void KillApplicationByRecord(const std::shared_ptr &appRecord); + void SendHiSysEvent(const int32_t innerEventId, const int64_t eventId); const std::string TASK_ON_CALLBACK_DIED = "OnCallbackDiedTask"; std::vector> appStateObservers_; std::map, sptr> recipientMap_; diff --git a/services/appmgr/include/app_running_record.h b/services/appmgr/include/app_running_record.h index 759010ff9bf..7d0ebcf9597 100644 --- a/services/appmgr/include/app_running_record.h +++ b/services/appmgr/include/app_running_record.h @@ -491,6 +491,7 @@ public: void SetStartMsg(const AppSpawnStartMsg &msg); AppSpawnStartMsg GetStartMsg(); + void SendEventForSpecifiedAbility(uint32_t msg, int64_t timeOut); private: /** * SearchTheModuleInfoNeedToUpdated, Get an uninitialized abilitystage data. diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 61b4b47c902..7aa59ae650d 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -31,6 +31,7 @@ #include "common_event.h" #include "common_event_manager.h" #include "common_event_support.h" +#include "hisysevent.h" #include "iremote_object.h" #include "iservice_registry.h" #include "ipc_skeleton.h" @@ -42,6 +43,7 @@ #include "locale_config.h" #include "uri_permission_manager_client.h" + namespace OHOS { namespace AppExecFwk { using namespace OHOS::Security; @@ -69,6 +71,21 @@ constexpr int32_t BASE_USER_RANGE = 200000; constexpr ErrCode APPMGR_ERR_OFFSET = ErrCodeOffset(SUBSYS_APPEXECFWK, 0x01); constexpr ErrCode ERR_ALREADY_EXIST_RENDER = APPMGR_ERR_OFFSET + 100; // error code for already exist render. +const std::string EVENT_NAME_LIFECYCLE_TIMEOUT = "LIFECYCLE_TIMEOUT"; +constexpr char EVENT_KEY_UID[] = "UID"; +constexpr char EVENT_KEY_PID[] = "PID"; +constexpr char EVENT_KEY_PACKAGE_NAME[] = "PACKAGE_NAME"; +constexpr char EVENT_KEY_PROCESS_NAME[] = "PROCESS_NAME"; +constexpr char EVENT_KEY_MESSAGE[] = "MSG"; + +// Msg length is less than 48 characters +const std::string EVENT_MESSAGE_TERMINATE_ABILITY_TIMEOUT = "Terminate Ability TimeOut!"; +const std::string EVENT_MESSAGE_TERMINATE_APPLICATION_TIMEOUT = "Terminate Application TimeOut!"; +const std::string EVENT_MESSAGE_ADD_ABILITY_STAGE_INFO_TIMEOUT = "Add Ability Stage TimeOut!"; +const std::string EVENT_MESSAGE_START_SPECIFIED_ABILITY_TIMEOUT = "Start Specified Ability TimeOut!"; +const std::string EVENT_MESSAGE_START_PROCESS_SPECIFIED_ABILITY_TIMEOUT = "Start Process Specified Ability TimeOut!"; +const std::string EVENT_MESSAGE_DEFAULT = "AppMgrServiceInner HandleTimeOut!"; + int32_t GetUserIdByUid(int32_t uid) { @@ -1597,6 +1614,7 @@ void AppMgrServiceInner::HandleTimeOut(const InnerEvent::Pointer &event) APP_LOGE("appRunningManager or event is nullptr"); return; } + SendHiSysEvent(event->GetInnerEventId(), event->GetParam()); switch (event->GetInnerEventId()) { case AMSEventHandler::TERMINATE_ABILITY_TIMEOUT_MSG: appRunningManager_->HandleTerminateTimeOut(event->GetParam()); @@ -1604,10 +1622,11 @@ void AppMgrServiceInner::HandleTimeOut(const InnerEvent::Pointer &event) case AMSEventHandler::TERMINATE_APPLICATION_TIMEOUT_MSG: HandleTerminateApplicationTimeOut(event->GetParam()); break; + case AMSEventHandler::START_PROCESS_SPECIFIED_ABILITY_TIMEOUT_MSG: case AMSEventHandler::ADD_ABILITY_STAGE_INFO_TIMEOUT_MSG: HandleAddAbilityStageTimeOut(event->GetParam()); break; - case AMSEventHandler::START_MULTI_INSTANCES_ABILITY_MSG: + case AMSEventHandler::START_SPECIFIED_ABILITY_TIMEOUT_MSG: HandleStartSpecifiedAbilityTimeOut(event->GetParam()); break; default: @@ -1653,6 +1672,12 @@ void AppMgrServiceInner::HandleTerminateApplicationTimeOut(const int64_t eventId APP_LOGE("appRecord is nullptr"); return; } + + auto abilityRecord = appRecord->GetAbilityRunningRecord(eventId); + if (!abilityRecord) { + APP_LOGE("abilityRecord is nullptr"); + return; + } appRecord->SetState(ApplicationState::APP_STATE_TERMINATED); OptimizerAppStateChanged(appRecord, ApplicationState::APP_STATE_BACKGROUND); appRecord->RemoveAppDeathRecipient(); @@ -1683,15 +1708,11 @@ void AppMgrServiceInner::HandleAddAbilityStageTimeOut(const int64_t eventId) return; } - appRecord->SetState(ApplicationState::APP_STATE_TERMINATED); - appRecord->RemoveAppDeathRecipient(); - pid_t pid = appRecord->GetPriorityObject()->GetPid(); - KillProcessByPid(pid); - appRunningManager_->RemoveAppRunningRecordById(appRecord->GetRecordId()); + if (appRecord->IsStartSpecifiedAbility() && startSpecifiedAbilityResponse_) { + startSpecifiedAbilityResponse_->OnTimeoutResponse(appRecord->GetSpecifiedWant()); + } - OptimizerAppStateChanged(appRecord, ApplicationState::APP_STATE_TERMINATED); - RemoveAppFromRecentListById(appRecord->GetRecordId()); - OnProcessDied(appRecord); + KillApplicationByRecord(appRecord); } int AppMgrServiceInner::CompelVerifyPermission(const std::string &permission, int pid, int uid, std::string &message) @@ -2157,10 +2178,11 @@ void AppMgrServiceInner::StartSpecifiedAbility(const AAFwk::Want &want, const Ap APP_LOGE("start process [%{public}s] failed!", processName.c_str()); return; } - + appRecord->SetEventHandler(eventHandler_); + appRecord->SendEventForSpecifiedAbility(AMSEventHandler::START_PROCESS_SPECIFIED_ABILITY_TIMEOUT_MSG, + AMSEventHandler::START_PROCESS_SPECIFIED_ABILITY_TIMEOUT); StartProcess(appInfo->name, processName, appRecord, appInfo->uid, appInfo->bundleName); - appRecord->SetEventHandler(eventHandler_); appRecord->SetSpecifiedAbilityFlagAndWant(true, want, hapModuleInfo.moduleName); appRecord->AddModules(appInfo, hapModules); } else { @@ -2213,7 +2235,25 @@ void AppMgrServiceInner::ScheduleAcceptWantDone( } void AppMgrServiceInner::HandleStartSpecifiedAbilityTimeOut(const int64_t eventId) -{} +{ + APP_LOGD("called start specified ability time out!"); + if (!appRunningManager_) { + APP_LOGE("appRunningManager_ is nullptr"); + return; + } + + auto appRecord = appRunningManager_->GetAppRunningRecord(eventId); + if (!appRecord) { + APP_LOGE("appRecord is nullptr"); + return; + } + + if (appRecord->IsStartSpecifiedAbility() && startSpecifiedAbilityResponse_) { + startSpecifiedAbilityResponse_->OnTimeoutResponse(appRecord->GetSpecifiedWant()); + } + + KillApplicationByRecord(appRecord); +} void AppMgrServiceInner::UpdateConfiguration(const Configuration &config) { @@ -2264,6 +2304,93 @@ std::shared_ptr AppMgrServiceInner::GetConfiguration( return configuration_; } +void AppMgrServiceInner::KillApplicationByRecord(const std::shared_ptr &appRecord) +{ + APP_LOGD("Kill application by appRecord."); + + if (!appRecord) { + APP_LOGD("appRecord is nullptr."); + return; + } + + auto pid = appRecord->GetPriorityObject()->GetPid(); + appRecord->SetTerminating(); + appRecord->ScheduleProcessSecurityExit(); + + auto startTime = SystemTimeMillis(); + std::list pids = {pid}; + if (WaitForRemoteProcessExit(pids, startTime)) { + APP_LOGD("The remote process exited successfully"); + return; + } + + auto result = KillProcessByPid(pid); + if (result < 0) { + APP_LOGE("Kill application by app record, pid: %{public}d", pid); + } +} + +void AppMgrServiceInner::SendHiSysEvent(const int32_t innerEventId, const int64_t eventId) +{ + APP_LOGD("called AppMgrServiceInner SendHiSysEvent!"); + if (!appRunningManager_) { + APP_LOGE("appRunningManager_ is nullptr"); + return; + } + + auto appRecord = appRunningManager_->GetAppRunningRecord(eventId); + if (!appRecord) { + APP_LOGE("appRecord is nullptr"); + return; + } + + std::string eventName = EVENT_NAME_LIFECYCLE_TIMEOUT; + std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + std::string uidStr = std::to_string(appRecord->GetUid()); + std::string packageName = appRecord->GetBundleName(); + std::string processName = appRecord->GetProcessName(); + std::string msg; + switch (innerEventId) { + case AMSEventHandler::TERMINATE_ABILITY_TIMEOUT_MSG: + msg = EVENT_MESSAGE_TERMINATE_ABILITY_TIMEOUT; + break; + case AMSEventHandler::TERMINATE_APPLICATION_TIMEOUT_MSG: + msg = EVENT_MESSAGE_TERMINATE_APPLICATION_TIMEOUT; + break; + case AMSEventHandler::ADD_ABILITY_STAGE_INFO_TIMEOUT_MSG: + msg = EVENT_MESSAGE_ADD_ABILITY_STAGE_INFO_TIMEOUT; + break; + case AMSEventHandler::START_PROCESS_SPECIFIED_ABILITY_TIMEOUT_MSG: + msg = EVENT_MESSAGE_START_PROCESS_SPECIFIED_ABILITY_TIMEOUT; + break; + case AMSEventHandler::START_SPECIFIED_ABILITY_TIMEOUT_MSG: + msg = EVENT_MESSAGE_START_SPECIFIED_ABILITY_TIMEOUT; + break; + default: + msg = EVENT_MESSAGE_DEFAULT; + break; + } + + APP_LOGD("SendHiSysEvent, eventName=%{public}s, uidStr=%{public}s, pidStr=%{public}s, \ + packageName=%{public}s, processName=%{public}s, msg=%{public}s", + eventName.c_str(), + uidStr.c_str(), + pidStr.c_str(), + packageName.c_str(), + processName.c_str(), + msg.c_str()); + + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + EVENT_KEY_PID, pidStr, + EVENT_KEY_UID, uidStr, + EVENT_KEY_PACKAGE_NAME, packageName, + EVENT_KEY_PROCESS_NAME, processName, + EVENT_KEY_MESSAGE, msg); +} + int AppMgrServiceInner::GetAbilityRecordsByProcessID(const int pid, std::vector> &tokens) { auto appRecord = GetAppRunningRecordByPid(pid); diff --git a/services/appmgr/src/app_running_record.cpp b/services/appmgr/src/app_running_record.cpp index fceaaec9b47..9616dc2bebc 100644 --- a/services/appmgr/src/app_running_record.cpp +++ b/services/appmgr/src/app_running_record.cpp @@ -360,7 +360,12 @@ void AppRunningRecord::AddAbilityStageBySpecifiedAbility(const std::string &bund { HapModuleInfo hapModuleInfo; if (GetTheModuleInfoNeedToUpdated(bundleName, hapModuleInfo)) { - SendEvent(AMSEventHandler::ADD_ABILITY_STAGE_INFO_TIMEOUT_MSG, AMSEventHandler::ADD_ABILITY_STAGE_INFO_TIMEOUT); + if (!eventHandler_->HasInnerEvent(AMSEventHandler::START_PROCESS_SPECIFIED_ABILITY_TIMEOUT_MSG)) { + SendEvent(AMSEventHandler::ADD_ABILITY_STAGE_INFO_TIMEOUT_MSG, + AMSEventHandler::ADD_ABILITY_STAGE_INFO_TIMEOUT); + } else { + APP_LOGI("%{public}s START_PROCESS_SPECIFIED_ABILITY_TIMEOUT_MSG is exist, don't set new event.", __func__); + } appLifeCycleDeal_->AddAbilityStage(hapModuleInfo); } } @@ -369,7 +374,13 @@ void AppRunningRecord::AddAbilityStageDone() { APP_LOGI("Add ability stage done. bundle %{public}s and eventId %{public}d", mainBundleName_.c_str(), static_cast(eventId_)); - eventHandler_->RemoveEvent(AMSEventHandler::ADD_ABILITY_STAGE_INFO_TIMEOUT_MSG, eventId_); + if (eventHandler_->HasInnerEvent(AMSEventHandler::START_PROCESS_SPECIFIED_ABILITY_TIMEOUT_MSG)) { + eventHandler_->RemoveEvent(AMSEventHandler::START_PROCESS_SPECIFIED_ABILITY_TIMEOUT_MSG); + } + + if (eventHandler_->HasInnerEvent(AMSEventHandler::ADD_ABILITY_STAGE_INFO_TIMEOUT_MSG)) { + eventHandler_->RemoveEvent(AMSEventHandler::ADD_ABILITY_STAGE_INFO_TIMEOUT_MSG); + } // Should proceed to the next notification if (isSpecifiedAbility_) { @@ -834,6 +845,11 @@ std::shared_ptr AppRunningRecord::GetPriorityObject() return priorityObject_; } +void AppRunningRecord::SendEventForSpecifiedAbility(uint32_t msg, int64_t timeOut) +{ + SendEvent(msg, timeOut); +} + void AppRunningRecord::SendEvent(uint32_t msg, int64_t timeOut) { if (!eventHandler_) { @@ -971,13 +987,15 @@ bool AppRunningRecord::IsStartSpecifiedAbility() const void AppRunningRecord::ScheduleAcceptWant(const std::string &moduleName) { SendEvent( - AMSEventHandler::START_MULTI_INSTANCES_ABILITY_MSG, AMSEventHandler::START_MULTI_INSTANCES_ABILITY_TIMEOUT); + AMSEventHandler::START_SPECIFIED_ABILITY_TIMEOUT_MSG, AMSEventHandler::START_SPECIFIED_ABILITY_TIMEOUT); appLifeCycleDeal_->ScheduleAcceptWant(SpecifiedWant_, moduleName); } void AppRunningRecord::ScheduleAcceptWantDone() { - eventHandler_->RemoveEvent(AMSEventHandler::START_MULTI_INSTANCES_ABILITY_MSG, appRecordId_); + APP_LOGI("Schedule accept want done. bundle %{public}s and eventId %{public}d", mainBundleName_.c_str(), + static_cast(eventId_)); + eventHandler_->RemoveEvent(AMSEventHandler::START_SPECIFIED_ABILITY_TIMEOUT_MSG, eventId_); } const AAFwk::Want &AppRunningRecord::GetSpecifiedWant() const diff --git a/services/appmgr/test/unittest/ams_ability_running_record_test/BUILD.gn b/services/appmgr/test/unittest/ams_ability_running_record_test/BUILD.gn index da2dfe6863f..2248c31b4c6 100644 --- a/services/appmgr/test/unittest/ams_ability_running_record_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_ability_running_record_test/BUILD.gn @@ -66,6 +66,7 @@ ohos_unittest("AmsAbilityRunningRecordTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn b/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn index dc221c935c3..e951dbe7c68 100644 --- a/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn @@ -74,6 +74,7 @@ ohos_unittest("AppDeathRecipientTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/test/unittest/ams_app_life_cycle_test/BUILD.gn b/services/appmgr/test/unittest/ams_app_life_cycle_test/BUILD.gn index 1554bc6a973..904b061dd96 100644 --- a/services/appmgr/test/unittest/ams_app_life_cycle_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_app_life_cycle_test/BUILD.gn @@ -72,6 +72,7 @@ ohos_unittest("AmsAppLifeCycleTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/test/unittest/ams_app_running_record_test/BUILD.gn b/services/appmgr/test/unittest/ams_app_running_record_test/BUILD.gn index 82442b11ca1..868a72d1c83 100644 --- a/services/appmgr/test/unittest/ams_app_running_record_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_app_running_record_test/BUILD.gn @@ -63,6 +63,7 @@ ohos_unittest("AmsAppRunningRecordTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn b/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn index 254ac523d03..5661ddcbfb7 100644 --- a/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn @@ -69,6 +69,7 @@ ohos_unittest("AmsWorkFlowTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn b/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn index 49ef60e977f..297d94e81e9 100644 --- a/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn @@ -70,6 +70,7 @@ ohos_unittest("AmsRecentAppListTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn index 477e6e2c17c..0013352c2a0 100644 --- a/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn @@ -66,6 +66,7 @@ ohos_unittest("AmsServiceAppSpawnClientTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn index 4c7f3d6470d..f0f315d9d92 100644 --- a/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn @@ -68,6 +68,7 @@ ohos_unittest("AmsServiceEventDriveTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn index 18c0cf797af..166feb363e3 100644 --- a/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn @@ -74,6 +74,7 @@ ohos_unittest("AmsServiceLoadAbilityProcessTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn index d34b4169490..181bd79b898 100644 --- a/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn @@ -65,6 +65,7 @@ ohos_unittest("AmsServiceStartupTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn b/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn index 635e47a975f..7fc5e9e0c5f 100644 --- a/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn +++ b/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn @@ -74,6 +74,7 @@ ohos_unittest("AMSEventHandlerTest") { external_deps = [ "appspawn:appspawn_socket_client", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/test/moduletest/common/ams/BUILD.gn b/services/test/moduletest/common/ams/BUILD.gn index 571d3de69b9..704ad3dcb3f 100755 --- a/services/test/moduletest/common/ams/BUILD.gn +++ b/services/test/moduletest/common/ams/BUILD.gn @@ -96,6 +96,7 @@ ohos_source_set("appmgr_mst_source") { "bytrace_standard:bytrace_core", "ces_standard:cesfwk_core", "ces_standard:cesfwk_innerkits", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] -- Gitee From e8e485759ca02cafe640ea4c8e670ce75ab1b2d3 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Sat, 26 Feb 2022 15:30:10 +0800 Subject: [PATCH 2/2] format gn Signed-off-by: wanchengzhen --- services/appmgr/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/appmgr/BUILD.gn b/services/appmgr/BUILD.gn index 5712d87b74b..724f220ced8 100644 --- a/services/appmgr/BUILD.gn +++ b/services/appmgr/BUILD.gn @@ -132,8 +132,8 @@ ohos_shared_library("libams") { "bytrace_standard:bytrace_core", "ces_standard:cesfwk_core", "ces_standard:cesfwk_innerkits", - "hisysevent_native:libhisysevent", "hicollie_native:libhicollie", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] -- Gitee