2026-02-22 16:57:36 +01:00
|
|
|
#!/system/bin/sh
|
|
|
|
|
# ============================================================
|
|
|
|
|
# Focus Mode Configuration
|
|
|
|
|
# ============================================================
|
2026-03-02 12:57:34 +01:00
|
|
|
# IMPORTANT: You MUST set HOME_LAT and HOME_LON in config_secrets.sh
|
|
|
|
|
# before deploying.
|
2026-02-22 16:57:36 +01:00
|
|
|
# Get them from Google Maps: right-click your apartment → coords
|
|
|
|
|
# ============================================================
|
|
|
|
|
|
2026-03-02 12:57:34 +01:00
|
|
|
# --- Home location (loaded from config_secrets.sh, not tracked by git) ---
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
|
. "$SCRIPT_DIR/config_secrets.sh"
|
2026-02-22 16:57:36 +01:00
|
|
|
|
|
|
|
|
# --- Radius in meters ---
|
2026-03-09 18:34:15 +01:00
|
|
|
export RADIUS=150
|
2026-02-22 16:57:36 +01:00
|
|
|
|
|
|
|
|
# --- Hysteresis buffer in meters (prevents rapid toggling at boundary) ---
|
2026-03-09 18:34:15 +01:00
|
|
|
export HYSTERESIS=30
|
2026-02-22 16:57:36 +01:00
|
|
|
|
|
|
|
|
# --- Location check interval in seconds ---
|
2026-03-09 18:34:15 +01:00
|
|
|
# When focus mode is ON (at home): check very frequently for near-instant
|
|
|
|
|
# detection of leaving home (phone is charging anyway).
|
2026-03-02 20:29:32 +01:00
|
|
|
# When focus mode is OFF (away): check less often to save battery.
|
2026-03-09 18:34:15 +01:00
|
|
|
export CHECK_INTERVAL_FOCUS=10
|
2026-03-02 20:29:32 +01:00
|
|
|
export CHECK_INTERVAL_NORMAL=120
|
2026-02-22 16:57:36 +01:00
|
|
|
|
|
|
|
|
# --- Log file ---
|
|
|
|
|
export LOG_FILE="/data/local/tmp/focus_mode/focus_mode.log"
|
|
|
|
|
export LOG_MAX_LINES=500
|
|
|
|
|
|
|
|
|
|
# --- State file (tracks which apps were disabled by focus mode) ---
|
|
|
|
|
STATE_DIR="/data/local/tmp/focus_mode"
|
|
|
|
|
export DISABLED_APPS_FILE="$STATE_DIR/disabled_by_focus.txt"
|
|
|
|
|
export MODE_FILE="$STATE_DIR/current_mode.txt"
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
|
# WHITELISTED APPS
|
|
|
|
|
# These apps will ALWAYS remain enabled, even in focus mode.
|
|
|
|
|
# Package names verified against installed packages on 2026-02-22.
|
|
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
export WHITELIST="
|
|
|
|
|
# --- User-requested productive apps ---
|
|
|
|
|
com.stronglifts.app
|
|
|
|
|
com.ichi2.anki
|
|
|
|
|
com.metrolist.music
|
|
|
|
|
com.kuhy.pomodoro_app
|
|
|
|
|
|
|
|
|
|
# --- Google system apps (add by name even though they show as system) ---
|
|
|
|
|
com.google.android.apps.maps
|
|
|
|
|
com.google.android.calendar
|
|
|
|
|
|
|
|
|
|
# --- Notes & productivity ---
|
|
|
|
|
net.cozic.joplin
|
|
|
|
|
|
|
|
|
|
# --- Navigation & transit (needed when going out) ---
|
|
|
|
|
net.osmand
|
|
|
|
|
de.schildbach.oeffi
|
|
|
|
|
com.kolejeslaskie.mss
|
|
|
|
|
|
|
|
|
|
# --- Banking (must always work) ---
|
|
|
|
|
pl.mbank
|
|
|
|
|
pl.pkobp.iko
|
|
|
|
|
|
|
|
|
|
# --- Security & root tools (must always work) ---
|
|
|
|
|
com.topjohnwu.magisk
|
|
|
|
|
moe.shizuku.privileged.api
|
|
|
|
|
me.phh.superuser
|
|
|
|
|
com.beemdevelopment.aegis
|
|
|
|
|
com.azure.authenticator
|
|
|
|
|
oracle.idm.mobile.authenticator
|
|
|
|
|
com.kunzisoft.keepass.libre
|
|
|
|
|
|
|
|
|
|
# --- Email & communication ---
|
|
|
|
|
com.microsoft.office.outlook
|
|
|
|
|
com.google.android.gm
|
|
|
|
|
ch.protonmail.android
|
|
|
|
|
com.microsoft.teams
|
2026-03-09 18:34:15 +01:00
|
|
|
|
|
|
|
|
# --- Manga reader ---
|
|
|
|
|
eu.kanade.tachiyomi.sy
|
|
|
|
|
"
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
|
# BLOCKED SYSTEM APPS
|
|
|
|
|
# System apps that should be disabled in focus mode.
|
|
|
|
|
# These are NOT covered by third-party package blocking.
|
|
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
export BLOCKED_SYSTEM_APPS="
|
|
|
|
|
# --- Browsers ---
|
|
|
|
|
com.android.chrome
|
|
|
|
|
com.chrome.beta
|
|
|
|
|
com.chrome.dev
|
|
|
|
|
com.chrome.canary
|
|
|
|
|
com.sec.android.app.sbrowser
|
|
|
|
|
com.opera.browser
|
|
|
|
|
com.opera.mini.native
|
|
|
|
|
com.brave.browser
|
|
|
|
|
com.vivaldi.browser
|
|
|
|
|
com.microsoft.emmx
|
|
|
|
|
com.kiwibrowser.browser
|
|
|
|
|
com.duckduckgo.mobile.android
|
2026-02-22 16:57:36 +01:00
|
|
|
"
|
|
|
|
|
|
|
|
|
|
# --- System / essential packages that must NEVER be disabled ---
|
|
|
|
|
# These are matched as prefixes (startswith).
|
|
|
|
|
# You generally don't need to edit this list.
|
|
|
|
|
export SYSTEM_NEVER_DISABLE="
|
|
|
|
|
com.android.launcher
|
|
|
|
|
com.android.launcher3
|
|
|
|
|
com.android.settings
|
|
|
|
|
com.android.systemui
|
|
|
|
|
com.android.phone
|
|
|
|
|
com.android.dialer
|
|
|
|
|
com.android.contacts
|
|
|
|
|
com.android.mms
|
|
|
|
|
com.android.messaging
|
|
|
|
|
com.android.providers
|
|
|
|
|
com.android.inputmethod
|
|
|
|
|
com.android.shell
|
|
|
|
|
com.android.packageinstaller
|
|
|
|
|
com.android.permissioncontroller
|
|
|
|
|
com.android.bluetooth
|
|
|
|
|
com.android.nfc
|
|
|
|
|
com.android.wifi
|
|
|
|
|
com.android.certinstaller
|
|
|
|
|
com.android.vpndialogs
|
|
|
|
|
com.android.se
|
|
|
|
|
com.android.emergency
|
|
|
|
|
com.android.camera
|
|
|
|
|
com.android.camera2
|
|
|
|
|
com.android.documentsui
|
|
|
|
|
com.android.externalstorage
|
|
|
|
|
com.android.keychain
|
|
|
|
|
com.android.location
|
|
|
|
|
com.android.networkstack
|
|
|
|
|
com.android.captiveportallogin
|
|
|
|
|
com.google.android.gms
|
|
|
|
|
com.google.android.gsf
|
|
|
|
|
com.google.android.ext.services
|
|
|
|
|
com.google.android.ext.shared
|
|
|
|
|
com.google.android.webview
|
|
|
|
|
com.google.android.trichromelibrary
|
|
|
|
|
com.google.android.inputmethod.latin
|
|
|
|
|
com.google.android.setupwizard
|
|
|
|
|
com.google.android.packageinstaller
|
|
|
|
|
com.google.android.permissioncontroller
|
|
|
|
|
com.google.android.deskclock
|
|
|
|
|
com.google.android.dialer
|
|
|
|
|
com.google.android.contacts
|
|
|
|
|
com.google.android.apps.messaging
|
|
|
|
|
android
|
|
|
|
|
com.mediatek
|
|
|
|
|
com.qualcomm
|
|
|
|
|
"
|