Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power event state improvements #371

Merged
merged 4 commits into from
Feb 28, 2019
Merged

Power event state improvements #371

merged 4 commits into from
Feb 28, 2019

Conversation

lukeswitz
Copy link
Collaborator

Aims to address #325

  • Remove hardcoded 'USB' from event
  • Return Disconnected, USB, AC & Wireless states on change
  • Add battery percentage

Sample output when unplugged & quickly reconnected:

Power
Feb 12, 2019 2:33:30 PM
POWER: 100%
STATE: Disconnected

Power
Feb 12, 2019 2:33:32 PM
POWER: 100%
STATE: USB Charging

Notes: faulty cable/connection may deliver odd power events as noted in #325. Testing concluded that voltage drops from a furnace, etc. can trigger a power event. Adding a delay would only add an attack vector (and false positives have been minimal). That said, testing and comments appreciated here.

I am going to look into making alerts configurable, with sensitivity options as suggested in #324 but for now I think this makes sense.

Instead of 'Charging true' the alert displays time, power level & state/source
Reuse method from heartbeat notifications
@n8fr8 n8fr8 merged commit 1f72731 into guardianproject:master Feb 28, 2019
@n8fr8
Copy link
Member

n8fr8 commented Feb 28, 2019

Had to add explicit receiver registration in monitor service in order to receive power events on Android 9 / Nokia 6.1.... otherwise, awesome!

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