Skip to content

Reduce battery usage from background log streaming#6

Merged
greenart7c3 merged 2 commits into
masterfrom
claude/reduce-battery-usage-Wcv0h
May 22, 2026
Merged

Reduce battery usage from background log streaming#6
greenart7c3 merged 2 commits into
masterfrom
claude/reduce-battery-usage-Wcv0h

Conversation

@greenart7c3
Copy link
Copy Markdown
Owner

The logcat reader was spawned in Application.onCreate and ran forever,
reading and string-matching every line of the device's system log even
while the UI was closed. Scope it to the Activity lifecycle so it only
runs while the user is looking at the log view, and filter at the
logcat level (Morganite:V *:S) so unrelated system log lines never
reach our process.

Also drop the AlarmManager.RTC_WAKEUP indirection used to start the
foreground service (startForegroundService directly does the same job
without a wake alarm) and remove the NostrClientLoggerListener whose
only purpose was to emit a Log.d for every websocket event.

claude added 2 commits May 21, 2026 15:00
The logcat reader was spawned in Application.onCreate and ran forever,
reading and string-matching every line of the device's system log even
while the UI was closed. Scope it to the Activity lifecycle so it only
runs while the user is looking at the log view, and filter at the
logcat level (Morganite:V *:S) so unrelated system log lines never
reach our process.

Also drop the AlarmManager.RTC_WAKEUP indirection used to start the
foreground service (startForegroundService directly does the same job
without a wake alarm) and remove the NostrClientLoggerListener whose
only purpose was to emit a Log.d for every websocket event.
The kernel-side filter form 'logcat Morganite:V *:S' was not matching
in practice, so no lines reached the UI. Go back to reading the full
logcat stream and filtering by tag in Kotlin like the original code.

The lifecycle scoping from the previous commit is what actually saves
battery (logcat no longer runs while the UI is closed); the kernel
filter was only a minor optimization on top of that and isn't worth
losing the log view over.
@greenart7c3 greenart7c3 merged commit 4801c68 into master May 22, 2026
1 check passed
@greenart7c3 greenart7c3 deleted the claude/reduce-battery-usage-Wcv0h branch May 22, 2026 15:05
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