blob: 00808c1800694a24091e4e6bf7851453adb62b8b [file] [log] [blame]
Pierre Imai55618be2016-02-19 15:25:54 +09001/*
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.os.Parcel;
20import android.os.Parcelable;
21
Pierre Imaibc9cc502016-03-29 14:50:51 +090022/**
23 * {@hide}
24 */
Pierre Imai55618be2016-02-19 15:25:54 +090025public class CaptivePortalStateChangeEvent extends IpConnectivityEvent implements Parcelable {
26 public static final String TAG = "CaptivePortalStateChangeEvent";
27
28 public static final int NETWORK_MONITOR_CONNECTED = 0;
29 public static final int NETWORK_MONITOR_DISCONNECTED = 1;
30 public static final int NETWORK_MONITOR_VALIDATED = 2;
31 private int mState;
32
33 public CaptivePortalStateChangeEvent(int state) {
34 mState = state;
35 }
36
37 public CaptivePortalStateChangeEvent(Parcel in) {
38 mState = in.readInt();
39 }
40
41 public void writeToParcel(Parcel out, int flags) {
42 out.writeInt(mState);
43 }
44
45 public static final Parcelable.Creator<CaptivePortalStateChangeEvent> CREATOR
46 = new Parcelable.Creator<CaptivePortalStateChangeEvent>() {
47 public CaptivePortalStateChangeEvent createFromParcel(Parcel in) {
48 return new CaptivePortalStateChangeEvent(in);
49 }
50
51 public CaptivePortalStateChangeEvent[] newArray(int size) {
52 return new CaptivePortalStateChangeEvent[size];
53 }
54 };
55
56 public static void logEvent(int state) {
57 IpConnectivityEvent.logEvent(IpConnectivityEvent.IPCE_NETMON_STATE_CHANGE,
58 new CaptivePortalStateChangeEvent(state));
59 }
60};