summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/am/UserController.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index ea7059894f38..f2c4e4428af2 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -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;
@@ -2630,6 +2630,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.
*
* <p> User journey tracks a chain of user lifecycle events occurring during different user