| 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.os.Parcel; |
| 23 |
import android.os.Parcelable; |
| 24 |
import android.util.SparseArray; |
| 25 |
|
| 26 |
import com.android.internal.util.MessageUtils; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
@Deprecated |
| 37 |
@SystemApi |
| 38 |
public final class IpReachabilityEvent implements IpConnectivityLog.Event { |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
public static final int PROBE = 1 << 8; |
| 43 |
|
| 44 |
public static final int NUD_FAILED = 2 << 8; |
| 45 |
|
| 46 |
public static final int PROVISIONING_LOST = 3 << 8; |
| 47 |
|
| 48 |
public static final int NUD_FAILED_ORGANIC = 4 << 8; |
| 49 |
|
| 50 |
public static final int PROVISIONING_LOST_ORGANIC = 5 << 8; |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
public final int eventType; |
| 59 |
|
| 60 |
public IpReachabilityEvent(int eventType) { |
| 61 |
this.eventType = eventType; |
| 62 |
} |
| 63 |
|
| 64 |
private IpReachabilityEvent(Parcel in) { |
| 65 |
this.eventType = in.readInt(); |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
@Override |
| 70 |
public void writeToParcel(Parcel out, int flags) { |
| 71 |
out.writeInt(eventType); |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
@Override |
| 76 |
public int describeContents() { |
| 77 |
return 0; |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
public static final @android.annotation.NonNull Parcelable.Creator<IpReachabilityEvent> CREATOR |
| 82 |
= new Parcelable.Creator<IpReachabilityEvent>() { |
| 83 |
public IpReachabilityEvent createFromParcel(Parcel in) { |
| 84 |
return new IpReachabilityEvent(in); |
| 85 |
} |
| 86 |
|
| 87 |
public IpReachabilityEvent[] newArray(int size) { |
| 88 |
return new IpReachabilityEvent[size]; |
| 89 |
} |
| 90 |
}; |
| 91 |
|
| 92 |
@NonNull |
| 93 |
@Override |
| 94 |
public String toString() { |
| 95 |
int hi = eventType & 0xff00; |
| 96 |
int lo = eventType & 0x00ff; |
| 97 |
String eventName = Decoder.constants.get(hi); |
| 98 |
return String.format("IpReachabilityEvent(%s:%02x)", eventName, lo); |
| 99 |
} |
| 100 |
|
| 101 |
@Override |
| 102 |
public boolean equals(@Nullable Object obj) { |
| 103 |
if (obj == null || !(obj.getClass().equals(IpReachabilityEvent.class))) return false; |
| 104 |
final IpReachabilityEvent other = (IpReachabilityEvent) obj; |
| 105 |
return eventType == other.eventType; |
| 106 |
} |
| 107 |
|
| 108 |
final static class Decoder { |
| 109 |
static final SparseArray<String> constants = |
| 110 |
MessageUtils.findMessageNames(new Class[]{IpReachabilityEvent.class}, |
| 111 |
new String[]{"PROBE", "PROVISIONING_", "NUD_"}); |
| 112 |
} |
| 113 |
} |