Commit graph

343 commits

Author SHA1 Message Date
David Anderson
629a26b6c5 healthd: Add handling for "Calibration required" battery health.
This string was added to sysfs fairly recently. It indicates that
re-calibration is needed, which we've already added an indicator for via
the INCONSISTENT health status.

Bug: 300585313
Test: m
Change-Id: I9594523e509ad94480ad13f489eee6d1c0a75e7e
2023-12-11 15:25:13 -08:00
David Anderson
d5ed26a45a healthd: Add support for the new Health HAL v3 properties.
Add BATTERY_PROP_PART_STATUS support via getProperty.

Add serial number support via a new helper function, since it doesn't
fit neatly into the BatteryProperty structure.

There are no sysfs nodes for this yet, so currently it is stubbed.

Bug: 309792384
Test: fastboot getvar battery-part-status
      fastboot getvar battery-serial-number
Change-Id: I3777e092d4ef26c02a7dd5420c9eaf1ec5aeae92
2023-12-11 11:59:23 -08:00
David Anderson
d473bcf1ab Update healthd to use Health AIDL HAL V3.
Bug: 309792384
Test: m
Change-Id: Ic92e4d699ee49284fea490d48e963555173033d7
2023-12-11 11:59:23 -08:00
Tomasz Wasilczyk
2b1a0599c4 Don't depend on String8 cast to C string
Bug: 295394788
Test: m checkbuild
Change-Id: I5b86ae56250d409a23ab3f2bc72b725bcf6ab23e
2023-09-20 15:11:54 +00:00
Tomasz Wasilczyk
f597129282 Migrate from android::String isEmpty to empty
This empty method is different from the old one - it aligns with
std::string definition.

Bug: 295394788
Test: make checkbuild
Change-Id: Id6baed8cde01a75a8839ad6b4475a31ba1f49c8a
2023-08-18 22:07:28 +00:00
Tomasz Wasilczyk
18b746188c Migrate String8/16 from .string() to c_str()
This will align usage with std::string.

Bug: 295394788
Test: make checkbuild
Change-Id: Ic5c215b011197950dcbcb0339f44cc68fefc65a1
2023-08-11 19:53:20 +00:00
Jack Wu
8231c3fe2d BatteryMonitor: support battery health INCONSISTENT from health status
Report Battery health INCONSISTENT when there is a battery recalibration
pending.

Bug: 283182048
Test: m
Change-Id: I8b944ddac7cc919fc95b1b71b015101642a62f96
Signed-off-by: Jack Wu <wjack@google.com>
2023-05-24 03:25:59 +00:00
Jack Wu
cf996f3d8d BatteryMonitor: support battery health NOT_AVAILABLE from health status
Battery health is supported but there is not enough information to
determine an accurate value  This is a temporary state.

Bug: 276400004
Test: m
Change-Id: I0d422db20c51ef7e9dc4fa904729beda625c9fea
Signed-off-by: Jack Wu <wjack@google.com>
2023-04-24 11:37:40 +00:00
Steven Moreland
165e086a1a remove healthd.rc
no longer used

Bug: 276813155
Test: N/A
Change-Id: Iae206540b07b61fa799ce6fcce4032879f02d8b3
2023-04-12 23:00:09 +00:00
Mike McCreavy
5766fe7dee Add ability to automatically bootup
Based on a new system property. This won't change any behavior if that
new system property isn't set.

Ignore-AOSP-First: WearOS specific change

Upstreaming from Wear: b/272526799
Bug: 199404658
Test: set the property, check that off-mode-charging automatically
reboots

(cherry picked from commit 332b3686290af70c73a464ce35b0c1124b2ce831)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:82d8011f170d5b1c936d117f4fb74836333714b6)
Merged-In: I98f37a840a43cb5216319457027b76fc493e3f62
Change-Id: I98f37a840a43cb5216319457027b76fc493e3f62

NOTE FOR REVIEWERS - original patch and result patch are not identical.
PLEASE REVIEW CAREFULLY.
Diffs between the patches:
0,6 +620,18 @@
         kick_animation(&batt_anim_);
     }
     health_info_ = health_info;
+
+    if (property_get_bool("ro.charger_mode_autoboot", false)) {
+        if (health_info_.battery_level >= boot_min_cap_) {
+            if (property_get_bool("ro.enable_boot_charger_mode", false)) {
+                LOGW("booting from charger mode\n");
+                property_set("sys.boot_from_charger_mode", "1");
+            } else {
+                LOGW("Battery SOC = %d%%, Automatically rebooting\n", health_info_.battery_level);
+                reboot(RB_AUTOBOOT);
+            }
+        }
+    }
 }

 int Charger::OnPrepareToWait(void) {

Original patch:
From 82d8011f170d5b1c936d117f4fb74836333714b6 Mon Sep 17 00:00:00 2001
From: Alice Sheng <alicesheng@google.com>
Date: Fri, 18 Mar 2022 10:25:31 -0700
Subject: [PATCH] Add ability to automatically bootup

Based on a new system property. This won't change any behavior if that
new system property isn't set.

Ignore-AOSP-First: WearOS specific change

Bug: 199404658
Test: set the property, check that off-mode-charging automatically
reboots

Change-Id: I98f37a840a43cb5216319457027b76fc493e3f62
(cherry picked from commit 332b3686290af70c73a464ce35b0c1124b2ce831)
---
2023-03-24 17:22:17 +00:00
Jack Wu
9ac8d76c11 charger: fix show qustion mark when start to draw UI
skip drawing UI for max 5 seconds if battery level is not ready.

Bug: 265896703
Test: confirm offmode charge UI behavior
Change-Id: I11ae3419749be8d3c1d8d8e61eb4446d276ac1ad
Signed-off-by: Jack Wu <wjack@google.com>
2023-03-17 01:28:56 +00:00
AleX Pelosi
ff7089295a BatteryMonitor: batteryStateOfHealth should be a property
Bug: 251427118
Test: m
Change-Id: I21bcd160f51cf8818d0c3c8c54c615314808e586
Signed-off-by: AleX Pelosi <apelosi@google.com>
2023-02-23 01:22:34 +00:00
Jack Wu
b57f68aedd BatteryMonitor: report battery health from health status
Bug: 251425963
Test: m
Change-Id: I0a34262c8146032120273ab9be4ef4d3b285d115
Signed-off-by: Jack Wu <wjack@google.com>
2023-02-10 07:40:20 +00:00
Jack Wu
2ed5c9c1a7 BatteryMonitor: fix build error with health hal v2 updraged
libbatterymonitor_V1 is used for some libraries linking health
aidl_interface V1 but at the same time BatteryMonitor also uses
battery hal V2 structure, it will cause compiling error.

Folk BatteryMonitor is also required along with folk libbatterymonitor

Bug: 251425963
Test: build
Change-Id: I796db83b1a67ad63e7f75f966e829a790b5c9c89
Signed-off-by: Jack Wu <wjack@google.com>
2023-01-21 15:28:23 +08:00
Jack Wu
e561d03cdf BatteryMonitor: get battery health data from sys file nodes
Requirements for battery health aidl hal v2, include sysfs nodes:
  - Battery state of health
  - Charging state
  - Charging policy
  - Date of manufacturing of the battery
  - Date of first use of the battery

and functions
  - setChargingPolicy
  - getChargingPolicy
  - getBatteryHealthData

Bug: 251425963
Test: m
Change-Id: I210dc403ba95b1b75759227f84bc32f32be1bbaf
Signed-off-by: Jack Wu <wjack@google.com>
2023-01-21 15:20:19 +08:00
Jack Wu
f83e5a6ebd BatteryMonitor: fix depending on multiple versions of the same aidl_interface
When health aidl_interface version updraged, some libraries are
depending on V1 and libbatterymonitor or libhealthd_charger_ui at
the same time. It will cause multiple versions depending if
libbatterymonitor or libhealthd_charger_ui are depending on new
version.

Fork libbatterymonitor and libhealthd_charger_ui to generate two
versions, so that other libraries can depend on the same aidl_interface
version, to avoid multiple versions depending.

Bug: 251425963
Test: build
Change-Id: I37ba23169428677550176916e5d0b52c154d7b85
Signed-off-by: Jack Wu <wjack@google.com>
2023-01-11 08:58:46 +08:00
Jack Wu
20b8a015c0 charger: fix secondary display not turning off after first display was off
turn off both display after first display was turned off

Bug: 242967285
Test: charging animation can show in display correctly
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: Ie5741b49322aaf8a3750b1977fb203e4d0df3539
2022-09-20 02:53:16 +00:00
Tim Zimmermann
c4c2a07210
healthd: Fix charger_res_images_vendor install location
* According to healthd_mode_charger.cpp#L106 this should be
  res/images/default/charger and not res/images/charger/default

Change-Id: Iabb5f5ecdd3b94c90a4b46849dd0a048da51364a
2022-08-26 15:58:07 +02:00
zengshuchuan
f694cf35ff charger: Fix charger pixel format useless
Create HealthdDraw in charger init beforce CreateDisplaySurface,
make sure minui gr_init pixel_format beforce gr_pixel_format.

Bug: 232441376
Test: 1. set ro.minui.pixel_format=ARGB_8888
2. Set a colorful battery_scale.png
3. Power off and enter charger mode.

Change-Id: If16f15d0a8bc3b7cb9dab7392f3753ec0a1525b8
2022-05-26 09:43:51 +08:00
Florian Mayer
6e2276b28a Add healthd to hwasan-postsubmit
Test: Run tests under HWASan.
Bug: 193568145
Change-Id: I710628acb0fffcbf670e4e30059f3cfa284f9540
2022-03-18 21:19:00 +00:00
Bart Van Assche
095c944b48 healthd: Convert multiple private methods into static nonmember functions
The private methods in class BatteryMonitor do not use the 'this'
pointer. Hence convert these into static nonmember functions.

Test: Compile-tested only.
Change-Id: I4b9b76c9697f1db894ba9fb939ce096ee6b7ff3b
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-03 18:46:12 +00:00
Bart Van Assche
5a7e5083e6 healthd: Fix readFromFile()
Not all readFromFile() callers pass an empty string. Make sure that
readFromFile() returns 0 (failure) if the *buf argument is not empty and
if reading fails.

Fixes: 3217c5c7d9 ("batterymonitor: simplify readFromFile and use std::string buffers")
Test: Compile-tested only.
Change-Id: I6f329491f8aa4a6d378eb7c3cbc17038eb6aa64d
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-03 18:46:12 +00:00
Bart Van Assche
024e18f060 healthd: Make initHealthInfo() easier to read
Use aggregate initialization instead of memberwise initialization. This
patch does not change any functionality.

Test: Compile-tested only.
Change-Id: I9c7831936e449aec8a48336b1ee76d26638e4f72
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-03 18:46:12 +00:00
Bart Van Assche
25b2a8de53 healthd: Improve readability of BatteryMonitor::init()
Declare and assign in a single statement instead of in two separate
statements. This patch does not change any functionality.

Test: Compile-tested only.
Change-Id: I0798cc940f5f2ca329548568ab68e96891521dd8
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-03 18:46:12 +00:00
Yifan Hong
b99d15c529 healthd: batterymonitor uses AIDL HealthInfo.
This change cleans up technical debt. As a side
effect, this change also exposes chargerDockOnline
properly to health HAL implementations.

Test: TH
Bug: 222120465
Change-Id: I306bd0538d94b310a69befb93b5862dd7208447f
2022-03-02 16:20:35 +08:00
Jack Wu
56540a0509 charger: support screen rotation
Bug: 191831427
Test: charging animation can show in display correctly
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: Iedcd7d6c3cd841c44bdf1116701abcbd12a26959
2022-01-27 13:27:59 +08:00
Jack Wu
3d637a9abb charger: process hall_sensor event to show charging animation
Bug: 191831427
Test: charging animation can show in display correctly
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: Id99a7401f53f647790e179e995dad9841f8284bb
2022-01-25 20:00:53 +08:00
Jack Wu
c1b171138e Charger: support secondary connector
set first connector as default

Test: charging animation can show in correct display
Bug: 191831427
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: Ia79981569e799f01db0036f0ecbdaca36a539ac6
2022-01-25 19:59:04 +08:00
Jack Wu
06b9041736 BatteryMonitor: support Dock charging
Bug: 194012532
Test: Show dock type correctly
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: I1698328b7b20c23d9b2571b7dbf1b907834582c8
2022-01-13 20:30:32 +08:00
Hridya Valsaraju
dcdb160411 healthd: remove hridya@ from OWNERS file
Test: N/A
Bug: N/A
Change-Id: Iffa783ea22d278c50df0c7a87f7f265c26a5c7c1
2022-01-06 16:56:57 -08:00
Yifan Hong
5771858dc0 healthd: *charger_test links to a.h.health@2.x statically.
These libraries might not be installed on the device
any more.

Fixes: 210093617
Test: run it
Change-Id: Ic1bc6ba3c78ccaad93aef00ab695f3c2acd2b367
2021-12-13 14:12:05 -08:00
Yifan Hong
ac748369bb charger: vendor charger use resources from /vendor
For the vendor variant of libhealthd_mode_charger, read resources
from /vendor. The core variant continues to read resources from
/product, /system, and /res.

Test: run charger from /vendor manually
Bug: 203246116
Change-Id: Ia9df1d081a51783409b5dbd3e3d4719efc3cb6a7
2021-11-02 13:52:40 -07:00
Yifan Hong
e3ffd1bfc2 charger: make libhealthd_charger_ui vendor_available.
This is a prerequisite to move charger to vendor partition.

Because vendor domains can't read ro.charger.*, they are all assumed
to be the default value. They aren't set in the ecosystem anyway,
so it is time to deprecate them.

Test: builds
Bug: 203246116
Change-Id: I0b17e62ab3ac5a89df091333fd9f24e33bdfd49a
2021-11-02 13:52:40 -07:00
Yifan Hong
8e55134f43 charger: Add API to replace ro.charger.enable_suspend
The system property is set by vendor partition but owned by platform,
hence vendor domains can't read this value. Add an API in
ChargerConfigurationInterface so that HAL implementations can override
its value.

Other ro.charger.* sysprops are unused, hence no APIs are created for
them.

Test: manual
Bug: 203246116

Change-Id: I583c21e58ed3d912b156e253d6a4b46a0378f11e
2021-11-01 12:38:56 -07:00
Yifan Hong
b5d7033dcc charger: separate UI and HAL access.
Abstract all the HIDL-ness from charger so an AIDL HAL
can later replace the HIDL HAL.

Created libhealthd_charger_ui that is responsible for
UI stuff in charger. Then libhealthd_charger is now the
charger library backed by HIDL HAL.

Bug: 170338625
Bug: 203246116

Test: charger_test

Change-Id: I193bb76afa18b3367f24796ac53b1760650e8683
2021-11-01 12:38:56 -07:00
Xiaohui Niu
a40d872989 charger: fix charger display stuck
1.Retry charger when gr init fail caused
by display not ready.
2.Remove meaningless logs which occupy log lines,
the logs that really need to be printed cannot be
output due to printk suppresses kernel logs.

Bug: 197604278
Change-Id: Id9465a0a9c994986192fd39c124d05aed8caa862
Test: Manual. Power off charging.
2021-09-02 03:17:58 +00:00
Bob Badour
d69ad69a93 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  bootstat/Android.bp
  cli-test/Android.bp
  code_coverage/Android.bp
  cpio/Android.bp
  debuggerd/crasher/Android.bp
  debuggerd/proto/Android.bp
  diagnose_usb/Android.bp
  fs_mgr/libdm/Android.bp
  fs_mgr/libfiemap/Android.bp
  fs_mgr/liblp/Android.bp
  fs_mgr/libsnapshot/Android.bp
  fs_mgr/libstorage_literals/Android.bp
  fs_mgr/libvbmeta/Android.bp
  fs_mgr/tests/Android.bp
  fs_mgr/tools/Android.bp
  gatekeeperd/Android.bp
  healthd/Android.bp
  healthd/testdata/Android.bp
  init/Android.bp
  init/Android.mk
  init/sysprop/Android.bp
  init/test_kill_services/Android.bp
  init/test_service/Android.bp
  libappfuse/Android.bp
  libasyncio/Android.bp
  libbinderwrapper/Android.bp
  libcrypto_utils/Android.bp
  libcrypto_utils/tests/Android.bp
  libdiskconfig/Android.bp
  libgrallocusage/Android.bp
  libkeyutils/mini_keyctl/Android.bp
  libmodprobe/Android.bp
  libnetutils/Android.bp
  libpackagelistparser/Android.bp
  libprocessgroup/Android.bp
  libprocessgroup/cgrouprc/Android.bp
  libprocessgroup/cgrouprc_format/Android.bp
  libprocessgroup/profiles/Android.bp
  libprocessgroup/setup/Android.bp
  libqtaguid/Android.bp
  libsparse/Android.bp
  libstats/push_compat/Android.bp
  libsuspend/Android.bp
  libsync/Android.bp
  libsystem/Android.bp
  libsysutils/Android.bp
  libusbhost/Android.bp
  libutils/Android.bp
  libvndksupport/Android.bp
  libvndksupport/tests/Android.bp
  llkd/Android.bp
  llkd/tests/Android.bp
  property_service/libpropertyinfoparser/Android.bp
  property_service/libpropertyinfoserializer/Android.bp
  property_service/property_info_checker/Android.bp
  qemu_pipe/Android.bp
  reboot/Android.bp
  rootdir/Android.bp
  rootdir/Android.mk
  rootdir/avb/Android.bp
  rootdir/avb/Android.mk
  run-as/Android.bp
  sdcard/Android.bp
  set-verity-state/Android.bp
  shell_and_utilities/Android.bp
  storaged/Android.bp
  toolbox/Android.bp
  trusty/apploader/Android.bp
  trusty/confirmationui/Android.bp
  trusty/confirmationui/fuzz/Android.bp
  trusty/coverage/Android.bp
  trusty/fuzz/Android.bp
  trusty/fuzz/test/Android.bp
  trusty/gatekeeper/Android.bp
  trusty/gatekeeper/fuzz/Android.bp
  trusty/keymaster/Android.bp
  trusty/keymaster/fuzz/Android.bp
  trusty/libtrusty/Android.bp
  trusty/libtrusty/tipc-test/Android.bp
  trusty/secure_dpu/Android.bp
  trusty/storage/interface/Android.bp
  trusty/storage/lib/Android.bp
  trusty/storage/proxy/Android.bp
  trusty/storage/tests/Android.bp
  trusty/utils/spiproxyd/Android.bp
  trusty/utils/trusty-ut-ctrl/Android.bp
  usbd/Android.bp
  watchdogd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  debuggerd/Android.bp
  fastboot/Android.bp
  libkeyutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT
to:
  libcutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
to:
  fs_mgr/Android.bp
  fs_mgr/libfs_avb/Android.bp
  trusty/Android.bp
  trusty/utils/rpmb_dev/Android.bp

Added SPDX-license-identifier-BSD
to:
  fastboot/fuzzy_fastboot/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Id740a7d2884556081fdb68876584b25eb95e1bef
2021-02-19 12:59:05 -08:00
Elliott Hughes
c3a206ccda Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/core"
This reverts commit 187b7d1950.

Reason for revert: system/core is multiple projects, not one.

Change-Id: I790ea41741f8cd9b8b6db2f59a49e71fb0958fd6
2021-02-16 20:01:20 +00:00
Bob Badour
187b7d1950 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  bootstat/Android.bp
  cli-test/Android.bp
  code_coverage/Android.bp
  cpio/Android.bp
  debuggerd/crasher/Android.bp
  debuggerd/proto/Android.bp
  diagnose_usb/Android.bp
  fs_mgr/libdm/Android.bp
  fs_mgr/libfiemap/Android.bp
  fs_mgr/liblp/Android.bp
  fs_mgr/libsnapshot/Android.bp
  fs_mgr/libstorage_literals/Android.bp
  fs_mgr/libvbmeta/Android.bp
  fs_mgr/tests/Android.bp
  fs_mgr/tools/Android.bp
  gatekeeperd/Android.bp
  healthd/Android.bp
  healthd/testdata/Android.bp
  init/Android.bp
  init/Android.mk
  init/sysprop/Android.bp
  init/test_kill_services/Android.bp
  init/test_service/Android.bp
  libappfuse/Android.bp
  libasyncio/Android.bp
  libbinderwrapper/Android.bp
  libcrypto_utils/Android.bp
  libcrypto_utils/tests/Android.bp
  libdiskconfig/Android.bp
  libgrallocusage/Android.bp
  libkeyutils/mini_keyctl/Android.bp
  libmodprobe/Android.bp
  libnetutils/Android.bp
  libpackagelistparser/Android.bp
  libprocessgroup/Android.bp
  libprocessgroup/cgrouprc/Android.bp
  libprocessgroup/cgrouprc_format/Android.bp
  libprocessgroup/profiles/Android.bp
  libprocessgroup/setup/Android.bp
  libqtaguid/Android.bp
  libsparse/Android.bp
  libstats/push_compat/Android.bp
  libsuspend/Android.bp
  libsync/Android.bp
  libsystem/Android.bp
  libsysutils/Android.bp
  libusbhost/Android.bp
  libutils/Android.bp
  libvndksupport/Android.bp
  libvndksupport/tests/Android.bp
  llkd/Android.bp
  llkd/tests/Android.bp
  property_service/libpropertyinfoparser/Android.bp
  property_service/libpropertyinfoserializer/Android.bp
  property_service/property_info_checker/Android.bp
  qemu_pipe/Android.bp
  reboot/Android.bp
  rootdir/Android.bp
  rootdir/Android.mk
  rootdir/avb/Android.bp
  rootdir/avb/Android.mk
  run-as/Android.bp
  sdcard/Android.bp
  set-verity-state/Android.bp
  shell_and_utilities/Android.bp
  storaged/Android.bp
  toolbox/Android.bp
  trusty/apploader/Android.bp
  trusty/confirmationui/Android.bp
  trusty/confirmationui/fuzz/Android.bp
  trusty/coverage/Android.bp
  trusty/fuzz/Android.bp
  trusty/fuzz/test/Android.bp
  trusty/gatekeeper/Android.bp
  trusty/gatekeeper/fuzz/Android.bp
  trusty/keymaster/Android.bp
  trusty/keymaster/fuzz/Android.bp
  trusty/libtrusty/Android.bp
  trusty/libtrusty/tipc-test/Android.bp
  trusty/secure_dpu/Android.bp
  trusty/storage/interface/Android.bp
  trusty/storage/lib/Android.bp
  trusty/storage/proxy/Android.bp
  trusty/storage/tests/Android.bp
  trusty/utils/spiproxyd/Android.bp
  trusty/utils/trusty-ut-ctrl/Android.bp
  usbd/Android.bp
  watchdogd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  debuggerd/Android.bp
  fastboot/Android.bp
  libkeyutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT
to:
  Android.bp
  libcutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
to:
  fs_mgr/Android.bp
  fs_mgr/libfs_avb/Android.bp
  trusty/utils/rpmb_dev/Android.bp

Added SPDX-license-identifier-BSD
to:
  fastboot/fuzzy_fastboot/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I5bd81adb5cdcf2b4dd4141b204eb430ff526af8f
2021-02-16 04:10:03 -08:00
Yifan Hong
605e7d20ee BatteryMonitor: Add helper of logValues()
... that logs values for an arbitrary health info and
health config.

This allows health 2.1 HAL implementation to log the
updated health info struct, which is not stored in
BatteryMonitor.

Test: healthd kernel log has correct values
Bug: 179326883
Change-Id: I394ef3f317229f94f4db82de5635d9380c183394
2021-02-08 15:22:28 -08:00
Yifan Hong
d86f5b99f8 Remove healthd.
It is replaced by health HIDL HAL 2.0. Devices launching
with Android P and above must always have health HAL 2.0,
so health HAL is no longer needed for Android S.

Test: TH
Bug: 171260613
Change-Id: I7d94af36a880d7c658e879a3986924a786e58de9
2021-01-11 15:44:58 -08:00
Yifan Hong
ae11855809 Merge "health: Add CAP_BLOCK_SUSPEND" 2020-10-15 20:24:17 +00:00
Inseob Kim
340d28487a Update sysprop_library API txt
Internal props are no longer stored in the txt file.

Exempt-From-Owner-Approval: cherry pick

Bug: 170693240
Test: m
Change-Id: I8d30b21a18759e35382f25a0706962cebbdeb096
Merged-In: I8d30b21a18759e35382f25a0706962cebbdeb096
2020-10-15 04:04:15 +00:00
Subbaraman Narayanamurthy
28ebc23625 health: Add CAP_BLOCK_SUSPEND
Add CAP_BLOCK_SUSPEND to android.hardware.health@2.0 service so
that when epoll_wait() is waiting on uevents and timer_fd events
it can block suspend to take the necessary action. Without this
permission, eventpoll is going to ignore the flags EPOLLWAKEUP
used in health HAL or healthloop.

Bug: 169873088
Change-Id: I50d84dd853f718d46fb4f15113da032b60c34b0d
2020-10-14 12:30:19 -07:00
Stephane Lee
bab6877710 Assume UNSUPPORTED if the battery capacity level sysfs node does
not exist.

Bug: 163382088
Test: Ensure that, if the ./capacity_level does not exist,
  that the device will shut down at 0 % SOC in an Health 2.1
  implementation
Change-Id: I00822b4bfba5d823c1a30163ea6824e59d3aae32
2020-08-13 14:31:02 -07:00
Greg Kaiser
8763fd26fb charger: Avoid a couple string constructions
With a couple recent changes to APIs taking a const std::string&,
instead of a const char *, we switch to directly passing in a
reference to our string.

Test: TreeHugger
Change-Id: Id9f832dd5e3def28cfeaa0d3cda7da323332b16c
2020-08-12 07:03:50 -07:00
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