Commit graph

347 commits

Author SHA1 Message Date
Yifan Hong
c2bed97e10 charger: Add tests for loading animation resources
Bug: 143907179
Test: run it

Change-Id: I1b1dfe4947210932c674657689e396ae909013c2
2020-08-07 17:07:09 -07:00
Yifan Hong
5109c8ce04 charger: Move built-in resources to /system
Convert rules to build charger resources to Soong
assuming BOARD_CHARGER_NO_UI is not set. As of now,
no devices in the source tree sets this variable. Also,
these images should be installed to the system image
regardless of this variable.

This change moves battery_fail and battery_scale to
/system/etc/res/images/charger.

Test: build and inspect system/etc/res/images/charger
Fixes: 143907179
Change-Id: Idccf5631371c7520cbfcfa6e92d1e88d0f3f95e7
2020-08-07 17:07:09 -07:00
Yifan Hong
abda7153fe charger: Load default resources from /system
When charger resources are missing from /product, before this change,
images are loaded from /res/images/charger. After this change, charger
first checks if the resource exists at that location, and if not, use
resource under /system/etc/res/images/charger.

On devices that uses resources from /product, this change has no effect.
On devices that uses resources from /res,
- if an old image is mounted at /, charger continues to load resources
  from /res.
- if a new image is mounted at /, that is, battery_fail and
  battery_scale may not exist under /res, charger loads them from /system.
  There are no font files installed by modules defined here, so any
  device-specific font files stay at /res.

Also create virtual function wrappers over minui APIs to be mocked
later.

See next change on moving battery_scale and battery_fail images to
/system.

Test: build and inspect system/etc/res/images/charger
Bug: 143907179
Change-Id: I4895b9602274fa4a1ebb4d7d3b842622b81b7b51
2020-08-07 17:07:09 -07:00
Yifan Hong
186b4d9ddd Add libhealthd_charger_test to presubmit.
Test: atest --test_mapping
Change-Id: Idae68e575f66b53c8b587405856b4a1c532ecadc
2020-08-05 20:00:09 -07:00
Yifan Hong
12d15750fe Convert healthd_test to Soong
This makefile is not included before, so it was never built. Also do
the following changes to make sure it works:

- Remove non-existing libhealthd_internal dep
- Add necessary libhealthd_charger dep because it tests AnimationParser
- Since it tests AnimationParser, change its name to
libhealthd_charger_test

Test: run it

Change-Id: If7f91de4b910024f27d09a25ca801e67b98221db
2020-08-05 20:00:09 -07:00
Yifan Hong
2a06ae8299 Fix AnimationParser remove_prefix test
The test fails because TEST_STRING, a char[], is silently
converted to a std::string, passed to remove_prefix, then
the string is destroyed, but a pointer to the string is
returned.

Fix it by changing the signature of remove_prefix to use
std::string_view to be more robust in handling raw char*.

Test: run it
Change-Id: I553c066907f09cf330c8b7a4659db5a1fee82cac
2020-08-05 20:00:09 -07:00
Yifan Hong
e5bd5f914f BatteryMonitor: report current_now in uA
/sys/class/power_supply/*/current_now should return uA and the HAL
expects uA too.

Test: VtsHalHealthV2_0TargetTest
Bug: 136717180
Change-Id: I675be1ae645413b9494af4a5d49955aad5bd4f2e
2020-04-08 16:24:17 -07:00
Kazuhiro Inaba
8e4d982d52 healthd: Don't take device-scoped battery as the main system battery.
Some devices expose the battery state of stylus etc in sysfs,
in addition to the whole system's main battery. Android only
recognizes the first battery enumerated here. We need to
filter out such HID-specific battery to let Android correctly
monitor the main battery status.

Bug: 136111013
Test: CtsBatterySavingTestCases on arcada
Change-Id: I4cbf6e3bf883fb3d107bedd2849d8ad525538629
2020-03-16 12:50:42 +09:00
Stephane Lee
06846044fe Add UNSUPPORTED to health HAL 2.1 values
Bug: 149429835
Test: lshal debug android.hardware.health@2.1::IHealth/default
Change-Id: Ibbcd89f38ed9ec2966b31854ab1cbe218c8e19cb
2020-02-15 16:51:02 -08:00
Stephane Lee
1c108edc74 Consume design capacity in health HAL 2.1
Bug: 149121450
Test: lshal debug <health hal 2.1>
Change-Id: I005fa47bda7e58f6636fdc87293227622d74187a
2020-02-13 15:14:40 -08:00
Stephane Lee
d43724d0b3 Initialize key structure to zero in charger
This is necessary because the key callback may not
be called before the states are checked.

Bug: 149107347
Test: Ensure charger does not reboot

Change-Id: I08d9e4b4046768eb0c0ca6171a2e5b7e5409d073
2020-02-10 16:38:04 -08:00
Yifan Hong
3aa3b3c627 charger: uses health HAL service.
hwservicemanager starts in charger, so directly get the health HAL
service.

Also sets up Android base kernel logging.

Bug: 142674987

Test: turn off device and charge, health HAL starts before charger, and inspect logs
      to confirm charger is reading from health HAL
Test: make health HAL start after charger, and inspect logs to confirm
      charger is reading from health HAL.

Change-Id: I5ba50a4b931735d1d14a50940e37c1e407dda34d
2020-01-31 13:29:21 -08:00
Stephane Lee
86f9f6aed5 Populate fields for health HAL 2.1
+ batteryCapacityLevel
+ batteryChargeTimeToFullNow

Bug: 137790244
Test: lshal debug (health service)
Change-Id: Ieb0b42e6cdded5974f01198ee151453367f82579
2020-01-22 10:50:05 -08:00
Treehugger Robot
ec56c59dbb Merge "healthd: Fix incorrect return check" 2019-11-07 21:18:59 +00:00
John Stultz
47a6bf014d healthd: Fix incorrect return check
In commit 1d4368b494 ("[REFACTOR] healthd: BatteryMonitor
use health 2.1 types"), the mapSysfsString() function was
changed to return NULL instead of -1 on error.

Everywher else that function is used commit 1d4368b494
tweaked the return value check from (ret < 0) to (!ret),
but one spot was missed.

This patch corrects the one missed check so that we compare
against null rather then negative value, since the return
value can no longer be negative.

This issue was found by inspection, and I've not seen an actual
problem with it, but thought it should be corrected.

Change-Id: I0a6564274d01276352a5dc0660b8ffbe748b5fde
Signed-off-by: John Stultz <john.stultz@linaro.org>
2019-11-06 01:40:18 +00:00
Yifan Hong
6cabe9bbc7 BatteryMonitor: init health info properly.
HIDL enum values are zero initialized, not the first value
of the enum. They need to be initialized properly.

Test: pass
Change-Id: I2adb8b851e6ac607ac4f547a6a6600604d07816f
2019-11-06 01:37:01 +00:00
Yifan Hong
7dcf7b0639 healthd: Remove libhealthd dependency from charger
Clean up charger's libhealthd dependency.

- Charger uses libhealthloop to maintain an infinite
  loop, similar to all health 2.x services.
- Charger tries to open up health 2.1 HAL implementation
  to retrieve health info. If it failed, it falls back
  to the legacy code path where a default BatteryMonitor
  is used, *except* that it won't depend on libhealthd's
  healthd_board_init() and healthd_board_battery_update()
  anymore.
- Remove global static variables because they are hard to
  track.
- Modernize code by converting charger_state in to a C++
  Charger class, transforming all functions into methods,
  and moving all other global states into the class.

- Devices that matches all of the following:
  - have a customized libhealthd (search for modules
    named libhealthd.xxxx)
  - uses charger from system image (look for "class charger"
    in device init.rc scripts; if you see the binary is named
    "/charger" or "/system/bin/charger" then you are using
    charger from system image)
  ... must implement health 2.1 passthrough implementation
  properly in order to have charger continue to work.

See hardware/interfaces/health/2.1/README.md for details.

Test: charger test
Test: manual charger mode
Bug: 127677771
Bug: 142286265

Change-Id: I0f26e5c1fe2be6b5952fc019224457c8419e43e4
2019-10-30 13:48:08 -07:00
Yifan Hong
35cb0838f6 healthd: partially fill in health 2.1 HAL fields
- batteryCurrentAverage
- batteryCapacityLevel
- batteryChargeTimeToFullNowSeconds
- batteryFullCapacityUah

Some of the fields are left 0 / UNKNOWN and will be
implemented in b/142260281.

Bug: 142260281

Test: lshal debug health 2.1 HAL shows these values
Change-Id: I8e462d612b39c16cfb3ae1b63b3e293153585c28
2019-10-23 14:55:35 -07:00
Yifan Hong
1d4368b494 [REFACTOR] healthd: BatteryMonitor use health 2.1 types
... instead of BatteryProperties. HealthInfo contains
much more information and is easy for health HAL impl
to use it.

Also add getHealthInfo* functions for health HAL
implentations to use.

Test: health VTS 2.0 test
Bug: 142260281
Change-Id: I188276788fd8f11e69f8e046b91a873afaa23457
2019-10-23 14:55:35 -07:00
Yifan Hong
1353e70278 [REFACTOR] healthd: BatteryMonitor::update split into 3 funcs
split bool update() into three functions:

void update()
void logValues()
bool isChargerOnline

... so that it doesn't depend on healthd_board_battery_update and
healthd_mode_ops, which are deprecated.

Test: health 2.0 VTS test
Bug: 142260281
Change-Id: I65908a04bae00654213efb4b5569ced0a7e76076
2019-10-14 14:07:13 -07:00
Steven Moreland
a4eaf64de8 Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I0bdffced6af52695c0ef98c9dd659348e56f7aa6
2019-09-05 14:17:42 -07:00
Inseob Kim
34114e3df3 Implement sysprop_library API stability check
sysprop_library now checks the API stability itself, cutting dependency
on java_sdk_library. Under the directory {module_dir}/api,
{module_name}-current.txt and {module_name}-latest.txt hold API
signatures.

When sysprop_library is built, or a user run "m {module_name}-check-api"
command, API check is performed. First, current.txt must have exactly
same signature with built sysprop_library module. Second, current.txt
must be compatible with latest.txt.

Build system emits a handy error message to generate/update those API
files, in case of missing or mismatching. Also, a script file for
freezing API files is introduced.

Bug: 131637873
Test: 1) m && boot blueline
Test: 2) m {sysprop_library} performs API check
Test: 3) manual test for check-api, freezing api
Change-Id: I6b95eebafaf88ad326be5d7c890e000cbdb79cb5
Merged-In: I6b95eebafaf88ad326be5d7c890e000cbdb79cb5
(cherry picked from commit f711999132)
2019-08-20 16:16:40 +09:00
Yifan Hong
958216c97f Merge changes from topic "charger_props"
am: 7cea50acd8

Change-Id: Ie5eeaa55a3749e2a155010aecf37ecacb43a7e88
2019-07-25 11:35:44 -07:00
Yifan Hong
dbaa477a70 healthd: Convert libhealthd_{draw,charger} to Soong.
Converting charger to Soong, one step at a time.

In the meantime, drop the use of BOARD_*/TARGET_* variables
in Android.mk because runtime sysprops will be used instead.
Libraries / binaries will always link to libminui / libpng /
libsuspend.

charger{.recovery,} can't be converted to Soong yet because
of the use of HAL_STATIC_LIBRARIES (Bug 127677771).

charger_test isn't converted because of the shared list
of CHARGER_{STATIC,SHARED}_LIBRARIES.

Bug: 124118169
Test: run charger on walleye

Change-Id: I355deda14e5b5c9938256ff0b778590ac0191095
2019-07-24 17:01:40 -07:00
Yifan Hong
97eecdc875 healthd: charger use runtime sysprops instead.
Bug: 124118169
Test: run off-mode charging
Change-Id: Ib71f84f1c93d1566f4e3101920d98b1d39184390
2019-07-24 17:01:40 -07:00
Yifan Hong
dcbaeef6e3 healthd: remove unused variable.
Test: builds
Change-Id: If12cfd31353cd26b41c1c07f44761cea3c46c34a
2019-07-24 17:01:40 -07:00
Steven Moreland
451e764bdc Merge "libhwbinder users use libhidlbase" into qt-dev
am: 490f1cf074

Change-Id: Ib20f4dc87cb2aea1350af98be9bb65eb7575a6fd
2019-06-20 13:09:55 -07:00
Steven Moreland
aedef73b9c libhwbinder users use libhidlbase
libhwbinder symbols are being moved into libhidlbase in order to
optimize linking/memory usage. libhwbinder will no longer be
required in the future (however removing references to it will come
separately).

Bug: 134961554
Test: boot
Change-Id: I2b9a4fb9d87913b6c0e4291d3debadbf27511111
2019-06-18 15:38:10 -07:00
John Zhao
5cac100e3d healthd: charger: shutdown timer configurable
config the shutdown timer via the property system
for vendor customize.

Bug: 129599884
Test: setprop ro.product.charger.unplugged_shutdown_time 5000
      getprop ro.product.charger.unplugged_shutdown_time
      5000
      dmesg:
          charger: [371812] device unplugged:
                   shutting down in [5000] (@ 421812)

Change-Id: Ifa377cdb8e100c453346522a3eb93379fd7e2567
Signed-off-by: John Zhao <yuankuiz@qualcomm.corp-partner.google.com>
2019-04-08 12:46:47 -07:00
Ken Tsou
6c7ece743c charger: fix show 0% symptom when start to draw UI
Bug: 123060995
Test: m -j succeeded and confirm offmode charge UI behavior
Change-Id: I7412157cfe829a86e72b3f43d9c43032f3567ed3
2019-03-29 18:33:00 +08:00
Yifan Hong
dc9c08b900 charger: android_get_control_file on last_kmsg
Call android_get_control_file on last_kmsg files if the file
descriptor is provided by init.

Also, uses base::Read(File|Fd)ToString functions to read the
files (because load_file doesn't support fd arguments).

Test: charger mode
Test: manual kernel panic, then start charger; seen last kmsg.

Bug: 129138950
Change-Id: Idd3376e349f29586a1e66faab2c0f1bf73e0eda5
2019-03-26 15:51:55 -07:00
Tao Bao
5747e228f7 healthd: Add charger.recovery module.
This CL splits out healthd_mode_charger_nops for building
charger.recovery. It doesn't change the functionality of the charger
module under recovery, i.e. a) it still doesn't do much work other than
reporting the battery status periodically; b) it keeps calling
device-specific healthd functions (healthd_board_init and
healthd_board_battery_update) via the statically linked HAL.

Previously `charger -r` was used to indicate starting charger under
recovery mode. This CL makes it a noop since we've changed the caller in
recovery.

Bug: 73660730
Bug: 114042635
Test: Boot into charger mode on walleye. Check that charger UI works.
Test: Boot into recovery mode on walleye. Check that /system/bin/charger
      keeps working.
Test: Run charger_test on walleye.
Change-Id: Id91acfcc77ec315c2382392dc54e36c3e85de2eb
2019-03-06 14:41:47 -08:00
Tao Bao
f2455d8068 healthd: charger uses shared libraries.
With the change in [1], /sbin/charger always gets included into
system.img (as opposed to ramdisk) and started by second-stage-init. It
no longer needs to be statically linked. This CL switches it to use
shared libraries, and moves it to /system/bin/charger.

With this change, charger no longer gets installed into recovery image,
which will be handled by a follow-up CL.

[1] https://android-review.googlesource.com/c/platform/build/+/728287

Bug: 73660730
Test: Boot into charger mode on taimen. Check that charger UI works.
Test: Run charger_test on taimen.
Change-Id: Idff70cfad09c825cdba4d35a471ff7ecd5f8a8f7
2019-03-06 14:36:59 -08:00
Suren Baghdasaryan
82b72a5667 libprocessgroup: Add support for task profiles
Abstract usage of cgroups into task profiles that allows for changes
in cgroup hierarchy and version without affecting framework codebase.
Rework current processgroup and sched_policy API function implementations
to use task profiles instead of hardcoded paths and attributes.
Mount cgroups using information from cgroups.json rather than from init.rc

Exempt-From-Owner-Approval: already approved in internal master

Bug: 111307099
Test: builds, boots

Change-Id: If5532d6dc570add825cebd5b5148e00c7d688e32
Merged-In: If5532d6dc570add825cebd5b5148e00c7d688e32
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-02-03 16:48:35 +00:00
Treehugger Robot
accdf0e9c7 Merge "healthd: update owners" 2019-01-29 22:24:34 +00:00
Yifan Hong
505b5513b4 healthd: update owners
Test: pass
Change-Id: I2efea4086ef9f8d9865da387bfc91345a31fc123
2019-01-28 14:55:39 -08:00
Yifan Hong
082d295fb3 healthd: charger loads resources from /product
Load resources from /product/etc/res/{values,images}/charger. If a
resource fails, falls back to /res/{values,images}/charger.

If the device has GSI flashed, resources may exist in both paths.
Resources in /product is used with a higher priority.

Test: turn off device, charge, observe animation
Bug: 119549685
Change-Id: I5a5143d132a0cc6ce9135469fb523feeeafd1b1b
2019-01-28 14:46:53 -08:00
Suren Baghdasaryan
02843339f9 Add dependencies on libprocessgroup for sched_policy users
After moving sched_policy functions into libprocessgroup its users require
additional dependency and inclusion of sched_policy_ctrl.h header.

Exempt-From-Owner-Approval: janitorial

Bug: 111307099
Test: builds, boots

Merged-In: Icc052080e1bce46ce06f7264446950cab0490a95
Change-Id: Icc052080e1bce46ce06f7264446950cab0490a95
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-01-22 18:19:45 +00:00
Thierry Strudel
f73de6f037 healthd.h: add ignorePowerSupplyNames to healthd_config
In case some power supply paths should not be considered, add a black list
to the healthd_config to instruct BatteryMonitor of the power supply paths
to ignore on init.

Bug: 117903348
Change-Id: I6f9ddeff9351ad01772b43728ddc2627da81df2a
Signed-off-by: Thierry Strudel <tstrudel@google.com>
2019-01-11 18:08:23 -08:00
Felix
fb55955462 health: Add CAP_WAKE_ALARM to service via init
platform/interfaces/health/2.0/default/healthd_common.cpp wants to use
timerfd_create() to register a wakealarm.

To use the timerfd_create() syscall with CLOCK_BOOTTIME_ALARM,
CAP_WAKE_ALARM is needed.

Since the .rc file for android.hardware.health@2.0 is shipped here in
system/core, update it here.

Signed-off-by: Felix <google@ix5.org>
Change-Id: I6cd5701b6e5cac37eb021d894251a3a9dc590b95
2019-01-04 02:24:41 +01:00
ShevT
9d98a6ac93 healthd: BatteryMonitor: Fix compiler warning
system/core/healthd/BatteryMonitor.cpp:248:19: note: initialize the variable 'i' to silence this warning
    unsigned int i;
                  ^
                   = 0
1 warning generated.

Change-Id: Ib2fa0061d657fd93871ca8a9056d173d5b7ab58d
2018-11-02 17:59:09 +00:00
Tao Bao
777af95c4e healthd: GRSurface now is a class.
Test: mmma -j system/core/healthd
Change-Id: I696542535cf4707c707c4f024de504ce343b1e69
2018-10-22 13:20:33 -07:00
Elliott Hughes
643268f325 Move system/core/ off NO_ERROR.
It causes trouble for Windows, and OK already exists.

Bug: N/A
Test: builds
Change-Id: Ida22fd658b0ebb259c710ba39049b07c9e495d9c
2018-10-08 11:15:52 -07:00
Jayant Chowdhary
c2d3949693 Reland "Add static libbinderthreadstate explicitly to charger module.""
This reverts commit 17a65497bb.

Reason for revert: Dependencies which broke tests due to exclusion from LOCAL_JNI_SHARED_LIBS have been added. 

Change-Id: I51e8ea7072026f233cd4a6c7e2142d92603af1f9
2018-10-01 22:50:07 +00:00
Remi NGUYEN VAN
17a65497bb Revert "Add static libbinderthreadstate explicitly to charger module."
This reverts commit f23fa3b12f.

Reason for revert: This breaks framework tests and blocks presubmit

Change-Id: Iccf29d7499c378c611ea5a783074865febf8514e
2018-09-28 07:50:18 +00:00
Jayant Chowdhary
f23fa3b12f Add static libbinderthreadstate explicitly to charger module.
Bug: 110364143

Bug: 114311116

Test: Builds

Change-Id: I367cab4f6113d72bbaf1c9a41099110124916f57
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
2018-09-27 10:36:13 -07:00
Tao Bao
b6ccc78e0c healthd: Drop the unneeded include path.
libminui has been exporting headers since Oreo.

Test: mmma -j system/core/healthd
Change-Id: Iaadfa526619dcd4837a97b78cfa03dc69ffa4000
2018-09-06 15:14:31 -07:00
kentsou
ba61ea462f charger: screen blank on disconnect and 0% not displayed
Bug: 74771887
Test: m -j succeeded and confirm offmode charge UI behavior
Change-Id: I8c97230f6c1e32ac9949601a86added79a3ead82
Signed-off-by: kentsou <kentsou@google.com>
2018-08-17 03:58:19 +00:00
Tao Bao
d6b7711e3d Merge "charger: minui error handling fixups"
am: bc31fc62ce

Change-Id: I48633f51f5259d783e7f72f98576ffbd8c26abbf
2018-07-30 10:39:55 -07:00
Todd Poynor
e5d1b62300 charger: minui error handling fixups
Log an error if minui init fails, and avoid subsequent calls to minui
in this case (which are likely to crash).

Warn if no system text font available.  This is now expected on most
devices, and the fallback text is not expected to be needed, but just
in case.

Avoid the attempt to print text if no system font available, log
warnings instead.

Bug: 80249440
Test: manual: charger mode with no system font
Change-Id: Ib0c761d37e41a893b2a192438eebcf48c4827049
Merged-In: Ib0c761d37e41a893b2a192438eebcf48c4827049
(cherry picked from commit 8211515fbe)
2018-07-30 08:45:52 -07:00
Thierry Strudel
2cbe2c7b29 healthd_mode_charger: unblank the screen only on first frame
Original code is unblank screen for all frames of the first
cycle, unblank is needed only before the first frame of the
first cycle.

Bug: 74771887
Change-Id: I51d8390e359335a0b1cb127b096db1a8b889b169
Signed-off-by: Thierry Strudel <tstrudel@google.com>
2018-07-30 00:18:06 -07:00
Yifan Hong
ef26fe4c16 healthd: uses android.hardware.health@2.0-service_defaults
Test: builds
Test: boots
Change-Id: Ia47ba805aa0e8f7cd6c0a7f5877b3120b0265c78
2018-07-18 13:51:01 -07:00
Yifan Hong
d5c59f729e Merge "healthd: libbatterymonitor: recovery_available" into stage-aosp-master 2018-07-18 19:54:58 +00:00
Yifan Hong
90fdc72409 healthd: libbatterymonitor: recovery_available
Bug: 80132328
Test: builds
Change-Id: I4d5ac73431fb002cc839fed2d97b1acff3fde263
Merged-In: I4d5ac73431fb002cc839fed2d97b1acff3fde263
(cherry picked from commit 0e317d7873)
2018-07-18 11:28:29 -07:00
Yifan Hong
9a81d54ce3 healthd: add missing libbatteryservice_headers dep
It used to use global header include dirs, which is bad.
Test: builds
Bug: 68724651

Change-Id: Ib5354c66633499ad57fe5997e2c35283ba5e408f
Merged-In: Ib5354c66633499ad57fe5997e2c35283ba5e408f
(cherry picked from commit 530ac5bad1)
2018-07-17 15:36:14 -07:00
Yifan Hong
31150c1121 healthd: overridden by health@2.0-service
Test: boots
Bug: 79107699
Bug: 77541952
Bug: 79107699
Change-Id: Ida4cf80d3553365b673e30cdd19590c156cb52e0
Merged-In: Ida4cf80d3553365b673e30cdd19590c156cb52e0
(cherry picked from commit 28d2fb80b2)
2018-07-17 11:57:44 -07:00
Yifan Hong
3a39eec307 healthd use vintf_fragments
This encourages device manufacturers to use
service.override over service and to remove healthd
on device, because it is one less step to do.

Test: make VINTF metadata
Bug: 66917623
Bug: 77541952
Bug: 79107699
Change-Id: I1cac3570f64a0308b1f2d465205f98a97e4b4320
Merged-In: I1cac3570f64a0308b1f2d465205f98a97e4b4320
(cherry picked from commit 2db565d75f)
2018-07-17 11:57:38 -07:00
Yifan Hong
3da9f08903 libbatterymonitor: vendor_available
libbatterymonitor is a static library.
Also removed unused libbinder dependency.

Test: pass
Bug: 111454508
Merged-In: I1f17ee643e6ed1bb2c11a6f3189a448dba2927ac
Change-Id: I1f17ee643e6ed1bb2c11a6f3189a448dba2927ac
(cherry picked from commit ffff9aae02)
2018-07-16 11:26:04 -07:00
Thierry Strudel
60c3c1f305 Merge "healthd_mode_charger: unblank the screen only on first frame" into pi-dev
am: 39edb87aaf

Change-Id: Ieb39b688d44ebae9c171e6c530f3f605ab26e20a
2018-05-24 17:49:21 -07:00
Thierry Strudel
ac2aa7d7b1 healthd_mode_charger: unblank the screen only on first frame
Original code is unblank screen for all frames of the first
cycle, unblank is needed only before the first frame of the
first cycle.

Bug: 74771887
Change-Id: I51d8390e359335a0b1cb127b096db1a8b889b169
Signed-off-by: Thierry Strudel <tstrudel@google.com>
2018-05-23 17:30:16 -07:00
android-build-prod (mdb)
6c970477ac Merge "healthd: Add elsk as OWNERS" am: abf6a2e1ad
am: 2a38926b9d

Change-Id: I3798a0bfe81eac780946bc42a31a004906875626
2018-05-03 14:07:45 -07:00
Yifan Hong
a922d6b596 healthd: Add elsk as OWNERS
Test: none
Change-Id: I676621ced38308296c32259c9525a8d55948e937
2018-05-03 12:25:00 -07:00
Pirama Arumuga Nainar
970b664608 Merge "Use the non-LTO, non-PGO version of libhwbinder" into pi-dev
am: aeee02f290

Change-Id: Id94d387b59be7f95c366aadd8844241f7a64ee08
2018-04-10 11:29:55 -07:00
Pirama Arumuga Nainar
9dddfbc77a Use the non-LTO, non-PGO version of libhwbinder
Bug: http://b/77320844

Android.mk doesn't have support for PGO either.  This causes linker
error (about missing __llvm_profile symbols) in the PGO-instrumentation
enabled builds in the release branch.

Test: m ANDROID_PGO_INSTRUMENT=ALL
Change-Id: I84fda4f1ac4f00ac26869507c6f5640b4ec9f6f3
2018-04-09 10:40:06 -07:00
Yifan Hong
bf5658e43b Merge "health service can write kernel log" into pi-dev
am: c867941783

Change-Id: Idaa35992343803752fb93e28824c0debf1512448
2018-04-06 14:28:18 -07:00
Yifan Hong
c867941783 Merge "health service can write kernel log" into pi-dev 2018-04-06 21:03:34 +00:00
Yi Kong
fb4806809b Merge "Use non-LTO variant of libhwbinder" into pi-dev
am: 715700a5a1

Change-Id: I08de6f781a1566cf85ea4dc38be4cffb3b5eaaa8
2018-04-06 13:37:03 -07:00
TreeHugger Robot
715700a5a1 Merge "Use non-LTO variant of libhwbinder" into pi-dev 2018-04-06 20:25:02 +00:00
Yifan Hong
7eed10800e health service can write kernel log
Test: device without healthd still have battery level messages
Bug: 77541952
Fixes: 77661605
Change-Id: I9b66ecde0735accf8b2d67b9562795be80071dd9
2018-04-05 19:34:43 -07:00
Yifan Hong
b36fb13bf3 Merge changes from topic "healthd_deprecate2" into pi-dev
am: 7498160272

Change-Id: I18b63bfae0890d4e2e7af9ad1a3377334c5139ff
2018-04-05 12:39:47 -07:00
Yifan Hong
1cf853fb65 healthd: a.h.health@2.0-service.override removes healthd
Removes healthd from the build if -service.override
is provided. This encourages developers to deprecate healthd
for their devices when they can.

When -service.override is used, framework manifest needs
to remove the /backup instance as well; this can be done
by including manifest_healthd_exclude.xml in
DEVICE_FRAMEWORK_MANIFEST_FILE.

Test: build and boot on 2016/2017 Pixel devices
Test: build and boot on a new device
Test: lshal and vts_treble_vintf_test on all these
      devices
Bug: 77541952

Change-Id: I25744feaad3034441cd7a96a5343d4ce3eedc288
2018-04-04 14:43:58 -07:00
Yifan Hong
fd1aa70a0f healthd: add healthd.rc
Split healthd section from init.rc into its own. This allows
healthd.rc to be excluded from the build when healthd is excluded.

Test: builds
Test: exclude healthd from build, healthd.rc is not installed
Bug: 77541952
Change-Id: I1c055f14c5862631f359fd0029289da8f43af063
2018-04-04 14:08:04 -07:00
Yi Kong
95958a74f6 Use non-LTO variant of libhwbinder
... as a workaround for build system does not currently infer non-LTO
usage from Android.mk.

Test: m
Bug: 77320844
Change-Id: Iefe5d08b907133b4cdf1516efee73b2c0161f77e
2018-04-03 12:43:13 -07:00
Dan Willemsen
42f9dd4997 Merge "Remove obsolete BRILLO variable" am: dbfbf85f0c
am: 2527add41a

Change-Id: Idc0c29c1accca9738755844c866859f440f7c94c
2018-03-12 22:05:38 +00:00
Dan Willemsen
fd72bde475 Remove obsolete BRILLO variable
Test: none
Change-Id: Iaf563b78819d63cb5ab7316a195a860b150d69c6
2018-03-10 15:41:37 -08:00
Yi Kong
979ace46ed Merge "healthd: Fix negativity check after cast to unsigned enum" am: 3dad67af05 am: 4734981245
am: eb066ae098

Change-Id: I2327adfd50fceb232ef2a52e535914743c25cf3a
2018-03-03 00:46:57 +00:00
Yi Kong
808e57e3f3 healthd: Fix negativity check after cast to unsigned enum
mapSysfsString return code is checked for negativity after being casted
to unsigned enum type, which will always be false. This is obviously
unintended behaviour.

Fixes tautological-unsigned-enum-zero-compare warning.

Bug: 72331526
Test: m
Change-Id: Icec76d7a1121cb56fd9d05feb70cede69954c322
2018-03-02 18:42:03 +00:00
Todd Poynor
4d7ee2ebbb healthd: don't report fake data for battery-less devices
If the kernel does not implement a power_supply class device of type
battery, do not report fake data, instead report the following by
default:

* batteryPresent = false (instead of true),
* charging status = unknown (instead of charging),
* capacity = 0 (instead of 100%),
* health = unknown (instead of good),
* AC charger online not modified (instead of forcing true)

If no charger and no battery devices are supplied by the kernel, the
AC charger online property will no longer be forced to true.  Devices
that are always plugged into AC power should either implement a
power_supply class charger device or implement a Health HAL that sets
properties appropriately.

Bug: 34507420
Test: manual: gce_x6_phone (no battery or charger),
      boots and stays booted, inspect properties
Merged-In: I14cb3b685e8130428e417e7d08c4246f7415210a

Change-Id: I64bd4431af10f3d232f36fcf8d356b6d88b08013
2018-02-05 19:48:30 +00:00
Yifan Hong
43f731ae45 healthd: Remove access to /sys/class/power_supply/battery/batt_vol and batt_temp
These are custom paths from early Android devices that the framework used to
read, and that code was copied into healthd. Removed because this is not
defined in upstream kernel.

Change-Id: I375a8a62610c1235d82c1f27568437b16e0f96a8
Fixes: 72824944
Test: health 2.0 VTS test
2018-02-01 13:51:04 -08:00
Todd Poynor
e030a10d0f Revert "Revert "healthd: don't report fake data for battery-less devices""
This reverts commit 1bc572dfe8.

The presubmit test that (incorrectly) fails on the original commit
has been marked @FlakyTest and a bug is failed on Assistant.

Bug: 34507420
Test: manual: gce_x6_phone (no battery or charger),
      boots and stays booted, inspect properties,
      presubmit tests on gce_x86
Change-Id: I5509bf5de9fceffdd5fd8abc3f1f4f6101119248
2018-01-23 19:07:23 +00:00
Yifan Hong
affa24f28f healthd: move HealthServiceCommon
... to hardware/interfaces. HealthServiceCommon
becomes two separate libraries:
- libhealthservicedefault for services on vendor
- libhealthservicehealthd for healthd

Test: boots
Bug: 63702641
Change-Id: Ibc7096328bb36356cb653e542bab900cd046fe8a
2018-01-22 12:34:04 -08:00
Hridya Valsaraju
79d38ebcaf health: Modify IHealthInfo Callback interface to return V2.0 HealthInfo
Bug: 71860528
Test: vts-tradefed run vts -m VtsHalHealthV2_0
Change-Id: I7de39ffa4c21772d8878c9a3f054bc6dbbde2fb9
2018-01-18 14:51:26 -08:00
Hridya Valsaraju
7fa7225cc4 Create a friend method for reporting battery health
Bug: 71860528
Test: Test: vts-tradefed run vts -m VtsHalHealthV2_0
Change-Id: I6c56c601ee59fe33ee4a19dd4aeafbe3a1bd4c72
2018-01-16 11:15:51 -08:00
Hridya Valsaraju
89178e79d5 Add libhealthstoragedefault to make files
This is to add empty implementations of methods
reporting storage health.

Bug: 68388678
Test: vts-tradefed run vts -m VtsHalHealthV2_0
Change-Id: If6180c22a4b356650084df61b1e24af3de0ca67e
2018-01-11 22:16:16 -08:00
Martijn Coenen
a5c1eecde7 healthd: Replace hwbinder-specific calls with generic ones.
To remove dependencies on libhwbinder.

Bug: 34388964
Test: sailfish boots
Change-Id: Ia1b8d8d8da91a510ef5739bac14236b7b3a9d3b9
2017-12-18 10:07:43 +01:00
Todd Poynor
1bc572dfe8 Revert "healthd: don't report fake data for battery-less devices"
This reverts commit de610c9a0e.

Reason for revert: May trigger flakiness in CTS ActivityManagerAssistantStackTests.

Change-Id: I02f831048f7802d91331e67bd9006860e4572b92
2017-12-15 06:51:04 +00:00
Todd Poynor
de610c9a0e healthd: don't report fake data for battery-less devices
If the kernel does not implement a power_supply class device of type
battery, do not report fake data, instead report the following by
default:

* batteryPresent = false (instead of true),
* charging status = unknown (instead of charging),
* capacity = 0 (instead of 100%),
* health = unknown (instead of good),
* AC charger online not modified (instead of forcing true)

If no charger and no battery devices are supplied by the kernel, the
AC charger online property will no longer be forced to true.  Devices
that are always plugged into AC power should either implement a
power_supply class charger device or implement a Health HAL that sets
properties appropriately.

Bug: 34507420
Test: manual: gce_x6_phone (no battery or charger),
      boots and stays booted, inspect properties
Change-Id: I14cb3b685e8130428e417e7d08c4246f7415210a
2017-12-14 21:13:06 +00:00
Hridya Valsaraju
ffb13032b6 Move healthd default implementation to hardware/interfaces.
Bug: 70533363 63702641
Test: make -j32

Change-Id: Icb6eaea8641dc8ae53ed3af1fca81ddca39f8421
2017-12-12 17:20:13 -08:00
Elliott Hughes
3e2b34136a Merge "Add OWNERS." am: 3289b9c928 am: 515c8fe572
am: aede8375fe

Change-Id: I28f7a8f3fa9c9837f4043768e70c0d985ed95abd
2017-12-08 01:29:20 +00:00
Elliott Hughes
3289b9c928 Merge "Add OWNERS." 2017-12-07 23:21:26 +00:00
Elliott Hughes
693d63f9cf Add OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
2017-12-07 13:30:03 -08:00
Chih-Hung Hsieh
9635266c75 Use -Werror in system/core/healthd
Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I921735c9531594697e002937cd57a33c65552dbf
2017-12-01 12:32:25 -08:00
Yifan Hong
25eb37a86e healthd: clean up unused code
With migration to health 2.0 HAL, there are unused code paths
that can be removed.

Test: health VTS test
Test: charger_test
Bug: 68724651
Change-Id: I9af2f95432529a0bf6e10980a99014d570dfce93
2017-11-30 15:34:46 -08:00
Yifan Hong
b7cd45f877 charger: add charger_test
Test: charger_test
Bug: 63702641
Change-Id: Id50d024c015916cb8007742e3c17eaf1161b909f
2017-11-21 15:05:17 -08:00
Yifan Hong
10c2b4013a healthd: charger use health 2.0 HAL
Test: charger_test
Test: off-mode charging, charger runs correctly
Bug: 63702641
Bug: 69268160
Change-Id: I7dfc83ae4020ada7e9d11ab955f648abb74f435b
2017-11-20 10:28:11 -08:00
Yifan Hong
3bc12ce7df healthd: move healthd_board_init call to Health::Health() c-tor
The invocation is wrapped so that clients of -impl doesn't
have to call healthd_board_init directly.

Test: health VTS test
Test: charger_test
Bug: 69268160

Change-Id: I61f820b80ce6b03fe51ca05d07ed7e09ca369d2d
2017-11-14 12:59:54 -08:00
Yifan Hong
9cffa8a161 healthd: move global gHealth service pointer
... to class implementation::Health. Expose APIs
InitInstance(), GetImplmentation()
for its setter and getter.

Clients that statically links to android.hardware
.health@2.0-impl (e.g. charger, recovery)
should use InitInstance().

Test: health VTS tests
Bug: 63702641
Change-Id: I51b9b976d0b723dac1a03e5113d5d9e84300c0e9
2017-11-13 12:34:47 -08:00
Yifan Hong
5382983429 healthd: remove global binder fd
It is not used elsewhere, so a local variable is
sufficient.

Also fix a shared lib order in soong file.

Test: health VTS test
Bug: 63702641
Change-Id: I53cc208d8dd388fc89119c0044c5e30acf0740fb
2017-11-10 07:58:09 +00:00
Yifan Hong
31cc64aa79 healthd connect to health@1.0 hal
This is the original code path (BatteryService
-> healthd -> health 1.0 HAL). This ensures
upgrade-ability for old devices to P.

This is a partial revert of
287c41fffe, with
some modifications to the original healthd_board_*
functions for healthd.

Bug: 65990106
Test: VTS test for healthd and health service
Change-Id: If1c65e64e2fd6750369d52c8051ca6aa2b57ef27
2017-11-08 10:37:20 -08:00
Yifan Hong
cded900b96 Refactor common code between healthd and health@2.0-service
Use healthd_board_* functions for the
code that's different between them.

Bug: 65990106
Test: boots
Test: VTS tests on healthd and health service
Change-Id: I88e6f210cb91c0cf08a9d7c52910c38fa9a75130
2017-11-07 14:03:15 -08:00