From 031281008d972a23d9531f034fe659acccac726d Mon Sep 17 00:00:00 2001 From: yuwenze Date: Thu, 10 Nov 2022 02:32:01 +0000 Subject: [PATCH] fixed 92cc0da from https://gitee.com/altay/ability_ability_runtime/pulls/3772 Description:fix pending state Sig:SIG_ApplicationFramework Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: yuwenze Change-Id: I62183c7f47e8e8cb2aa976f76690f666eb5246a2 --- .../abilitymgr/src/ability_manager_service.cpp | 8 ++++++++ services/abilitymgr/src/mission_list_manager.cpp | 14 +++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index a9e199f4f3..16984f461c 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -4643,6 +4643,14 @@ int AbilityManagerService::DoAbilityForeground(const sptr &token, return ERR_WOULD_BLOCK; } + if (abilityRecord->GetPendingState() == AbilityState::FOREGROUND) { + HILOG_DEBUG("pending state is FOREGROUND."); + abilityRecord->SetPendingState(AbilityState::FOREGROUND); + return ERR_OK; + } else { + HILOG_DEBUG("pending state is not FOREGROUND."); + abilityRecord->SetPendingState(AbilityState::FOREGROUND); + } abilityRecord->ProcessForegroundAbility(flag); return ERR_OK; } diff --git a/services/abilitymgr/src/mission_list_manager.cpp b/services/abilitymgr/src/mission_list_manager.cpp index 0132bbd052..2befa79f11 100644 --- a/services/abilitymgr/src/mission_list_manager.cpp +++ b/services/abilitymgr/src/mission_list_manager.cpp @@ -272,11 +272,11 @@ int MissionListManager::StartAbilityLocked(const std::shared_ptr } if (targetAbilityRecord->GetPendingState() == AbilityState::FOREGROUND) { - HILOG_ERROR("pending state is FOREGROUND."); + HILOG_DEBUG("pending state is FOREGROUND."); targetAbilityRecord->SetPendingState(AbilityState::FOREGROUND); - return 0; + return ERR_OK; } else { - HILOG_ERROR("pending state is not FOREGROUND."); + HILOG_DEBUG("pending state is not FOREGROUND."); targetAbilityRecord->SetPendingState(AbilityState::FOREGROUND); } @@ -322,7 +322,7 @@ int MissionListManager::StartAbilityLocked(const std::shared_ptr #else targetAbilityRecord->ProcessForegroundAbility(); #endif - return 0; + return ERR_OK; } static int32_t CallType2StartMethod(int32_t callType) @@ -719,7 +719,7 @@ int MissionListManager::MinimizeAbilityLocked(const std::shared_ptrSetPendingState(AbilityState::BACKGROUND); if (!abilityRecord->IsAbilityState(AbilityState::FOREGROUND)) { - HILOG_ERROR("Minimize ability fail, ability state is invalid, not foregroundnew or foregerounding_new."); + HILOG_ERROR("Fail to minimize ability, ability state is not foreground."); return ERR_OK; } @@ -1054,7 +1054,7 @@ void MissionListManager::CompleteForegroundSuccess(const std::shared_ptrGetPendingState() == AbilityState::FOREGROUND) { - HILOG_ERROR("not continuous startup."); + HILOG_DEBUG("not continuous startup."); abilityRecord->SetPendingState(AbilityState::INITIAL); } } @@ -1115,7 +1115,7 @@ void MissionListManager::CompleteBackground(const std::shared_ptr if (abilityRecord->GetPendingState() == AbilityState::FOREGROUND) { DelayedSingleton::GetInstance()->MoveToForeground(abilityRecord->GetToken()); } else if (abilityRecord->GetPendingState() == AbilityState::BACKGROUND) { - HILOG_ERROR("not continuous startup."); + HILOG_DEBUG("not continuous startup."); abilityRecord->SetPendingState(AbilityState::INITIAL); }