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
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
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
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
/sys/class/power_supply/*/current_now should return uA and the HAL
expects uA too.
Test: VtsHalHealthV2_0TargetTest
Bug: 136717180
Change-Id: I675be1ae645413b9494af4a5d49955aad5bd4f2e
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
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
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
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>
HIDL enum values are zero initialized, not the first value
of the enum. They need to be initialized properly.
Test: pass
Change-Id: I2adb8b851e6ac607ac4f547a6a6600604d07816f
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
- 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
... 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
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
Since these were combined into libhidlbase.
Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I0bdffced6af52695c0ef98c9dd659348e56f7aa6
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)
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
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
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>
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
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
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
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>
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
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>
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
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
This reverts commit f23fa3b12f.
Reason for revert: This breaks framework tests and blocks presubmit
Change-Id: Iccf29d7499c378c611ea5a783074865febf8514e
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)
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>
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)
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)
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>
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
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
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
... as a workaround for build system does not currently infer non-LTO
usage from Android.mk.
Test: m
Bug: 77320844
Change-Id: Iefe5d08b907133b4cdf1516efee73b2c0161f77e
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
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
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
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
... to hardware/interfaces. HealthServiceCommon
becomes two separate libraries:
- libhealthservicedefault for services on vendor
- libhealthservicehealthd for healthd
Test: boots
Bug: 63702641
Change-Id: Ibc7096328bb36356cb653e542bab900cd046fe8a
This is to add empty implementations of methods
reporting storage health.
Bug: 68388678
Test: vts-tradefed run vts -m VtsHalHealthV2_0
Change-Id: If6180c22a4b356650084df61b1e24af3de0ca67e
This reverts commit de610c9a0e.
Reason for revert: May trigger flakiness in CTS ActivityManagerAssistantStackTests.
Change-Id: I02f831048f7802d91331e67bd9006860e4572b92
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
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
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
... 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
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
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
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