summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2015-03-09 15:23:42 -0700
committerAdam Lesinski <adamlesinski@google.com>2015-03-09 15:28:29 -0700
commit488caeb70293b7c70e9ce128fc002a0666340fb0 (patch)
treec2cb1ddd1a06dcc7a05a6ee6a0cbfa3392fe995f /wifi
parent0a75d4e96cb5f2d3c27d5e4e36376e349cae2161 (diff)
downloadframeworks_base-488caeb70293b7c70e9ce128fc002a0666340fb0.zip
frameworks_base-488caeb70293b7c70e9ce128fc002a0666340fb0.tar.gz
frameworks_base-488caeb70293b7c70e9ce128fc002a0666340fb0.tar.bz2
Change WiFi and Bluetooth ActivityEnergyInfo classes
Have them take an elapsed time millis timestamp instead of having the constructor call System.currentTimeMillis. Change-Id: Ic9ca8f92347c336beee8ebcc3407de2c1e5b4073
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiActivityEnergyInfo.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
index 533b8bc..6263463 100644
--- a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
+++ b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
@@ -21,37 +21,37 @@ import android.os.Parcelable;
/**
* Record of energy and activity information from controller and
- * underlying wifi stack state.Timestamp the record with system
- * time
+ * underlying wifi stack state. Timestamp the record with elapsed
+ * real-time.
* @hide
*/
public final class WifiActivityEnergyInfo implements Parcelable {
+ private final long mTimestamp;
private final int mStackState;
private final int mControllerTxTimeMs;
private final int mControllerRxTimeMs;
private final int mControllerIdleTimeMs;
private final int mControllerEnergyUsed;
- private final long timestamp;
public static final int STACK_STATE_INVALID = 0;
public static final int STACK_STATE_STATE_ACTIVE = 1;
public static final int STACK_STATE_STATE_SCANNING = 2;
public static final int STACK_STATE_STATE_IDLE = 3;
- public WifiActivityEnergyInfo(int stackState, int txTime, int rxTime,
- int idleTime, int energyUsed) {
+ public WifiActivityEnergyInfo(long timestamp, int stackState,
+ int txTime, int rxTime, int idleTime, int energyUsed) {
+ mTimestamp = timestamp;
mStackState = stackState;
mControllerTxTimeMs = txTime;
mControllerRxTimeMs = rxTime;
mControllerIdleTimeMs = idleTime;
mControllerEnergyUsed = energyUsed;
- timestamp = System.currentTimeMillis();
}
@Override
public String toString() {
return "WifiActivityEnergyInfo{"
- + " timestamp=" + timestamp
+ + " timestamp=" + mTimestamp
+ " mStackState=" + mStackState
+ " mControllerTxTimeMs=" + mControllerTxTimeMs
+ " mControllerRxTimeMs=" + mControllerRxTimeMs
@@ -63,13 +63,14 @@ public final class WifiActivityEnergyInfo implements Parcelable {
public static final Parcelable.Creator<WifiActivityEnergyInfo> CREATOR =
new Parcelable.Creator<WifiActivityEnergyInfo>() {
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();
- return new WifiActivityEnergyInfo(stackState, txTime, rxTime,
- idleTime, energyUsed);
+ return new WifiActivityEnergyInfo(timestamp, stackState,
+ txTime, rxTime, idleTime, energyUsed);
}
public WifiActivityEnergyInfo[] newArray(int size) {
return new WifiActivityEnergyInfo[size];
@@ -77,6 +78,7 @@ 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);
@@ -127,7 +129,7 @@ public final class WifiActivityEnergyInfo implements Parcelable {
* @return timestamp(wall clock) of record creation
*/
public long getTimeStamp() {
- return timestamp;
+ return mTimestamp;
}
/**