Merge "batteryService: Add Charge Counter." into nyc-dev
am: 0f36ba8
* commit '0f36ba81e7a8c05d6500ce32197989c6fc3c30fc':
batteryService: Add Charge Counter.
Change-Id: Ia15b676d999118b774b5cdc7695083e1d694ee3f
This commit is contained in:
@@ -115,6 +115,13 @@ public class BatteryManager {
|
||||
*/
|
||||
public static final String EXTRA_MAX_CHARGING_VOLTAGE = "max_charging_voltage";
|
||||
|
||||
/**
|
||||
* Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
|
||||
* integer containing the charge counter present in the battery.
|
||||
* {@hide}
|
||||
*/
|
||||
public static final String EXTRA_CHARGE_COUNTER = "charge_counter";
|
||||
|
||||
// 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;
|
||||
|
||||
@@ -30,6 +30,7 @@ public class BatteryProperties implements Parcelable {
|
||||
public int batteryLevel;
|
||||
public int batteryVoltage;
|
||||
public int batteryTemperature;
|
||||
public int batteryChargeCounter;
|
||||
public String batteryTechnology;
|
||||
|
||||
public BatteryProperties() {
|
||||
@@ -47,6 +48,7 @@ public class BatteryProperties implements Parcelable {
|
||||
batteryLevel = other.batteryLevel;
|
||||
batteryVoltage = other.batteryVoltage;
|
||||
batteryTemperature = other.batteryTemperature;
|
||||
batteryChargeCounter = other.batteryChargeCounter;
|
||||
batteryTechnology = other.batteryTechnology;
|
||||
}
|
||||
|
||||
@@ -67,6 +69,7 @@ public class BatteryProperties implements Parcelable {
|
||||
batteryLevel = p.readInt();
|
||||
batteryVoltage = p.readInt();
|
||||
batteryTemperature = p.readInt();
|
||||
batteryChargeCounter = p.readInt();
|
||||
batteryTechnology = p.readString();
|
||||
}
|
||||
|
||||
@@ -82,6 +85,7 @@ public class BatteryProperties implements Parcelable {
|
||||
p.writeInt(batteryLevel);
|
||||
p.writeInt(batteryVoltage);
|
||||
p.writeInt(batteryTemperature);
|
||||
p.writeInt(batteryChargeCounter);
|
||||
p.writeString(batteryTechnology);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,7 @@ public final class BatteryService extends SystemService {
|
||||
private boolean mLastBatteryLevelCritical;
|
||||
private int mLastMaxChargingCurrent;
|
||||
private int mLastMaxChargingVoltage;
|
||||
private int mLastChargeCounter;
|
||||
|
||||
private int mInvalidCharger;
|
||||
private int mLastInvalidCharger;
|
||||
@@ -341,6 +342,7 @@ public final class BatteryService extends SystemService {
|
||||
+ ", chargerWirelessOnline=" + mBatteryProps.chargerWirelessOnline
|
||||
+ ", maxChargingCurrent" + mBatteryProps.maxChargingCurrent
|
||||
+ ", maxChargingVoltage" + mBatteryProps.maxChargingVoltage
|
||||
+ ", chargeCounter" + mBatteryProps.batteryChargeCounter
|
||||
+ ", batteryStatus=" + mBatteryProps.batteryStatus
|
||||
+ ", batteryHealth=" + mBatteryProps.batteryHealth
|
||||
+ ", batteryPresent=" + mBatteryProps.batteryPresent
|
||||
@@ -373,6 +375,7 @@ public final class BatteryService extends SystemService {
|
||||
mBatteryProps.batteryTemperature != mLastBatteryTemperature ||
|
||||
mBatteryProps.maxChargingCurrent != mLastMaxChargingCurrent ||
|
||||
mBatteryProps.maxChargingVoltage != mLastMaxChargingVoltage ||
|
||||
mBatteryProps.batteryChargeCounter != mLastChargeCounter ||
|
||||
mInvalidCharger != mLastInvalidCharger)) {
|
||||
|
||||
if (mPlugType != mLastPlugType) {
|
||||
@@ -501,6 +504,7 @@ public final class BatteryService extends SystemService {
|
||||
mLastBatteryTemperature = mBatteryProps.batteryTemperature;
|
||||
mLastMaxChargingCurrent = mBatteryProps.maxChargingCurrent;
|
||||
mLastMaxChargingVoltage = mBatteryProps.maxChargingVoltage;
|
||||
mLastChargeCounter = mBatteryProps.batteryChargeCounter;
|
||||
mLastBatteryLevelCritical = mBatteryLevelCritical;
|
||||
mLastInvalidCharger = mInvalidCharger;
|
||||
}
|
||||
@@ -527,6 +531,7 @@ public final class BatteryService extends SystemService {
|
||||
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);
|
||||
intent.putExtra(BatteryManager.EXTRA_CHARGE_COUNTER, mBatteryProps.batteryChargeCounter);
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Sending ACTION_BATTERY_CHANGED. level:" + mBatteryProps.batteryLevel +
|
||||
", scale:" + BATTERY_SCALE + ", status:" + mBatteryProps.batteryStatus +
|
||||
@@ -540,7 +545,8 @@ public final class BatteryService extends SystemService {
|
||||
", Wireless powered:" + mBatteryProps.chargerWirelessOnline +
|
||||
", icon:" + icon + ", invalid charger:" + mInvalidCharger +
|
||||
", maxChargingCurrent:" + mBatteryProps.maxChargingCurrent +
|
||||
", maxChargingVoltage:" + mBatteryProps.maxChargingVoltage);
|
||||
", maxChargingVoltage:" + mBatteryProps.maxChargingVoltage +
|
||||
", chargeCounter:" + mBatteryProps.batteryChargeCounter);
|
||||
}
|
||||
|
||||
mHandler.post(new Runnable() {
|
||||
@@ -772,6 +778,7 @@ public final class BatteryService extends SystemService {
|
||||
pw.println(" Wireless powered: " + mBatteryProps.chargerWirelessOnline);
|
||||
pw.println(" Max charging current: " + mBatteryProps.maxChargingCurrent);
|
||||
pw.println(" Max charging voltage: " + mBatteryProps.maxChargingVoltage);
|
||||
pw.println(" Charge counter: " + mBatteryProps.batteryChargeCounter);
|
||||
pw.println(" status: " + mBatteryProps.batteryStatus);
|
||||
pw.println(" health: " + mBatteryProps.batteryHealth);
|
||||
pw.println(" present: " + mBatteryProps.batteryPresent);
|
||||
|
||||
Reference in New Issue
Block a user