Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -19578,6 +19578,7 @@ package android.os { public class BatteryProperty implements android.os.Parcelable { method public int describeContents(); method public int getInt(); method public long getLong(); method public void readFromParcel(android.os.Parcel); method public void writeToParcel(android.os.Parcel, int); field public static final int CAPACITY = 4; // 0x4 Loading @@ -19585,6 +19586,7 @@ package android.os { field public static final android.os.Parcelable.Creator CREATOR; field public static final int CURRENT_AVERAGE = 3; // 0x3 field public static final int CURRENT_NOW = 2; // 0x2 field public static final int ENERGY_COUNTER = 4; // 0x4 } public class Binder implements android.os.IBinder { core/java/android/os/BatteryManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -146,9 +146,9 @@ public class BatteryManager { return null; } BatteryProperty prop = new BatteryProperty(Integer.MIN_VALUE); BatteryProperty prop = new BatteryProperty(); if ((mBatteryPropertiesRegistrar.getProperty(id, prop) == 0) && (prop.getInt() != Integer.MIN_VALUE)) (prop.getLong() != Long.MIN_VALUE)) return prop; else return null; Loading core/java/android/os/BatteryProperty.java +20 −10 Original line number Diff line number Diff line Loading @@ -53,20 +53,18 @@ public class BatteryProperty implements Parcelable { */ public static final int CAPACITY = 4; private int mValueInt; /** * @hide * Battery remaining energy in nanowatt-hours, as a long integer. */ public BatteryProperty(int value) { mValueInt = value; } public static final int ENERGY_COUNTER = 4; private long mValueLong; /** * @hide */ public BatteryProperty() { mValueInt = Integer.MIN_VALUE; mValueLong = Long.MIN_VALUE; } /** Loading @@ -79,9 +77,21 @@ public class BatteryProperty implements Parcelable { * @return The queried property value, or Integer.MIN_VALUE if not supported. */ public int getInt() { return mValueInt; return (int)mValueLong; } /** * Return the value of a property of long type previously queried * via {@link BatteryManager#getProperty * BatteryManager.getProperty()}. If the platform does * not provide the property queried, this value will be * Long.MIN_VALUE. * * @return The queried property value, or Long.MIN_VALUE if not supported. */ public long getLong() { return mValueLong; } /* * Parcel read/write code must be kept in sync with * frameworks/native/services/batteryservice/BatteryProperty.cpp Loading @@ -92,11 +102,11 @@ public class BatteryProperty implements Parcelable { } public void readFromParcel(Parcel p) { mValueInt = p.readInt(); mValueLong = p.readLong(); } public void writeToParcel(Parcel p, int flags) { p.writeInt(mValueInt); p.writeLong(mValueLong); } public static final Parcelable.Creator<BatteryProperty> CREATOR Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -19578,6 +19578,7 @@ package android.os { public class BatteryProperty implements android.os.Parcelable { method public int describeContents(); method public int getInt(); method public long getLong(); method public void readFromParcel(android.os.Parcel); method public void writeToParcel(android.os.Parcel, int); field public static final int CAPACITY = 4; // 0x4 Loading @@ -19585,6 +19586,7 @@ package android.os { field public static final android.os.Parcelable.Creator CREATOR; field public static final int CURRENT_AVERAGE = 3; // 0x3 field public static final int CURRENT_NOW = 2; // 0x2 field public static final int ENERGY_COUNTER = 4; // 0x4 } public class Binder implements android.os.IBinder {
core/java/android/os/BatteryManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -146,9 +146,9 @@ public class BatteryManager { return null; } BatteryProperty prop = new BatteryProperty(Integer.MIN_VALUE); BatteryProperty prop = new BatteryProperty(); if ((mBatteryPropertiesRegistrar.getProperty(id, prop) == 0) && (prop.getInt() != Integer.MIN_VALUE)) (prop.getLong() != Long.MIN_VALUE)) return prop; else return null; Loading
core/java/android/os/BatteryProperty.java +20 −10 Original line number Diff line number Diff line Loading @@ -53,20 +53,18 @@ public class BatteryProperty implements Parcelable { */ public static final int CAPACITY = 4; private int mValueInt; /** * @hide * Battery remaining energy in nanowatt-hours, as a long integer. */ public BatteryProperty(int value) { mValueInt = value; } public static final int ENERGY_COUNTER = 4; private long mValueLong; /** * @hide */ public BatteryProperty() { mValueInt = Integer.MIN_VALUE; mValueLong = Long.MIN_VALUE; } /** Loading @@ -79,9 +77,21 @@ public class BatteryProperty implements Parcelable { * @return The queried property value, or Integer.MIN_VALUE if not supported. */ public int getInt() { return mValueInt; return (int)mValueLong; } /** * Return the value of a property of long type previously queried * via {@link BatteryManager#getProperty * BatteryManager.getProperty()}. If the platform does * not provide the property queried, this value will be * Long.MIN_VALUE. * * @return The queried property value, or Long.MIN_VALUE if not supported. */ public long getLong() { return mValueLong; } /* * Parcel read/write code must be kept in sync with * frameworks/native/services/batteryservice/BatteryProperty.cpp Loading @@ -92,11 +102,11 @@ public class BatteryProperty implements Parcelable { } public void readFromParcel(Parcel p) { mValueInt = p.readInt(); mValueLong = p.readLong(); } public void writeToParcel(Parcel p, int flags) { p.writeInt(mValueInt); p.writeLong(mValueLong); } public static final Parcelable.Creator<BatteryProperty> CREATOR Loading