mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-22 05:42:19 +01:00
- New companion Android app (com.kuhy.focusstatus) under phone_focus_mode/focus_status_app/ with a pure-Java, Gradle-less command-line build pipeline (build.sh). Shows an ongoing notification titled 'Focus: HOME / AWAY / DAEMON DOWN' with distance, GPS, disabled-app count, last check, daemon checkmarks, and a 'Re-check now' action button. - focus_daemon.sh: write_status_snapshot() + sleep_with_recheck() for JSON status + early-wake on trigger file. init() chmods STATE_DIR 777 so the app can drop the trigger file. - config.sh: new STATUS_FILE / RECHECK_TRIGGER; WHITELIST expanded with com.kuhy.focusstatus and 11 more user-requested apps (podcini X, mpv, bible/openbible, pkp/portalpasazera, orange, runnerup, splitbills/splitwise, xiaomi smarthome). - focus_ctl.sh: new 'recheck' + 'notif-status' subcommands. - deploy.sh: new step [7/7] builds APK, installs, grants POST_NOTIFICATIONS, pre-approves Magisk SU policy, launches foreground service. - .gitignore: exclude focus_status_app/build symlink + debug.keystore. End-to-end verified on device: notification live with real values; Re-check button triggers a daemon location check within ~1s.
39 lines
1.5 KiB
Bash
Executable File
39 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# ============================================================
|
|
# Magisk service.d autostart script
|
|
# This file is placed on the device at:
|
|
# /data/adb/service.d/99-focus-mode.sh
|
|
# Magisk executes everything in service.d on boot with root.
|
|
# ============================================================
|
|
|
|
# Wait for system to be fully booted before starting daemons
|
|
sleep 120
|
|
|
|
SCRIPT_DIR="/data/local/tmp/focus_mode"
|
|
|
|
# Ensure scripts are executable
|
|
chmod +x "$SCRIPT_DIR/focus_daemon.sh"
|
|
chmod +x "$SCRIPT_DIR/focus_ctl.sh"
|
|
chmod +x "$SCRIPT_DIR/hosts_enforcer.sh"
|
|
chmod +x "$SCRIPT_DIR/dns_enforcer.sh"
|
|
chmod +x "$SCRIPT_DIR/launcher_enforcer.sh"
|
|
|
|
# Start hosts enforcer FIRST - it must bind-mount the hosts file before
|
|
# the user has a chance to exploit it. This runs even outside focus mode
|
|
# because hosts hardening should always be active.
|
|
setsid sh "$SCRIPT_DIR/hosts_enforcer.sh" </dev/null >/dev/null 2>&1 &
|
|
|
|
# Start DNS enforcer - forces Private DNS off and blocks DoH/DoT endpoints
|
|
# so the hosts file actually gets consulted by apps that would otherwise
|
|
# bypass it (e.g. Chrome's built-in secure DNS). Always on.
|
|
setsid sh "$SCRIPT_DIR/dns_enforcer.sh" </dev/null >/dev/null 2>&1 &
|
|
|
|
# Start launcher enforcer - keeps Minimalist Phone installed and pinned as
|
|
# the default HOME. Always on (not location-gated).
|
|
setsid sh "$SCRIPT_DIR/launcher_enforcer.sh" </dev/null >/dev/null 2>&1 &
|
|
|
|
# Start focus daemon in a new session (detached from any controlling terminal)
|
|
setsid sh "$SCRIPT_DIR/focus_daemon.sh" </dev/null >/dev/null 2>&1 &
|
|
|
|
exit 0
|