blob: aabd09b1ec07fb20bf8a124e0f43cd2b9ac61bc6 [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
Hugo Benichi4b6dfc22016-04-15 12:15:47 +090019import android.annotation.SystemApi;
Pierre Imai55618be2016-02-19 15:25:54 +090020import android.os.Parcel;
21import android.os.Parcelable;
22
Pierre Imaibc9cc502016-03-29 14:50:51 +090023/**
24 * {@hide}
25 */
Hugo Benichi4b6dfc22016-04-15 12:15:47 +090026@SystemApi
Hugo Benichi627b4242016-04-15 16:56:28 +090027public final class CaptivePortalStateChangeEvent extends IpConnectivityEvent implements Parcelable {
28 public static final int NETWORK_MONITOR_CONNECTED = 0;
Pierre Imai55618be2016-02-19 15:25:54 +090029 public static final int NETWORK_MONITOR_DISCONNECTED = 1;
Hugo Benichi627b4242016-04-15 16:56:28 +090030 public static final int NETWORK_MONITOR_VALIDATED = 2;
31
32 public final int state;
Pierre Imai55618be2016-02-19 15:25:54 +090033
34 public CaptivePortalStateChangeEvent(int state) {
Hugo Benichi627b4242016-04-15 16:56:28 +090035 this.state = state;
Pierre Imai55618be2016-02-19 15:25:54 +090036 }
37
38 public CaptivePortalStateChangeEvent(Parcel in) {
Hugo Benichi627b4242016-04-15 16:56:28 +090039 state = in.readInt();
Pierre Imai55618be2016-02-19 15:25:54 +090040 }
41
42 public void writeToParcel(Parcel out, int flags) {
Hugo Benichi627b4242016-04-15 16:56:28 +090043 out.writeInt(state);
44 }
45
46 public int describeContents() {
47 return 0;
Pierre Imai55618be2016-02-19 15:25:54 +090048 }
49
50 public static final Parcelable.Creator<CaptivePortalStateChangeEvent> CREATOR
51 = new Parcelable.Creator<CaptivePortalStateChangeEvent>() {
52 public CaptivePortalStateChangeEvent createFromParcel(Parcel in) {
53 return new CaptivePortalStateChangeEvent(in);
54 }
55
56 public CaptivePortalStateChangeEvent[] newArray(int size) {
57 return new CaptivePortalStateChangeEvent[size];
58 }
59 };
60
61 public static void logEvent(int state) {
Hugo Benichi627b4242016-04-15 16:56:28 +090062 logEvent(IPCE_NETMON_STATE_CHANGE, new CaptivePortalStateChangeEvent(state));
Pierre Imai55618be2016-02-19 15:25:54 +090063 }
64};