!11485 在窗口销毁时调用terminateAbilityWithResult,清理ability

Merge pull request !11485 from savior-xzh/terminate
This commit is contained in:
openharmony_ci 2024-11-09 10:54:39 +00:00 committed by Gitee
commit a51fbf199f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -313,12 +313,12 @@ ErrCode AbilityContextImpl::StopServiceExtensionAbility(const AAFwk::Want& want,
ErrCode AbilityContextImpl::TerminateAbilityWithResult(const AAFwk::Want& want, int resultCode)
{
isTerminating_.store(true);
auto sessionToken = GetSessionToken();
if (sessionToken == nullptr) {
TAG_LOGW(AAFwkTag::CONTEXT, "withResult null sessionToken");
}
#ifdef SUPPORT_SCREEN
if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) {
auto sessionToken = GetSessionToken();
if (sessionToken == nullptr) {
return ERR_INVALID_VALUE;
}
if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled() && sessionToken) {
sptr<AAFwk::SessionInfo> info = sptr<AAFwk::SessionInfo>::MakeSptr();
info->want = want;
info->resultCode = resultCode;