Repository navigation
perf(engine): stop logcat while precise input is live - #70
jeffreyyan4 wants to merge 1 commit into
Conversation
Once the Shizuku input stream is live, log lines are read and discarded without parsing, but the unfiltered logcat stream keeps running. That keeps logd, the shell logcat process and the app's reader thread busy with every line on the phone, around the clock. Stop the log reader while precise input is live and no teaching session needs the log. Restart it when teaching begins, or as the fallback when the input stream ends. The last access state is kept while paused, so the home status, listening state and paused notification are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Why
Once the Shizuku input stream is live,
LogReaderskips every log line (shouldParse()is false), but the unfilteredlogcat -v threadtime,uid -T 1keeps running through the shell service. That keeps logd, the shelllogcatprocess and the app's reader thread busy with every line on the phone, all day, outside Doze.On a Find X9 Pro (ColorOS 17,
CPH2791_17.0.0.102) after 6 days of uptime,topshowed logd at about 80 minutes of CPU time and thelog-readerandlogcatprocesses at about 17 minutes between them. In that state the stream does no detection work.What changed
SnapEnginestops the log reader while precise input is live and no teaching session needs the log. Teaching still learns from the log, sobeginTeachingandprepareTeachingLogsstart it again, andreleaseTeachingLogsandendTeachingpause it afterwards.onAccessChanged(OFF)andreconnectpath, so background consent works as before.LogAccessstate is kept. The home status,listeningSinceand the paused notification therefore behave as before.startBackgroundLogsandonConsentResumeddon't start a reader or show the consent prompt while paused.LogPauseclass keeps the pause and resume state, covered byLogPauseTest.docs/privacy.mdandCONTRIBUTING.mddescribed the log stream staying open during precise input. Both now describe the new behaviour.This adds no new detection risk. While precise input was live, log lines were already discarded without parsing. Before the first key edge after a start, the log still runs as it does today.
CI on the fork passed: unit tests, release build and reproducibility (run). The advisory lint step reports the existing
StartActivityAndCollapseDeprecatederror inSnapTileService.kt:80, which this change doesn't touch.Tested on device: not tested
🤖 Generated with Claude Code