Temporarily allow a blocked tracker per app (#216)#643
Closed
kasnder wants to merge 3 commits into
Closed
Conversation
Long-pressing a blocked tracker company/service row in an app's tracker details now offers "Allow for 10 minutes". The company is unblocked immediately (the packet path reads the live TrackerBlocklist singleton), and an AlarmManager alarm re-blocks it when the window expires, so users never have to remember to re-block. Design follows TC's simplicity-over-configurability philosophy: single fixed 10-minute duration, no settings screen. The row shows "ALLOWED FOR 10 MIN" while active. Expiry timestamps are persisted so a process death cannot leave a tracker permanently unblocked — ServiceSinkhole.onCreate sweeps expired allowances (re-block) and reschedules alarms for active ones. Manually re-blocking a row cancels its allowance and alarm. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
kasnder
commented
Jul 12, 2026
kasnder
left a comment
Member
Author
There was a problem hiding this comment.
Review finding: TempUnblockReceiver.java contained two literal NUL bytes in Java string/character literals used as the SharedPreferences key separator. NUL makes the source invalid Java input (and is not a safe XML-backed preference-key delimiter), so this prevented the new receiver from compiling. I replaced the separator with : in commit 1bbf1c1 and verified :app:compileGithubDebugJavaWithJavac succeeds.
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.
Implements #216: temporarily unblock a blocked tracker company/service for a single app, so a user can complete a flow that a blocked tracker breaks, without having to remember to re-block. Per the maintainer's note on the issue, this is done per-app (rather than the existing global pause via the notification).
What it does
Design decisions
TrackerBlocklistsingleton per connection (ServiceSinkhole~line 2540), sounblock()+saveSettings()take effect immediately for new connections — matching the existing per-tracker tap toggle, which also does not reload.TempUnblockReceivercallsRule.clearCache()+ServiceSinkhole.reload(...)to guarantee the change reaches the packet path, mirroring the header toggles.WidgetAdmin's pause alarm:setAndAllowWhileIdle(RTC_WAKEUP, …), allow-while-idle so it can fire in Doze, noSCHEDULE_EXACT_ALARMpermission. Inexact, so under deep Doze the re-block may lag slightly (acceptable — the fail-safe direction is re-blocking late, not never).temp_unblockSharedPreferences file.ServiceSinkhole.onCreate()callsTempUnblockReceiver.sweep(), which re-blocks anything already expired and reschedules alarms for anything still active. So a killed process cannot leave a tracker permanently unblocked.values/strings.xml; translations flow via Crowdin.Files
app/src/main/java/eu/faircode/netguard/TempUnblockReceiver.java(new) — allowance state, alarm scheduling, sweep, re-block.TrackersListAdapter.java— long-press handler, "ALLOWED FOR 10 MIN" status, cancel-on-manual-reblock.ServiceSinkhole.java— sweep on service start.AndroidManifest.xml— registers the (non-exported) receiver.values/strings.xml— new user-facing strings.Needs on-device verification
ListViewrows across supported API levels.Note
A community contributor volunteered on the issue on 2026-07-12. This draft is a starting point — the maintainer may prefer to hand it over to that contributor or use it as a reference.
🤖 Generated with Claude Code