Merge "BatteryStats: Clamp temperature to 0" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2042770ea5
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user