lfiecycle msg modification

Signed-off-by: wangzhen <wangzhen346@huawei.com>
Change-Id: Ica6f817fa1449eac3c8b1adfa8cb0284112546b0
This commit is contained in:
wangzhen 2024-11-18 12:30:09 +08:00
parent a5ebb78d7b
commit 1590c200ff
17 changed files with 46 additions and 44 deletions

View File

@ -617,7 +617,7 @@ void AbilityImpl::WindowLifeCycleImpl::AfterForeground()
TAG_LOGE(AAFwkTag::ABILITY, "null stage mode ability/abilityImpl");
return;
}
std::string entry = "AbilityImpl::WindowLifeCycleImpl::AfterForeground; the foreground lifecycle";
std::string entry = "AbilityImpl::WindowLifeCycleImpl::AfterForeground";
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
bool needNotifyAMS = false;
@ -652,7 +652,7 @@ void AbilityImpl::WindowLifeCycleImpl::AfterBackground()
TAG_LOGW(AAFwkTag::ABILITY, "not stage");
return;
}
std::string entry = "AbilityImpl::WindowLifeCycleImpl::AfterBackground; the background lifecycle";
std::string entry = "AbilityImpl::WindowLifeCycleImpl::AfterBackground";
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
TAG_LOGI(AAFwkTag::ABILITY, "window after background");

View File

@ -181,13 +181,13 @@ void CJUIAbility::OnStart(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo
void CJUIAbility::AddLifecycleEventBeforeCall(FreezeUtil::TimeoutState state, const std::string &methodName) const
{
auto entry = std::string("CJUIAbility::") + methodName + "; the " + methodName + " begin";
auto entry = std::string("CJUIAbility::") + methodName + " begin";
FreezeUtil::GetInstance().AddLifecycleEvent(AbilityContext::token_, entry);
}
void CJUIAbility::AddLifecycleEventAfterCall(FreezeUtil::TimeoutState state, const std::string &methodName) const
{
auto entry = std::string("CJUIAbility::") + methodName + "; the " + methodName + " end.";
auto entry = std::string("CJUIAbility::") + methodName + " end";
FreezeUtil::GetInstance().AddLifecycleEvent(AbilityContext::token_, entry);
}

View File

@ -271,13 +271,13 @@ void JsAbility::OnStart(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo)
void JsAbility::AddLifecycleEventBeforeJSCall(FreezeUtil::TimeoutState state, const std::string &methodName) const
{
auto entry = std::string("JsAbility::") + methodName + "; the " + methodName + " begin";
auto entry = std::string("JsAbility::") + methodName + " begin";
FreezeUtil::GetInstance().AddLifecycleEvent(AbilityContext::token_, entry);
}
void JsAbility::AddLifecycleEventAfterJSCall(FreezeUtil::TimeoutState state, const std::string &methodName) const
{
auto entry = std::string("JsAbility::") + methodName + "; the " + methodName + " end";
auto entry = std::string("JsAbility::") + methodName + " end";
FreezeUtil::GetInstance().AddLifecycleEvent(AbilityContext::token_, entry);
}

View File

@ -362,13 +362,13 @@ void JsUIAbility::OnStart(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo
void JsUIAbility::AddLifecycleEventBeforeJSCall(FreezeUtil::TimeoutState state, const std::string &methodName) const
{
auto entry = std::string("JsUIAbility::") + methodName + "; the " + methodName + " begin.";
auto entry = std::string("JsUIAbility::") + methodName + " begin";
FreezeUtil::GetInstance().AddLifecycleEvent(AbilityContext::token_, entry);
}
void JsUIAbility::AddLifecycleEventAfterJSCall(FreezeUtil::TimeoutState state, const std::string &methodName) const
{
auto entry = std::string("JsUIAbility::") + methodName + "; the " + methodName + " end.";
auto entry = std::string("JsUIAbility::") + methodName + " end";
FreezeUtil::GetInstance().AddLifecycleEvent(AbilityContext::token_, entry);
}
@ -877,7 +877,7 @@ void JsUIAbility::DoOnForegroundForSceneIsNull(const Want &want)
if (ret != Rosen::WMError::WM_OK) {
TAG_LOGE(AAFwkTag::UIABILITY, "init window scene failed");
FreezeUtil::GetInstance().AppendLifecycleEvent(AbilityContext::token_,
std::string("ERROR JsUIAbility::DoOnForegroundForSceneIsNull: ") + std::to_string(static_cast<int>(ret)));
std::string("JsUIAbility::DoOnForegroundForSceneIsNull; error ") + std::to_string(static_cast<int>(ret)));
return;
}

View File

@ -315,7 +315,7 @@ void FAAbilityThread::AttachInner(const std::shared_ptr<AppExecFwk::OHOSApplicat
abilityImpl_->Init(application, abilityRecord, currentAbility_, abilityHandler_, token_);
// 4. ability attach : ipc
TAG_LOGD(AAFwkTag::FA, "attach ability");
std::string entry = "AbilityThread::Attach; the load lifecycle.";
std::string entry = "AbilityThread::Attach";
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
ErrCode err = AbilityManagerClient::GetInstance()->AttachAbilityThread(this, token_);
if (err != ERR_OK) {
@ -495,11 +495,11 @@ void FAAbilityThread::AddLifecycleEvent(uint32_t state, std::string &methodName)
return;
}
if (state == AAFwk::ABILITY_STATE_FOREGROUND_NEW) {
std::string entry = "AbilityThread::" + methodName + "; the foreground lifecycle.";
std::string entry = "AbilityThread::" + methodName;
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
}
if (state == AAFwk::ABILITY_STATE_BACKGROUND_NEW) {
std::string entry = "AbilityThread::" + methodName + "; the background lifecycle.";
std::string entry = "AbilityThread::" + methodName;
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
}
}

View File

@ -219,7 +219,7 @@ void UIAbilityImpl::AbilityTransactionCallback(const AAFwk::AbilityLifeCycleStat
TAG_LOGD(AAFwkTag::UIABILITY, "called");
if (state == AAFwk::ABILITY_STATE_FOREGROUND_NEW) {
lifecycleState_ = AAFwk::ABILITY_STATE_FOREGROUND_NEW;
std::string entry = "AbilityManagerClient::AbilityTransitionDone; the transaction start.";
std::string entry = "AbilityManagerClient::AbilityTransitionDone";
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
}
auto ret = AAFwk::AbilityManagerClient::GetInstance()->AbilityTransitionDone(token_, state, GetRestoreData());
@ -418,7 +418,7 @@ void UIAbilityImpl::WindowLifeCycleImpl::AfterForeground()
TAG_LOGE(AAFwkTag::UIABILITY, "null owner");
return;
}
std::string entry = "UIAbilityImpl::WindowLifeCycleImpl::AfterForeground; the foreground lifecycle.";
std::string entry = "UIAbilityImpl::WindowLifeCycleImpl::AfterForeground";
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
bool needNotifyAMS = false;
@ -435,7 +435,7 @@ void UIAbilityImpl::WindowLifeCycleImpl::AfterForeground()
if (needNotifyAMS) {
TAG_LOGI(AAFwkTag::UIABILITY, "notify ability manager service");
entry = "AbilityManagerClient::AbilityTransitionDone; the transaction start.";
entry = "AbilityManagerClient::AbilityTransitionDone";
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
owner->lifecycleState_ = AAFwk::ABILITY_STATE_BACKGROUND_NEW;
AppExecFwk::PacMap restoreData;
@ -452,7 +452,7 @@ void UIAbilityImpl::WindowLifeCycleImpl::AfterBackground()
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
TAG_LOGI(AAFwkTag::UIABILITY, "Lifecycle:call");
std::string entry = "UIAbilityImpl::WindowLifeCycleImpl::AfterBackground; the background lifecycle.";
std::string entry = "UIAbilityImpl::WindowLifeCycleImpl::AfterBackground";
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
AppExecFwk::PacMap restoreData;
@ -487,7 +487,7 @@ void UIAbilityImpl::WindowLifeCycleImpl::AfterUnfocused()
void UIAbilityImpl::WindowLifeCycleImpl::ForegroundFailed(int32_t type)
{
TAG_LOGE(AAFwkTag::UIABILITY, "scb call, ForegroundFailed");
std::string entry = "ERROR UIAbilityImpl::WindowLifeCycleImpl::ForegroundFailed; GoForeground failed.";
std::string entry = "UIAbilityImpl::WindowLifeCycleImpl::ForegroundFailed; GoForeground failed";
FreezeUtil::GetInstance().AppendLifecycleEvent(token_, entry);
AppExecFwk::PacMap restoreData;
switch (type) {

View File

@ -167,11 +167,11 @@ void UIAbilityThread::AttachInner(const std::shared_ptr<AppExecFwk::OHOSApplicat
// ability attach : ipc
TAG_LOGI(AAFwkTag::UIABILITY, "Lifecycle:Attach");
std::string entry = "AbilityThread::Attach start; the load lifecycle.";
std::string entry = "AbilityThread::Attach";
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
ErrCode err = AbilityManagerClient::GetInstance()->AttachAbilityThread(this, token_);
if (err != ERR_OK) {
entry = std::string("AbilityThread::Attach failed ipc error: ") + std::to_string(err);
entry = std::string("AbilityThread::Attach; error ") + std::to_string(err);
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
TAG_LOGE(AAFwkTag::UIABILITY, "err: %{public}d", err);
return;
@ -249,11 +249,11 @@ void UIAbilityThread::HandleAbilityTransaction(
void UIAbilityThread::AddLifecycleEvent(uint32_t state, std::string &methodName) const
{
if (state == AAFwk::ABILITY_STATE_FOREGROUND_NEW) {
std::string entry = "AbilityThread::" + methodName + "; the foreground lifecycle.";
std::string entry = "AbilityThread::" + methodName;
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
}
if (state == AAFwk::ABILITY_STATE_BACKGROUND_NEW) {
std::string entry = "AbilityThread::" + methodName + "; the background lifecycle.";
std::string entry = "AbilityThread::" + methodName;
FreezeUtil::GetInstance().AddLifecycleEvent(token_, entry);
}
}

View File

@ -734,7 +734,7 @@ void MainThread::ScheduleLaunchAbility(const AbilityInfo &info, const sptr<IRemo
tmpWatchdog->SetBgWorkingThreadStatus(IsBgWorkingThread(info));
tmpWatchdog = nullptr;
}
std::string entry = "MainThread::ScheduleLaunchAbility; the load lifecycle.";
std::string entry = "MainThread::ScheduleLaunchAbility";
FreezeUtil::GetInstance().AddLifecycleEvent(token, entry);
wptr<MainThread> weak = this;
@ -1296,7 +1296,7 @@ CJUncaughtExceptionInfo MainThread::CreateCjExceptionInfo(const std::string &bun
void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, const Configuration &config)
{
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
FreezeUtil::GetInstance().AddAppLifecycleEvent(0, "HandleLaunchApplication:begin");
FreezeUtil::GetInstance().AddAppLifecycleEvent(0, "HandleLaunchApplication begin");
if (!CheckForHandleLaunchApplication(appLaunchData)) {
TAG_LOGE(AAFwkTag::APPKIT, "CheckForHandleLaunchApplication failed");
return;
@ -1747,7 +1747,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
TAG_LOGE(AAFwkTag::APPKIT, "applicationImpl_->PerformAppReady failed");
return;
}
FreezeUtil::GetInstance().AddAppLifecycleEvent(0, "HandleLaunchApplication:end");
FreezeUtil::GetInstance().AddAppLifecycleEvent(0, "HandleLaunchApplication end");
// L1 needs to add corresponding interface
ApplicationEnvImpl *pAppEvnIml = ApplicationEnvImpl::GetInstance();
@ -2158,7 +2158,7 @@ void MainThread::HandleLaunchAbility(const std::shared_ptr<AbilityLocalRecord> &
auto abilityToken = abilityRecord->GetToken();
CHECK_POINTER_LOG(abilityToken, "abilityRecord->GetToken failed");
std::string entry = "MainThread::HandleLaunchAbility; the load lifecycle.";
std::string entry = "MainThread::HandleLaunchAbility";
FreezeUtil::GetInstance().AddLifecycleEvent(abilityToken, entry);
abilityRecordMgr_->SetToken(abilityToken);
@ -2330,7 +2330,7 @@ void MainThread::HandleForegroundApplication()
}
if (!applicationImpl_->PerformForeground()) {
FreezeUtil::GetInstance().AddAppLifecycleEvent(0, "HandleForegroundApplication fail");
FreezeUtil::GetInstance().AddAppLifecycleEvent(0, "HandleForegroundApplication; fail");
TAG_LOGE(AAFwkTag::APPKIT, "applicationImpl_->PerformForeground() failed");
}

View File

@ -188,8 +188,8 @@ int AppfreezeInner::AcquireStack(const FaultData& info, bool onlyMainThread)
FaultData faultData;
faultData.errorObject.message = it->errorObject.message + "\n";
if (it->state != 0) {
faultData.errorObject.message += "client:\n" +
FreezeUtil::GetInstance().GetLifecycleEvent(it->token) + "\nclient app:\n" +
faultData.errorObject.message += "client actions for ability:\n" +
FreezeUtil::GetInstance().GetLifecycleEvent(it->token) + "\nclient actions for app:\n" +
FreezeUtil::GetInstance().GetAppLifecycleEvent(0) + "\n";
}
faultData.errorObject.stack = stack;

View File

@ -213,7 +213,7 @@ void AppSchedulerProxy::ScheduleLaunchAbility(const AbilityInfo &info, const spt
if (!data.WriteParcelable(want.get())) {
TAG_LOGE(AAFwkTag::APPMGR, "write want fail.");
AbilityRuntime::FreezeUtil::GetInstance().AppendLifecycleEvent(token,
"ERROR AppLifeCycleDeal::LaunchAbility; write want fail");
"AppLifeCycleDeal::LaunchAbility; write want fail");
return;
}
if (!data.WriteInt32(abilityRecordId)) {
@ -225,7 +225,7 @@ void AppSchedulerProxy::ScheduleLaunchAbility(const AbilityInfo &info, const spt
if (ret != NO_ERROR) {
TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret);
AbilityRuntime::FreezeUtil::GetInstance().AppendLifecycleEvent(token,
"ERROR AppLifeCycleDeal::LaunchAbility; ipc fail " + std::to_string(ret));
"AppLifeCycleDeal::LaunchAbility; ipc error " + std::to_string(ret));
}
}

View File

@ -1351,7 +1351,7 @@ int AbilityManagerProxy::AttachAbilityThread(const sptr<IAbilityScheduler> &sche
if (error != NO_ERROR) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "request error:%{public}d", error);
AbilityRuntime::FreezeUtil::GetInstance().AppendLifecycleEvent(token,
std::string("ERROR AttachAbilityThread failed IPC error ") + std::to_string(error));
std::string("AttachAbilityThread; ipc error ") + std::to_string(error));
return error;
}
return reply.ReadInt32();
@ -1374,7 +1374,7 @@ int AbilityManagerProxy::AbilityTransitionDone(const sptr<IRemoteObject> &token,
if (!data.WriteParcelable(&saveData)) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "saveData write fail");
AbilityRuntime::FreezeUtil::GetInstance().AppendLifecycleEvent(token,
"write saveData failed");
"AbilityTransitionDone; write saveData failed");
return INNER_ERR;
}
@ -1382,7 +1382,7 @@ int AbilityManagerProxy::AbilityTransitionDone(const sptr<IRemoteObject> &token,
if (error != NO_ERROR) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "request error:%{public}d", error);
AbilityRuntime::FreezeUtil::GetInstance().AppendLifecycleEvent(token,
std::string("ERROR AbilityTransitionDone failed IPC error ") + std::to_string(error));
std::string("AbilityTransitionDone; ipc error ") + std::to_string(error));
return error;
}
return reply.ReadInt32();

View File

@ -2247,8 +2247,9 @@ void MissionListManager::PrintTimeOutLog(const std::shared_ptr<AbilityRecord> &a
flow.token = ability->GetToken()->AsObject();
flow.state = state;
}
info.msg = msgContent + "\nserver:\n" + FreezeUtil::GetInstance().GetLifecycleEvent(flow.token)
+ "\nserver app:\n" + FreezeUtil::GetInstance().GetAppLifecycleEvent(processInfo.pid_);
info.msg = msgContent + "\nserver actions for ability:\n" +
FreezeUtil::GetInstance().GetLifecycleEvent(flow.token) +
"\nserver actions for app:\n" + FreezeUtil::GetInstance().GetAppLifecycleEvent(processInfo.pid_);
if (!isHalf) {
FreezeUtil::GetInstance().DeleteLifecycleEvent(flow.token);
FreezeUtil::GetInstance().DeleteAppLifecycleEvent(ability->GetPid());

View File

@ -1209,8 +1209,9 @@ void UIAbilityLifecycleManager::PrintTimeOutLog(std::shared_ptr<AbilityRecord> a
flow.token = ability->GetToken()->AsObject();
flow.state = state;
}
info.msg = msgContent + "\nserver:\n" + FreezeUtil::GetInstance().GetLifecycleEvent(flow.token)
+ "\nserver app:\n" + FreezeUtil::GetInstance().GetAppLifecycleEvent(processInfo.pid_);
info.msg = msgContent + "\nserver actions for ability:\n" +
FreezeUtil::GetInstance().GetLifecycleEvent(flow.token)
+ "\nserver actions for app:\n" + FreezeUtil::GetInstance().GetAppLifecycleEvent(processInfo.pid_);
if (!isHalf) {
FreezeUtil::GetInstance().DeleteLifecycleEvent(flow.token);
FreezeUtil::GetInstance().DeleteAppLifecycleEvent(processInfo.pid_);

View File

@ -75,7 +75,7 @@ void AppLifeCycleDeal::LaunchAbility(const std::shared_ptr<AbilityRunningRecord>
return;
}
if (abilityInfo->type == AbilityType::PAGE) {
std::string entry = "AppLifeCycleDeal::LaunchAbility; the LoadAbility lifecycle.";
std::string entry = "AppLifeCycleDeal::LaunchAbility";
FreezeUtil::GetInstance().AddLifecycleEvent(ability->GetToken(), entry);
}
TAG_LOGD(AAFwkTag::APPMGR, "Launch");

View File

@ -629,7 +629,7 @@ void AppMgrServiceInner::LoadAbility(std::shared_ptr<AbilityInfo> abilityInfo, s
return;
}
if (abilityInfo->type == AbilityType::PAGE) {
std::string entry = "AppMgrServiceInner::LoadAbility; the load lifecycle.";
std::string entry = "AppMgrServiceInner::LoadAbility";
AbilityRuntime::FreezeUtil::GetInstance().AddLifecycleEvent(loadParam->token, entry);
}

View File

@ -472,7 +472,7 @@ void AppRunningRecord::LaunchApplication(const Configuration &config)
auto scheduler = appLifeCycleDeal_->GetApplicationClient();
if (!scheduler) {
TAG_LOGE(AAFwkTag::APPMGR, "null appThread");
AddAppLifecycleEvent("AppRunningRecord::LaunchApplication null scheduler");
AddAppLifecycleEvent("AppRunningRecord::LaunchApplication; null scheduler");
return;
}
AppLaunchData launchData;
@ -504,7 +504,7 @@ void AppRunningRecord::LaunchApplication(const Configuration &config)
TAG_LOGD(AAFwkTag::APPMGR, "%{public}s called,app is %{public}s.", __func__, GetName().c_str());
AddAppLifecycleEvent("AppRunningRecord::LaunchApplication");
AbilityRuntime::ErrorMsgGuard errorMsgGuard(GetPid(), reinterpret_cast<uintptr_t>(scheduler.GetRefPtr()),
"ScheduleForegroundRunning");
"LaunchApplication");
appLifeCycleDeal_->LaunchApplication(launchData, config);
}
@ -673,11 +673,11 @@ bool AppRunningRecord::ScheduleForegroundRunning()
AddAppLifecycleEvent("AppRunningRecord::ScheduleForegroundRunning");
auto scheduler = appLifeCycleDeal_->GetApplicationClient();
if (!scheduler) {
AddAppLifecycleEvent("AppRunningRecord::ScheduleForegroundRunning null scheduler");
AddAppLifecycleEvent("AppRunningRecord::ScheduleForegroundRunning; null scheduler");
return false;
}
AbilityRuntime::ErrorMsgGuard errorMsgGuard(GetPid(), reinterpret_cast<uintptr_t>(scheduler.GetRefPtr()),
"LaunchApplication");
"ScheduleForegroundRunning");
return appLifeCycleDeal_->ScheduleForegroundRunning();
}
return false;

View File

@ -20,7 +20,7 @@
namespace OHOS::AbilityRuntime {
namespace {
constexpr int32_t MAX_ENTRY_COUNT = 10;
constexpr int32_t MAX_ENTRY_COUNT = 20;
std::string ConcatStr(const std::list<std::string> &strList, const std::string &split)
{
if (strList.empty()) {