Repository navigation
Commit 2f6a068
v1.0.8: throttle accessibility tree walks to fix frame-rate drop (#12)
User reported visible frame-rate drop while scrolling YouTube with
the accessibility service active. Cause: YouTube fires
TYPE_WINDOW_CONTENT_CHANGED at ~30 Hz during scroll, and v1.0.7 ran
the full 1200-node tree walk on every event. That's ~36k node
inspections per second while scrolling — enough to push the system
past the 16ms frame budget.
Two changes:
1. Throttle walks for content-changed events to one every 250ms.
State-changed events (rare; fire when entering Shorts /
navigating screens) keep being processed immediately so detection
latency on the path that matters is unchanged.
2. Reduce MAX_NODES_PER_WALK from 1200 to 600. Empirically the
relevant Shorts UI lives in the first few hundred nodes; the
1200 cap was just safety margin we don't need.
Net effect for the user: while on YouTube home / scrolling the
feed, we walk ~4×/sec instead of ~30×/sec, and each walk visits
half as many nodes. Total CPU work in the steady state is about
1/15th of v1.0.7. Detection on Shorts open is unaffected since
that triggers a STATE_CHANGED event which still walks immediately.
Bump versionCode 8 → 9, versionName 1.0.7 → 1.0.8.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 345afd4 commit 2f6a068
2 files changed
Lines changed: 23 additions & 5 deletions
File tree
- ShortsBlocker/app
- src/main/java/com/shortsBlocker/service
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
| |||
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
| 103 | + | |
96 | 104 | | |
97 | 105 | | |
98 | 106 | | |
| |||
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
| 113 | + | |
105 | 114 | | |
106 | 115 | | |
107 | | - | |
| 116 | + | |
108 | 117 | | |
109 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
110 | 128 | | |
111 | 129 | | |
112 | 130 | | |
| |||
0 commit comments