diff options
| author | 2016-03-29 18:03:35 +0000 | |
|---|---|---|
| committer | 2016-03-29 18:03:37 +0000 | |
| commit | 89d9480be2dbb33e97a6efdf45bc6790eff1e5d0 (patch) | |
| tree | f9bc2c31bc871350cdf02180d7ebfdf2d993ac85 | |
| parent | 160222a4390d7738b541ed3f5c116d22c1fda04b (diff) | |
| parent | 42e606250a13edc22cb9f14937a4d73c14cc41aa (diff) | |
Merge changes from topic 'wifi_tx_power_levels' into nyc-dev
* changes:
Add new wifi tx power levels in Wifi activity energy
Add new wifi tx power levels in link layer stats
3 files changed, 35 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java index ffa3b5b2e2e8..3d420471ea82 100644 --- a/services/core/java/com/android/server/am/BatteryStatsService.java +++ b/services/core/java/com/android/server/am/BatteryStatsService.java @@ -1224,7 +1224,8 @@ public final class BatteryStatsService extends IBatteryStats.Stub // WiFi keeps an accumulated total of stats, unlike Bluetooth. // Keep the last WiFi stats so we can compute a delta. @GuardedBy("mExternalStatsLock") - private WifiActivityEnergyInfo mLastInfo = new WifiActivityEnergyInfo(0, 0, 0, 0, 0, 0); + private WifiActivityEnergyInfo mLastInfo = + new WifiActivityEnergyInfo(0, 0, 0, new long[]{0}, 0, 0, 0); @GuardedBy("mExternalStatsLock") private WifiActivityEnergyInfo pullWifiEnergyInfoLocked() { diff --git a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java index 035317ea402b..4c38c9bbe2cd 100644 --- a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java +++ b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java @@ -19,6 +19,8 @@ package android.net.wifi; import android.os.Parcel; import android.os.Parcelable; +import java.util.Arrays; + /** * Record of energy and activity information from controller and * underlying wifi stack state. Timestamp the record with elapsed @@ -44,6 +46,11 @@ public final class WifiActivityEnergyInfo implements Parcelable { /** * @hide */ + public long[] mControllerTxTimePerLevelMs; + + /** + * @hide + */ public long mControllerRxTimeMs; /** @@ -62,10 +69,12 @@ public final class WifiActivityEnergyInfo implements Parcelable { public static final int STACK_STATE_STATE_IDLE = 3; public WifiActivityEnergyInfo(long timestamp, int stackState, - long txTime, long rxTime, long idleTime, long energyUsed) { + long txTime, long[] txTimePerLevel, long rxTime, long idleTime, + long energyUsed) { mTimestamp = timestamp; mStackState = stackState; mControllerTxTimeMs = txTime; + mControllerTxTimePerLevelMs = txTimePerLevel; mControllerRxTimeMs = rxTime; mControllerIdleTimeMs = idleTime; mControllerEnergyUsed = energyUsed; @@ -77,6 +86,7 @@ public final class WifiActivityEnergyInfo implements Parcelable { + " timestamp=" + mTimestamp + " mStackState=" + mStackState + " mControllerTxTimeMs=" + mControllerTxTimeMs + + " mControllerTxTimePerLevelMs=" + Arrays.toString(mControllerTxTimePerLevelMs) + " mControllerRxTimeMs=" + mControllerRxTimeMs + " mControllerIdleTimeMs=" + mControllerIdleTimeMs + " mControllerEnergyUsed=" + mControllerEnergyUsed @@ -89,11 +99,12 @@ public final class WifiActivityEnergyInfo implements Parcelable { long timestamp = in.readLong(); int stackState = in.readInt(); long txTime = in.readLong(); + long[] txTimePerLevel = in.createLongArray(); long rxTime = in.readLong(); long idleTime = in.readLong(); long energyUsed = in.readLong(); return new WifiActivityEnergyInfo(timestamp, stackState, - txTime, rxTime, idleTime, energyUsed); + txTime, txTimePerLevel, rxTime, idleTime, energyUsed); } public WifiActivityEnergyInfo[] newArray(int size) { return new WifiActivityEnergyInfo[size]; @@ -104,6 +115,7 @@ public final class WifiActivityEnergyInfo implements Parcelable { out.writeLong(mTimestamp); out.writeInt(mStackState); out.writeLong(mControllerTxTimeMs); + out.writeLongArray(mControllerTxTimePerLevelMs); out.writeLong(mControllerRxTimeMs); out.writeLong(mControllerIdleTimeMs); out.writeLong(mControllerEnergyUsed); @@ -128,6 +140,16 @@ public final class WifiActivityEnergyInfo implements Parcelable { } /** + * @return tx time at power level provided in ms + */ + public long getControllerTxTimeMillisAtLevel(int level) { + if (level < mControllerTxTimePerLevelMs.length) { + return mControllerTxTimePerLevelMs[level]; + } + return 0; + } + + /** * @return rx time in ms */ public long getControllerRxTimeMillis() { diff --git a/wifi/java/android/net/wifi/WifiLinkLayerStats.java b/wifi/java/android/net/wifi/WifiLinkLayerStats.java index 1de4fd834fcd..edd400b56238 100644 --- a/wifi/java/android/net/wifi/WifiLinkLayerStats.java +++ b/wifi/java/android/net/wifi/WifiLinkLayerStats.java @@ -19,6 +19,8 @@ package android.net.wifi; import android.os.Parcelable; import android.os.Parcel; +import java.util.Arrays; + /** * A class representing link layer statistics collected over a Wifi Interface. */ @@ -101,6 +103,8 @@ public class WifiLinkLayerStats implements Parcelable { /** {@hide} */ public int tx_time; /** {@hide} */ + public int[] tx_time_per_level; + /** {@hide} */ public int rx_time; /** {@hide} */ public int on_time_scan; @@ -141,9 +145,10 @@ public class WifiLinkLayerStats implements Parcelable { .append(" lost=").append(Long.toString(this.lostmpdu_vo)) .append(" retries=").append(Long.toString(this.retries_vo)).append('\n'); sbuf.append(" on_time : ").append(Integer.toString(this.on_time)) - .append(" tx_time=").append(Integer.toString(this.tx_time)) .append(" rx_time=").append(Integer.toString(this.rx_time)) - .append(" scan_time=").append(Integer.toString(this.on_time_scan)).append('\n'); + .append(" scan_time=").append(Integer.toString(this.on_time_scan)).append('\n') + .append(" tx_time=").append(Integer.toString(this.tx_time)) + .append(" tx_time_per_level=" + Arrays.toString(tx_time_per_level)); return sbuf.toString(); } @@ -179,6 +184,7 @@ public class WifiLinkLayerStats implements Parcelable { dest.writeString(BSSID); dest.writeInt(on_time); dest.writeInt(tx_time); + dest.writeIntArray(tx_time_per_level); dest.writeInt(rx_time); dest.writeInt(on_time_scan); } @@ -192,6 +198,7 @@ public class WifiLinkLayerStats implements Parcelable { stats.BSSID = in.readString(); stats.on_time = in.readInt(); stats.tx_time = in.readInt(); + stats.tx_time_per_level = in.createIntArray(); stats.rx_time = in.readInt(); stats.on_time_scan = in.readInt(); return stats; |