Skip to content

Respect per-app monitoring toggle when recording tracker access (#435)#644

Merged
kasnder merged 2 commits into
masterfrom
claude/fix-monitoring-off-435
Jul 12, 2026
Merged

Respect per-app monitoring toggle when recording tracker access (#435)#644
kasnder merged 2 commits into
masterfrom
claude/fix-monitoring-off-435

Conversation

@kasnder

@kasnder kasnder commented Jul 12, 2026

Copy link
Copy Markdown
Member

Fixes #435.

Problem

With Manage system apps on, a user turned monitoring off for the "GPS daemon" system app, yet the app list kept showing "contacted 1 company last week" (google.com). Clearing the tracker data made it reappear hours later. Expected: with per-app monitoring disabled, no new tracker-contact data should accrue for that app.

Root cause

The app-list count comes from access rows written by updateAccess(). That write is gated by shouldTrackApp(packet.uid):

  • Write site: ServiceSinkhole.java:988 (application log -> dh.updateAccess(...))
  • Gate: ServiceSinkhole.java shouldTrackApp(int uid)

shouldTrackApp() checked tracker protection (tracker_protect) and manage_system, but never the apply (monitoring) preference. Turning monitoring off adds the package to addDisallowedApplication (ServiceSinkhole.java:1713-1716, 1756-1758), so its own traffic bypasses the VPN — but traffic from system daemons sharing the same UID still reaches the tunnel. Because the count query (TrackerList.getTrackerCountsAndTotal()) is keyed by UID, those rows kept being written and displayed on the monitoring-off app, and re-accrued after a clear.

Fix

Add an apply/monitoring check to shouldTrackApp(), using a cached prefs handle refreshed in reload() — matching the existing cachedTrackerProtectPrefs pattern. When monitoring is off for the resolved package, no tracker access is recorded. This mirrors the VPN-exclusion semantics already applied when apply is false; blocking behaviour for monitored apps is unchanged, and no new setting is introduced.

Verification

  • ./gradlew :app:compileGithubDebugJavaWithJavac passes.
  • Needs on-device verification: with Manage system apps on, disable monitoring for a system app (e.g. GPS daemon / a shared-UID system component), clear its tracker data, and confirm over several hours that the "contacted N companies" line does not reappear, while blocking/monitoring of other apps continues normally.

🤖 Generated with Claude Code

kasnder and others added 2 commits July 12, 2026 10:24
When "Manage system apps" is on and monitoring (the per-app `apply`
toggle) is turned off for a system app such as the GPS daemon, the app
list kept showing "contacted N companies last week" and the data
reaccrued hours after clearing it.

`shouldTrackApp()` gates whether tracker access is recorded via
`updateAccess()` (ServiceSinkhole.java:988), and the app-list count is
derived from those access rows. The gate checked tracker protection and
`manage_system`, but never the `apply`/monitoring preference. Turning
monitoring off adds the package to `addDisallowedApplication`, but
traffic from system daemons sharing the app's UID can still reach the
tunnel, so access rows kept being written under that UID and displayed
on the monitoring-off app.

Add an `apply` preference check to `shouldTrackApp()` (with a cached
prefs handle refreshed in reload(), matching the existing
tracker_protect pattern) so monitoring-off apps record no new tracker
access. This mirrors the VPN-exclusion semantics already applied when
`apply` is false and does not introduce any new setting.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kasnder

kasnder commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

Review summary: I inspected the full diff and surrounding access-recording, preference reload, UID/package cache, shared-UID related-rule propagation, and app-removal invalidation paths. The apply preference is refreshed with the same lifecycle as the existing tracker-protection preferences, and related packages sharing a UID receive synchronized rule changes, so I did not find an actionable correctness or regression issue. The diff check is clean, and the refreshed GitHub test job passes.

@kasnder kasnder marked this pull request as ready for review July 12, 2026 10:38
@kasnder kasnder merged commit 302f9e8 into master Jul 12, 2026
1 check 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.

GPS daemon

1 participant