diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-05-30 00:51:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-05-30 00:51:06 +0000 |
commit | 4c324bef94bacc4d6f2f761dd286c43f72b5f773 (patch) | |
tree | 78fbf4cc8f58caac0f91b96a18982a55313bb04a /service | |
parent | 47d386420fb3e3523f643f0d1e1fd3496c5f6aeb (diff) | |
parent | b5a8f62f9ff6667bbce349569659a84fbd826db0 (diff) |
Merge "Add CarrierWifi metrics" into rvc-dev
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; +} |