From dc8a82b759e1609b9161a7adfec98e1fd03901c6 Mon Sep 17 00:00:00 2001 From: yangxuguang-huawei Date: Thu, 21 Nov 2024 17:12:29 +0800 Subject: [PATCH] bugfix: start ability in hidden mode goes onForeground Signed-off-by: yangxuguang-huawei Change-Id: If0158fed8f9088c60ce786829fc5ae1543b260c4 --- frameworks/native/ability/native/ui_ability_impl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/native/ability/native/ui_ability_impl.cpp b/frameworks/native/ability/native/ui_ability_impl.cpp index cc6c528ea3..4e57d39015 100644 --- a/frameworks/native/ability/native/ui_ability_impl.cpp +++ b/frameworks/native/ability/native/ui_ability_impl.cpp @@ -366,7 +366,8 @@ void UIAbilityImpl::UpdateSilentForeground(const AAFwk::LifeCycleStateInfo &targ } if (lifecycleState_ == AAFwk::ABILITY_STATE_INITIAL && sessionInfo && sessionInfo->processOptions && - AAFwk::ProcessOptions::IsValidProcessMode(sessionInfo->processOptions->processMode) && + (sessionInfo->processOptions->isRestartKeepAlive + || AAFwk::ProcessOptions::IsValidProcessMode(sessionInfo->processOptions->processMode)) && sessionInfo->processOptions->startupVisibility == AAFwk::StartupVisibility::STARTUP_HIDE) { TAG_LOGI(AAFwkTag::UIABILITY, "set IsSilentForeground to true"); ability_->SetIsSilentForeground(true);