| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app.admin; |
| 18 |
|
| 19 |
import android.content.pm.PackageManager; |
| 20 |
import android.os.Parcel; |
| 21 |
import android.os.ParcelFormatException; |
| 22 |
import android.os.Parcelable; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public abstract class NetworkEvent implements Parcelable { |
| 28 |
|
| 29 |
|
| 30 |
static final int PARCEL_TOKEN_DNS_EVENT = 1; |
| 31 |
|
| 32 |
static final int PARCEL_TOKEN_CONNECT_EVENT = 2; |
| 33 |
|
| 34 |
|
| 35 |
String mPackageName; |
| 36 |
|
| 37 |
|
| 38 |
long mTimestamp; |
| 39 |
|
| 40 |
|
| 41 |
long mId; |
| 42 |
|
| 43 |
|
| 44 |
NetworkEvent() { |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
NetworkEvent(String packageName, long timestamp) { |
| 50 |
this.mPackageName = packageName; |
| 51 |
this.mTimestamp = timestamp; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
public String getPackageName() { |
| 59 |
return mPackageName; |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
public long getTimestamp() { |
| 67 |
return mTimestamp; |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
public void setId(long id) { |
| 72 |
this.mId = id; |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
public long getId() { |
| 80 |
return this.mId; |
| 81 |
} |
| 82 |
|
| 83 |
@Override |
| 84 |
public int describeContents() { |
| 85 |
return 0; |
| 86 |
} |
| 87 |
|
| 88 |
public static final @android.annotation.NonNull Parcelable.Creator<NetworkEvent> CREATOR |
| 89 |
= new Parcelable.Creator<NetworkEvent>() { |
| 90 |
public NetworkEvent createFromParcel(Parcel in) { |
| 91 |
final int initialPosition = in.dataPosition(); |
| 92 |
final int parcelToken = in.readInt(); |
| 93 |
|
| 94 |
in.setDataPosition(initialPosition); |
| 95 |
switch (parcelToken) { |
| 96 |
case PARCEL_TOKEN_DNS_EVENT: |
| 97 |
return DnsEvent.CREATOR.createFromParcel(in); |
| 98 |
case PARCEL_TOKEN_CONNECT_EVENT: |
| 99 |
return ConnectEvent.CREATOR.createFromParcel(in); |
| 100 |
default: |
| 101 |
throw new ParcelFormatException("Unexpected NetworkEvent token in parcel: " |
| 102 |
+ parcelToken); |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
public NetworkEvent[] newArray(int size) { |
| 107 |
return new NetworkEvent[size]; |
| 108 |
} |
| 109 |
}; |
| 110 |
|
| 111 |
@Override |
| 112 |
public abstract void writeToParcel(Parcel out, int flags); |
| 113 |
} |