DhcpClientEvent.java revision cfddd6879283860bb4d2cf2972ea086f585a37ec
1/*
2 * Copyright (C) 2016 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
17package android.net.metrics;
18
19import android.annotation.SystemApi;
20import android.os.Parcel;
21import android.os.Parcelable;
22
23/**
24 * {@hide}
25 */
26@SystemApi
27public final class DhcpClientEvent implements Parcelable {
28    public final String ifName;
29    public final String msg;
30
31    /** {@hide} */
32    public DhcpClientEvent(String ifName, String msg) {
33        this.ifName = ifName;
34        this.msg = msg;
35    }
36
37    private DhcpClientEvent(Parcel in) {
38        this.ifName = in.readString();
39        this.msg = in.readString();
40    }
41
42    public void writeToParcel(Parcel out, int flags) {
43        out.writeString(ifName);
44        out.writeString(msg);
45    }
46
47    public int describeContents() {
48        return 0;
49    }
50
51    @Override
52    public String toString() {
53        return String.format("DhcpClientEvent(%s, %s)", ifName, msg);
54    }
55
56    public static final Parcelable.Creator<DhcpClientEvent> CREATOR
57        = new Parcelable.Creator<DhcpClientEvent>() {
58        public DhcpClientEvent createFromParcel(Parcel in) {
59            return new DhcpClientEvent(in);
60        }
61
62        public DhcpClientEvent[] newArray(int size) {
63            return new DhcpClientEvent[size];
64        }
65    };
66
67    public static void logStateEvent(String ifName, String state) {
68    }
69}
70