Skip to content

Reload rules when apps on external storage become available - #998

Merged
kasnder merged 2 commits into
masterfrom
claude/gracious-planck-ar7bx1
Oct 25, 2026
Merged

kasnder merged 2 commits into
masterfrom
claude/gracious-planck-ar7bx1

Conversation

@kasnder

@kasnder kasnder commented Oct 25, 2026

Copy link
Copy Markdown
Member

Fixes #975.

Problem

Apps installed on an SD card or adopted storage only become visible once the volume mounts. On boot that happens after ServiceSinkhole has built its rules, so those apps are unknown to the VPN and get no network access until the user refreshes the app list.

Change

Android announces the mount with ACTION_EXTERNAL_APPLICATIONS_AVAILABLE (and the unmount with ..._UNAVAILABLE). These broadcasts carry no data URI, so the existing package-scheme filter never matches them.

  • ServiceSinkhole: register a second, scheme-less filter on packageChangedReceiver. On available, clear the rule cache, resolve any pending internet/tracker settings for the packages in EXTRA_CHANGED_PACKAGE_LIST (they could not be mapped to a UID while the volume was missing), save if changed, and reload. On unavailable, clear the cache and reload, keeping settings, since the apps are still installed.
  • ActivityMain: same filter, so an open app list refreshes as well.

Testing

  • Not compiled: the cloud container has no Android SDK, and Maven Central rate-limited the Gradle configuration. Needs ./gradlew :app:compileGithubDebugJavaWithJavac in CI.
  • Not tested on a device. It needs someone with apps on external storage (the reporter offered) to reboot and check that those apps get network access without opening TrackerControl.

https://claude.ai/code/session_014q8SwK4eSqqhJWWVKN6VJW


Generated by Claude Code

Apps on an SD card or adopted storage are announced only once the volume
mounts, which on boot is after the service has built its rules. They
stayed without network access until the app list was refreshed by hand.
Listen for ACTION_EXTERNAL_APPLICATIONS_AVAILABLE/UNAVAILABLE in the
service and the main activity, reload the rules, and resolve any saved
settings that were still pending for the newly visible packages.

Fixes #975

Claude-Session: https://claude.ai/code/session_014q8SwK4eSqqhJWWVKN6VJW

kasnder commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

The instrumentation check failed in WgbridgeInstrumentedTest.tunnelStatsRebindAndStopUseRealJni with Failed to bind UDP sockets ... Address already in use (os error 98). That's in wgbridge-rs, which this PR doesn't touch, and the same test was red on master at fa4fce0. #999 fixed it on master, so I merged master into this branch (7b3f089) to pick that fix up.


Generated by Claude Code

@kasnder
kasnder marked this pull request as ready for review October 25, 2026 22:47
@kasnder
kasnder merged commit d6011a3 into master Oct 25, 2026
3 checks passed
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.

Sdcard applications not detected on startup.

2 participants