1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.net.wifi; 18 19 import android.annotation.NonNull; 20 import android.annotation.SystemApi; 21 import android.os.Parcel; 22 import android.os.Parcelable; 23 24 /** 25 * Connection Statistics For a WiFi Network. 26 * @hide 27 * @deprecated This is no longer supported. 28 */ 29 @Deprecated 30 @SystemApi 31 public class WifiNetworkConnectionStatistics implements Parcelable { 32 private static final String TAG = "WifiNetworkConnnectionStatistics"; 33 34 public int numConnection; 35 public int numUsage; 36 WifiNetworkConnectionStatistics(int connection, int usage)37 public WifiNetworkConnectionStatistics(int connection, int usage) { 38 numConnection = connection; 39 numUsage = usage; 40 } 41 WifiNetworkConnectionStatistics()42 public WifiNetworkConnectionStatistics() { } 43 44 @NonNull 45 @Override toString()46 public String toString() { 47 StringBuilder sbuf = new StringBuilder(); 48 sbuf.append("c=").append(numConnection); 49 sbuf.append(" u=").append(numUsage); 50 return sbuf.toString(); 51 } 52 53 54 /** copy constructor*/ WifiNetworkConnectionStatistics(WifiNetworkConnectionStatistics source)55 public WifiNetworkConnectionStatistics(WifiNetworkConnectionStatistics source) { 56 numConnection = source.numConnection; 57 numUsage = source.numUsage; 58 } 59 60 /** Implement the Parcelable interface */ describeContents()61 public int describeContents() { 62 return 0; 63 } 64 65 /** Implement the Parcelable interface */ 66 @Override writeToParcel(Parcel dest, int flags)67 public void writeToParcel(Parcel dest, int flags) { 68 dest.writeInt(numConnection); 69 dest.writeInt(numUsage); 70 } 71 72 /** Implement the Parcelable interface */ 73 public static final @android.annotation.NonNull Creator<WifiNetworkConnectionStatistics> CREATOR = 74 new Creator<WifiNetworkConnectionStatistics>() { 75 public WifiNetworkConnectionStatistics createFromParcel(Parcel in) { 76 int numConnection = in.readInt(); 77 int numUsage = in.readInt(); 78 WifiNetworkConnectionStatistics stats = 79 new WifiNetworkConnectionStatistics(numConnection, numUsage); 80 return stats; 81 } 82 83 public WifiNetworkConnectionStatistics[] newArray(int size) { 84 return new WifiNetworkConnectionStatistics[size]; 85 } 86 }; 87 } 88