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
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
@@ -41,6 +43,11 @@ public final class WifiActivityEnergyInfo implements Parcelable {
|
||||
*/
|
||||
public long mControllerTxTimeMs;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public long[] mControllerTxTimePerLevelMs;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@@ -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);
|
||||
@@ -127,6 +139,16 @@ public final class WifiActivityEnergyInfo implements Parcelable {
|
||||
return mControllerTxTimeMs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user