Merge "Added an event before clearning user journey" into rvc-dev am: 15f86c346a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11812814

Change-Id: I384fe10f0413ee93e0ec103a300933d8dd14ff61
This commit is contained in:
TreeHugger Robot
2020-06-10 20:50:31 +00:00
committed by Automerger Merge Worker

View File

@@ -2515,7 +2515,7 @@ class UserController implements Handler.Callback {
showUserSwitchDialog(fromToUserPair);
break;
case CLEAR_USER_JOURNEY_SESSION_MSG:
clearSessionId(msg.arg1);
logAndClearSessionId(msg.arg1);
break;
}
return false;
@@ -2629,6 +2629,21 @@ class UserController implements Handler.Callback {
}
}
/**
* Log a final event of the {@link UserJourneySession} and clear it.
*/
private void logAndClearSessionId(@UserIdInt int userId) {
synchronized (mUserIdToUserJourneyMap) {
final UserJourneySession userJourneySession = mUserIdToUserJourneyMap.get(userId);
if (userJourneySession != null) {
FrameworkStatsLog.write(FrameworkStatsLog.USER_LIFECYCLE_EVENT_OCCURRED,
userJourneySession.mSessionId, userId, USER_LIFECYCLE_EVENT_UNKNOWN,
USER_LIFECYCLE_EVENT_STATE_NONE);
}
clearSessionId(userId);
}
}
/**
* Helper class to store user journey and session id.
*