Scrollless employs an Offline-First strategy. The is a local database.The data pipeline follows a Raw-to-Summary architecture:
Ingestion: Raw system events (app opens, notifications, scroll deltas) are captured and stored.
Processing: A background engine aggregates these raw logs into daily summaries.
Projection: For real-time features (like limits), a mediator combines persisted DB data with “in-flight” memory data to provide a zero-latency view of usage.
ScrollDataRepository: The primary engine. It syncs system events from the Android UsageStatsManager, processes them into DailyAppUsageRecord and DailyDeviceSummary, and handles historical backfills.
UsageRepository: A high-level mediator that uses the UsageProjectionEngine to calculate “Used vs. Remaining” time by combining DB records with live session buffers.
JourneysRepository: Reconstructs a chronological timeline of user behavior (the “User Journey”) by correlating unlock sessions, app switches, and notification triggers.
AppMetadataRepository: Manages the list of installed apps, caches high-resolution icons to the local file system, and determines if an app is “user-visible” (e.g., has a launcher icon).
AppCategoryRepository: Interfaces with a remote service to fetch and cache app categories (e.g., “Social”, “Productivity”).
To solve the “Sync Lag” problem (where the DB might be a few seconds behind the actual system state), the UsageProjectionEngine implements a Memory-Buffer strategy:
DB Base: Reads the last known usage from the database.
Pending Buffer: Adds sessions that have finished but haven’t been processed into the daily summary yet.
Live Session: Adds the duration of the currently active app session.