aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Erat <derat@chromium.org>2017-08-02 19:00:21 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-08-05 22:07:57 -0700
commit87d717a9e67756a26a49c4c23592d88760d11a5a (patch)
treebfcf952149f4bf38f2032ffc22d57ea2c8371b4d
parent0143e1b0a141eb02192f018b04e4358f39efb5fb (diff)
downloadsystem_api-87d717a9e67756a26a49c4c23592d88760d11a5a.tar.gz
system_api: battery_percent default in PowerSupplyProperties
Update powerd's PowerSupplyProperties protocol buffer to specify a default of -1.0 for its battery_percent field. powerd has historically set this field to -1 when a battery isn't present, but it's probably more correct to leave battery-related fields unset in this case. Chrome reads these fields unconditionally in some cases, though, so we want to maintain the same user-facing behavior. BUG=chromium:724903 TEST=none Change-Id: I7cf0b9e46e7e90742185c7785a9b2133cd6af1ff Reviewed-on: https://chromium-review.googlesource.com/598512 Commit-Ready: Dan Erat <derat@chromium.org> Tested-by: Dan Erat <derat@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Reviewed-by: Naoki Fukino <fukino@chromium.org>
-rw-r--r--dbus/power_manager/power_supply_properties.proto17
1 files changed, 10 insertions, 7 deletions
diff --git a/dbus/power_manager/power_supply_properties.proto b/dbus/power_manager/power_supply_properties.proto
index 2a1906a..c68b938 100644
--- a/dbus/power_manager/power_supply_properties.proto
+++ b/dbus/power_manager/power_supply_properties.proto
@@ -107,25 +107,28 @@ message PowerSupplyProperties {
optional BatteryState battery_state = 15;
// Estimated battery charge as a percent of its total capacity, in the
- // range [0.0, 100.0].
- optional double battery_percent = 7;
+ // range [0.0, 100.0]. Unset if a battery isn't present.
+ optional double battery_percent = 7 [default = -1.0];
// Estimated time until the battery is empty, in seconds, or zero if the
// battery isn't discharging. -1 if the estimated time would be huge
- // (e.g. because the current is zero or close to zero).
+ // (e.g. because the current is zero or close to zero). Unset if a battery
+ // isn't present.
optional int64 battery_time_to_empty_sec = 5;
// Estimated time until the battery is full, in seconds, or zero if the
// battery isn't charging. -1 if the estimated time would be huge (e.g.
- // because the current is zero or close to zero).
+ // because the current is zero or close to zero). Unset if a battery isn't
+ // present.
optional int64 battery_time_to_full_sec = 6;
// True when |battery_time_to_*| can't be trusted, e.g. because the power
- // source just changed.
+ // source just changed. Unset if a battery isn't present.
optional bool is_calculating_battery_time = 12 [default = false];
- // The battery discharge rate measured in W. Positive if the battery is
- // being discharged and negative if it's being charged.
+ // The battery discharge rate measured in W. Positive if the battery is being
+ // discharged, negative if it's being charged, or unset if a battery isn't
+ // present.
optional double battery_discharge_rate = 16;
// True if it is possible for some connected devices to function as either