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

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

Merge "BatteryStats: Clamp temperature to 0" into oc-dev

parents 1a89073d 29ddfe55
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10057,6 +10057,9 @@ public class BatteryStatsImpl extends BatteryStats {

    public void setBatteryStateLocked(int status, int health, int plugType, int level,
            int temp, int volt, int chargeUAh, int chargeFullUAh) {
        // Temperature is encoded without the signed bit, so clamp any negative temperatures to 0.
        temp = Math.max(0, temp);

        final boolean onBattery = plugType == BATTERY_PLUGGED_NONE;
        final long uptime = mClocks.uptimeMillis();
        final long elapsedRealtime = mClocks.elapsedRealtime();
+4 −1
Original line number Diff line number Diff line
@@ -679,7 +679,7 @@ public final class BatteryService extends SystemService {
        pw.println("Battery service (battery) commands:");
        pw.println("  help");
        pw.println("    Print this help text.");
        pw.println("  set [-f] [ac|usb|wireless|status|level|present|invalid] <value>");
        pw.println("  set [-f] [ac|usb|wireless|status|level|temp|present|invalid] <value>");
        pw.println("    Force a battery property value, freezing battery state.");
        pw.println("    -f: force a battery change broadcast be sent, prints new sequence.");
        pw.println("  unplug [-f]");
@@ -767,6 +767,9 @@ public final class BatteryService extends SystemService {
                        case "level":
                            mBatteryProps.batteryLevel = Integer.parseInt(value);
                            break;
                        case "temp":
                            mBatteryProps.batteryTemperature = Integer.parseInt(value);
                            break;
                        case "invalid":
                            mInvalidCharger = Integer.parseInt(value);
                            break;