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

Commit 3d44f637 authored by Makoto Onuki's avatar Makoto Onuki Committed by Android (Google) Code Review
Browse files

Merge "Fix boost charging, also expose test API"

parents f7925c11 897f6366
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1281,6 +1281,10 @@ package android.net.util {

package android.os {

  public class BatteryManager {
    method @RequiresPermission("android.permission.POWER_SAVER") public boolean setChargingStateUpdateDelayMillis(int);
  }

  public class Build {
    method public static boolean is64BitAbi(String);
  }
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.Manifest.permission;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.content.Context;
import android.content.Intent;
import android.hardware.health.V1_0.Constants;
@@ -386,6 +387,7 @@ public class BatteryManager {
     */
    @RequiresPermission(permission.POWER_SAVER)
    @SystemApi
    @TestApi
    public boolean setChargingStateUpdateDelayMillis(int delayMillis) {
        try {
            return mBatteryStats.setChargingStateUpdateDelayMillis(delayMillis);
+2 −4
Original line number Diff line number Diff line
@@ -12775,13 +12775,11 @@ public class BatteryStatsImpl extends BatteryStats {
                    // charging even if it happens to go down a level.
                    changed |= setChargingLocked(true);
                    mLastChargeStepLevel = level;
                }
                if (!mCharging) {
                } else if (!mCharging) {
                    if (mLastChargeStepLevel < level) {
                        // We have not reported that we are charging, but the level has gone up,
                        // but we would like to not have tons of activity from charging-constraint
                        // jobs, so instead of reporting ACTION_CHARGING immediately, we defer it.
                        mLastChargeStepLevel = level;
                        if (!mHandler.hasCallbacks(mDeferSetCharging)) {
                            mHandler.postDelayed(
                                    mDeferSetCharging,
@@ -12800,9 +12798,9 @@ public class BatteryStatsImpl extends BatteryStats {
                        // power supplied isn't enough, so consider the device to now be
                        // discharging.
                        changed |= setChargingLocked(false);
                        mLastChargeStepLevel = level;
                    }
                }
                mLastChargeStepLevel = level;
                if (mLastChargeStepLevel != level && mMaxChargeStepLevel < level) {
                    mChargeStepTracker.addLevelSteps(level - mLastChargeStepLevel,
                            modeBits, elapsedRealtime);