Summary
The User Journeys feature transforms raw phone usage data into a readable, chronological story. Instead of just showing total screen time, it visualizes exactly how the user interacts with their device throughout the day. It groups actions into “Sessions” (unlocking the phone, using apps, and locking it again) and highlights “Gaps” (time spent off the phone), helping users understand their behavioral patterns and frequency of checking their device.How It Works
The feature works by querying a database of events and stitching them together into a visual timeline.Date Selection & Retrieval
When the user opens the screen, it defaults to the current date. The user can also select a past date using the calendar icon. The ViewModel requests all journey events for that specific day from the Repository.
Event Grouping
The app retrieves a raw list of events (like “Unlocked at 9:00 AM”, “Opened Instagram”, “Locked at 9:05 AM”). The screen logic processes this list to identify Sessions. A session is defined as the time between unlocking the phone and locking it again.
Gap Calculation
Between two sessions, the app calculates the time difference. If the time between locking the phone and unlocking it again is significant (more than 2 seconds), it is identified as a Gap. This represents “Time Off” the screen.
Data Stored
The feature relies on theUserJourney entity, which stores individual events that make up the timeline.
| Field | Type | Description |
|---|---|---|
| timestamp | Long | The exact time the event occurred (in milliseconds) |
| eventType | String | The type of action (Session Start, App Usage, Session End) |
| packageName | String | The ID of the app being used (if applicable) |
| durationMs | Long | How long the app was used |
| scrollDistancePx | Long | Approximate distance scrolled in pixels (converted to meters in UI) |
| triggerRef | String | If the session was started by a notification, this stores which app sent it |
Key Components
JourneysScreen
The main interface that renders the vertical timeline, handles scrolling, and manages the “Scroll to Top” button.
JourneysViewModel
Manages the currently selected date and coordinates fetching data from the repository.
Timeline Processor
Logic within the screen that sorts raw events into “Sessions” and calculates the duration of “Gaps” between them.
Info Sheet
A helper screen that explains the terminology (Journey, Time Off, Timeline) to the user.