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

Commit afc4b2d9 authored by Michael Wright's avatar Michael Wright Committed by android-build-merger
Browse files

Merge "Add API to compute charge time remaining." into pi-dev am: ba6f173c

am: ec69f61c

Change-Id: Ic383fb123232f0a69221bda7fa489922dd6a5218
parents c417adf9 ec69f61c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32067,6 +32067,7 @@ package android.os {
  }
  public class BatteryManager {
    method public long computeChargeTimeRemaining();
    method public int getIntProperty(int);
    method public long getLongProperty(int);
    method public boolean isCharging();
+16 −0
Original line number Diff line number Diff line
@@ -353,4 +353,20 @@ public class BatteryManager {
    public static boolean isPlugWired(int plugType) {
        return plugType == BATTERY_PLUGGED_USB || plugType == BATTERY_PLUGGED_AC;
    }

    /**
     * Compute an approximation for how much time (in milliseconds) remains until the battery is
     * fully charged. Returns -1 if no time can be computed: either there is not enough current
     * data to make a decision or the battery is currently discharging.
     *
     * @return how much time is left, in milliseconds, until the battery is fully charged or -1 if
     *         the computation fails
     */
    public long computeChargeTimeRemaining() {
        try {
            return mBatteryStats.computeChargeTimeRemaining();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
}