Package: android.hardware.health@2.0

IHealth

interface IHealth

IHealth manages health info and posts events on registered callbacks.

Methods

registerCallback

registerCallback (IHealthInfoCallback callback)
generates (Result result)

Register a callback for any health info events.

Registering a new callback must not unregister the old one;the old callback remains registered until one of the following happens:- A client explicitly calls {

Details
Parameters
callback
the callback to register.
Generates
result
SUCCESS if successful, UNKNOWN for other errors.

unregisterCallback

unregisterCallback (IHealthInfoCallback callback)
generates (Result result)

Explicitly unregister a callback that is previously registered through {

Details
Parameters
callback
the callback to unregister
Generates
result
SUCCESS if successful, NOT_FOUND if callback is not registered previously, UNKNOWN for other errors.

update

update ()
generates (Result result)

Schedule update.

When update() is called, the service must notify all registered callbacks with the most recent health info.

Details
Generates
result
SUCCESS if successful, CALLBACK_DIED if any registered callback is dead, UNKNOWN for other errors.

getChargeCounter

getChargeCounter ()
generates (Result result, int32_t value)

Get battery capacity in microampere-hours(µAh).

Details
Generates
result
SUCCESS if successful, NOT_SUPPORTED if this property is not supported(e.g.the file that stores this property does not exist), UNKNOWN for other errors.
value
battery capacity, or INT32_MIN if not successful.

getCurrentNow

getCurrentNow ()
generates (Result result, int32_t value)

Get instantaneous battery current in microamperes(µA).

Positive values indicate net current entering the battery from a charge source, negative values indicate net current discharging from the battery.

Details
Generates
result
SUCCESS if successful, NOT_SUPPORTED if this property is not supported(e.g.the file that stores this property does not exist), UNKNOWN for other errors.
value
instantaneous battery current, or INT32_MIN if not successful.

getCurrentAverage

getCurrentAverage ()
generates (Result result, int32_t value)

Get average battery current in microamperes(µA).

Positive values indicate net current entering the battery from a charge source, negative values indicate net current discharging from the battery.The time period over which the average is computed may depend on the fuel gauge hardware and its configuration.

Details
Generates
result
SUCCESS if successful, NOT_SUPPORTED if this property is not supported(e.g.the file that stores this property does not exist), UNKNOWN for other errors.
value
average battery current, or INT32_MIN if not successful.

getCapacity

getCapacity ()
generates (Result result, int32_t value)

Get remaining battery capacity percentage of total capacity(with no fractional part).

Details
Generates
result
SUCCESS if successful, NOT_SUPPORTED if this property is not supported(e.g.the file that stores this property does not exist), UNKNOWN for other errors.
value
remaining battery capacity, or INT32_MIN if not successful.

getEnergyCounter

getEnergyCounter ()
generates (Result result, int64_t value)

Get battery remaining energy in nanowatt-hours.

Details
Generates
result
SUCCESS if successful, NOT_SUPPORTED if this property is not supported, UNKNOWN for other errors.
value
remaining energy, or INT64_MIN if not successful.

getChargeStatus

getChargeStatus ()
generates (Result result, BatteryStatus value)

Get battery charge status.

Details
Generates
result
SUCCESS if successful, NOT_SUPPORTED if this property is not supported(e.g.the file that stores this property does not exist), UNKNOWN other errors.
value
charge status, or UNKNOWN if not successful.