uiextensiondfx

Signed-off-by: zhaoleyi <zhaoleyi@huawei.com>
Change-Id: Ia1ea794dd18af687c159ca3a2f4a0dbb46d83061
This commit is contained in:
zhaoleyi 2024-07-19 14:53:36 +08:00
parent aebe6d9028
commit b51414f04d
4 changed files with 25 additions and 17 deletions

View File

@ -732,7 +732,8 @@ void JsUIExtension::ForegroundWindow(const AAFwk::Want &want, const sptr<AAFwk::
return;
}
std::lock_guard<std::mutex> lock(uiWindowMutex_);
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ".", sessionInfo->uiExtensionComponentId);
TAG_LOGI(AAFwkTag::UI_EXT, "Before window show UIExtcomponent id: %{public}" PRId64,
sessionInfo->uiExtensionComponentId);
auto componentId = sessionInfo->uiExtensionComponentId;
auto& uiWindow = uiWindowMap_[componentId];
if (uiWindow) {
@ -750,13 +751,14 @@ void JsUIExtension::BackgroundWindow(const sptr<AAFwk::SessionInfo> &sessionInfo
return;
}
std::lock_guard<std::mutex> lock(uiWindowMutex_);
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ".", sessionInfo->uiExtensionComponentId);
auto componentId = sessionInfo->uiExtensionComponentId;
if (uiWindowMap_.find(componentId) == uiWindowMap_.end()) {
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to find uiWindow");
return;
}
auto& uiWindow = uiWindowMap_[componentId];
TAG_LOGI(AAFwkTag::UI_EXT, "Befor window hide UIExtcomponent id: %{public}" PRId64,
sessionInfo->uiExtensionComponentId);
if (uiWindow) {
uiWindow->Hide();
foregroundWindows_.erase(componentId);
@ -772,7 +774,6 @@ void JsUIExtension::DestroyWindow(const sptr<AAFwk::SessionInfo> &sessionInfo)
return;
}
std::lock_guard<std::mutex> lock(uiWindowMutex_);
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ".", sessionInfo->uiExtensionComponentId);
auto componentId = sessionInfo->uiExtensionComponentId;
if (uiWindowMap_.find(componentId) == uiWindowMap_.end()) {
TAG_LOGE(AAFwkTag::UI_EXT, "Wrong to find uiWindow");
@ -788,6 +789,8 @@ void JsUIExtension::DestroyWindow(const sptr<AAFwk::SessionInfo> &sessionInfo)
CallObjectMethod("onSessionDestroy", argv, ARGC_ONE);
}
}
TAG_LOGI(AAFwkTag::UI_EXT, "Befor window destory, UIExtcomponent id: %{public}" PRId64,
sessionInfo->uiExtensionComponentId);
auto uiWindow = uiWindowMap_[componentId];
if (uiWindow) {
uiWindow->Destroy();

View File

@ -1593,7 +1593,7 @@ void JsRuntime::GetPkgContextInfoListMap(const std::map<std::string, std::string
}
std::ostringstream outStream;
if (!extractor->ExtractByName("pkgContextInfo.json", outStream)) {
TAG_LOGW(AAFwkTag::JSRUNTIME, "moduleName: %{public}s get pkgContextInfo failed", it->first.c_str());
TAG_LOGD(AAFwkTag::JSRUNTIME, "moduleName: %{public}s get pkgContextInfo failed", it->first.c_str());
continue;
}
auto jsonObject = nlohmann::json::parse(outStream.str(), nullptr, false);

View File

@ -292,7 +292,7 @@ void AbilityConnectManager::SetLastExitReason(
{
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
if (targetRecord == nullptr || !UIExtensionUtils::IsUIExtension(abilityRequest.abilityInfo.extensionAbilityType)) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to set UIExtensionAbility last exit reason.");
TAG_LOGD(AAFwkTag::ABILITYMGR, "Failed to set UIExtensionAbility last exit reason.");
return;
}
auto appExitReasonDataMgr = DelayedSingleton<AbilityRuntime::AppExitReasonDataManager>::GetInstance();
@ -306,7 +306,7 @@ void AbilityConnectManager::SetLastExitReason(
targetRecord->GetAbilityInfo().moduleName + SEPARATOR +
targetRecord->GetAbilityInfo().name;
if (!appExitReasonDataMgr->GetUIExtensionAbilityExitReason(keyEx, exitReason)) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "There is no record of UIExtensionAbility's last exit reason in the database.");
TAG_LOGD(AAFwkTag::ABILITYMGR, "There is no record of UIExtensionAbility's last exit reason in the database.");
return;
}
targetRecord->SetLastExitReason(exitReason);
@ -317,8 +317,10 @@ void AbilityConnectManager::DoForegroundUIExtension(std::shared_ptr<AbilityRecor
{
CHECK_POINTER(abilityRecord);
CHECK_POINTER(abilityRequest.sessionInfo);
TAG_LOGI(AAFwkTag::ABILITYMGR, "Foreground ability: %{public}s, persistentId: %{public}d",
abilityRecord->GetURI().c_str(), abilityRequest.sessionInfo->persistentId);
auto abilitystateStr = abilityRecord->ConvertAbilityState(abilityRecord->GetAbilityState());
TAG_LOGI(AAFwkTag::ABILITYMGR,
"Foreground ability: %{public}s, persistentId: %{public}d, abilityState: %{public}s",
abilityRecord->GetURI().c_str(), abilityRequest.sessionInfo->persistentId, abilitystateStr.c_str());
if (abilityRecord->IsReady() && !abilityRecord->IsAbilityState(AbilityState::INACTIVATING) &&
!abilityRecord->IsAbilityState(AbilityState::FOREGROUNDING) &&
!abilityRecord->IsAbilityState(AbilityState::BACKGROUNDING) &&
@ -1605,7 +1607,7 @@ void AbilityConnectManager::HandleStopTimeoutTask(const std::shared_ptr<AbilityR
CHECK_POINTER(abilityRecord);
if (UIExtensionUtils::IsUIExtension(abilityRecord->GetAbilityInfo().extensionAbilityType)) {
if (uiExtensionAbilityRecordMgr_ != nullptr && IsCallerValid(abilityRecord)) {
TAG_LOGD(AAFwkTag::ABILITYMGR, "Start terminate timeout.");
TAG_LOGW(AAFwkTag::ABILITYMGR, "Start terminate timeout");
uiExtensionAbilityRecordMgr_->TerminateTimeout(abilityRecord->GetUIExtensionAbilityId());
}
PrintTimeOutLog(abilityRecord, AbilityManagerService::TERMINATE_TIMEOUT_MSG);
@ -1775,9 +1777,10 @@ void AbilityConnectManager::DoBackgroundAbilityWindow(const std::shared_ptr<Abil
{
CHECK_POINTER(abilityRecord);
CHECK_POINTER(sessionInfo);
TAG_LOGI(AAFwkTag::ABILITYMGR, "Background ability: %{public}s, persistentId: %{public}d",
abilityRecord->GetURI().c_str(), sessionInfo->persistentId);
auto abilitystateStr = abilityRecord->ConvertAbilityState(abilityRecord->GetAbilityState());
TAG_LOGI(AAFwkTag::ABILITYMGR,
"Background ability: %{public}s, persistentId: %{public}d, abilityState: %{public}s",
abilityRecord->GetURI().c_str(), sessionInfo->persistentId, abilitystateStr.c_str());
if (abilityRecord->IsAbilityState(AbilityState::FOREGROUND)) {
MoveToBackground(abilityRecord);
} else if (abilityRecord->IsAbilityState(AbilityState::INITIAL) ||
@ -1795,8 +1798,10 @@ void AbilityConnectManager::TerminateAbilityWindowLocked(const std::shared_ptr<A
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
CHECK_POINTER(abilityRecord);
CHECK_POINTER(sessionInfo);
TAG_LOGI(AAFwkTag::ABILITYMGR, "Terminate ability: %{public}s, persistentId: %{public}d",
abilityRecord->GetURI().c_str(), sessionInfo->persistentId);
auto abilitystateStr = abilityRecord->ConvertAbilityState(abilityRecord->GetAbilityState());
TAG_LOGI(AAFwkTag::ABILITYMGR,
"Terminate ability: %{public}s, persistentId: %{public}d, abilityState: %{public}s",
abilityRecord->GetURI().c_str(), sessionInfo->persistentId, abilitystateStr.c_str());
EventInfo eventInfo;
eventInfo.bundleName = abilityRecord->GetAbilityInfo().bundleName;
eventInfo.abilityName = abilityRecord->GetAbilityInfo().name;
@ -2551,7 +2556,7 @@ void AbilityConnectManager::HandleForegroundTimeoutTask(const std::shared_ptr<Ab
}
if (UIExtensionUtils::IsUIExtension(abilityRecord->GetAbilityInfo().extensionAbilityType) &&
uiExtensionAbilityRecordMgr_ != nullptr && IsCallerValid(abilityRecord)) {
TAG_LOGD(AAFwkTag::ABILITYMGR, "Start foreground timeout.");
TAG_LOGW(AAFwkTag::ABILITYMGR, "Start foreground timeout.");
uiExtensionAbilityRecordMgr_->ForegroundTimeout(abilityRecord->GetUIExtensionAbilityId());
}
abilityRecord->SetAbilityState(AbilityState::BACKGROUND);

View File

@ -379,7 +379,7 @@ ErrCode AbilityManagerClient::TerminateUIExtensionAbility(sptr<SessionInfo> exte
auto abms = GetAbilityManager();
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
CHECK_POINTER_RETURN_INVALID_VALUE(extensionSessionInfo);
TAG_LOGD(AAFwkTag::ABILITYMGR, "name: %{public}s %{public}s, persistentId: %{public}d.",
TAG_LOGI(AAFwkTag::ABILITYMGR, "name: %{public}s %{public}s, persistentId: %{public}d",
extensionSessionInfo->want.GetElement().GetAbilityName().c_str(),
extensionSessionInfo->want.GetElement().GetBundleName().c_str(), extensionSessionInfo->persistentId);
return abms->TerminateUIExtensionAbility(extensionSessionInfo, resultCode, resultWant);
@ -450,7 +450,7 @@ ErrCode AbilityManagerClient::MinimizeUIExtensionAbility(sptr<SessionInfo> exten
auto abms = GetAbilityManager();
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
CHECK_POINTER_RETURN_INVALID_VALUE(extensionSessionInfo);
TAG_LOGD(AAFwkTag::ABILITYMGR, "name: %{public}s %{public}s, persistentId: %{public}d, fromUser: %{public}d.",
TAG_LOGI(AAFwkTag::ABILITYMGR, "name: %{public}s %{public}s, persistentId: %{public}d, fromUser: %{public}d",
extensionSessionInfo->want.GetElement().GetAbilityName().c_str(),
extensionSessionInfo->want.GetElement().GetBundleName().c_str(), extensionSessionInfo->persistentId, fromUser);
return abms->MinimizeUIExtensionAbility(extensionSessionInfo, fromUser);