!11676 ChangeUIAbilityVisibilityBySCB补充pending状态的判断

Merge pull request !11676 from gongyuechen/master
This commit is contained in:
openharmony_ci 2024-11-20 11:31:39 +00:00 committed by Gitee
commit b57df00fa0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1470,7 +1470,6 @@ void UIAbilityLifecycleManager::DelayCompleteTerminate(const std::shared_ptr<Abi
void UIAbilityLifecycleManager::CompleteTerminate(const std::shared_ptr<AbilityRecord> &abilityRecord)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
CHECK_POINTER(abilityRecord);
std::lock_guard<ffrt::mutex> guard(sessionLock_);
CompleteTerminateLocked(abilityRecord);
@ -1478,9 +1477,7 @@ void UIAbilityLifecycleManager::CompleteTerminate(const std::shared_ptr<AbilityR
void UIAbilityLifecycleManager::CompleteTerminateLocked(const std::shared_ptr<AbilityRecord> &abilityRecord)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
CHECK_POINTER(abilityRecord);
if (abilityRecord->GetAbilityState() != AbilityState::TERMINATING) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "failed, %{public}s, ability not terminating", __func__);
return;
@ -2721,6 +2718,14 @@ int UIAbilityLifecycleManager::ChangeUIAbilityVisibilityBySCB(sptr<SessionInfo>
if (isShow) {
uiAbilityRecord->SetAbilityVisibilityState(AbilityVisibilityState::FOREGROUND_SHOW);
#ifdef SUPPORT_SCREEN
if (uiAbilityRecord->GetPendingState() != AbilityState::INITIAL) {
TAG_LOGI(AAFwkTag::ABILITYMGR, "pending state: FOREGROUND/ BACKGROUND, dropped");
uiAbilityRecord->SetPendingState(AbilityState::FOREGROUND);
return ERR_OK;
} else {
TAG_LOGD(AAFwkTag::ABILITYMGR, "pending state is not FOREGROUND or BACKGROUND.");
uiAbilityRecord->SetPendingState(AbilityState::FOREGROUND);
}
uiAbilityRecord->ProcessForegroundAbility(sessionInfo->callingTokenId);
#endif // SUPPORT_SCREEN
} else {