WifiConnectionStatisticspublic class WifiConnectionStatistics extends Object implements android.os.ParcelableWifi Connection Statistics: gather various stats regarding WiFi connections,
connection requests, auto-join
and WiFi usage. |
Fields Summary |
---|
private static final String | TAG | public HashMap | untrustedNetworkHistoryhistory of past connection to untrusted SSID
Key = SSID
Value = num connection | public int | num5GhzConnected | public int | num24GhzConnected | public int | numAutoJoinAttempt | public int | numAutoRoamAttempt | public int | numWifiManagerJoinAttempt | public static final Creator | CREATORImplement the Parcelable interface |
Constructors Summary |
---|
public WifiConnectionStatistics()
untrustedNetworkHistory = new HashMap<String, WifiNetworkConnectionStatistics>();
| public WifiConnectionStatistics(WifiConnectionStatistics source)copy constructor
untrustedNetworkHistory = new HashMap<String, WifiNetworkConnectionStatistics>();
if (source != null) {
untrustedNetworkHistory.putAll(source.untrustedNetworkHistory);
}
|
Methods Summary |
---|
public int | describeContents()Implement the Parcelable interface
return 0;
| public void | incrementOrAddUntrusted(java.lang.String SSID, int connection, int usage)
WifiNetworkConnectionStatistics stats;
if (TextUtils.isEmpty(SSID))
return;
if (untrustedNetworkHistory.containsKey(SSID)) {
stats = untrustedNetworkHistory.get(SSID);
if (stats != null){
stats.numConnection = connection + stats.numConnection;
stats.numUsage = usage + stats.numUsage;
}
} else {
stats = new WifiNetworkConnectionStatistics(connection, usage);
}
if (stats != null) {
untrustedNetworkHistory.put(SSID, stats);
}
| public java.lang.String | toString()
StringBuilder sbuf = new StringBuilder();
sbuf.append("Connected on: 2.4Ghz=").append(num24GhzConnected);
sbuf.append(" 5Ghz=").append(num5GhzConnected).append("\n");
sbuf.append(" join=").append(numWifiManagerJoinAttempt);
sbuf.append("\\").append(numAutoJoinAttempt).append("\n");
sbuf.append(" roam=").append(numAutoRoamAttempt).append("\n");
for (String Key : untrustedNetworkHistory.keySet()) {
WifiNetworkConnectionStatistics stats = untrustedNetworkHistory.get(Key);
if (stats != null) {
sbuf.append(Key).append(" ").append(stats.toString()).append("\n");
}
}
return sbuf.toString();
| public void | writeToParcel(android.os.Parcel dest, int flags)Implement the Parcelable interface
dest.writeInt(num24GhzConnected);
dest.writeInt(num5GhzConnected);
dest.writeInt(numAutoJoinAttempt);
dest.writeInt(numAutoRoamAttempt);
dest.writeInt(numWifiManagerJoinAttempt);
dest.writeInt(untrustedNetworkHistory.size());
for (String Key : untrustedNetworkHistory.keySet()) {
WifiNetworkConnectionStatistics num = untrustedNetworkHistory.get(Key);
dest.writeString(Key);
dest.writeInt(num.numConnection);
dest.writeInt(num.numUsage);
}
|
|