power: Refactor PowerSupply to support multiple sources.

Pull the line-power- and battery-specific code from the
massive PowerSupply::UpdatePowerStatus() method out into
separate methods and update it to support iterating through
multiple line power directories, reporting the first one
from which the system is being charged.

Also ignore line power directories that claim to be
discharging.

BUG=chromium:424246
TEST=existing tests pass; also added new tests and manually
     verified on devices

Change-Id: I61deb8f6ffb9eee92172062c98d5fcbaf580edca
Reviewed-on: https://chromium-review.googlesource.com/225263
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
3 files changed