disposed enable service block

Signed-off-by: donglin <donglin9@huawei.com>
This commit is contained in:
donglin 2024-10-31 21:40:33 +08:00
parent 66af852ec0
commit da2b7fb994
2 changed files with 1 additions and 19 deletions

View File

@ -45,8 +45,6 @@ private:
ErrCode StartNonBlockRule(const Want &want, AppExecFwk::DisposedRule &disposedRule); ErrCode StartNonBlockRule(const Want &want, AppExecFwk::DisposedRule &disposedRule);
sptr<AppExecFwk::IAppMgr> GetAppMgr(); sptr<AppExecFwk::IAppMgr> GetAppMgr();
ErrCode CreateModalUIExtension(const Want &want, const sptr<IRemoteObject> &callerToken); ErrCode CreateModalUIExtension(const Want &want, const sptr<IRemoteObject> &callerToken);
bool ShouldModalSystemUIExtension(std::shared_ptr<AAFwk::AbilityRecord> abilityRecord,
sptr<IRemoteObject> callerToken);
void SetInterceptInfo(const Want &want, AppExecFwk::DisposedRule &disposedRule); void SetInterceptInfo(const Want &want, AppExecFwk::DisposedRule &disposedRule);
private: private:
std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler_; std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler_;

View File

@ -250,7 +250,7 @@ ErrCode DisposedRuleInterceptor::CreateModalUIExtension(const Want &want, const
{ {
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
auto abilityRecord = Token::GetAbilityRecordByToken(callerToken); auto abilityRecord = Token::GetAbilityRecordByToken(callerToken);
if (abilityRecord == nullptr || ShouldModalSystemUIExtension(abilityRecord, callerToken)) { if (abilityRecord == nullptr || abilityRecord->GetAbilityInfo().type != AppExecFwk::AbilityType::PAGE) {
auto systemUIExtension = std::make_shared<OHOS::Rosen::ModalSystemUiExtension>(); auto systemUIExtension = std::make_shared<OHOS::Rosen::ModalSystemUiExtension>();
(const_cast<Want &>(want)).SetParam(UIEXTENSION_MODAL_TYPE, 1); (const_cast<Want &>(want)).SetParam(UIEXTENSION_MODAL_TYPE, 1);
return IN_PROCESS_CALL(systemUIExtension->CreateModalUIExtension(want)) ? ERR_OK : INNER_ERR; return IN_PROCESS_CALL(systemUIExtension->CreateModalUIExtension(want)) ? ERR_OK : INNER_ERR;
@ -259,22 +259,6 @@ ErrCode DisposedRuleInterceptor::CreateModalUIExtension(const Want &want, const
} }
} }
bool DisposedRuleInterceptor::ShouldModalSystemUIExtension(std::shared_ptr<AAFwk::AbilityRecord> abilityRecord,
sptr<IRemoteObject> callerToken)
{
CHECK_POINTER_AND_RETURN(abilityRecord, true);
if (abilityRecord->GetAbilityInfo().type != AppExecFwk::AbilityType::PAGE) {
return true;
}
sptr<IRemoteObject> topToken = nullptr;
auto ret = IN_PROCESS_CALL(DelayedSingleton<AbilityManagerService>::GetInstance()->GetTopAbility(topToken));
if (ret != ERR_OK) {
TAG_LOGW(AAFwkTag::ABILITYMGR, "GetTopAbility fail:%{public}d", ret);
return true;
}
return topToken != callerToken;
}
void DisposedRuleInterceptor::SetInterceptInfo(const Want &want, AppExecFwk::DisposedRule &disposedRule) void DisposedRuleInterceptor::SetInterceptInfo(const Want &want, AppExecFwk::DisposedRule &disposedRule)
{ {
if (disposedRule.want == nullptr) { if (disposedRule.want == nullptr) {