| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.net; |
| 18 |
|
| 19 |
import android.os.Parcel; |
| 20 |
import android.os.Parcelable; |
| 21 |
|
| 22 |
import java.util.BitSet; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
public final class ConnectivityMetricsEvent implements Parcelable { |
| 30 |
|
| 31 |
|
| 32 |
public long timestamp; |
| 33 |
|
| 34 |
public long transports; |
| 35 |
|
| 36 |
public int netId; |
| 37 |
|
| 38 |
public String ifname; |
| 39 |
|
| 40 |
public Parcelable data; |
| 41 |
|
| 42 |
public ConnectivityMetricsEvent() { |
| 43 |
} |
| 44 |
|
| 45 |
private ConnectivityMetricsEvent(Parcel in) { |
| 46 |
timestamp = in.readLong(); |
| 47 |
transports = in.readLong(); |
| 48 |
netId = in.readInt(); |
| 49 |
ifname = in.readString(); |
| 50 |
data = in.readParcelable(null); |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
public static final @android.annotation.NonNull Parcelable.Creator<ConnectivityMetricsEvent> CREATOR |
| 55 |
= new Parcelable.Creator<ConnectivityMetricsEvent> (){ |
| 56 |
public ConnectivityMetricsEvent createFromParcel(Parcel source) { |
| 57 |
return new ConnectivityMetricsEvent(source); |
| 58 |
} |
| 59 |
|
| 60 |
public ConnectivityMetricsEvent[] newArray(int size) { |
| 61 |
return new ConnectivityMetricsEvent[size]; |
| 62 |
} |
| 63 |
}; |
| 64 |
|
| 65 |
@Override |
| 66 |
public int describeContents() { |
| 67 |
return 0; |
| 68 |
} |
| 69 |
|
| 70 |
@Override |
| 71 |
public void writeToParcel(Parcel dest, int flags) { |
| 72 |
dest.writeLong(timestamp); |
| 73 |
dest.writeLong(transports); |
| 74 |
dest.writeInt(netId); |
| 75 |
dest.writeString(ifname); |
| 76 |
dest.writeParcelable(data, 0); |
| 77 |
} |
| 78 |
|
| 79 |
@Override |
| 80 |
public String toString() { |
| 81 |
StringBuilder buffer = new StringBuilder("ConnectivityMetricsEvent("); |
| 82 |
buffer.append(String.format("%tT.%tL", timestamp, timestamp)); |
| 83 |
if (netId != 0) { |
| 84 |
buffer.append(", ").append("netId=").append(netId); |
| 85 |
} |
| 86 |
if (ifname != null) { |
| 87 |
buffer.append(", ").append(ifname); |
| 88 |
} |
| 89 |
buffer.append(", transports=").append(BitSet.valueOf(new long[] { transports })); |
| 90 |
buffer.append("): ").append(data.toString()); |
| 91 |
return buffer.toString(); |
| 92 |
} |
| 93 |
} |