The Phone Usage module is the analytical heart of the application. It provides a multi-dimensional view of how a user interacts with their device, aggregating data across time (Daily, Weekly, Monthly) and metrics (Usage Time, Scroll Distance).Beyond simple reporting, it serves as a control center where users can observe patterns via a and immediately act on those insights by setting or adjusting app limits.
The entry point. It renders the metric header, heatmap, and the scrollable list of app usage cards.
PhoneUsageViewModel
Manages the business logic for switching time periods and calculating aggregate statistics. It leverages flatMapLatest to switch data sources based on the selected period.
AppUiModelMapper
A specialized that enriches raw usage records with metadata and limit information.
LimitViewModelDelegate
Encapsulates shared logic for the “Set Limit” bottom sheet, allowing the same limit-setting behavior to be reused across different screens.
Daily: Shows exact usage for a specific 24-hour window.
Weekly/Monthly: Calculates Average Daily Usage across the selected range.
The ViewModel dynamically adjusts the usageStat label and recalculates LimitInfo based on the current day’s progress, even when viewing historical averages.
A unique feature of this module is its handling of Removed Apps. If a user deletes an app that has recorded usage data for the current period, the system:
Retains the usage record in the database.
Groups these apps into a specialized RemovedAppsCard.
Allows the user to view their historical impact on total screen time even after the app is gone.