diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2016-04-22 09:41:04 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-04-22 09:41:06 +0000 |
| commit | 784c93e372ff8ba8ca59499a8e35d83e5bd71c1a (patch) | |
| tree | fa4188b5b8d7b9011f56988ccd3cdc843969a92b /core/java | |
| parent | b40667eccdd797d08560c33e696625509f90d52b (diff) | |
| parent | cc92c6e87773df9d5a84922066716ae9bb09cd6d (diff) | |
Merge "Split network monitoring and portal probe events" into nyc-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/net/metrics/CaptivePortalCheckResultEvent.java | 64 | ||||
| -rw-r--r-- | core/java/android/net/metrics/CaptivePortalStateChangeEvent.java | 68 | ||||
| -rw-r--r-- | core/java/android/net/metrics/NetworkEvent.java | 86 | ||||
| -rw-r--r-- | core/java/android/net/metrics/ValidationProbeEvent.java (renamed from core/java/android/net/metrics/NetworkMonitorEvent.java) | 43 |
4 files changed, 106 insertions, 155 deletions
diff --git a/core/java/android/net/metrics/CaptivePortalCheckResultEvent.java b/core/java/android/net/metrics/CaptivePortalCheckResultEvent.java deleted file mode 100644 index 02ab63e4959c..000000000000 --- a/core/java/android/net/metrics/CaptivePortalCheckResultEvent.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.metrics; - -import android.annotation.SystemApi; -import android.os.Parcel; -import android.os.Parcelable; - -/** - * {@hide} - */ -@SystemApi -public final class CaptivePortalCheckResultEvent extends IpConnectivityEvent implements Parcelable { - public final int netId; - public final int result; - - private CaptivePortalCheckResultEvent(int netId, int result) { - this.netId = netId; - this.result = result; - } - - private CaptivePortalCheckResultEvent(Parcel in) { - this.netId = in.readInt(); - this.result = in.readInt(); - } - - public void writeToParcel(Parcel out, int flags) { - out.writeInt(netId); - out.writeInt(result); - } - - public int describeContents() { - return 0; - } - - public static final Parcelable.Creator<CaptivePortalCheckResultEvent> CREATOR - = new Parcelable.Creator<CaptivePortalCheckResultEvent>() { - public CaptivePortalCheckResultEvent createFromParcel(Parcel in) { - return new CaptivePortalCheckResultEvent(in); - } - - public CaptivePortalCheckResultEvent[] newArray(int size) { - return new CaptivePortalCheckResultEvent[size]; - } - }; - - public static void logEvent(int netId, int result) { - logEvent(IPCE_NETMON_CHECK_RESULT, new CaptivePortalCheckResultEvent(netId, result)); - } -}; diff --git a/core/java/android/net/metrics/CaptivePortalStateChangeEvent.java b/core/java/android/net/metrics/CaptivePortalStateChangeEvent.java deleted file mode 100644 index a67589af2563..000000000000 --- a/core/java/android/net/metrics/CaptivePortalStateChangeEvent.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.metrics; - -import android.annotation.SystemApi; -import android.os.Parcel; -import android.os.Parcelable; - -/** - * {@hide} - */ -@SystemApi -public final class CaptivePortalStateChangeEvent extends IpConnectivityEvent implements Parcelable { - public static final int NETWORK_MONITOR_CONNECTED = 0; - public static final int NETWORK_MONITOR_DISCONNECTED = 1; - public static final int NETWORK_MONITOR_VALIDATED = 2; - - public final int netId; - public final int state; - - public CaptivePortalStateChangeEvent(int netId, int state) { - this.netId = netId; - this.state = state; - } - - public CaptivePortalStateChangeEvent(Parcel in) { - netId = in.readInt(); - state = in.readInt(); - } - - public void writeToParcel(Parcel out, int flags) { - out.writeInt(netId); - out.writeInt(state); - } - - public int describeContents() { - return 0; - } - - public static final Parcelable.Creator<CaptivePortalStateChangeEvent> CREATOR - = new Parcelable.Creator<CaptivePortalStateChangeEvent>() { - public CaptivePortalStateChangeEvent createFromParcel(Parcel in) { - return new CaptivePortalStateChangeEvent(in); - } - - public CaptivePortalStateChangeEvent[] newArray(int size) { - return new CaptivePortalStateChangeEvent[size]; - } - }; - - public static void logEvent(int netId, int state) { - logEvent(IPCE_NETMON_STATE_CHANGE, new CaptivePortalStateChangeEvent(netId, state)); - } -}; diff --git a/core/java/android/net/metrics/NetworkEvent.java b/core/java/android/net/metrics/NetworkEvent.java new file mode 100644 index 000000000000..b15dcee62a81 --- /dev/null +++ b/core/java/android/net/metrics/NetworkEvent.java @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.net.metrics; + +import android.annotation.SystemApi; +import android.os.Parcel; +import android.os.Parcelable; + +/** + * {@hide} + */ +@SystemApi +public final class NetworkEvent extends IpConnectivityEvent implements Parcelable { + + public static final int NETWORK_CONNECTED = 1; + public static final int NETWORK_VALIDATED = 2; + public static final int NETWORK_VALIDATION_FAILED = 3; + public static final int NETWORK_CAPTIVE_PORTAL_FOUND = 4; + public static final int NETWORK_LINGER = 5; + public static final int NETWORK_UNLINGER = 6; + public static final int NETWORK_DISCONNECTED = 7; + + public final int netId; + public final int eventType; + public final long durationMs; + + private NetworkEvent(int netId, int eventType, long durationMs) { + this.netId = netId; + this.eventType = eventType; + this.durationMs = durationMs; + } + + private NetworkEvent(Parcel in) { + netId = in.readInt(); + eventType = in.readInt(); + durationMs = in.readLong(); + } + + public void writeToParcel(Parcel out, int flags) { + out.writeInt(netId); + out.writeInt(eventType); + out.writeLong(durationMs); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<NetworkEvent> CREATOR + = new Parcelable.Creator<NetworkEvent>() { + public NetworkEvent createFromParcel(Parcel in) { + return new NetworkEvent(in); + } + + public NetworkEvent[] newArray(int size) { + return new NetworkEvent[size]; + } + }; + + public static void logEvent(int netId, int eventType) { + logEvent(IPCE_NETMON_STATE_CHANGE, new NetworkEvent(netId, eventType, 0)); + } + + public static void logValidated(int netId, long durationMs) { + logEvent(IPCE_NETMON_VALIDATED, new NetworkEvent(netId, NETWORK_VALIDATED, durationMs)); + } + + public static void logCaptivePortalFound(int netId, long durationMs) { + final NetworkEvent ev = new NetworkEvent(netId, NETWORK_CAPTIVE_PORTAL_FOUND, durationMs); + logEvent(IPCE_NETMON_CAPPORT_FOUND, ev); + } +}; diff --git a/core/java/android/net/metrics/NetworkMonitorEvent.java b/core/java/android/net/metrics/ValidationProbeEvent.java index 23712661b9d5..0a524c69fb67 100644 --- a/core/java/android/net/metrics/NetworkMonitorEvent.java +++ b/core/java/android/net/metrics/ValidationProbeEvent.java @@ -24,26 +24,34 @@ import android.os.Parcelable; * {@hide} */ @SystemApi -public final class NetworkMonitorEvent extends IpConnectivityEvent implements Parcelable { +public final class ValidationProbeEvent extends IpConnectivityEvent implements Parcelable { + + public static final int PROBE_HTTP = 0; + public static final int PROBE_HTTPS = 1; + public final int netId; public final long durationMs; + public final int probeType; public final int returnCode; - private NetworkMonitorEvent(int netId, long durationMs, int returnCode) { + private ValidationProbeEvent(int netId, long durationMs, int probeType, int returnCode) { this.netId = netId; this.durationMs = durationMs; + this.probeType = probeType; this.returnCode = returnCode; } - public NetworkMonitorEvent(Parcel in) { + private ValidationProbeEvent(Parcel in) { netId = in.readInt(); durationMs = in.readLong(); + probeType = in.readInt(); returnCode = in.readInt(); } public void writeToParcel(Parcel out, int flags) { out.writeInt(netId); out.writeLong(durationMs); + out.writeInt(probeType); out.writeInt(returnCode); } @@ -51,30 +59,19 @@ public final class NetworkMonitorEvent extends IpConnectivityEvent implements Pa return 0; } - public static final Parcelable.Creator<NetworkMonitorEvent> CREATOR - = new Parcelable.Creator<NetworkMonitorEvent>() { - public NetworkMonitorEvent createFromParcel(Parcel in) { - return new NetworkMonitorEvent(in); + public static final Parcelable.Creator<ValidationProbeEvent> CREATOR + = new Parcelable.Creator<ValidationProbeEvent>() { + public ValidationProbeEvent createFromParcel(Parcel in) { + return new ValidationProbeEvent(in); } - public NetworkMonitorEvent[] newArray(int size) { - return new NetworkMonitorEvent[size]; + public ValidationProbeEvent[] newArray(int size) { + return new ValidationProbeEvent[size]; } }; - private static void logEvent(int eventType, int netId, long durationMs, int returnCode) { - logEvent(eventType, new NetworkMonitorEvent(netId, durationMs, returnCode)); - } - - public static void logValidated(int netId, long durationMs) { - logEvent(IPCE_NETMON_VALIDATED, netId, durationMs, 0); - } - - public static void logPortalProbeEvent(int netId, long durationMs, int returnCode) { - logEvent(IPCE_NETMON_PORTAL_PROBE, netId, durationMs, returnCode); - } - - public static void logCaptivePortalFound(int netId, long durationMs) { - logEvent(IPCE_NETMON_CAPPORT_FOUND, netId, durationMs, 0); + public static void logEvent(int netId, long durationMs, int probeType, int returnCode) { + logEvent(IPCE_NETMON_PORTAL_PROBE, + new ValidationProbeEvent(netId, durationMs, probeType, returnCode)); } }; |
