Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2591459 authored by Mayank Garg's avatar Mayank Garg
Browse files

Added an event before clearning user journey

Bug: 141388849
Bug: 146505521
Bug: 150788910
Test: statsd_testdrive 264 265
Change-Id: I5fd44b22ea94aacc7060e7afcfce6cd2824b97da
parent 5692bbb6
Loading
Loading
Loading
Loading
+16 −1
Original line number Original line Diff line number Diff line
@@ -2515,7 +2515,7 @@ class UserController implements Handler.Callback {
                showUserSwitchDialog(fromToUserPair);
                showUserSwitchDialog(fromToUserPair);
                break;
                break;
            case CLEAR_USER_JOURNEY_SESSION_MSG:
            case CLEAR_USER_JOURNEY_SESSION_MSG:
                clearSessionId(msg.arg1);
                logAndClearSessionId(msg.arg1);
                break;
                break;
        }
        }
        return false;
        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.
     * Helper class to store user journey and session id.
     *
     *