Add authentication failure reason in ConnectionEvent

To allow for a breakdown of authentication failures.

Bug: 121223972

Test: frameworks/base/wifi/tests/runtests.sh

Change-Id: I30898ecb6acd779c1e41baf535bcf45df3ef4b56
Signed-off-by: Mingguang Xu <mingguangxu@google.com>
diff --git a/proto/src/wifi.proto b/proto/src/wifi.proto
index 7bf37ff..3d4f1f2 100644
--- a/proto/src/wifi.proto
+++ b/proto/src/wifi.proto
@@ -654,6 +654,26 @@
     HLF_UNWANTED = 4;
   }
 
+  // Level 2 failure reason.
+  enum Level2FailureReason {
+
+    // Unknown default
+    FAILURE_REASON_UNKNOWN = 0;
+
+    // The reason code if there is no error during authentication. It could
+    // also imply that there no authentication in progress.
+    AUTH_FAILURE_NONE = 1;
+
+    // The reason code if there was a timeout authenticating.
+    AUTH_FAILURE_TIMEOUT = 2;
+
+    // The reason code if there was a wrong password while authenticating.
+    AUTH_FAILURE_WRONG_PSWD = 3;
+
+    // The reason code if there was EAP failure while authenticating.
+    AUTH_FAILURE_EAP_FAILURE = 4;
+  }
+
   // Entity that recommended connecting to this network.
   enum ConnectionNominator {
     // Unknown nominator
@@ -722,6 +742,10 @@
 
   // The currently running network selector when this connection event occurred.
   optional int32 network_selector_experiment_id = 12;
+
+  // Breakdown of level_2_failure_code with more detailed reason.
+  optional Level2FailureReason level_2_failure_reason = 13
+          [default = FAILURE_REASON_UNKNOWN];
 }
 
 // Number of occurrences of a specific RSSI poll rssi value