Skip to content

Record the charge counter and the current in the battery log - #7

Merged
danielgorgonha merged 2 commits into
mainfrom
feat/battery-log-counter
Nov 13, 2026
Merged

danielgorgonha merged 2 commits into
mainfrom
feat/battery-log-counter

Conversation

@danielgorgonha

Copy link
Copy Markdown
Member

What this changes and why:

  • scripts/battery-log.mjs also records the charge counter (µAh) and the current (mA) every 10 s, as the battery method in docs/method.md proposes. A phone that does not print a field logs none.
  • Both fields come from the battery service's own lines (anchored, first match). The battery event history that dumpsys battery prints after them is never read, since it holds times of use and other apps.
  • docs/method.md, docs/protocol-details.md and the CHANGELOG say what the logger records.

Tests run (see CONTRIBUTING.md):

node --test tests/node.test.mjs tests/charts.test.mjs: all pass. A new test puts history-shaped lines before and after the service block and checks that nothing from them reaches the log. Mutants that read cc: from the history, take the last match, or drop the anchors make it fail.

For a result under community-results/: commit built, device, browser:

Not applicable.

AI disclosure: no AI assistance / AI-assisted (tool and what it did):

AI-assisted: Claude Code wrote the change and the tests; a separate AI review pass audited them.

🤖 Generated with Claude Code

danielgorgonha and others added 2 commits November 13, 2026 01:09
The battery method reads both; they come from the battery service's own
lines, never from the event history dumpsys prints after them.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@danielgorgonha
danielgorgonha merged commit 881e9ab into main Nov 13, 2026
2 checks passed
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.

1 participant