Summary
The Usage Limits Management feature serves as the central dashboard for users to control their screen time. It allows users to set daily time allowances for individual apps or group multiple apps together (e.g., “Social Media” or “Games”) under a shared timer. The feature also includes smart “Coach” suggestions that analyze past behavior to recommend realistic limit reductions, helping users gradually improve their digital wellbeing.How It Works
This feature orchestrates the interaction between user input, historical usage data, and the background enforcement system.Dashboard Aggregation
When the user opens the Limits screen, the system aggregates data from multiple sources. It fetches currently active limits, retrieves app usage statistics for the current day and the past week, and checks the installation status of apps. This data is combined to show progress bars indicating how much time is left for each group.
Smart Suggestions
Simultaneously, the system analyzes the user’s usage history. It identifies apps or categories (like “Social” or “Gaming”) that consume the most time and generates “Quick Action” cards. These cards suggest creating new limit groups with calculated time goals based on the user’s actual average usage.
Creation and Conflict Resolution
When a user creates a new group, they select specific apps. The system checks if any of selected apps are already part of another limit group. If a conflict is found, the user is presented with a resolution UI where they can choose to “Move” the app to the new group or “Keep” it in the old one.
Saving and Enforcement
Once the user saves a group (defining the name, emoji, and time limit), the configuration is written to the database. The system immediately notifies the background
LimitMonitor service. This service recalculates the remaining time for the day and begins enforcing the new rules immediately.Data Stored
The feature manages complex relationships between groups and apps.| Field | Type | Description |
|---|---|---|
| group_id | Long | Unique identifier for the limit group |
| name | String | User-defined name (often includes an emoji prefix) |
| time_limit_minutes | Integer | The daily allowance in minutes |
| apps | List | List of package names included in this group |
| is_enabled | Boolean | Whether the limit is currently active |
| paused_until | Timestamp | If paused, the time when the limit will automatically resume |
| pause_reason | String | The user-selected reason for pausing the limit |
Key Components
Limits Screen
The main dashboard displaying active limits, progress bars, and smart suggestions.
Limits ViewModel
Handles business logic, including calculating remaining time, generating suggestions, and resolving app conflicts.
Coach Engine
Analyzes success/failure rates of previous days to suggest tighter limits or “Easy Goals.”
Conflict Resolver
A UI mechanism that prevents an app from belonging to two different limit groups simultaneously.