!10367 [Bugfix]对拉起方是否为uiability的判断有误

Merge pull request !10367 from 张亚菲/zyf0905
This commit is contained in:
openharmony_ci 2024-09-05 14:16:41 +00:00 committed by Gitee
commit dcef71f98f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -9503,13 +9503,18 @@ bool AbilityManagerService::CheckUIExtensionCallerIsForeground(const AbilityRequ
bool AbilityManagerService::CheckUIExtensionCallerIsUIAbility(const AbilityRequest &abilityRequest)
{
auto callerAbility = Token::GetAbilityRecordByToken(abilityRequest.callerToken);
if (callerAbility == nullptr) {
TAG_LOGE(AAFwkTag::UI_EXT, "caller ability invalid");
return false;
}
if (callerAbility->GetAbilityInfo().type == AppExecFwk::AbilityType::PAGE) {
return true;
}
if (UIExtensionUtils::IsUIExtension(callerAbility->GetAbilityInfo().extensionAbilityType)) {
auto callerability = GetUIExtensionRootCaller(abilityRequest.callerToken, abilityRequest.userId);
if (callerAbility->GetAbilityInfo().type == AppExecFwk::AbilityType::PAGE) {
callerAbility = GetUIExtensionRootCaller(abilityRequest.callerToken, abilityRequest.userId);
if (callerAbility != nullptr && callerAbility->GetAbilityInfo().type == AppExecFwk::AbilityType::PAGE) {
return true;
}
}