Fix 14 bugs and improvements from code review#25
Open
kasnder wants to merge 2 commits into
Open
Conversation
Bugs fixed: - Replace hashCode()-based preference keys with stable ruleString-based keys to prevent collisions and orphaned state (ServiceConfig, RulesAdapter) - Fix comment leaking across unrelated rules in FilterRuleParser - Fix OverlayManager.clearOverlays race condition between list clear and UI removal - Fix AccessibilityNodeInfo leak in matchPaths for same-class children - Guard against indexOf returning -1 for footer spannable text (crash fix) - Filter empty lines when saving custom rules to prevent accumulation - Fix redundant ServiceConfig instantiation in DistractionControlService - Fix thread safety of rules list using CopyOnWriteArrayList - Add null checks for getSupportActionBar() in MainActivity and CustomRulesActivity Improvements: - Extract duplicated setupNavigationBarColor into NavigationBarHelper utility - Move hardcoded English strings in pause dialog to string resources (i18n) - Move hardcoded progress string in FrictionGateActivity to string resources - Add sanitizeRuleValue to strip ## from user input preventing rule injection - Escape viewId field in LayoutDumper JSON output https://claude.ai/code/session_01MGiLsJG7zisFJTRfLzrkQg
- matchPaths: Original code was correct — the break exits the loop after finding the match, and all previously iterated children were already recycled. Children after the break are never obtained via getChild(). - CopyOnWriteArrayList: onAccessibilityEvent runs on the main thread per Android's AccessibilityService contract, same thread as reloadRulesFromSource. No concurrent access exists, so CopyOnWriteArrayList adds overhead without fixing an actual bug. https://claude.ai/code/session_01MGiLsJG7zisFJTRfLzrkQg
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.
Bugs fixed:
to prevent collisions and orphaned state (ServiceConfig, RulesAdapter)
Improvements:
https://claude.ai/code/session_01MGiLsJG7zisFJTRfLzrkQg