FileDocCategorySizeDatePackage
WifiConnectionStatistics.javaAPI DocAndroid 5.1 API5640Thu Mar 12 22:22:44 GMT 2015android.net.wifi

WifiConnectionStatistics

public class WifiConnectionStatistics extends Object implements android.os.Parcelable
Wifi Connection Statistics: gather various stats regarding WiFi connections, connection requests, auto-join and WiFi usage.
hide

Fields Summary
private static final String
TAG
public HashMap
untrustedNetworkHistory
history 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
CREATOR
Implement 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 intdescribeContents()
Implement the Parcelable interface

        return 0;
    
public voidincrementOrAddUntrusted(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.StringtoString()

        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 voidwriteToParcel(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);

        }