Skip to content
galion96Public

About

Self-control Android launcher running as Device Owner: app hiding, rule-based browser, DNS filter, YouTube Shorts blocker, retype-to-unlock

Resources

Stars

7 stars

Watchers

0 watching

Forks

Repository files navigation

Focus

A self-control "OS" for Android — without flashing a ROM.

Focus turns an ordinary Android phone into a calm, locked-down tool. You decide once, while calm, what the phone is allowed to do. Afterwards, making things stricter is instant, but loosening them is hard: you must retype a long text by hand (no pasting) and, optionally, wait hours or days.

It runs as a Device Owner app, so it can actually enforce rules (hide apps, block factory reset, lock VPN settings), not just nag you like a normal screen-time app.

Wizard Home + search Reorder Shorts blocked Settings Unlock

Demo video: screenshots/demo.mp4 · all screens in screenshots/

Features

  • Setup wizard: pick allowed apps, browser rules, phone-wide filter, unlock difficulty.
  • Minimal text launcher: search, pages (swipe), long-press to reorder; apps per page and alphabetical sort are configurable.
  • Built-in browser with rules: block whole sites or just paths (youtube.com/shorts), or whitelist-only mode. Catches single-page-app navigation (tapping "Shorts" inside YouTube), iframes, raw IPs, and proxy/translate/archive sites. All other browsers are hidden.
  • Phone-wide DNS filter: a local, DNS-only always-on VPN. Blocked domains don't resolve in any app. With the adult content pack on, DNS goes through Cloudflare for Families (1.1.1.3).
  • YouTube Shorts blocker for the YouTube app: an accessibility service closes Shorts as soon as they open (split-screen included). If the service is turned off, YouTube gets hidden.
  • Battery & privacy: hides preinstalled background apps (Samsung telemetry, Bixby, hidden Facebook services, game/AR extras…).
  • Retype-to-unlock: N random sentences, paste/swipe rejected, optional delay (1h–7d), then a 15-minute window. USB debugging and (optionally) app installs are only allowed inside that window.
  • Hard to escape: factory reset, safe mode, date/time, VPN, private DNS, unknown sources and third-party keyboards are locked while Focus is locked.
  • Deactivate restores the phone completely.
  • English, plus Croatian / Bosnian / Serbian (Latin).

No dependencies, no accounts, no network calls except DNS forwarding. Kotlin, ~2k lines.

Install

Needs a computer with adb. Tested on Samsung Galaxy S10+ (Android 12) and the Android 12 emulator.

  1. Build: ./gradlew assembleDebug (JDK 17, Android SDK 34).
  2. On the phone: enable Developer options → USB debugging.
  3. Remove all accounts (Settings → Accounts). Android only allows a Device Owner on a phone with zero accounts. Some apps keep hidden accounts (e.g. Instagram, Reddit); if dpm still complains, temporarily uninstall them with adb shell pm uninstall -k --user 0 <pkg> (keeps data) and restore with adb shell cmd package install-existing <pkg>.
  4. Install and make Focus the device owner:
    adb install -r app/build/outputs/apk/debug/app-debug.apk
    adb shell dpm set-device-owner com.fokus.os/.FokusAdmin
    adb shell settings put secure enabled_accessibility_services com.fokus.os/com.fokus.os.ShortsGuardService
    adb shell settings put secure accessibility_enabled 1
    
  5. Press Home → go through the wizard → Lock. Add your accounts back.

Updates: adb install -r with the same signing key keeps the device owner and all settings.

Security model

The adversary is you, at a weak moment. See docs/SECURITY_RAKE.md for the full map of bypass vectors and what was done about each.

Known limits (by design of Android, not fixable by an app):

  • Recovery-mode factory reset (hardware buttons) wipes the phone and Focus with it.
  • Apps with their own DNS-over-HTTPS can bypass the DNS filter (Chrome is hidden for this reason).
  • The recents screen in gesture navigation always comes from the system launcher.
  • The Shorts detector relies on YouTube's view IDs; scripts/yt_shorts_ids.sh helps update them.

Project layout

File What
Policy.kt hiding apps, user restrictions, always-on VPN, deactivation
Rules.kt URL rules, block packs, proxy/IP handling
BrowserActivity.kt WebView browser enforcing rules
DnsVpnService.kt DNS-only local VPN
ShortsGuardService.kt accessibility service for YouTube Shorts
UnlockActivity.kt retype-to-unlock + delay
WizardActivity.kt, SettingsActivity.kt, LauncherActivity.kt UI
Bloat.kt background app groups

License

MIT

About

Self-control Android launcher running as Device Owner: app hiding, rule-based browser, DNS filter, YouTube Shorts blocker, retype-to-unlock

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages