diff options
author | vandwalle <vandwalle@google.com> | 2014-07-25 17:10:56 -0700 |
---|---|---|
committer | Pierre Vandwalle <vandwalle@google.com> | 2014-07-28 21:20:55 +0000 |
commit | 4eeecb25509f91ac7a6e2cde76dac782fbec5360 (patch) | |
tree | b7da7e0d7ba9c7dbc88499d871a2d7f2c312da44 /wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java | |
parent | 154b2cf6bbb99ee258b289846183172139a87dba (diff) | |
download | frameworks_base-4eeecb25509f91ac7a6e2cde76dac782fbec5360.zip frameworks_base-4eeecb25509f91ac7a6e2cde76dac782fbec5360.tar.gz frameworks_base-4eeecb25509f91ac7a6e2cde76dac782fbec5360.tar.bz2 |
introduce WifiConnectionstatistics
This CL is dependent on I10584a447fecd977df3eefd8e2cc028bd26ec0e3
Change-Id: I51fbbf062feb22c5f16b438675519064cc43e160
Diffstat (limited to 'wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java')
-rw-r--r-- | wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java b/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java new file mode 100644 index 0000000..c7d62e5 --- /dev/null +++ b/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.net.wifi; + +import android.annotation.SystemApi; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.HashMap; + +/** + * Connection Statistics For a WiFi Network. + * @hide + */ +@SystemApi +public class WifiNetworkConnectionStatistics implements Parcelable { + private static final String TAG = "WifiNetworkConnnectionStatistics"; + + public int numConnection; + public int numUsage; + + public WifiNetworkConnectionStatistics(int connection, int usage) { + numConnection = connection; + numUsage = usage; + } + + public WifiNetworkConnectionStatistics() { } + + + @Override + public String toString() { + StringBuilder sbuf = new StringBuilder(); + sbuf.append("c=").append(numConnection); + sbuf.append(" u=").append(numUsage); + return sbuf.toString(); + } + + + /** copy constructor*/ + public WifiNetworkConnectionStatistics(WifiNetworkConnectionStatistics source) { + numConnection = source.numConnection; + numUsage = source.numUsage; + } + + /** Implement the Parcelable interface */ + public int describeContents() { + return 0; + } + + /** Implement the Parcelable interface */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(numConnection); + dest.writeInt(numUsage); + } + + /** Implement the Parcelable interface */ + public static final Creator<WifiNetworkConnectionStatistics> CREATOR = + new Creator<WifiNetworkConnectionStatistics>() { + public WifiNetworkConnectionStatistics createFromParcel(Parcel in) { + int numConnection = in.readInt(); + int numUsage = in.readInt(); + WifiNetworkConnectionStatistics stats = + new WifiNetworkConnectionStatistics(numConnection, numUsage); + return stats; + } + + public WifiNetworkConnectionStatistics[] newArray(int size) { + return new WifiNetworkConnectionStatistics[size]; + } + }; +} |