Skip to content

Fix 14 bugs and improvements from code review#25

Open
kasnder wants to merge 2 commits into
mainfrom
claude/code-review-jduBO
Open

Fix 14 bugs and improvements from code review#25
kasnder wants to merge 2 commits into
mainfrom
claude/code-review-jduBO

Conversation

@kasnder
Copy link
Copy Markdown
Owner

@kasnder kasnder commented Apr 3, 2026

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

claude added 2 commits April 3, 2026 14:57
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
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.

2 participants