Loading core/java/android/bluetooth/BluetoothActivityEnergyInfo.java +20 −20 Original line number Diff line number Diff line Loading @@ -28,10 +28,10 @@ import android.os.Parcelable; public final class BluetoothActivityEnergyInfo implements Parcelable { private final long mTimestamp; private final int mBluetoothStackState; private final int mControllerTxTimeMs; private final int mControllerRxTimeMs; private final int mControllerIdleTimeMs; private final int mControllerEnergyUsed; private final long mControllerTxTimeMs; private final long mControllerRxTimeMs; private final long mControllerIdleTimeMs; private final long mControllerEnergyUsed; public static final int BT_STACK_STATE_INVALID = 0; public static final int BT_STACK_STATE_STATE_ACTIVE = 1; Loading @@ -39,7 +39,7 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { public static final int BT_STACK_STATE_STATE_IDLE = 3; public BluetoothActivityEnergyInfo(long timestamp, int stackState, int txTime, int rxTime, int idleTime, int energyUsed) { long txTime, long rxTime, long idleTime, long energyUsed) { mTimestamp = timestamp; mBluetoothStackState = stackState; mControllerTxTimeMs = txTime; Loading @@ -65,10 +65,10 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { public BluetoothActivityEnergyInfo createFromParcel(Parcel in) { long timestamp = in.readLong(); int stackState = in.readInt(); int txTime = in.readInt(); int rxTime = in.readInt(); int idleTime = in.readInt(); int energyUsed = in.readInt(); long txTime = in.readLong(); long rxTime = in.readLong(); long idleTime = in.readLong(); long energyUsed = in.readLong(); return new BluetoothActivityEnergyInfo(timestamp, stackState, txTime, rxTime, idleTime, energyUsed); } Loading @@ -80,10 +80,10 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeLong(mTimestamp); out.writeInt(mBluetoothStackState); out.writeInt(mControllerTxTimeMs); out.writeInt(mControllerRxTimeMs); out.writeInt(mControllerIdleTimeMs); out.writeInt(mControllerEnergyUsed); out.writeLong(mControllerTxTimeMs); out.writeLong(mControllerRxTimeMs); out.writeLong(mControllerIdleTimeMs); out.writeLong(mControllerEnergyUsed); } public int describeContents() { Loading @@ -100,21 +100,21 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { /** * @return tx time in ms */ public int getControllerTxTimeMillis() { public long getControllerTxTimeMillis() { return mControllerTxTimeMs; } /** * @return rx time in ms */ public int getControllerRxTimeMillis() { public long getControllerRxTimeMillis() { return mControllerRxTimeMs; } /** * @return idle time in ms */ public int getControllerIdleTimeMillis() { public long getControllerIdleTimeMillis() { return mControllerIdleTimeMs; } Loading @@ -122,7 +122,7 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { * product of current(mA), voltage(V) and time(ms) * @return energy used */ public int getControllerEnergyUsed() { public long getControllerEnergyUsed() { return mControllerEnergyUsed; } Loading @@ -137,8 +137,8 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { * @return if the record is valid */ public boolean isValid() { return ((getControllerTxTimeMillis() !=0) || (getControllerRxTimeMillis() !=0) || (getControllerIdleTimeMillis() !=0)); return ((mControllerTxTimeMs !=0) || (mControllerRxTimeMs !=0) || (mControllerIdleTimeMs !=0)); } } services/core/java/com/android/server/am/BatteryStatsService.java +4 −0 Original line number Diff line number Diff line Loading @@ -1167,6 +1167,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub BluetoothActivityEnergyInfo info = adapter.getControllerActivityEnergyInfo( BluetoothAdapter.ACTIVITY_ENERGY_INFO_REFRESHED); if (info != null && info.isValid()) { if (info.getControllerEnergyUsed() < 0 || info.getControllerIdleTimeMillis() < 0 || info.getControllerRxTimeMillis() < 0 || info.getControllerTxTimeMillis() < 0) { Slog.wtf(TAG, "Bluetooth energy data is invalid: " + info); } return info; } } Loading wifi/java/android/net/wifi/WifiActivityEnergyInfo.java +23 −24 Original line number Diff line number Diff line Loading @@ -39,22 +39,22 @@ public final class WifiActivityEnergyInfo implements Parcelable { /** * @hide */ public int mControllerTxTimeMs; public long mControllerTxTimeMs; /** * @hide */ public int mControllerRxTimeMs; public long mControllerRxTimeMs; /** * @hide */ public int mControllerIdleTimeMs; public long mControllerIdleTimeMs; /** * @hide */ public int mControllerEnergyUsed; public long mControllerEnergyUsed; public static final int STACK_STATE_INVALID = 0; public static final int STACK_STATE_STATE_ACTIVE = 1; Loading @@ -62,7 +62,7 @@ public final class WifiActivityEnergyInfo implements Parcelable { public static final int STACK_STATE_STATE_IDLE = 3; public WifiActivityEnergyInfo(long timestamp, int stackState, int txTime, int rxTime, int idleTime, int energyUsed) { long txTime, long rxTime, long idleTime, long energyUsed) { mTimestamp = timestamp; mStackState = stackState; mControllerTxTimeMs = txTime; Loading @@ -88,10 +88,10 @@ public final class WifiActivityEnergyInfo implements Parcelable { public WifiActivityEnergyInfo createFromParcel(Parcel in) { long timestamp = in.readLong(); int stackState = in.readInt(); int txTime = in.readInt(); int rxTime = in.readInt(); int idleTime = in.readInt(); int energyUsed = in.readInt(); long txTime = in.readLong(); long rxTime = in.readLong(); long idleTime = in.readLong(); long energyUsed = in.readLong(); return new WifiActivityEnergyInfo(timestamp, stackState, txTime, rxTime, idleTime, energyUsed); } Loading @@ -103,10 +103,10 @@ public final class WifiActivityEnergyInfo implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeLong(mTimestamp); out.writeInt(mStackState); out.writeInt(mControllerTxTimeMs); out.writeInt(mControllerRxTimeMs); out.writeInt(mControllerIdleTimeMs); out.writeInt(mControllerEnergyUsed); out.writeLong(mControllerTxTimeMs); out.writeLong(mControllerRxTimeMs); out.writeLong(mControllerIdleTimeMs); out.writeLong(mControllerEnergyUsed); } public int describeContents() { Loading @@ -123,30 +123,29 @@ public final class WifiActivityEnergyInfo implements Parcelable { /** * @return tx time in ms */ public int getControllerTxTimeMillis() { return (int)mControllerTxTimeMs; public long getControllerTxTimeMillis() { return mControllerTxTimeMs; } /** * @return rx time in ms */ public int getControllerRxTimeMillis() { return (int)mControllerRxTimeMs; public long getControllerRxTimeMillis() { return mControllerRxTimeMs; } /** * @return idle time in ms */ public int getControllerIdleTimeMillis() { return (int)mControllerIdleTimeMs; public long getControllerIdleTimeMillis() { return mControllerIdleTimeMs; } /** * product of current(mA), voltage(V) and time(ms) * @return energy used */ public int getControllerEnergyUsed() { public long getControllerEnergyUsed() { return mControllerEnergyUsed; } /** Loading @@ -160,8 +159,8 @@ public final class WifiActivityEnergyInfo implements Parcelable { * @return if the record is valid */ public boolean isValid() { return ((getControllerTxTimeMillis() !=0) || (getControllerRxTimeMillis() !=0) || (getControllerIdleTimeMillis() !=0)); return ((mControllerTxTimeMs !=0) || (mControllerRxTimeMs !=0) || (mControllerIdleTimeMs !=0)); } } Loading
core/java/android/bluetooth/BluetoothActivityEnergyInfo.java +20 −20 Original line number Diff line number Diff line Loading @@ -28,10 +28,10 @@ import android.os.Parcelable; public final class BluetoothActivityEnergyInfo implements Parcelable { private final long mTimestamp; private final int mBluetoothStackState; private final int mControllerTxTimeMs; private final int mControllerRxTimeMs; private final int mControllerIdleTimeMs; private final int mControllerEnergyUsed; private final long mControllerTxTimeMs; private final long mControllerRxTimeMs; private final long mControllerIdleTimeMs; private final long mControllerEnergyUsed; public static final int BT_STACK_STATE_INVALID = 0; public static final int BT_STACK_STATE_STATE_ACTIVE = 1; Loading @@ -39,7 +39,7 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { public static final int BT_STACK_STATE_STATE_IDLE = 3; public BluetoothActivityEnergyInfo(long timestamp, int stackState, int txTime, int rxTime, int idleTime, int energyUsed) { long txTime, long rxTime, long idleTime, long energyUsed) { mTimestamp = timestamp; mBluetoothStackState = stackState; mControllerTxTimeMs = txTime; Loading @@ -65,10 +65,10 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { public BluetoothActivityEnergyInfo createFromParcel(Parcel in) { long timestamp = in.readLong(); int stackState = in.readInt(); int txTime = in.readInt(); int rxTime = in.readInt(); int idleTime = in.readInt(); int energyUsed = in.readInt(); long txTime = in.readLong(); long rxTime = in.readLong(); long idleTime = in.readLong(); long energyUsed = in.readLong(); return new BluetoothActivityEnergyInfo(timestamp, stackState, txTime, rxTime, idleTime, energyUsed); } Loading @@ -80,10 +80,10 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeLong(mTimestamp); out.writeInt(mBluetoothStackState); out.writeInt(mControllerTxTimeMs); out.writeInt(mControllerRxTimeMs); out.writeInt(mControllerIdleTimeMs); out.writeInt(mControllerEnergyUsed); out.writeLong(mControllerTxTimeMs); out.writeLong(mControllerRxTimeMs); out.writeLong(mControllerIdleTimeMs); out.writeLong(mControllerEnergyUsed); } public int describeContents() { Loading @@ -100,21 +100,21 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { /** * @return tx time in ms */ public int getControllerTxTimeMillis() { public long getControllerTxTimeMillis() { return mControllerTxTimeMs; } /** * @return rx time in ms */ public int getControllerRxTimeMillis() { public long getControllerRxTimeMillis() { return mControllerRxTimeMs; } /** * @return idle time in ms */ public int getControllerIdleTimeMillis() { public long getControllerIdleTimeMillis() { return mControllerIdleTimeMs; } Loading @@ -122,7 +122,7 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { * product of current(mA), voltage(V) and time(ms) * @return energy used */ public int getControllerEnergyUsed() { public long getControllerEnergyUsed() { return mControllerEnergyUsed; } Loading @@ -137,8 +137,8 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { * @return if the record is valid */ public boolean isValid() { return ((getControllerTxTimeMillis() !=0) || (getControllerRxTimeMillis() !=0) || (getControllerIdleTimeMillis() !=0)); return ((mControllerTxTimeMs !=0) || (mControllerRxTimeMs !=0) || (mControllerIdleTimeMs !=0)); } }
services/core/java/com/android/server/am/BatteryStatsService.java +4 −0 Original line number Diff line number Diff line Loading @@ -1167,6 +1167,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub BluetoothActivityEnergyInfo info = adapter.getControllerActivityEnergyInfo( BluetoothAdapter.ACTIVITY_ENERGY_INFO_REFRESHED); if (info != null && info.isValid()) { if (info.getControllerEnergyUsed() < 0 || info.getControllerIdleTimeMillis() < 0 || info.getControllerRxTimeMillis() < 0 || info.getControllerTxTimeMillis() < 0) { Slog.wtf(TAG, "Bluetooth energy data is invalid: " + info); } return info; } } Loading
wifi/java/android/net/wifi/WifiActivityEnergyInfo.java +23 −24 Original line number Diff line number Diff line Loading @@ -39,22 +39,22 @@ public final class WifiActivityEnergyInfo implements Parcelable { /** * @hide */ public int mControllerTxTimeMs; public long mControllerTxTimeMs; /** * @hide */ public int mControllerRxTimeMs; public long mControllerRxTimeMs; /** * @hide */ public int mControllerIdleTimeMs; public long mControllerIdleTimeMs; /** * @hide */ public int mControllerEnergyUsed; public long mControllerEnergyUsed; public static final int STACK_STATE_INVALID = 0; public static final int STACK_STATE_STATE_ACTIVE = 1; Loading @@ -62,7 +62,7 @@ public final class WifiActivityEnergyInfo implements Parcelable { public static final int STACK_STATE_STATE_IDLE = 3; public WifiActivityEnergyInfo(long timestamp, int stackState, int txTime, int rxTime, int idleTime, int energyUsed) { long txTime, long rxTime, long idleTime, long energyUsed) { mTimestamp = timestamp; mStackState = stackState; mControllerTxTimeMs = txTime; Loading @@ -88,10 +88,10 @@ public final class WifiActivityEnergyInfo implements Parcelable { public WifiActivityEnergyInfo createFromParcel(Parcel in) { long timestamp = in.readLong(); int stackState = in.readInt(); int txTime = in.readInt(); int rxTime = in.readInt(); int idleTime = in.readInt(); int energyUsed = in.readInt(); long txTime = in.readLong(); long rxTime = in.readLong(); long idleTime = in.readLong(); long energyUsed = in.readLong(); return new WifiActivityEnergyInfo(timestamp, stackState, txTime, rxTime, idleTime, energyUsed); } Loading @@ -103,10 +103,10 @@ public final class WifiActivityEnergyInfo implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeLong(mTimestamp); out.writeInt(mStackState); out.writeInt(mControllerTxTimeMs); out.writeInt(mControllerRxTimeMs); out.writeInt(mControllerIdleTimeMs); out.writeInt(mControllerEnergyUsed); out.writeLong(mControllerTxTimeMs); out.writeLong(mControllerRxTimeMs); out.writeLong(mControllerIdleTimeMs); out.writeLong(mControllerEnergyUsed); } public int describeContents() { Loading @@ -123,30 +123,29 @@ public final class WifiActivityEnergyInfo implements Parcelable { /** * @return tx time in ms */ public int getControllerTxTimeMillis() { return (int)mControllerTxTimeMs; public long getControllerTxTimeMillis() { return mControllerTxTimeMs; } /** * @return rx time in ms */ public int getControllerRxTimeMillis() { return (int)mControllerRxTimeMs; public long getControllerRxTimeMillis() { return mControllerRxTimeMs; } /** * @return idle time in ms */ public int getControllerIdleTimeMillis() { return (int)mControllerIdleTimeMs; public long getControllerIdleTimeMillis() { return mControllerIdleTimeMs; } /** * product of current(mA), voltage(V) and time(ms) * @return energy used */ public int getControllerEnergyUsed() { public long getControllerEnergyUsed() { return mControllerEnergyUsed; } /** Loading @@ -160,8 +159,8 @@ public final class WifiActivityEnergyInfo implements Parcelable { * @return if the record is valid */ public boolean isValid() { return ((getControllerTxTimeMillis() !=0) || (getControllerRxTimeMillis() !=0) || (getControllerIdleTimeMillis() !=0)); return ((mControllerTxTimeMs !=0) || (mControllerRxTimeMs !=0) || (mControllerIdleTimeMs !=0)); } }