The Limit Enforcement Engine is the core system responsible for tracking app usage and enforcing blocks when limits are reached. It combines real-time monitoring (active when you use an app) with background workers (safety checks) to ensure limits are respected even if the app is killed or restarted. It also manages “snooze” and “pause” timers to temporarily lift restrictions.
What it does: Acts as a safety net by periodically verifying usage against limits for all app groups to ensure no blocks were missed.
Property
Value
Type
Periodic
Interval
Regular intervals (approx. 15 min)
Constraints
None specified
1
Fetch Data
Retrieves all limit groups and the current day’s usage statistics from the repository.
2
Verify Limits
Compares total usage against the allowed time limit for each group.
3
Enforce
If usage exceeds the limit (minus a small buffer), it commands the BlockingStateManager to block the apps. If usage is under the limit, it ensures they are unblocked.
Triggered by: Periodic scheduler to ensure consistency between the database and the blocking state.
What it does: The “Brain” of the operation. It tracks the currently open app, calculates real-time usage, and schedules the exact moment an app should be blocked.
Feature
Description
Live Tracking
Detects when you open/close an app and starts a session timer.
Predictive Blocking
Calculates exactly how many milliseconds remain and schedules a timer to block the app the moment time runs out.
Midnight Reset
Schedules a task to run at 12:00 AM to reset usage counters and unblock apps for the new day.
What it does: A ConditionProviderService intended to integrate with Android’s Digital Wellbeing or Do Not Disturb features. Currently acts as a placeholder for future system-level integrations.