guardianproject / haven

Haven is for people who need a way to protect their personal spaces and possessions without compromising their own privacy, through an Android app and on-device sensors
https://guardianproject.github.io/haven/
GNU General Public License v3.0
6.58k stars 728 forks source link

Power event state improvements #371

Closed lukeswitz closed 5 years ago

lukeswitz commented 5 years ago

Aims to address #325

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.

n8fr8 commented 5 years ago

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