Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c0740e2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "IHealth: get* function return 0 on fail."

parents b55e22a5 81874af4
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ interface IHealth {
     *                NOT_SUPPORTED if this property is not supported
     *                 (e.g. the file that stores this property does not exist),
     *                UNKNOWN for other errors.
     * @return value battery capacity, or INT32_MIN if not successful.
     * @return value battery capacity, or 0 if not successful.
     */
    getChargeCounter() generates (Result result, int32_t value);

@@ -84,7 +84,7 @@ interface IHealth {
     *                NOT_SUPPORTED if this property is not supported
     *                 (e.g. the file that stores this property does not exist),
     *                UNKNOWN for other errors.
     * @return value instantaneous battery current, or INT32_MIN if not
     * @return value instantaneous battery current, or 0 if not
     *               successful.
     */
    getCurrentNow() generates (Result result, int32_t value);
@@ -101,7 +101,7 @@ interface IHealth {
     *                NOT_SUPPORTED if this property is not supported
     *                 (e.g. the file that stores this property does not exist),
     *                UNKNOWN for other errors.
     * @return value average battery current, or INT32_MIN if not successful.
     * @return value average battery current, or 0 if not successful.
     */
    getCurrentAverage() generates (Result result, int32_t value);

@@ -113,7 +113,7 @@ interface IHealth {
     *                NOT_SUPPORTED if this property is not supported
     *                 (e.g. the file that stores this property does not exist),
     *                UNKNOWN for other errors.
     * @return value remaining battery capacity, or INT32_MIN if not successful.
     * @return value remaining battery capacity, or 0 if not successful.
     */
    getCapacity() generates (Result result, int32_t value);

@@ -123,7 +123,7 @@ interface IHealth {
     * @return result SUCCESS if successful,
     *                NOT_SUPPORTED if this property is not supported,
     *                UNKNOWN for other errors.
     * @return value remaining energy, or INT64_MIN if not successful.
     * @return value remaining energy, or 0 if not successful.
     */
    getEnergyCounter() generates (Result result, int64_t value);

+5 −5
Original line number Diff line number Diff line
@@ -108,27 +108,27 @@ void getProperty(const std::unique_ptr<BatteryMonitor>& monitor, int id, T defau
}

Return<void> Health::getChargeCounter(getChargeCounter_cb _hidl_cb) {
    getProperty(battery_monitor_, BATTERY_PROP_CHARGE_COUNTER, INT32_MIN, _hidl_cb);
    getProperty<int32_t>(battery_monitor_, BATTERY_PROP_CHARGE_COUNTER, 0, _hidl_cb);
    return Void();
}

Return<void> Health::getCurrentNow(getCurrentNow_cb _hidl_cb) {
    getProperty(battery_monitor_, BATTERY_PROP_CURRENT_NOW, INT32_MIN, _hidl_cb);
    getProperty<int32_t>(battery_monitor_, BATTERY_PROP_CURRENT_NOW, 0, _hidl_cb);
    return Void();
}

Return<void> Health::getCurrentAverage(getCurrentAverage_cb _hidl_cb) {
    getProperty(battery_monitor_, BATTERY_PROP_CURRENT_AVG, INT32_MIN, _hidl_cb);
    getProperty<int32_t>(battery_monitor_, BATTERY_PROP_CURRENT_AVG, 0, _hidl_cb);
    return Void();
}

Return<void> Health::getCapacity(getCapacity_cb _hidl_cb) {
    getProperty(battery_monitor_, BATTERY_PROP_CAPACITY, INT32_MIN, _hidl_cb);
    getProperty<int32_t>(battery_monitor_, BATTERY_PROP_CAPACITY, 0, _hidl_cb);
    return Void();
}

Return<void> Health::getEnergyCounter(getEnergyCounter_cb _hidl_cb) {
    getProperty(battery_monitor_, BATTERY_PROP_ENERGY_COUNTER, INT64_MIN, _hidl_cb);
    getProperty<int64_t>(battery_monitor_, BATTERY_PROP_ENERGY_COUNTER, 0, _hidl_cb);
    return Void();
}