BatteryProperty: Add property ENERGY_COUNTER and 64-bit integer properties

Also fixup comments to match recent changes in BatteryManager.

Change-Id: I6f40924f9e66d564ad1175f9650e2bfd2ad39a3a
This commit is contained in:
Todd Poynor 2014-05-08 16:04:22 -07:00
parent 37a5e7a21a
commit a186e65368
2 changed files with 9 additions and 7 deletions

View File

@ -18,6 +18,7 @@
#define ANDROID_BATTERYSERVICE_H
#include <binder/Parcel.h>
#include <sys/types.h>
#include <utils/Errors.h>
#include <utils/String8.h>
@ -45,10 +46,11 @@ enum {
// must be kept in sync with definitions in BatteryProperty.java
enum {
BATTERY_PROP_CHARGE_COUNTER = 1, // equals BatteryProperty.BATTERY_PROP_CHARGE_COUNTER constant
BATTERY_PROP_CURRENT_NOW = 2, // equals BatteryProperty.BATTERY_PROP_CURRENT_NOW constant
BATTERY_PROP_CURRENT_AVG = 3, // equals BatteryProperty.BATTERY_PROP_CURRENT_AVG constant
BATTERY_PROP_CAPACITY = 4, // equals BatteryProperty.BATTERY_PROP_CAPACITY constant
BATTERY_PROP_CHARGE_COUNTER = 1, // equals BatteryProperty.CHARGE_COUNTER constant
BATTERY_PROP_CURRENT_NOW = 2, // equals BatteryProperty.CURRENT_NOW constant
BATTERY_PROP_CURRENT_AVG = 3, // equals BatteryProperty.CURRENT_AVG constant
BATTERY_PROP_CAPACITY = 4, // equals BatteryProperty.CAPACITY constant
BATTERY_PROP_ENERGY_COUNTER = 5, // equals BatteryProperty.ENERGY_COUNTER constant
};
struct BatteryProperties {
@ -68,7 +70,7 @@ struct BatteryProperties {
};
struct BatteryProperty {
int valueInt;
int64_t valueInt64;
status_t writeToParcel(Parcel* parcel) const;
status_t readFromParcel(Parcel* parcel);

View File

@ -28,12 +28,12 @@ namespace android {
*/
status_t BatteryProperty::readFromParcel(Parcel* p) {
valueInt = p->readInt32();
valueInt64 = p->readInt64();
return OK;
}
status_t BatteryProperty::writeToParcel(Parcel* p) const {
p->writeInt32(valueInt);
p->writeInt64(valueInt64);
return OK;
}