Summary
The Blocking Screen is the core enforcement mechanism of the app. When a user exceeds their daily time limit for a specific app or group, this screen immediately appears over the target app, preventing further interaction. It acts as a “stop sign,” presenting the user with their usage statistics and offering two choices: stop using the app (Close) or intentionally request more time (Snooze) through a friction-based interface.How It Works
The blocking system works by monitoring usage in the background and launching a high-priority screen when limits are crossed.Triggering the Block
When the background monitoring service detects that an app’s usage has surpassed the user’s set limit, it launches the Blocking Activity. This is a special screen with a transparent background that draws over the app the user is currently trying to use.
Validation and Display
Before showing any content, the screen checks with the Snooze Manager to ensure the user hasn’t already been granted extra time (handling race conditions). If the block is valid, the ViewModel loads usage statistics—such as how many times the app was opened today and total time spent—to show the user the reality of their consumption.
The User's Choice
The user is presented with a “friction” interface. They cannot simply swipe the screen away. They must choose to:
- Close: Returns to the home screen, effectively stopping the session.
- Snooze: Request a small amount of extra time (e.g., 5 minutes). This button often requires a countdown or “wait” period to discourage impulsive clicking.
Snooze and Cooldown
If the user chooses to snooze, the app grants a temporary allowance (e.g., 5 minutes). The blocking screen closes immediately so the user can resume their task. However, the system may enforce a Cooldown, meaning if the user runs out of time again immediately, they might have to wait longer or see a stricter message before they can snooze again.
Data Stored
This feature primarily reads usage data but updates specific tracking tables when a user interacts with it.| Field | Type | Description |
|---|---|---|
| snooze_count | Integer | Increments every time the user successfully snoozes a block today. |
| granted_duration | Long | The amount of extra time (in milliseconds) added to the user’s allowance. |
| cooldown_timestamp | Long | The time until which the user is in a “cooling down” state (restricting rapid snoozing). |
Key Components
BlockingActivity
The transparent overlay activity that intercepts the user’s touch and hides the underlying app content.
BlockingViewModel
Calculates how much time has been used versus the limit and determines if the user is allowed to snooze.
SnoozeManager
Manages the logic for granting extra time, including calculating “friction” (how long the user must wait to snooze).
NudgeMonitor
Displays a small confirmation “chip” at the top of the screen (e.g., “+5 min added”) after a successful snooze.