diff options
| author | Erik Kline <ek@google.com> | 2016-04-12 15:31:13 +0900 |
|---|---|---|
| committer | Erik Kline <ek@google.com> | 2016-04-14 10:53:30 +0900 |
| commit | 5b25a0f7960048cbf5929ba144e7a575eb4f7d32 (patch) | |
| tree | 870b729eb2fc45ae18a5c9cd9156cd5684b8ae5c /core/java/android | |
| parent | 577672966cf466db37e6af1e383111de008154a3 (diff) | |
Add some more metrics: IpManager, IpReachabilityMonitor
Change-Id: Ibb7150c849715a42fc2c879589eaaf86e8a007e7
Diffstat (limited to 'core/java/android')
3 files changed, 120 insertions, 0 deletions
diff --git a/core/java/android/net/metrics/IpConnectivityEvent.java b/core/java/android/net/metrics/IpConnectivityEvent.java index ec428909e1cb..59c1cfe25be0 100644 --- a/core/java/android/net/metrics/IpConnectivityEvent.java +++ b/core/java/android/net/metrics/IpConnectivityEvent.java @@ -28,14 +28,17 @@ public class IpConnectivityEvent implements Parcelable { // DHCP = DhcpClient // NETMON = NetworkMonitorEvent // CONSRV = ConnectivityServiceEvent + // IPMGR = IpManager public static final String TAG = "IpConnectivityEvent"; public static final int IPCE_IPRM_BASE = 0*1024; public static final int IPCE_DHCP_BASE = 1*1024; public static final int IPCE_NETMON_BASE = 2*1024; public static final int IPCE_CONSRV_BASE = 3*1024; + public static final int IPCE_IPMGR_BASE = 4*1024; public static final int IPCE_IPRM_PROBE_RESULT = IPCE_IPRM_BASE + 0; public static final int IPCE_IPRM_MESSAGE_RECEIVED = IPCE_IPRM_BASE + 1; + public static final int IPCE_IPRM_REACHABILITY_LOST = IPCE_IPRM_BASE + 2; public static final int IPCE_DHCP_RECV_ERROR = IPCE_DHCP_BASE + 0; public static final int IPCE_DHCP_PARSE_ERROR = IPCE_DHCP_BASE + 1; public static final int IPCE_DHCP_TIMEOUT = IPCE_DHCP_BASE + 2; @@ -43,6 +46,9 @@ public class IpConnectivityEvent implements Parcelable { public static final int IPCE_NETMON_STATE_CHANGE = IPCE_NETMON_BASE + 0; public static final int IPCE_NETMON_CHECK_RESULT = IPCE_NETMON_BASE + 1; public static final int IPCE_CONSRV_DEFAULT_NET_CHANGE = IPCE_CONSRV_BASE + 0; + public static final int IPCE_IPMGR_PROVISIONING_OK = IPCE_IPMGR_BASE + 0; + public static final int IPCE_IPMGR_PROVISIONING_FAIL = IPCE_IPMGR_BASE + 1; + public static final int IPCE_IPMGR_COMPLETE_LIFECYCLE = IPCE_IPMGR_BASE + 2; private static ConnectivityMetricsLogger mMetricsLogger = new ConnectivityMetricsLogger(); diff --git a/core/java/android/net/metrics/IpManagerEvent.java b/core/java/android/net/metrics/IpManagerEvent.java new file mode 100644 index 000000000000..6328ccb38256 --- /dev/null +++ b/core/java/android/net/metrics/IpManagerEvent.java @@ -0,0 +1,58 @@ +/* + * 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.os.Parcel; +import android.os.Parcelable; + +/** + * {@hide} + */ +public class IpManagerEvent extends IpConnectivityEvent implements Parcelable { + private String mIfName; + private long mDurationMs; + + public IpManagerEvent(String ifName, long duration) { + mIfName = ifName; + mDurationMs = duration; + } + + public IpManagerEvent(Parcel in) { + mIfName = in.readString(); + mDurationMs = in.readLong(); + } + + public void writeToParcel(Parcel out, int flags) { + out.writeString(mIfName); + out.writeLong(mDurationMs); + } + + public static final Parcelable.Creator<IpManagerEvent> CREATOR + = new Parcelable.Creator<IpManagerEvent>() { + public IpManagerEvent createFromParcel(Parcel in) { + return new IpManagerEvent(in); + } + + public IpManagerEvent[] newArray(int size) { + return new IpManagerEvent[size]; + } + }; + + public static void logEvent(int eventType, String ifName, long durationMs) { + IpConnectivityEvent.logEvent(eventType, new IpManagerEvent(ifName, durationMs)); + } +}; diff --git a/core/java/android/net/metrics/IpReachabilityMonitorLostEvent.java b/core/java/android/net/metrics/IpReachabilityMonitorLostEvent.java new file mode 100644 index 000000000000..0f1421065e66 --- /dev/null +++ b/core/java/android/net/metrics/IpReachabilityMonitorLostEvent.java @@ -0,0 +1,56 @@ +/* + * 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.os.Parcel; +import android.os.Parcelable; + +/** + * {@hide} + */ +public class IpReachabilityMonitorLostEvent extends IpConnectivityEvent + implements Parcelable { + private String mIfName; + + public IpReachabilityMonitorLostEvent(String ifName) { + mIfName = ifName; + } + + public IpReachabilityMonitorLostEvent(Parcel in) { + mIfName = in.readString(); + } + + public void writeToParcel(Parcel out, int flags) { + out.writeString(mIfName); + } + + public static final Parcelable.Creator<IpReachabilityMonitorLostEvent> CREATOR + = new Parcelable.Creator<IpReachabilityMonitorLostEvent>() { + public IpReachabilityMonitorLostEvent createFromParcel(Parcel in) { + return new IpReachabilityMonitorLostEvent(in); + } + + public IpReachabilityMonitorLostEvent[] newArray(int size) { + return new IpReachabilityMonitorLostEvent[size]; + } + }; + + public static void logEvent(String ifName) { + IpConnectivityEvent.logEvent(IpConnectivityEvent.IPCE_IPRM_REACHABILITY_LOST, + new IpReachabilityMonitorLostEvent(ifName)); + } +}; |
