!1148 内源问题修复

Merge pull request !1148 from jerry/master
This commit is contained in:
openharmony_ci 2022-03-11 07:52:59 +00:00 committed by Gitee
commit 15b305a747
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 20 additions and 12 deletions

View File

@ -71,11 +71,11 @@ ErrCode TaskExecutor::DoWorks(const std::shared_ptr<WorkerThread> &worker)
while (((task != nullptr && done == false) || ((task = GetTask(worker)) != nullptr))) {
HILOG_INFO("TaskExecutor::DoWorks loop tasks.");
BeforeRun(task);
task->Run();
AfterRun(task);
if (task) {
BeforeRun(task);
task->Run();
AfterRun(task);
}
worker->IncTaskCount();
IncrementAndGet(taskCounter_);

View File

@ -1600,6 +1600,10 @@ std::shared_ptr<AbilityRuntime::AbilityContext> AbilityThread::BuildAbilityConte
void AbilityThread::DumpAbilityInfo(const std::vector<std::string> &params, std::vector<std::string> &info)
{
HILOG_INFO("%{public}s begin.", __func__);
if (!currentAbility_) {
HILOG_ERROR("currentAbility is nullptr.");
return;
}
if (!params.empty()) {
if (abilityImpl_->IsStageBasedModel()) {
auto scene = currentAbility_->GetScene();
@ -1636,11 +1640,6 @@ void AbilityThread::DumpAbilityInfo(const std::vector<std::string> &params, std:
runner->DumpRunnerInfo(dumpInfo);
info.push_back(dumpInfo);
if (!currentAbility_) {
HILOG_INFO("currentAbility is nullptr.");
return;
}
const auto ablityContext = currentAbility_->GetAbilityContext();
if (!ablityContext) {
HILOG_INFO("current ability context is nullptr.");
@ -1664,7 +1663,7 @@ sptr<IRemoteObject> AbilityThread::CallRequest()
HILOG_INFO("AbilityThread::CallRequest begin");
if (!currentAbility_) {
HILOG_INFO("ability is nullptr.");
HILOG_ERROR("ability is nullptr.");
return nullptr;
}

View File

@ -2579,10 +2579,19 @@ int AbilityManagerService::GenerateAbilityRequest(
AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_METADATA);
HILOG_DEBUG("%{public}s, QueryAbilityInfo, userId is %{public}d", __func__, userId);
IN_PROCESS_CALL_WITHOUT_RET(bms->QueryAbilityInfo(want, abilityInfoFlag, userId, request.abilityInfo));
if (request.abilityInfo.name.empty() || request.abilityInfo.bundleName.empty()) {
HILOG_WARN("%{public}s, QueryAbilityInfo again, userId is 0", __func__);
IN_PROCESS_CALL_WITHOUT_RET(bms->QueryAbilityInfo(want, abilityInfoFlag, U0_USER_ID, request.abilityInfo));
}
if (request.abilityInfo.name.empty() || request.abilityInfo.bundleName.empty()) {
// try to find extension
std::vector<AppExecFwk::ExtensionAbilityInfo> extensionInfos;
IN_PROCESS_CALL_WITHOUT_RET(bms->QueryExtensionAbilityInfos(want, abilityInfoFlag, userId, extensionInfos));
if (extensionInfos.size() <= 0) {
HILOG_WARN("%{public}s, QueryExtensionAbilityInfos again, userId is 0", __func__);
IN_PROCESS_CALL_WITHOUT_RET(bms->QueryExtensionAbilityInfos(want, abilityInfoFlag,
U0_USER_ID, extensionInfos));
}
if (extensionInfos.size() <= 0) {
HILOG_ERROR("Get extension info failed.");
return RESOLVE_ABILITY_ERR;
@ -3259,8 +3268,8 @@ void AbilityManagerService::RestartAbility(const sptr<IRemoteObject> &token)
}
auto abilityRecord = Token::GetAbilityRecordByToken(token);
auto userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE;
CHECK_POINTER(abilityRecord);
auto userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE;
auto stackManager = GetStackManagerByUserId(userId);
if (!stackManager) {