* A default registry of social media package names is hardcoded in social_media_packages.dart including: Instagram, X/Twitter, TikTok, Facebook, Messenger, Snapchat, Reddit, Pinterest, LinkedIn, Tumblr, Telegram, Discord, BeReal, and YouTube.
* Each entry maps a package name string to a human-readable display name.
* The user can add custom package names via the settings UI. Custom additions are persisted in the local database.
* The user can remove default entries from their personal monitored list without deleting them from the default registry.
* The user can set per-app threshold overrides. If no override is set, the global default threshold applies.
* A DetectionConfig entity holds the global enabled state, default threshold duration, and map of per-app overrides.
* The package registry is queried by both the Flutter app and the Kotlin foreground service. Synchronization happens through SharedPreferences.
gherkin
Given the default social media package registry is loaded
When the registry is queried for "com.instagram.android"
Then it returns true for isSocialMedia and the display name "Instagram"
Given the registry is queried for "com.google.android.gm" (Gmail)
When isSocialMedia is checked
Then it returns false
Given the user adds a custom package "com.example.newapp" with display name "NewApp"
When the registry is queried for that package
Then it returns true for isSocialMedia and the display name "NewApp"
Given the user removes Instagram from their monitored list
When the service polls and detects Instagram in the foreground
Then no intervention is triggered for Instagram even though it remains in the default registry
Given the user sets a custom threshold of 5 minutes for TikTok
When the detection config is loaded
Then TikTok's threshold is 5 minutes while all other apps use the global default threshold
Given the detection config is updated in Flutter
When the changes are saved
Then the updated config is written to SharedPreferences so the Kotlin service reads the latest values on the next poll
Details and Assumptions
Acceptance Criteria