Add launch type in activity startup trace

To distinguish launch type easier in trace instead of combing
other traces to infer.

Bug: 248003285
Test: Cold/warm/hold launch app and check the trace.
Change-Id: Ieab111cc11b71db17449c52edbd80f9c016c016e
This commit is contained in:
Riddle Hsu
2022-09-21 23:36:52 +08:00
parent 520f0183b6
commit fac9803757

View File

@@ -231,9 +231,21 @@ class ActivityMetricsLogger {
if (mAssociatedTransitionInfo == null) {
launchResult = ":failed";
} else {
launchResult = (abort ? ":canceled:" : mAssociatedTransitionInfo.mProcessSwitch
? ":completed:" : ":completed-same-process:")
+ mAssociatedTransitionInfo.mLastLaunchedActivity.packageName;
final String status;
if (abort) {
status = ":canceled:";
} else if (!mAssociatedTransitionInfo.mProcessSwitch) {
status = ":completed-same-process:";
} else {
if (endInfo.mTransitionType == TYPE_TRANSITION_HOT_LAUNCH) {
status = ":completed-hot:";
} else if (endInfo.mTransitionType == TYPE_TRANSITION_WARM_LAUNCH) {
status = ":completed-warm:";
} else {
status = ":completed-cold:";
}
}
launchResult = status + mAssociatedTransitionInfo.mLastLaunchedActivity.packageName;
}
// Put a supplement trace as the description of the async trace with the same id.
Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, mTraceName + launchResult);