BatteryService: Add Max charging voltage
Bug: 25229483
Change-Id: Ibeba97eb145c3d59a763bd8632ab7fcc43118e4b
(cherry picked from commit f92fcfe36a)
This commit is contained in:
committed by
Rom Lemarchand
parent
75603fb707
commit
4f72447fbf
@@ -108,6 +108,13 @@ public class BatteryManager {
|
||||
*/
|
||||
public static final String EXTRA_MAX_CHARGING_CURRENT = "max_charging_current";
|
||||
|
||||
/**
|
||||
* Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
|
||||
* Int value set to the maximum charging voltage supported by the charger in micro volts.
|
||||
* {@hide}
|
||||
*/
|
||||
public static final String EXTRA_MAX_CHARGING_VOLTAGE = "max_charging_voltage";
|
||||
|
||||
// values for "status" field in the ACTION_BATTERY_CHANGED Intent
|
||||
public static final int BATTERY_STATUS_UNKNOWN = 1;
|
||||
public static final int BATTERY_STATUS_CHARGING = 2;
|
||||
|
||||
@@ -23,6 +23,7 @@ public class BatteryProperties implements Parcelable {
|
||||
public boolean chargerUsbOnline;
|
||||
public boolean chargerWirelessOnline;
|
||||
public int maxChargingCurrent;
|
||||
public int maxChargingVoltage;
|
||||
public int batteryStatus;
|
||||
public int batteryHealth;
|
||||
public boolean batteryPresent;
|
||||
@@ -39,6 +40,7 @@ public class BatteryProperties implements Parcelable {
|
||||
chargerUsbOnline = other.chargerUsbOnline;
|
||||
chargerWirelessOnline = other.chargerWirelessOnline;
|
||||
maxChargingCurrent = other.maxChargingCurrent;
|
||||
maxChargingVoltage = other.maxChargingVoltage;
|
||||
batteryStatus = other.batteryStatus;
|
||||
batteryHealth = other.batteryHealth;
|
||||
batteryPresent = other.batteryPresent;
|
||||
@@ -58,6 +60,7 @@ public class BatteryProperties implements Parcelable {
|
||||
chargerUsbOnline = p.readInt() == 1 ? true : false;
|
||||
chargerWirelessOnline = p.readInt() == 1 ? true : false;
|
||||
maxChargingCurrent = p.readInt();
|
||||
maxChargingVoltage = p.readInt();
|
||||
batteryStatus = p.readInt();
|
||||
batteryHealth = p.readInt();
|
||||
batteryPresent = p.readInt() == 1 ? true : false;
|
||||
@@ -72,6 +75,7 @@ public class BatteryProperties implements Parcelable {
|
||||
p.writeInt(chargerUsbOnline ? 1 : 0);
|
||||
p.writeInt(chargerWirelessOnline ? 1 : 0);
|
||||
p.writeInt(maxChargingCurrent);
|
||||
p.writeInt(maxChargingVoltage);
|
||||
p.writeInt(batteryStatus);
|
||||
p.writeInt(batteryHealth);
|
||||
p.writeInt(batteryPresent ? 1 : 0);
|
||||
|
||||
@@ -121,6 +121,7 @@ public final class BatteryService extends SystemService {
|
||||
private int mLastBatteryTemperature;
|
||||
private boolean mLastBatteryLevelCritical;
|
||||
private int mLastMaxChargingCurrent;
|
||||
private int mLastMaxChargingVoltage;
|
||||
|
||||
private int mInvalidCharger;
|
||||
private int mLastInvalidCharger;
|
||||
@@ -325,6 +326,7 @@ public final class BatteryService extends SystemService {
|
||||
+ ", chargerUsbOnline=" + mBatteryProps.chargerUsbOnline
|
||||
+ ", chargerWirelessOnline=" + mBatteryProps.chargerWirelessOnline
|
||||
+ ", maxChargingCurrent" + mBatteryProps.maxChargingCurrent
|
||||
+ ", maxChargingVoltage" + mBatteryProps.maxChargingVoltage
|
||||
+ ", batteryStatus=" + mBatteryProps.batteryStatus
|
||||
+ ", batteryHealth=" + mBatteryProps.batteryHealth
|
||||
+ ", batteryPresent=" + mBatteryProps.batteryPresent
|
||||
@@ -356,6 +358,7 @@ public final class BatteryService extends SystemService {
|
||||
mBatteryProps.batteryVoltage != mLastBatteryVoltage ||
|
||||
mBatteryProps.batteryTemperature != mLastBatteryTemperature ||
|
||||
mBatteryProps.maxChargingCurrent != mLastMaxChargingCurrent ||
|
||||
mBatteryProps.maxChargingVoltage != mLastMaxChargingVoltage ||
|
||||
mInvalidCharger != mLastInvalidCharger)) {
|
||||
|
||||
if (mPlugType != mLastPlugType) {
|
||||
@@ -483,6 +486,7 @@ public final class BatteryService extends SystemService {
|
||||
mLastBatteryVoltage = mBatteryProps.batteryVoltage;
|
||||
mLastBatteryTemperature = mBatteryProps.batteryTemperature;
|
||||
mLastMaxChargingCurrent = mBatteryProps.maxChargingCurrent;
|
||||
mLastMaxChargingVoltage = mBatteryProps.maxChargingVoltage;
|
||||
mLastBatteryLevelCritical = mBatteryLevelCritical;
|
||||
mLastInvalidCharger = mInvalidCharger;
|
||||
}
|
||||
@@ -508,7 +512,7 @@ public final class BatteryService extends SystemService {
|
||||
intent.putExtra(BatteryManager.EXTRA_TECHNOLOGY, mBatteryProps.batteryTechnology);
|
||||
intent.putExtra(BatteryManager.EXTRA_INVALID_CHARGER, mInvalidCharger);
|
||||
intent.putExtra(BatteryManager.EXTRA_MAX_CHARGING_CURRENT, mBatteryProps.maxChargingCurrent);
|
||||
|
||||
intent.putExtra(BatteryManager.EXTRA_MAX_CHARGING_VOLTAGE, mBatteryProps.maxChargingVoltage);
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Sending ACTION_BATTERY_CHANGED. level:" + mBatteryProps.batteryLevel +
|
||||
", scale:" + BATTERY_SCALE + ", status:" + mBatteryProps.batteryStatus +
|
||||
@@ -521,7 +525,8 @@ public final class BatteryService extends SystemService {
|
||||
", USB powered:" + mBatteryProps.chargerUsbOnline +
|
||||
", Wireless powered:" + mBatteryProps.chargerWirelessOnline +
|
||||
", icon:" + icon + ", invalid charger:" + mInvalidCharger +
|
||||
", maxChargingCurrent:" + mBatteryProps.maxChargingCurrent);
|
||||
", maxChargingCurrent:" + mBatteryProps.maxChargingCurrent +
|
||||
", maxChargingVoltage:" + mBatteryProps.maxChargingVoltage);
|
||||
}
|
||||
|
||||
mHandler.post(new Runnable() {
|
||||
@@ -627,6 +632,7 @@ public final class BatteryService extends SystemService {
|
||||
pw.println(" USB powered: " + mBatteryProps.chargerUsbOnline);
|
||||
pw.println(" Wireless powered: " + mBatteryProps.chargerWirelessOnline);
|
||||
pw.println(" Max charging current: " + mBatteryProps.maxChargingCurrent);
|
||||
pw.println(" Max charging voltage: " + mBatteryProps.maxChargingVoltage);
|
||||
pw.println(" status: " + mBatteryProps.batteryStatus);
|
||||
pw.println(" health: " + mBatteryProps.batteryHealth);
|
||||
pw.println(" present: " + mBatteryProps.batteryPresent);
|
||||
|
||||
Reference in New Issue
Block a user