Skip to content

Trusted Wi-Fi: open locked apps on networks you trust - #8

Merged
thiagosoeiro merged 4 commits into
masterfrom
feature/trusted-wifi
Sep 11, 2026
Merged

thiagosoeiro merged 4 commits into
masterfrom
feature/trusted-wifi

Conversation

@thiagosoeiro

Copy link
Copy Markdown
Owner

Builds option A of aload0#243 into the app. While the phone is on a trusted Wi-Fi network, locked apps open without authentication. Anywhere else, or whenever the state is unknown, they stay locked. No automation app is needed, and the automation intents from #1 keep working unchanged.

What changed

Commit Change
16b89d2 TrustedNetworkMonitor; isProtectionActive() in all three backends; relockAll, shared with AutomationReceiver; location permissions
b6911d6 Settings → Trusted Wi-Fi: a switch with the permission flow and live status, and a trusted networks dialog
3adb41d The shield shows HOME while a trusted network keeps apps open
a281900 An AUTOMATION.md section on built-in trusted Wi-Fi

How it behaves

  • Fails closed. Trust lives only in memory, so after a reboot or restart apps stay locked until Android reports a trusted network. A network name that can't be read counts as untrusted: Wi-Fi off, Location off, or location access missing or set to "While using the app".
  • Screen-on check. Each time the screen turns on or the phone unlocks, the name is read again, and anything but a trusted name drops trust at once. The check never grants trust and costs no wake-ups.
  • Leaving re-locks, through the same relockAll used when the shield is turned back on.
  • The shield stays the master switch. Trusted Wi-Fi only relaxes locking while the shield is on, and never changes it. The automation intents still read and write only the shield flag.
  • Networks match by name only. Someone holding the unlocked phone could name a hotspot the same and connect to it. The Settings dialog and the docs say so.
  • Needs precise location, "Allow all the time" and Location on. Only the network name is read.
  • Unchanged: the anti-uninstall and device-admin guards, the service notification, and the automation intents.

Testing

Not compiled locally; CI is the first build.

On the phone, first turn off any automation that sends DISABLE_PROTECTION, or it will hide the result. Then:

  • Turn the switch on, grant precise location and "Allow all the time", and add the network. The shield shows HOME and a locked app opens without the PIN.
  • Wi-Fi off: the shield shows ON, locked apps ask for the PIN, and an app already open locks on its next interaction.
  • Walk out of range: locked once Wi-Fi drops. Back in range: HOME.
  • Location off: locked straight away. Back on: HOME.
  • Location set to "While using the app", then screen off and on: locked, and the status asks for "Allow all the time".
  • A different network: locked.
  • Reboot: locked until Wi-Fi connects.
  • Shield taps: HOME → OFF → HOME on a trusted network; ON → OFF → ON elsewhere.
  • Anti-uninstall still guards App info on a trusted network.
  • Log: trust changes appear without network names. "Screen-on check found no trusted network" should not appear on every screen-on while on a trusted network; if it does, Android is withholding the direct Wi-Fi read.
  • The permission prompts, Location app permissions and the background-location reminder all show "System Services".

🤖 Generated with Claude Code

https://claude.ai/code/session_01HVGZVKJhw7t1rVQitX1sFz

thiagosoeiro and others added 4 commits September 11, 2026 12:38
Builds option A of the trusted-Wi-Fi feature request into the app: while the
phone is on a trusted Wi-Fi network, the lock backends let locked apps open,
so protection can follow home Wi-Fi without an automation app.

TrustedNetworkMonitor follows the connected Wi-Fi through a network callback
and fails closed throughout, since it switches locking off:
- trust is kept in memory only, so a reboot or restart stays protected until
  Android reports a trusted network;
- a name that can't be read (Location off, no location access, or access only
  while in use) counts as untrusted, and turning Location off drops trust at
  once;
- when the screen turns on or the phone unlocks, the name is read again and
  anything but a trusted name drops trust. That check never grants trust, and
  unlike a timer it costs no wake-ups.

The three backends now check isProtectionActive(): the shield is on and no
trusted network is relaxing it. The shield and the automation intents still
read and write only the shield flag, so the two features stay independent.
Anti-uninstall runs before that check and is unaffected.

Leaving a trusted network re-locks through relockAll, moved out of
AutomationReceiver.setProtection, so both paths clear unlocks and restart the
services the same way.

Off by default; the Settings screen that turns it on comes next.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVGZVKJhw7t1rVQitX1sFz
A Trusted Wi-Fi section in Settings turns the feature on and manages the
networks.

Turning it on asks for precise location, then for "Allow all the time" (from
Android 11 on its own settings page, after a short explanation), because
Android only shares the Wi-Fi name with apps that have location access, and
only in the background with that grant. The switch stays off until both are
granted.

A network can only be added while connected to it, never typed, so the stored
name always matches what Android reports: quoted, or hex for names that aren't
valid UTF-8. The dialog says plainly that networks are matched by name.

The status line under the switch follows the monitor, and location access and
the Location switch are re-read whenever the screen resumes. With Location
off, the dialog offers a button to Android's Location settings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVGZVKJhw7t1rVQitX1sFz
Otherwise the shield says ON at home while locked apps open freely. Tapping it
still toggles the same flag, so at home it cycles HOME, OFF, HOME.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVGZVKJhw7t1rVQitX1sFz
Covers setup, why location access is needed, the fail-closed rules including
the screen-on check, how it combines with the automation intents, and the
limits of matching networks by name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVGZVKJhw7t1rVQitX1sFz
@thiagosoeiro
thiagosoeiro merged commit 5aa1ba4 into master Sep 11, 2026
2 checks passed
@thiagosoeiro
thiagosoeiro deleted the feature/trusted-wifi branch September 11, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant