$ show curbox-app/curbox-android
Curbox is a digital wellbeing Android application that leverages AccessibilityService to monitor and intervene in user behavior. It blocks distracting apps, websites, keywords, and short-form videos (reels/shorts), enforces focus sessions (with pomodoro), applies grayscale filters, displays mindful message overlays, and hides UI elements via a custom domain-specific script engine. The app tracks detailed usage statistics (app, website, reel, focus) locally in Room and optionally synchronizes across devices using Supabase with end-to-end encryption (paywalled subscription). It provides anti-tamper features including device admin protection, uninstall prevention, and a settings change delay mechanism. The architecture is a monolithic Android app with multiple build flavors (F-Droid, Play Store, full) that gate features like cloud sync, UI hider, and device admin. It exposes an AIDL-based API for external apps. The codebase demonstrates strong engineering with reusable components like a custom script interpreter, encryption utilities, and pattern-based accessibility node selectors, but carries technical drift from deprecated Android APIs and hardcoded app-specific identifiers.
The LLM identified 4 files worth highlighting for reuse:
A self-contained AES-256-GCM encryption/decryption utility with PBKDF2 key derivation, HKDF, and a vault concept for wrapping data encryption keys. It imports only standard Android and Java crypto libraries (no internal dependencies), making it directly extractable into any Kotlin project needing client-side encryption. Includes JSON test vectors for cross-platform compatibility.
A stateless keyword matching utility that supports exact, glob, regex, and literal matching modes. It compiles patterns efficiently and provides a single `matches(text, keywords, mode)` function. No internal dependencies, purely algorithmic – can be reused in any content filtering or search application.
A tree-walking interpreter for a minimal custom language used to describe UI element selection and manipulation. It supports control flow, string operations, regex matching, and arithmetic, with a resource budget sandbox (maximum steps) and a RuntimeApi abstraction for external actions. While coupled to the app's UI node model, the interpreter core is a well-designed, testable component that could be adapted for other DSL needs.
A conservative comparator that determines whether a new setting configuration is 'same or stricter' than an existing one. Used to enforce the settings change delay feature (preventing users from weakening rules impulsively). Handles complex comparison of lists, maps, and nested objects with a contract that defaults to 'weakening' on unrecognized fields. Demonstrates a robust pattern for gated configuration changes in user-facing apps.