Take advantage of the many tests and tools described in Evaluating Performance as part of your work getting the most out of Android.
Android 9 includes
android.hardware.health HAL 2.0,
a major version upgrade from email@example.com HAL. This new HAL has the following
- Cleaner separation between framework and vendor code.
- Deprecates the unnecessary
- Greater degrees of freedom for vendor customization in health information reports.
- More device health information than just battery.
Devices launching with Android 9 must provide the 2.0 HAL (and must not provide the 1.0 HAL). Devices not launching with Android 9 but planning to update the vendor image to Target Framework Compatibility Matrix Version 3 (released in Android 9) must remove existing 1.0 HAL implementations and provide the 2.0 HAL.
AOSP includes multiple helper libraries designed to help you implement the 2.0 HAL and the transition from the old 1.0 HAL.
- firstname.lastname@example.org: abbreviation of
email@example.com. Refers to health HIDL HAL version 1.0 released in Android 8.0.
- firstname.lastname@example.org: abbreviation of
email@example.com. Refers to health HIDL HAL version 2.0 released in Android 9.
- charger: executable running in off-mode charging that displays the phone-charging animation.
- recovery: executable running in recovery mode that must retrieve battery information.
- healthd: legacy daemon running in Android that retrieves health-related information and provides it to framework.
- storaged: daemon running in Android that retrieves storage information and provides it to framework.
Health in Android 8.x
In Android 8.x, the health component works as detailed in the following diagram:
Figure 1. Health in Android 8.x
In this diagram:
- One (1) binder call and one (1) hwbinder call are used by the framework to communicate with hardware.
healthdstatically links to
- firstname.lastname@example.org statically links to
Each board can customize a different
it is determined at build time what charger, email@example.com, and recovery link
For other modes:
Figure 2. Health in Android 8.x, off-mode charging and recovery mode
- charger statically links to
- recovery statically links to
Health in Android 9
In Android 9, the health component works as detailed in the following diagram:
Figure 3. Health in Android 9
The framework attempts to retrieve firstname.lastname@example.org service from
If it fails, it calls into email@example.com (in Android 8.x). The legacy code path is
kept so the Android 9 system image is compatible with
the Android 8.x vendor image. The framework does not retrieve information from
both HALs because only one service version (1.0 or 2.0) can exist on the device.
For other modes:
Figure 4. Health in Android 9, off-mode charging and recovery mode
The firstname.lastname@example.org HAL provides the same functionality to the framework as the old healthd daemon. It also provides APIs that are similar to what healthd previously provided as a binder service (i.e. IBatteryPropertiesRegistrar).
The main interface, IHealth , provides the following functions:
registerCallback, to replace
unregisterCallback, to replace
update, to replace
IBatteryPropertiesRegistrar.getPropertiesare replaced by the following:
IHealth provides the following new APIs for
retrieve vendor-specific storage related information:
A new struct,
@2.0::HealthInfo, is returned via callbacks and
This struct contains all device health information available through email@example.com
- Charging information (AC/USB/wireless, current, voltage, etc.)
- Battery information (presence, battery level, current, voltage, charge, technology, etc.)
- Storage information (storage device information, disk statistics)
For information on implementing the Health service, see Implementing Health.