summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java42
1 files changed, 29 insertions, 13 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 5b579d5ae..fa4ed1030 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -4453,6 +4453,22 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
mWifiNative.BLUETOOTH_COEXISTENCE_MODE_SENSE);
}
+ /**
+ * Inform other components (WifiMetrics, WifiLogger, etc.) that the current connection attempt
+ * has concluded.
+ */
+ private void reportConnectionAttemptEnd(int level2FailureCode, int connectivityFailureCode) {
+ mWifiMetrics.endConnectionEvent(level2FailureCode, connectivityFailureCode);
+ switch (level2FailureCode) {
+ case WifiMetrics.ConnectionEvent.FAILURE_NONE:
+ case WifiMetrics.ConnectionEvent.FAILURE_REDUNDANT_CONNECTION_ATTEMPT:
+ // WifiLogger doesn't care about success, or pre-empted connections.
+ break;
+ default:
+ mWifiLogger.reportConnectionFailure();
+ }
+ }
+
private void handleIPv4Success(DhcpResults dhcpResults) {
if (DBG) {
logd("handleIPv4Success <" + dhcpResults.toString() + ">");
@@ -4522,7 +4538,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
}
log("DHCP failure count=" + count);
}
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_DHCP,
WifiMetricsProto.ConnectionEvent.HLF_DHCP);
synchronized(mDhcpResultsLock) {
@@ -6156,7 +6172,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
mSupplicantStateTracker.sendMessage(WifiMonitor.ASSOCIATION_REJECTION_EVENT);
//If rejection occurred while Metrics is tracking a ConnnectionEvent, end it.
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_ASSOCIATION_REJECTION,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
break;
@@ -6169,7 +6185,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
.DISABLED_AUTHENTICATION_FAILURE);
}
//If failure occurred while Metrics is tracking a ConnnectionEvent, end it.
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_AUTHENTICATION_FAILURE,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
break;
@@ -6180,7 +6196,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
message.arg1,
WifiConfiguration.NetworkSelectionStatus
.DISABLED_AUTHENTICATION_FAILURE);
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_SSID_TEMP_DISABLED,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
break;
@@ -6632,7 +6648,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
loge("Failed to connect config: " + config + " netId: " + netId);
replyToMessage(message, WifiManager.CONNECT_NETWORK_FAILED,
WifiManager.ERROR);
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_CONNECT_NETWORK_FAILED,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
break;
@@ -6784,7 +6800,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
loge("Failed to connect config: " + config + " netId: " + netId);
replyToMessage(message, WifiManager.CONNECT_NETWORK_FAILED,
WifiManager.ERROR);
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_CONNECT_NETWORK_FAILED,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
break;
@@ -7354,7 +7370,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
}
case CMD_IP_CONFIGURATION_SUCCESSFUL:
handleSuccessfulIpConfiguration();
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_NONE,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
sendConnectedState();
@@ -7762,7 +7778,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
/* Defer any power mode changes since we must keep active power mode at DHCP */
case WifiMonitor.NETWORK_DISCONNECTION_EVENT:
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_NETWORK_DISCONNECTION,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
return NOT_HANDLED;
@@ -7910,7 +7926,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
sendNetworkStateChangeBroadcast(mLastBssid);
// Successful framework roam! (probably)
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_NONE,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
// We used to transition to ObtainingIpState in an
@@ -8122,7 +8138,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
return NOT_HANDLED;
case WifiMonitor.NETWORK_DISCONNECTION_EVENT:
long lastRoam = 0;
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_NETWORK_DISCONNECTION,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
if (mLastDriverRoamAttempt != 0) {
@@ -8235,7 +8251,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
}
if (deferForUserInput(message, netId, false)) {
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_CONNECT_NETWORK_FAILED,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
break;
@@ -8243,7 +8259,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
WifiConfiguration.USER_BANNED) {
replyToMessage(message, WifiManager.CONNECT_NETWORK_FAILED,
WifiManager.NOT_AUTHORIZED);
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_CONNECT_NETWORK_FAILED,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
break;
@@ -8271,7 +8287,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.PnoEven
replyToMessage(message, WifiManager.CONNECT_NETWORK_FAILED,
WifiManager.ERROR);
messageHandlingStatus = MESSAGE_HANDLING_STATUS_FAIL;
- mWifiMetrics.endConnectionEvent(
+ reportConnectionAttemptEnd(
WifiMetrics.ConnectionEvent.FAILURE_CONNECT_NETWORK_FAILED,
WifiMetricsProto.ConnectionEvent.HLF_NONE);
break;