diff options
author | Jimmy Chen <jimmycmchen@google.com> | 2020-03-04 17:41:44 +0800 |
---|---|---|
committer | Jimmy Chen <jimmycmchen@google.com> | 2020-03-06 10:33:54 +0800 |
commit | 3400eb76bb9f8fc7fbc2376281f21ffd465fcce2 (patch) | |
tree | cb83750294f551087785f8beb8ff2767f4330572 /service | |
parent | 8f5ba75b3d586f22f9f3037f91720ff3990b530b (diff) |
Wifi: add WAPI metrics
Bug: 143378134
Test: atest FrameworksWifiTests
Change-Id: Ib81b4f35db2fc6835b244e51f1ff9bd2751e8e18
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 32 | ||||
-rw-r--r-- | service/proto/src/metrics.proto | 15 |
2 files changed, 47 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 14f7f846b..bd369f84b 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -896,6 +896,9 @@ public class WifiMetrics { case WifiMetricsProto.ConnectionEvent.TYPE_OPEN: sb.append("TYPE_OPEN"); break; + case WifiMetricsProto.ConnectionEvent.TYPE_WAPI: + sb.append("TYPE_WAPI"); + break; } sb.append(", networkCreator="); switch (mConnectionEvent.networkCreator) { @@ -1212,6 +1215,12 @@ public class WifiMetrics { } else if (WifiConfigurationUtil.isConfigForSaeNetwork(config)) { mCurrentConnectionEvent.mConnectionEvent.networkType = WifiMetricsProto.ConnectionEvent.TYPE_WPA3; + } else if (WifiConfigurationUtil.isConfigForWapiPskNetwork(config)) { + mCurrentConnectionEvent.mConnectionEvent.networkType = + WifiMetricsProto.ConnectionEvent.TYPE_WAPI; + } else if (WifiConfigurationUtil.isConfigForWapiCertNetwork(config)) { + mCurrentConnectionEvent.mConnectionEvent.networkType = + WifiMetricsProto.ConnectionEvent.TYPE_WAPI; } else if (WifiConfigurationUtil.isConfigForPskNetwork(config)) { mCurrentConnectionEvent.mConnectionEvent.networkType = WifiMetricsProto.ConnectionEvent.TYPE_WPA2; @@ -1932,6 +1941,8 @@ public class WifiMetrics { int enhacedOpenNetworks = 0; int wpa3PersonalNetworks = 0; int wpa3EnterpriseNetworks = 0; + int wapiPersonalNetworks = 0; + int wapiEnterpriseNetworks = 0; for (ScanDetail scanDetail : scanDetails) { NetworkDetail networkDetail = scanDetail.getNetworkDetail(); @@ -1952,6 +1963,10 @@ public class WifiMetrics { if (scanResult != null && scanResult.capabilities != null) { if (ScanResultUtil.isScanResultForEapSuiteBNetwork(scanResult)) { wpa3EnterpriseNetworks++; + } else if (ScanResultUtil.isScanResultForWapiPskNetwork(scanResult)) { + wapiPersonalNetworks++; + } else if (ScanResultUtil.isScanResultForWapiCertNetwork(scanResult)) { + wapiEnterpriseNetworks++; } else if (ScanResultUtil.isScanResultForEapNetwork(scanResult)) { enterpriseNetworks++; } else if (ScanResultUtil.isScanResultForSaeNetwork(scanResult)) { @@ -1974,6 +1989,8 @@ public class WifiMetrics { mWifiLogProto.numEnhancedOpenNetworkScanResults += enhacedOpenNetworks; mWifiLogProto.numWpa3PersonalNetworkScanResults += wpa3PersonalNetworks; mWifiLogProto.numWpa3EnterpriseNetworkScanResults += wpa3EnterpriseNetworks; + mWifiLogProto.numWapiPersonalNetworkScanResults += wapiPersonalNetworks; + mWifiLogProto.numWapiEnterpriseNetworkScanResults += wapiEnterpriseNetworks; mWifiLogProto.numHiddenNetworkScanResults += hiddenNetworks; mWifiLogProto.numHotspot2R1NetworkScanResults += hotspot2r1Networks; mWifiLogProto.numHotspot2R2NetworkScanResults += hotspot2r2Networks; @@ -2576,6 +2593,10 @@ public class WifiMetrics { + mWifiLogProto.numWpa3PersonalNetworks); pw.println("mWifiLogProto.numWpa3EnterpriseNetworks=" + mWifiLogProto.numWpa3EnterpriseNetworks); + pw.println("mWifiLogProto.numWapiPersonalNetworks=" + + mWifiLogProto.numWapiPersonalNetworks); + pw.println("mWifiLogProto.numWapiEnterpriseNetworks=" + + mWifiLogProto.numWapiEnterpriseNetworks); pw.println("mWifiLogProto.numHiddenNetworks=" + mWifiLogProto.numHiddenNetworks); pw.println("mWifiLogProto.numPasspointNetworks=" + mWifiLogProto.numPasspointNetworks); @@ -2741,6 +2762,10 @@ public class WifiMetrics { + mWifiLogProto.numWpa3PersonalNetworkScanResults); pw.println("mWifiLogProto.numWpa3EnterpriseNetworkScanResults=" + mWifiLogProto.numWpa3EnterpriseNetworkScanResults); + pw.println("mWifiLogProto.numWapiPersonalNetworkScanResults=" + + mWifiLogProto.numWapiPersonalNetworkScanResults); + pw.println("mWifiLogProto.numWapiEnterpriseNetworkScanResults=" + + mWifiLogProto.numWapiEnterpriseNetworkScanResults); pw.println("mWifiLogProto.numHiddenNetworkScanResults=" + mWifiLogProto.numHiddenNetworkScanResults); pw.println("mWifiLogProto.numHotspot2R1NetworkScanResults=" @@ -3142,6 +3167,8 @@ public class WifiMetrics { mWifiLogProto.numEnhancedOpenNetworks = 0; mWifiLogProto.numWpa3PersonalNetworks = 0; mWifiLogProto.numWpa3EnterpriseNetworks = 0; + mWifiLogProto.numWapiPersonalNetworks = 0; + mWifiLogProto.numWapiEnterpriseNetworks = 0; mWifiLogProto.numNetworksAddedByUser = 0; mWifiLogProto.numNetworksAddedByApps = 0; mWifiLogProto.numHiddenNetworks = 0; @@ -3151,9 +3178,14 @@ public class WifiMetrics { mWifiLogProto.numOpenNetworks++; } else if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.OWE)) { mWifiLogProto.numEnhancedOpenNetworks++; + } else if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WAPI_PSK)) { + mWifiLogProto.numWapiPersonalNetworks++; } else if (config.isEnterprise()) { if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.SUITE_B_192)) { mWifiLogProto.numWpa3EnterpriseNetworks++; + } else if (config.allowedKeyManagement.get( + WifiConfiguration.KeyMgmt.WAPI_CERT)) { + mWifiLogProto.numWapiEnterpriseNetworks++; } else { mWifiLogProto.numLegacyEnterpriseNetworks++; } diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto index 145a3b2bc..138c1e143 100644 --- a/service/proto/src/metrics.proto +++ b/service/proto/src/metrics.proto @@ -585,6 +585,18 @@ message WifiLog { // Connection duration under various health conditions optional ConnectionDurationStats connection_duration_stats = 160; + + // Number of WAPI-Personal saved networks. + optional int32 num_wapi_personal_networks = 161; + + // Number of WAPI-Enterprise saved networks. + optional int32 num_wapi_enterprise_networks = 162; + + // Total number of scan results for WAPI-Personal networks + optional int32 num_wapi_personal_network_scan_results = 163; + + // Total number of scan results for WAPI-Enterprise networks + optional int32 num_wapi_enterprise_network_scan_results = 164; } // Information that gets logged for every WiFi connection. @@ -858,6 +870,9 @@ message ConnectionEvent { // Open network TYPE_OPEN = 6; + + // WAPI network + TYPE_WAPI = 7; } enum NetworkCreator { |