diff options
author | Steven Liu <steveliu@google.com> | 2020-04-30 19:58:43 -0700 |
---|---|---|
committer | Steven Liu <steveliu@google.com> | 2020-05-29 16:34:42 -0700 |
commit | b5a8f62f9ff6667bbce349569659a84fbd826db0 (patch) | |
tree | 69966578d4a60c5e0260e68c101e5a7ae8b1f6fa /service | |
parent | e1273d71ef5e5b4615e02aabad0b770c90b4ba15 (diff) |
Add CarrierWifi metrics
Updated-PDD: TRUE
Bug: 145762500
Test: atest com.android.server.wifi
Merged-In: I11a60c877cd0a7594a4a691207e89935f35fe22e
Change-Id: Ifd03a0e6d15d777e632f000c07a666d1d5491d6c
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 14 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 68 | ||||
-rw-r--r-- | service/proto/src/metrics.proto | 11 |
3 files changed, 93 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 727676880..ac1c8d0b4 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -2965,6 +2965,20 @@ public class ClientModeImpl extends StateMachine { } } + if (configuration != null + && configuration.carrierId != TelephonyManager.UNKNOWN_CARRIER_ID) { + if (level2FailureCode == WifiMetrics.ConnectionEvent.FAILURE_NONE) { + mWifiMetrics.incrementNumOfCarrierWifiConnectionSuccess(); + } else if (level2FailureCode + == WifiMetrics.ConnectionEvent.FAILURE_AUTHENTICATION_FAILURE + && level2FailureReason + != WifiMetricsProto.ConnectionEvent.AUTH_FAILURE_NONE) { + mWifiMetrics.incrementNumOfCarrierWifiConnectionAuthFailure(); + } else { + mWifiMetrics.incrementNumOfCarrierWifiConnectionNonAuthFailure(); + } + } + boolean isAssociationRejection = level2FailureCode == WifiMetrics.ConnectionEvent.FAILURE_ASSOCIATION_REJECTION; boolean isAuthenticationFailure = level2FailureCode diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 0559326b1..dbd532541 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -62,6 +62,7 @@ import com.android.server.wifi.hotspot2.Utils; import com.android.server.wifi.p2p.WifiP2pMetrics; import com.android.server.wifi.proto.WifiStatsLog; import com.android.server.wifi.proto.nano.WifiMetricsProto; +import com.android.server.wifi.proto.nano.WifiMetricsProto.CarrierWifiMetrics; import com.android.server.wifi.proto.nano.WifiMetricsProto.ConnectToNetworkNotificationAndActionCount; import com.android.server.wifi.proto.nano.WifiMetricsProto.DeviceMobilityStatePnoScanStats; import com.android.server.wifi.proto.nano.WifiMetricsProto.ExperimentValues; @@ -500,6 +501,9 @@ public class WifiMetrics { private final SoftApConfigLimitationMetrics mSoftApConfigLimitationMetrics = new SoftApConfigLimitationMetrics(); + private final CarrierWifiMetrics mCarrierWifiMetrics = + new CarrierWifiMetrics(); + @VisibleForTesting static class NetworkSelectionExperimentResults { public static final int MAX_CHOICES = 10; @@ -1185,6 +1189,38 @@ public class WifiMetrics { } } + class CarrierWifiMetrics { + public int numConnectionSuccess = 0; + public int numConnectionAuthFailure = 0; + public int numConnectionNonAuthFailure = 0; + + public WifiMetricsProto.CarrierWifiMetrics toProto() { + WifiMetricsProto.CarrierWifiMetrics proto = + new WifiMetricsProto.CarrierWifiMetrics(); + proto.numConnectionSuccess = numConnectionSuccess; + proto.numConnectionAuthFailure = numConnectionAuthFailure; + proto.numConnectionNonAuthFailure = numConnectionNonAuthFailure; + return proto; + } + + public void clear() { + numConnectionSuccess = 0; + numConnectionAuthFailure = 0; + numConnectionNonAuthFailure = 0; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("numConnectionSuccess=") + .append(numConnectionSuccess) + .append(", numConnectionAuthFailure=") + .append(numConnectionAuthFailure) + .append(", numConnectionNonAuthFailure") + .append(numConnectionNonAuthFailure); + return sb.toString(); + } + } public WifiMetrics(Context context, FrameworkFacade facade, Clock clock, Looper looper, WifiAwareMetrics awareMetrics, RttMetrics rttMetrics, @@ -3646,6 +3682,8 @@ public class WifiMetrics { + mTxThroughputMbpsHistogramAbove2G); pw.println("mRxThroughputMbpsHistogramAbove2G:\n" + mRxThroughputMbpsHistogramAbove2G); + pw.println("mCarrierWifiMetrics:\n" + + mCarrierWifiMetrics); dumpInitPartialScanMetrics(pw); } @@ -4321,6 +4359,8 @@ public class WifiMetrics { initialPartialScanStats.failedScanChannelCountHistogram = mInitPartialScanFailureHistogram.toProto(); mWifiLogProto.initPartialScanStats = initialPartialScanStats; + + mWifiLogProto.carrierWifiMetrics = mCarrierWifiMetrics.toProto(); } } @@ -4538,6 +4578,7 @@ public class WifiMetrics { mInitPartialScanFailureCount = 0; mInitPartialScanSuccessHistogram.clear(); mInitPartialScanFailureHistogram.clear(); + mCarrierWifiMetrics.clear(); } } @@ -6461,4 +6502,31 @@ public class WifiMetrics { mWifiLogProto.numBssidDifferentSelectionBetweenFrameworkAndFirmware++; } } + + /** + * Note the carrier wifi network connected successfully. + */ + public void incrementNumOfCarrierWifiConnectionSuccess() { + synchronized (mLock) { + mCarrierWifiMetrics.numConnectionSuccess++; + } + } + + /** + * Note the carrier wifi network connection authentication failure. + */ + public void incrementNumOfCarrierWifiConnectionAuthFailure() { + synchronized (mLock) { + mCarrierWifiMetrics.numConnectionAuthFailure++; + } + } + + /** + * Note the carrier wifi network connection non-authentication failure. + */ + public void incrementNumOfCarrierWifiConnectionNonAuthFailure() { + synchronized (mLock) { + mCarrierWifiMetrics.numConnectionNonAuthFailure++; + } + } } diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto index 8755271f7..eaea7342b 100644 --- a/service/proto/src/metrics.proto +++ b/service/proto/src/metrics.proto @@ -709,6 +709,9 @@ message WifiLog { // Number of connection with different BSSID between framework and firmware selection. optional int32 num_bssid_different_selection_between_framework_and_firmware = 199; + + // Metrics about carrier wifi network. + optional CarrierWifiMetrics carrier_wifi_metrics = 200; } // Information that gets logged for every WiFi connection. @@ -3295,3 +3298,11 @@ message UserReactionToApprovalUiEvent { // Event of user reaction to the carrier approval UI. repeated UserReaction user_approval_carrier_ui_reaction = 2; } + +message CarrierWifiMetrics { + // Number of successful network connection using Carrier ID + optional int32 num_connection_success = 1; + // Number of failed authentication from network connection using Carrier ID + optional int32 num_connection_auth_failure = 2; + optional int32 num_connection_non_auth_failure = 3; +} |