Open-source Android app blocker & website blocker for digital wellbeing, screen time control, and focus.
SelfLock helps you break phone addiction by blocking distracting apps and websites on a schedule or daily time budget — with self-control locks so you can’t easily cheat.
App blocking · Website blocking · Daily limits · Schedules · Password locks · Usage stats
Most screen-time and digital wellbeing tools are easy to disable the moment willpower fails. SelfLock is built for self-control:
| Problem | How SelfLock helps |
|---|---|
| Endless scrolling on social apps | Block apps by schedule or daily limit |
| YouTube / Reddit rabbit holes | Block websites in Chrome, Firefox, Edge, Samsung Internet |
| “Just five more minutes” | Active rules lock until the window ends or budget resets |
| Turning off the blocker yourself | Optional master password + per-rule passwords |
| No visibility into habits | Local usage statistics and block history |
Privacy-first: all rules, usage, and passwords stay on your device. No accounts, no cloud sync, no analytics SDKs.
- Block any installed app by time-of-day schedule or daily usage limit
- Full-screen block overlay when a restricted app is opened
- Foreground detection via Accessibility Service + Usage Stats backup
- App icons in rule lists and block screen
- Block domains (e.g.
youtube.com,reddit.com) by schedule or daily budget - Works in Chrome, Firefox, Samsung Internet, and Edge via URL-bar detection
- No root required; accessibility-based (no VPN required)
- Favicons on rules and block overlay
- Locked rules while a block is active — can’t edit/delete mid-session
- Optional master password (app lock on launch/resume)
- Per-rule passwords with master password as override
- PBKDF2-HMAC-SHA256 password hashing (600k iterations) + EncryptedSharedPreferences
FLAG_SECUREwhen app lock is enabled
- Daily usage accumulation for apps and matched website rules
- Statistics tab with summaries and date range selection
- Budget warnings and block notifications
- Guided onboarding for all required permissions
- Foreground monitoring service + boot/schedule receivers
- Exact alarms for schedule start/end
- Battery optimization guidance for reliable enforcement
┌─────────────────┐ ┌──────────────────────┐ ┌────────────────────┐
│ Accessibility │────▶│ Rule engine │────▶│ Block overlay │
│ + Usage Stats │ │ (schedule / limit) │ │ (full-screen) │
└─────────────────┘ └──────────────────────┘ └────────────────────┘
│ │
▼ ▼
Browser URL bar Room database
(website domains) (rules, usage, events)
- Apps — detects the foreground package; if a rule is active, shows a non-dismissible block screen.
- Websites — reads the browser address bar, matches the domain against your rules, blocks when over schedule/limit.
- Self-lock — while a rule is in its active window or daily budget is exhausted, the rule stays read-only unless unlocked with a password.
Note: Website blocking is accessibility-based (not VPN). Ideal if you already use a VPN (e.g. Tailscale) and don’t want a second VPN profile.
| Layer | Choice |
|---|---|
| Language | Kotlin |
| UI | Jetpack Compose, Material 3 |
| Architecture | MVVM + Clean Architecture |
| DI | Hilt |
| Database | Room |
| Async / background | Coroutines, Foreground Service, AlarmManager |
| Security | AndroidX Security Crypto, PBKDF2 |
| Images | Coil (favicons) |
Requirements: Android 14+ (API 34), target API 36 · tested with modern Pixel devices.
Screenshots welcome — open a PR with images under
docs/screenshots/and link them here.
| Websites | Apps | Statistics | Block overlay |
|---|---|---|---|
| Coming soon | Coming soon | Coming soon | Coming soon |
git clone https://github.com/EtashTyagi/SelfLock.git
cd SelfLock
./gradlew assembleDebugDebug APK:
app/build/outputs/apk/debug/app-debug.apk
Release (minified):
./gradlew assembleReleaseadb install -r app/build/outputs/apk/debug/app-debug.apkOr open the project in Android Studio (Ladybug / recent stable) and Run.
On first launch, complete onboarding and grant:
- Accessibility — foreground app + browser URL detection
- Usage access — app usage timing
- Display over other apps — block overlay
- Notifications — monitoring & budget alerts
- Exact alarms — schedule boundaries
- Battery unrestricted — reliable background enforcement
Optional: set a master password so SelfLock itself can’t be opened freely.
- Open the Apps or Websites tab.
- Add a rule:
- Schedule — blocked between start and end time (per day of week as configured).
- Daily limit — allowed minutes per day; blocked after the budget is used.
- While the rule is active, SelfLock shows the block screen and locks the rule from easy edits.
- Check Statistics for usage over time.
- Use Settings (gear icon) for theme, notifications, and password options.
app/src/main/java/com/selflock/app/
├── data/ # Room entities, DAOs, repositories
├── domain/ # Models + use cases (block status, lock, installed apps)
├── di/ # Hilt modules
├── security/ # Master password, app lock state
├── service/ # Accessibility, monitoring, boot/schedule receivers
├── ui/ # Compose screens, components, navigation, theme
└── util/ # Permissions, URL parsing, schedule helpers
| Permission | Why |
|---|---|
| Accessibility Service | Detect foreground app; read browser URL bars for website rules |
Usage access (PACKAGE_USAGE_STATS) |
Measure app time for daily limits |
| Display over other apps | Show the full-screen block UI |
| Notifications | Monitoring status, blocks, budget warnings |
| Foreground service | Continuous monitoring without being killed |
| Exact alarms | Fire at schedule start/end |
| Boot completed | Resume protection after reboot |
| Query all packages | List apps when creating rules |
| Internet | Load website favicons only |
SelfLock does not send your browsing or app usage to a server.
- 100% on-device rules, logs, and passwords
- No login, no telemetry, no third-party ad/analytics SDKs
- Password hashes stored with system-backed encrypted preferences
- Open source — audit the code yourself
Contributions are welcome: bug fixes, browser URL-bar mappings, UI polish, docs, and translations.
- Fork the repo
- Create a branch:
git checkout -b feature/your-feature - Commit with a clear message
- Open a Pull Request against
master
Please keep changes focused. Match existing Kotlin / Compose style (see AGENTS.md for contributor-oriented project notes).
- More browser / in-app browser URL detectors
- Home-screen widget (remaining budget)
- Export/import rules (local file)
- Additional languages
- Play Store / F-Droid packaging notes
- Instrumented tests for rule locking & schedule edges
Current focus
- Reliable app + website enforcement without a local VPN
- Strong self-lock (passwords + locked active rules)
- Clear Material 3 UI
Known limitations
- Website blocking depends on accessibility URL-bar IDs (browsers can change them)
- Not a network-level DNS sinkhole (no VPN path in the active design)
- Cannot fully prevent Safe Mode / ADB uninstall / factory reset
- minSdk 34 — Android 14 and newer only
Is this on Google Play?
Build from source for now. Releases may appear via GitHub Actions artifacts.
Does it need root?
No.
Can I use my own VPN?
Yes. SelfLock does not require the Android VPN slot for website blocking.
Will it drain battery?
It runs a lightweight foreground monitor. Exempting the app from battery optimization improves reliability.
Is my data private?
Yes — local-only. See Privacy.
If SelfLock helps you stay focused, consider starring the repo — it helps others discover open-source digital wellbeing tools.
This project is licensed under the MIT License.
- Jetpack Compose & Material 3
- Hilt · Room · Coil
Keywords: Android app blocker, website blocker, screen time, digital wellbeing, focus mode, phone addiction, usage limits, open source Kotlin Jetpack Compose