Commit graph

50 commits

Author SHA1 Message Date
Ruchi Kandoi
a84b1f64cc Charger: Add a Charger to Android transition threshold
Existing code allows charger-mode to exit to Android even with 0%
battery.
This might lead to more battery discharge while booting to Android,
especially if only USB-charger is connected, and thus certain
features/components not functioning as expected in Android.

This patch adds a configurable parameter to improve the user experience
by preventing the charger exit till battery capacity is good enough to
boot Android

Change-Id: I56a283243551373e962ac562f25eaf11f07666c3
Signed-off-by: Pavan Kumar S <pavan.kumar.s@intel.com>
Signed-off-by: Jenny TC <jenny.tc@intel.com>
Signed-off-by: Yong Yao <yong.yao@intel.com>
2014-10-22 22:01:07 +00:00
Ruchi Kandoi
bdf11c76a3 healthd: Add callback for screen_on to the healthdHAL
Adds a callback to the healthdHAL which can check for device specific
properties to decide if the screen should turn on.

Change-Id: I543e7729ecb291157df4d3be1bd718f8af01ac40
Signed-off-by: Ruchi Kandoi<kandoiruchi@google.com>
2014-09-26 14:37:17 -07:00
Ruchi Kandoi
ce6bfc93a1 am 301a907f: Merge "healthd: charger: Run animation even if capacity is 0" into lmp-dev
* commit '301a907f28570ff1627e30a37069e6c5ab6a4b75':
  healthd: charger: Run animation even if capacity is 0
2014-09-24 17:11:43 +00:00
Devin Kim
9b0d442385 healthd: charger: Run animation even if capacity is 0
If charger is connected and battery capacity is 0, charging animation should
run. The device would be booted up even if capacity is 0 in off-mode charging.
At that time, it would take some time to be 1 from 0 for capacity if you
use USB charger.

Bug: 17606689
Change-Id: I37e0f1b6ab0ee1f6d833882e169bf3ea06cf2399
2014-09-23 17:09:28 -07: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
Todd Poynor
342a2264b9 healthd: charger: fix check for charger connected to enter suspend
Logic for this check was inadvertently reversed when porting this from
the charger daemon to healthd.  Request suspend if a charegr is connected,
else stay out of suspend waiting for a charger connect or power off if
none.

Bug: 17112463
Change-Id: Iffdb6dbcd0d0a2a614ff8f50bf5f2e22e1ad552f
2014-08-18 14:32:14 -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
Colin Cross
d2b5bfa0cd healthd: fix 64-bit build
int64_t needs to be printed with PRId64

Change-Id: If59b60bac71856e4266d459d159a570961e7340a
2014-07-01 10:56:34 -07:00
Todd Poynor
a7300274fd charger: leave screen off when entered with very low battery
Change-Id: I28e3d6adaf4bb59d14eca7103d7b063d54a41c75
2014-06-30 13:25:53 -07:00
Riley Andrews
6bd4588d65 resolved conflicts for merge of 079c637f to master
Change-Id: Iab9a857026de954d7497d6b0eaf3751d2d3904c7
2014-06-23 15:20:51 -07:00
Ruchi Kandoi
9015eaa30f healthd: Avoid animation while not charging.
At present, charging animation runs irrespective of whether charger is
connected or not. When the charger is disconnected, device does not
shutdown for 10sec. Charger animation during this period should be
avoided.

Change-Id: I34dc5028522ca199d50a1a1b684b035b2d81ef68
2014-06-23 11:16:36 -07:00
Ruchi Kandoi
4614f5097c resolved conflicts for merge of de7bdc94 to master
Change-Id: I6dc10c8220c0984b31a05534b576ca25afdf5383
2014-06-20 11:46:40 -07:00
Ruchi Kandoi
04db8a55b8 healthd: UEVENT_MSG_LEN is changed from 1048 to 2048 in compliance with
BUFFER_LEN in the kobject_uevent in kernel.

Change-Id: Ia9f4b520847d40fe4e032875dfb79bd063bc723d
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2014-06-19 13:16:50 -07: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
Colin Cross
e1d5247e00 healthd: fix warnings
Fix a few warnings missed when turning on -Werror

Change-Id: I5728664a90d33b95ab3d6ea8823244c59643aedc
2014-05-15 17:49:06 -07:00
Mark Salyzyn
6f5b47f914 healthd: Turn on -Werror
Change-Id: I72caf38008ee7d842dfacd3f58add9bc8e4787e8
2014-05-15 15:46:15 -07:00
Natalie Silvanovich
3e6d3319b2 NULL check in registerListener
Prevents crash in batteryproperties. Now with two times as much NULL checking.

Bug: 13730158
Change-Id: Ica083da60c6543431c2d82d46aed48eaccc3b4b4
2014-04-30 15:49:37 -07:00
Sasha Levitskiy
e2acb82a94 am 43cb7ae6: am 4f362e43: am 835526fd: Merge "Cleanup: warning fixit."
* commit '43cb7ae6c31ced8cd518eab59dfea31ab1ade812':
  Cleanup: warning fixit.
2014-04-12 00:02:33 +00:00
Sasha Levitskiy
cdc1cfb3e5 Cleanup: warning fixit.
bootable/recovery has a dependent commit: I9adb470b04e4301989d128c9c3097b21b4dea431

Change-Id: Icf23e659265d71d5226d527c2b40cfbc132320ee
Signed-off-by: Sasha Levitskiy <sanek@google.com>
2014-04-11 16:15:46 -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
Doug Zongker
2f10b6bc23 am 706d57b2: am 769c6452: update minui library call
* commit '706d57b2948cc2eec22dc16394cf5582586b4237':
  update minui library call
2014-03-18 00:15:27 +00:00
Doug Zongker
ee6ef15e67 remove pixelflinger from healthd
The minui library has changed to no longer use libpixelflinger.  It
also offers a more efficient way of storing and loading frames of
animation; use it to represent the battery-full state images.

Also removes the unused battery_charge.png image.

Bug: 12131110
Change-Id: I6cc8b19f36a806c99cda30cc47b5968daf6b333b
2014-03-11 12:25:41 -07:00
Colin Cross
1c38f5d958 resolved conflicts for merge of 1fef485f to master
Change-Id: If402e68292a183064afe35cb77a4437682ee373a
2014-02-13 13:34:37 -08:00
Todd Poynor
cd7c10438a healthd: charger mode dump previous console from pstore
Change-Id: Id65ffe4f80aa870a1d1f3f3d67c3bb687490c27f
2013-12-10 22:22:43 +00:00
Todd Poynor
1c3d3cdea1 healthd: fix runstring option error reporting
Change-Id: I548d837afbde8a66826bb2cdb79ede7edda42b1f
2013-11-21 11:28:12 -08:00
Todd Poynor
c15e993467 healthd: remove/rearrange extra battery property handling
Change-Id: I6cc1570e23c1c1468f08579f633997e95327347a
2013-10-22 18:21:27 -07:00
Todd Poynor
9b53cf79af healthd: remove service batterypropreg
Change-Id: Iac24af6a59453686fca145d0814dc5ff045efcec
2013-10-22 17:56:21 -07:00
Todd Poynor
f0e2ac2642 healthd: rename service batterypropreg => batteryproperties
Part 1 of 2 (to avoid transitory runtime crashes).

Change-Id: I40d990ef7ee18cea99e5add39738bbe9fd5701ca
2013-10-22 17:50:59 -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
Ying Wang
c4d6ade839 Install the nonexistent-source symlink as a post-install step
Previously because /sbin/healthd does not exist on the build host, make
always tries to rebuild the symlink even in an already-up-to-date tree.

Change-Id: I41201282281476b14eaf4c7d9b2e09fe367c1422
2013-09-20 10:37:42 -07:00
Todd Poynor
fea5b4d44b healthd: move charger executable to healthd charger mode
* Add healthd charger mode ops
* Check for executable invocation as "charger", set charger mode if so
* Incorporate charger executable as healthd charger mode

Change-Id: I4a44e7a4c3a65ae9be94491f7f498aa48d4f8a84
2013-09-17 14:41:07 -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
98c23d82f0 healthd: add register event interface
Facilitates registering events from external source files.

Add epoll events param to callbacks.

Change-Id: Icf8fb0c62af11453cbcc92877ff2c3bc03b9bb1b
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
47f284af49 am ee549d25: am ff9ec2d9: healthd: perform periodic chores when awake and on battery power
* commit 'ee549d256f50ca3078a8537fa5b32a3f86295ea5':
  healthd: perform periodic chores when awake and on battery power
2013-09-09 16:54:49 -07:00
Todd Poynor
ff9ec2d999 healthd: perform periodic chores when awake and on battery power
Monitor battery/charging status at normal awake rate when on battery
power.

Bug: 10650797
Change-Id: I914d24af4963ab9d52b03c0a2615ad653ced9b12
2013-09-09 14:49:53 -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
d65104ca31 healthd: switch to HAL static libraries
Change-Id: I5a802f9b9a8ad4782c4d0c6376a068aef32a70cb
2013-08-13 16:09:12 -07: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
9face5cad5 healthd: create healthd_board_init()
Subsume healthd_board_poll_intervals, make clear the call is for init-time
actions.

Change-Id: I9267e4ce7c62b78d2997a43822f20bfa13b54cd8
2013-08-08 12:26:36 -07: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