Commit graph

50 commits

Author SHA1 Message Date
Ruchi Kandoi
6e394f0f6c healthd: Check if battery device exists instead of charger drivers before setting fake properties. am: 9cb3d3ccf4
am: f2ca669e80

* commit 'f2ca669e80078254ad3aceac800161b3266d3195':
  healthd: Check if battery device exists instead of charger drivers before setting fake properties.

Change-Id: I8115836dbd81264634dd7ab84bc360ac610a030b
2016-05-17 18:23:04 +00:00
Ruchi Kandoi
9cb3d3ccf4 healthd: Check if battery device exists instead of charger drivers before
setting fake properties.

healthd used to check for registered charger drivers to determine if the
device is an always-plugged device with no battery. This patch changes
it to check for battery instead.

Change-Id: Ie4ff5d3f21dc1a83a780a41eb0c929f66b86d631
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
(cherry picked from commit fabd490f58)
2016-05-16 08:58:35 -07:00
Ruchi Kandoi
3f9886bb0b healthd: Add charge counter for BatteryProperties.
Bug: 27174034
Change-Id: I26de33714bb353faadb159d898f0b2142c76c657
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2016-04-07 23:10:14 +00:00
Ruchi Kandoi
5c09ec1726 healthd: Correct the scaling factor for maxVoltage and maxCurrent.
Change-Id: I93a4c916d0c742710c00c0b15d8d1de6b8f8d1c2
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2016-02-26 10:09:28 -08:00
Badhri Jagan Sridharan
40e1df4488 healthd: Read the max power supply voltage
With Type-C PD, VBUS can no longer be assumed to
to be at 5V. Read the "voltage_max" field from the
power_supply class node and export it through
BatteryProperties service.

Bug: 25229483
Change-Id: I04e32d9783a21bab375f1724758a9eeace2a047c
2016-02-25 12:15:54 -08:00
Yabin Cui
b0580d710f healthd: support reading charge status from BatteryMonitor.
recovery needs to know whether the battery is charged.

Bug: 26879394
Change-Id: Ie2a1d06e81878efa3ff432c2015d409a625e473e
(cherry picked from commit aedf6038dc)
2016-02-23 11:01:21 -08:00
Yabin Cui
f6dbc6d4b8 healthd: separate libbatterymonitor for use in recovery.
Bug: 26879394

Change-Id: I97b5b4994c42988ce43f5085b8b4b25e9e80c9fa
(cherry picked from commit e98e177a34)
2016-02-23 10:52:43 -08:00
Yabin Cui
ac3387b71b healthd: init members of BatteryMonitor.
Bug: 26879394
Change-Id: I09a6c78137f91a0c88bf4ba1e8890b4ec31dcf2c
(cherry picked from commit db04a49a6f)
2016-02-23 10:46:38 -08:00
Elliott Hughes
96e3d1b5c1 Merge "Add support for USB_HVDCP chargers" am: ba3014c914
am: a902887970

* commit 'a9028879707d58f286014c4a6a9c6b53f61c2806':
  Add support for USB_HVDCP chargers
2016-02-04 02:35:19 +00:00
Johan Redestig
3282861b68 Add support for USB_HVDCP chargers
and print a warning message containing the type
when the battery monitor fails to recognize a power supply.

Change-Id: I02ebd89736f7444f8bf7f28550afeec82d57e107
2016-02-03 13:45:54 +01:00
Mark Salyzyn
580933efcd Merge "logd: isMonotonic improvements" am: 554630f94e
am: e4a625a844

* commit 'e4a625a84498b0749986be85a521be85088ca5f0':
  logd: isMonotonic improvements
2015-12-30 21:38:02 +00:00
Mark Salyzyn
10b82b6834 logd: isMonotonic improvements
Use 1972 as a right delineation. Otherwise use half way point
between the monotonic and realtime. Treat correction factor as
unsigned, ensure that any wrapping to a negative value is
dropped or set to EPOCH. Acknowledge that we can get a more
accurate time track by acquiring the time rather than relying on
healthd timestamp.

Bug: 26331432
Change-Id: I09075fca58676a30cf7d87baf2d4b0f53795abaa
2015-12-29 11:34:29 -08:00
Qiwen Zhao
7ac8cacdfe Merge remote-tracking branch \'origin/mnc-dr2-dev\' into mnc-dr2-dev-plus-aosp
am: 09aa2f9b2c

* commit '09aa2f9b2c34339878dfd218d1c6e09644a108b0':
  Fix build break with uninitialized boost_fd.
  Improve cpuset support for surfaceflinger.
  liblog: printable do not escape tabs
  libutils: Add UNEXPECTED_NULL status_t
2015-11-19 16:30:32 +00:00
Ruchi Kandoi
e99972ac49 Merge "healthd: Support new PD and USB Type C types" am: ab75edb4ad am: 741df1263e
am: 6b1c15d7ff

* commit '6b1c15d7ffe95bc43cc160e3f81b6bf1f4629159':
  healthd: Support new PD and USB Type C types
2015-11-13 17:48:43 +00:00
Ruchi Kandoi
741df1263e Merge "healthd: Support new PD and USB Type C types"
am: ab75edb4ad

* commit 'ab75edb4ad01b518cb5c96a5a3d4ad344bc4ce26':
  healthd: Support new PD and USB Type C types
2015-11-13 17:39:54 +00:00
Benson Leung
8a4eef60e1 healthd: Support new PD and USB Type C types
See the new types added here :
https://chromium-review.googlesource.com/304660
Add support for these.

Signed-off-by: Benson Leung <bleung@google.com>

Change-Id: I12c51e0611692a763a7f1cda57c77ad83d7aa7ea
2015-11-12 18:12:43 -08:00
Badhri Jagan Sridharan
42d9133a23 healthd: Read the max power supply voltage
With Type-C PD, VBUS can no longer be assumed to
to be at 5V. Read the "voltage_max" field from the
power_supply class node and export it through
BatteryProperties service.

Bug: 25229483
Change-Id: I04e32d9783a21bab375f1724758a9eeace2a047c
2015-11-02 10:23:44 -08:00
Ian Pedowitz
585ab65c58 Adding comment removed from failed merge (6acb240c)
Change-Id: Iace4c8512c6a4a26d36b98a5a3144e6836db1904
2015-10-12 19:01:00 -07:00
Ruchi Kandoi
6acb240c53 am 43ed8e15: am 08cf0e55: Merge "healthd: Adds fake battery properties for devices with no battery." into mnc-dr-dev
* commit '43ed8e152214094c453048948877b1b4c7b29e23':
  healthd: Adds fake battery properties for devices with no battery.
2015-10-13 00:20:08 +00:00
Ruchi Kandoi
42a981ddee healthd: Adds fake battery properties for devices with no battery.
Devices which have no battery and are always plugged in will not have
any battery property initialized. This causes the 'stable power' to
never be switched which is required for updating apps.

This change recognizes such a device and manually sets the battery to
100% and charger status to connected to AC mains. It will also fake the
battery temperature.

Bug: 24258855
Change-Id: I98e5ed0dbeb7f2ab6d3802cd7e0f3a269bd8f31f
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2015-10-12 14:31:58 -07:00
Ruchi Kandoi
f18ec9f227 healthd: Adds fake battery properties for devices with no battery.
Devices which have no battery and are always plugged in will not have
any battery property initialized. This causes the 'stable power' to
never be switched which is required for updating apps.

This change recognizes such a device and manually sets the battery to
100% and charger status to connected to AC mains. It will also fake the
battery temperature.

Bug: 24258855
Change-Id: I98e5ed0dbeb7f2ab6d3802cd7e0f3a269bd8f31f
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2015-10-09 13:18:09 -07:00
Mark Salyzyn
bc193c53ec healthd: logd: add timestamp to kernel logged battery messages
(cherry pick from commit acb1ddf56c)

Aid monotonic to realtime logging synchronization correction in
the Android ecosystem by providing a periodic notification.  We
now have the following messages in the kernel logs:

- PM: suspend entry %Y-%m-%d %H:%M:%S.%09q UTC
- PM: suspend exit %Y-%m-%d %H:%M:%S.%09q UTC
- Suspended for %s.%03q seconds
- healthd: battery l=100 ... %Y-%m-%d %H:%M:%S.%09q UTC

Alter klogd to resynchronize on healthd messages as well.

NB: Time using strftime format, %q is a reference to fractional
second as introduced into log_time strptime method.

Bug: 21868540
Change-Id: I854afc0a07dff9c7f26d2b2f68990e52bf90e300
2015-08-27 10:14:10 -07:00
Ruchi Kandoi
ef1bb411cb am 62729a1d: am 565e4c6a: Merge "healthd: Adds cycle_count, current_now and full_charge properties."
* commit '62729a1d195cd27b353da24be21bd0a855884431':
  healthd: Adds cycle_count, current_now and full_charge properties.
2015-08-26 03:47:33 +00:00
Ruchi Kandoi
cc338801e4 healthd: Adds cycle_count, current_now and full_charge properties.
Bug: 22981343
Change-Id: I4b942b891f61e6bf12e3b23f4e0ada5b7f14fd83
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2015-08-24 13:01:16 -07:00
Mark Salyzyn
2be6ebbedb am e49aba54: am 95e7cb5b: Merge "healthd: logd: add timestamp to kernel logged battery messages"
* commit 'e49aba5413419bbc4f87889edd9a12956a932ef8':
  healthd: logd: add timestamp to kernel logged battery messages
2015-08-12 14:29:05 +00:00
Mark Salyzyn
acb1ddf56c healthd: logd: add timestamp to kernel logged battery messages
Aid monotonic to realtime logging synchronization correction in
the Android ecosystem by providing a periodic notification.  We
now have the following messages in the kernel logs:

- PM: suspend entry %Y-%m-%d %H:%M:%S.%09q UTC
- PM: suspend exit %Y-%m-%d %H:%M:%S.%09q UTC
- Suspended for %s.%03q seconds
- healthd: battery l=100 ... %Y-%m-%d %H:%M:%S.%09q UTC

Alter klogd to resynchronize on healthd messages as well.

NB: Time using strftime format, %q is a reference to fractional
second as introduced into log_time strptime method.

Bug: 21868540
Change-Id: I854afc0a07dff9c7f26d2b2f68990e52bf90e300
2015-07-28 16:52:58 -07:00
Adrian Roos
d5fe6675a7 Show charging speed on Keyguard
Bug: 8099739
Change-Id: I2e5c21dd7ec028ce47fb03ab71e74f7fccaa9e36
2015-07-13 17:33:07 -07:00
Andreas Gampe
38c3386a6c resolved conflicts for merge of 03be4928 to lmp-mr1-dev-plus-aosp
Change-Id: I7c72ed2c54ceae19c9dfe8b2e1707f869faad110
2014-11-25 11:45:46 -08:00
Andreas Gampe
c0970d31f3 Healthd: Remove unused variables
For build-system CFLAGS clean-up, remove unused variables.

Change-Id: Ifc5884518bfdb744ea9823b98db544dbe59c20d2
2014-11-24 18:48:55 -08:00
Todd Poynor
ebeb0c0ea6 healthd: use warning level for info logs
To allow healthd/charger info to appear in systems where the loglevel
has been bumped to squelch chatty drivers.

Change-Id: I4ab135765700d7584a1ce5d972ea473d77f299f8
2014-09-23 15:05:07 -07:00
Ruchi Kandoi
a78fc23491 healthd: Reports arbitrary numbers for capacity and temperature when
connected to fake battery.

Detects if the device is attached to a fake battery if yes, healthd
reports 42% battery charge and 42.2 degrees temperature.

Change-Id: I2508fd91c8d3848ea64f57ab59d20be1c2817913
2014-07-11 01:19:28 +00:00
Todd Poynor
3db03a5ab0 healthd: Set fixed battery level and temperature via properties
setprop persist.sys.battery.capacity 77
setprop persist.sys.battery.temperature 123

and reboot to cause a fixed battery level of 77% and temperature of 12.3C
to be reported to Android.

Typically used on power evaluation boards without batteries connected.

Bug: 14839868
Change-Id: Ibae5e16429d05891cb0787d74a2fe93b07013699
2014-05-22 01:56:15 +00:00
Todd Poynor
e14b37eb07 healthd: Add hooks for ENERGY_COUNTER property
Bug: 10118565
Change-Id: Ibabae2a78a600ae37ce9b91da0f5980ee94b05c2
2014-05-20 16:26:48 -07:00
Todd Poynor
8f132af495 healthd: Add ENERGY_COUNTER property placeholder, and 64-bit properties
Will add healthd HAL support for ENERGY_COUNTER, and support in some HALs,
in following CLs.

Change-Id: Ife2eaa30473be3a59183c6ce61fdaa61f32dd01b
2014-05-16 03:05:47 +00:00
Mark Salyzyn
6f5b47f914 healthd: Turn on -Werror
Change-Id: I72caf38008ee7d842dfacd3f58add9bc8e4787e8
2014-05-15 15:46:15 -07:00
Paul Lawrence
347c8de285 healthd: Add battery capacity to getProperty
Add support for BATTERY_PROP_CAPACITY property in getProperty

Bug: 11985952
Change-Id: I905cda68f990fa96138a16a11c55f2d902d0bbc1
2014-03-20 18:16:14 -07:00
Todd Poynor
c15e993467 healthd: remove/rearrange extra battery property handling
Change-Id: I6cc1570e23c1c1468f08579f633997e95327347a
2013-10-22 18:21:27 -07:00
Todd Poynor
020369d872 healthd: BatteryService dumpstate support
Change-Id: Ia6938b7126751801310632c995af0f96e41f5f64
2013-10-22 16:32:54 -07:00
Todd Poynor
6dcc45ed6d healthd: Fixups for systems without batteries or removable batteries
* Replace unnecessary warnings about missing attributes with a more
  informative message when no battery devices provided by the system.

* Turn off periodic battery checks when no battery devices (thereby
  reducing unnecessary kernel log spam).

* Replace battery properties in log messages with a more informative
  message when no battery is provided or the battery is removed.

Change-Id: I68a514aa7315ae2b5d22cb8861d3c9b1b38035a1
2013-10-22 11:15:50 -07:00
Todd Poynor
2e227fbc5a healthd: start switchover to BatteryExtraProperties
Change-Id: I47a24d4284f502858ee929b2cda8881165ef4ef3
2013-09-30 15:36:44 -07:00
Todd Poynor
c7464c9150 healthd: move Android communication code to separate source
* add ops for different "modes" of healthd operation: android vs. recovery
* recovery mode selected by runstring options -r
* binder/Android communication moved to android mode
* recovery mode ops avoiding binder service registration
* "no service manager" flag removed; now handled by android vs. other modes

Change-Id: I3d8c89bf96a18a6a00cc85306f9a07d3f408f2a0
2013-09-17 14:41:07 -07:00
Todd Poynor
7b27f27d3d healthd: break link between BatteryMonitor and BatteryPropertiesRegistrar
Make it easier to later separate out binder-related code.

Add helper functions healthd_battery_update(), healthd_get_property() to
allow these operations without needing references to the BatteryMonitor
object.

Change-Id: Ie584bf53e5178ce0a098d0d940d6c311fdff62d4
2013-09-17 11:18:36 -07:00
Todd Poynor
bc10211184 healthd: Add average current property
Change-Id: Ibc901fe1b550c0d72095ef5590e2db8962d1a7b2
2013-09-04 17:41:57 -07:00
Todd Poynor
c133b7198a healthd: read individual battery property value on demand
Adding support for batteryChargeCounter and batteryCurrentNow as parameters
likely to be useful for power consumption analysis.

Change-Id: Ib23b05d3c31c22ece0d21e55cc481c1b5dabe59e
2013-08-22 02:00:26 +00:00
Todd Poynor
f5d3012d2c healthd: Move power_supply attribute paths to healthd_config
Allow health HAL to select specific paths to be used, overriding
default search for arbitrary power supplies with the named paths.

Change-Id: I5f724739f58ef56087ab592b7403fc083db8f173
2013-08-14 02:27:54 +00:00
Todd Poynor
a41611f638 healthd: fix botched logging call
Change-Id: Ibf5e28c657e0d9d193b266acd7b2912bebc3e71f
2013-08-12 12:18:36 -07:00
Todd Poynor
57fd0989cb healthd: preserve uA and uAh units for current_now and charge_counter
Change-Id: I20b3f47c541c4321b0593e504090ad6573b9cb01
2013-08-09 21:52:25 +00:00
Todd Poynor
10b235e743 healthd: add health HAL support
Adds board-specific battery monitoring capabilities:

* processing of battery property values and additional charging logic.
* adjusted (or removed) polling intervals.
* replaced (or removed) battery status heartbeat in kernel log.

Change-Id: Ia77bca8dc92c6c2a51afa65d516cacca08da73ac
2013-08-07 18:57:37 -07:00
Todd Poynor
b45f1f5bd0 healthd: add optional current_now and charge_counter to tracked state
uA and uAh units are converted to mA and mAh.

If current_now is present, add it to the heartbeat log (c=nnn).

Change-Id: I2b5fe7b4505c98ca2d11c3f94564c1c38493c8b9
2013-08-07 18:34:34 +00:00
Todd Poynor
752faf2c18 healthd: Add system health monitoring daemon
Initially moving battery health monitoring here.

Command line flag -n tells healthd not to use (or wait for) servicemanager
in this execution, for charger and recovery modes.

Change-Id: I1720594724af0c068497b359f9c6ad65aeaa1519
2013-07-26 01:30:42 +00:00