Skip to content

Fireperf: fix incorrect sessionIds for _fs and _bs traces #3122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ public synchronized void onActivityStopped(Activity activity) {
if (activityToResumedMap.isEmpty()) {
// no more activity in foreground, app goes to background.
stopTime = clock.getTime();
updateAppState(ApplicationProcessState.BACKGROUND);
sendSessionLog(Constants.TraceNames.FOREGROUND_TRACE_NAME.toString(), resumeTime, stopTime);
// order is important to avoid b/204362742
updateAppState(ApplicationProcessState.BACKGROUND);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also qualify the reasoning for this ordering? For example: Complete _fs trace before triggering a change in the application state as that would lead to a new sessionID change.

}
}
}
Expand All @@ -189,14 +190,16 @@ public synchronized void onActivityResumed(Activity activity) {
// The first resumed activity means app comes to foreground.
resumeTime = clock.getTime();
activityToResumedMap.put(activity, true);
updateAppState(ApplicationProcessState.FOREGROUND);
if (isColdStart) {
// case 1: app startup.
updateAppState(ApplicationProcessState.FOREGROUND);
sendAppColdStartUpdate();
isColdStart = false;
} else {
// case 2: app switch from background to foreground.
sendSessionLog(Constants.TraceNames.BACKGROUND_TRACE_NAME.toString(), stopTime, resumeTime);
// order is important to avoid b/204362742
updateAppState(ApplicationProcessState.FOREGROUND);
}
} else {
// case 3: app already in foreground, current activity is replaced by another activity.
Expand Down