summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/networkstack/metrics/IpProvisioningMetrics.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/networkstack/metrics/IpProvisioningMetrics.java b/src/com/android/networkstack/metrics/IpProvisioningMetrics.java
index 1f969d4..64e173d 100644
--- a/src/com/android/networkstack/metrics/IpProvisioningMetrics.java
+++ b/src/com/android/networkstack/metrics/IpProvisioningMetrics.java
@@ -120,12 +120,21 @@ public class IpProvisioningMetrics {
transSuccess ? HostnameTransResult.HTR_SUCCESS : HostnameTransResult.HTR_FAILURE);
}
+ private static DhcpErrorCode dhcpErrorFromNumberSafe(int number) {
+ // See DhcpErrorCode.errorCodeWithOption
+ // TODO: add a DhcpErrorCode method to extract the code;
+ // or replace legacy error codes with the new metrics.
+ final DhcpErrorCode error = DhcpErrorCode.forNumber(number & 0xFFFF0000);
+ if (error == null) return DhcpErrorCode.ET_UNKNOWN;
+ return error;
+ }
+
/**
* write the DHCP error code into DhcpSession.
*/
public void addDhcpErrorCode(final int errorCode) {
if (mDhcpSessionBuilder.getErrorCodeCount() >= MAX_DHCP_ERROR_COUNT) return;
- mDhcpSessionBuilder.addErrorCode(DhcpErrorCode.forNumber(errorCode));
+ mDhcpSessionBuilder.addErrorCode(dhcpErrorFromNumberSafe(errorCode));
}
/**