| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.net.metrics; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.annotation.Nullable; |
| 21 |
import android.annotation.SystemApi; |
| 22 |
import android.compat.annotation.UnsupportedAppUsage; |
| 23 |
import android.os.Build; |
| 24 |
import android.os.Parcel; |
| 25 |
import android.os.Parcelable; |
| 26 |
import android.text.TextUtils; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
@Deprecated |
| 36 |
@SystemApi |
| 37 |
public final class DhcpClientEvent implements IpConnectivityLog.Event { |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
public final String msg; |
| 43 |
|
| 44 |
public final int durationMs; |
| 45 |
|
| 46 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
| 47 |
private DhcpClientEvent(String msg, int durationMs) { |
| 48 |
this.msg = msg; |
| 49 |
this.durationMs = durationMs; |
| 50 |
} |
| 51 |
|
| 52 |
private DhcpClientEvent(Parcel in) { |
| 53 |
this.msg = in.readString(); |
| 54 |
this.durationMs = in.readInt(); |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
public static final class Builder { |
| 61 |
private String mMsg; |
| 62 |
private int mDurationMs; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
@NonNull |
| 68 |
public Builder setMsg(String msg) { |
| 69 |
mMsg = msg; |
| 70 |
return this; |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
@NonNull |
| 77 |
public Builder setDurationMs(int durationMs) { |
| 78 |
mDurationMs = durationMs; |
| 79 |
return this; |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
@NonNull |
| 86 |
public DhcpClientEvent build() { |
| 87 |
return new DhcpClientEvent(mMsg, mDurationMs); |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
|
| 92 |
@Override |
| 93 |
public void writeToParcel(Parcel out, int flags) { |
| 94 |
out.writeString(msg); |
| 95 |
out.writeInt(durationMs); |
| 96 |
} |
| 97 |
|
| 98 |
|
| 99 |
@Override |
| 100 |
public int describeContents() { |
| 101 |
return 0; |
| 102 |
} |
| 103 |
|
| 104 |
@NonNull |
| 105 |
@Override |
| 106 |
public String toString() { |
| 107 |
return String.format("DhcpClientEvent(%s, %dms)", msg, durationMs); |
| 108 |
} |
| 109 |
|
| 110 |
@Override |
| 111 |
public boolean equals(@Nullable Object obj) { |
| 112 |
if (obj == null || !(obj.getClass().equals(DhcpClientEvent.class))) return false; |
| 113 |
final DhcpClientEvent other = (DhcpClientEvent) obj; |
| 114 |
return TextUtils.equals(msg, other.msg) |
| 115 |
&& durationMs == other.durationMs; |
| 116 |
} |
| 117 |
|
| 118 |
|
| 119 |
public static final @android.annotation.NonNull Parcelable.Creator<DhcpClientEvent> CREATOR |
| 120 |
= new Parcelable.Creator<DhcpClientEvent>() { |
| 121 |
public DhcpClientEvent createFromParcel(Parcel in) { |
| 122 |
return new DhcpClientEvent(in); |
| 123 |
} |
| 124 |
|
| 125 |
public DhcpClientEvent[] newArray(int size) { |
| 126 |
return new DhcpClientEvent[size]; |
| 127 |
} |
| 128 |
}; |
| 129 |
} |