Respect per-app monitoring toggle when recording tracker access (#435)#644
Merged
Conversation
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>
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 byshouldTrackApp(packet.uid):ServiceSinkhole.java:988(application log ->dh.updateAccess(...))ServiceSinkhole.javashouldTrackApp(int uid)shouldTrackApp()checked tracker protection (tracker_protect) andmanage_system, but never theapply(monitoring) preference. Turning monitoring off adds the package toaddDisallowedApplication(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 toshouldTrackApp(), using a cached prefs handle refreshed inreload()— matching the existingcachedTrackerProtectPrefspattern. When monitoring is off for the resolved package, no tracker access is recorded. This mirrors the VPN-exclusion semantics already applied whenapplyis false; blocking behaviour for monitored apps is unchanged, and no new setting is introduced.Verification
./gradlew :app:compileGithubDebugJavaWithJavacpasses.🤖 Generated with Claude Code