diff options
author | hsuvictor <hsuvictor@google.com> | 2019-04-09 20:11:28 +0800 |
---|---|---|
committer | hsuvictor <hsuvictor@google.com> | 2019-04-19 11:09:14 +0800 |
commit | 5de5a95d6e4061031abee4fdcf2d3bb3bded3ab7 (patch) | |
tree | 3d5b0dd1a96ef1118f344615f20ead1dec58bab0 /service | |
parent | ed6fece8522299c4485808c9300c870b807f5145 (diff) |
WifiMetrics: separate count of passpoint profile type for R1 and R2
Bug: 122542221
Test: atest WifiMetricsTest PasspointManagerTest
Change-Id: I3401cc6843b7e489a080cb6f33f1bb34873b7aca
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 125cd0987..ffe76afe9 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -63,6 +63,7 @@ import com.android.server.wifi.nano.WifiMetricsProto.LinkProbeStats; import com.android.server.wifi.nano.WifiMetricsProto.LinkProbeStats.LinkProbeFailureReasonCount; import com.android.server.wifi.nano.WifiMetricsProto.LinkSpeedCount; import com.android.server.wifi.nano.WifiMetricsProto.NetworkSelectionExperimentDecisions; +import com.android.server.wifi.nano.WifiMetricsProto.PasspointProfileTypeCount; import com.android.server.wifi.nano.WifiMetricsProto.PasspointProvisionStats; import com.android.server.wifi.nano.WifiMetricsProto.PasspointProvisionStats.ProvisionFailureCount; import com.android.server.wifi.nano.WifiMetricsProto.PnoScanMetrics; @@ -276,7 +277,8 @@ public class WifiMetrics { private final SparseIntArray mAvailableSavedPasspointProviderBssidsInScanHistogram = new SparseIntArray(); - private final SparseIntArray mInstalledPasspointProfileType = new SparseIntArray(); + private final IntCounter mInstalledPasspointProfileTypeForR1 = new IntCounter(); + private final IntCounter mInstalledPasspointProfileTypeForR2 = new IntCounter(); /** Mapping of "Connect to Network" notifications to counts. */ private final SparseIntArray mConnectToNetworkNotificationCount = new SparseIntArray(); @@ -2535,12 +2537,10 @@ public class WifiMetrics { pw.println("mWifiLogProto.numPasspointProvidersSuccessfullyConnected=" + mWifiLogProto.numPasspointProvidersSuccessfullyConnected); - pw.println("mWifiLogProto.installedPasspointProfileType: "); - for (int i = 0; i < mInstalledPasspointProfileType.size(); i++) { - int eapType = mInstalledPasspointProfileType.keyAt(i); - pw.println("EAP_METHOD (" + eapType + "): " - + mInstalledPasspointProfileType.valueAt(i)); - } + pw.println("mWifiLogProto.installedPasspointProfileTypeForR1:" + + mInstalledPasspointProfileTypeForR1); + pw.println("mWifiLogProto.installedPasspointProfileTypeForR2:" + + mInstalledPasspointProfileTypeForR2); pw.println("mWifiLogProto.passpointProvisionStats.numProvisionSuccess=" + mNumProvisionSuccess); @@ -2907,7 +2907,8 @@ public class WifiMetrics { int eapType; PasspointConfiguration config; synchronized (mLock) { - mInstalledPasspointProfileType.clear(); + mInstalledPasspointProfileTypeForR1.clear(); + mInstalledPasspointProfileTypeForR2.clear(); for (Map.Entry<String, PasspointProvider> entry : providers.entrySet()) { config = entry.getValue().getConfig(); if (config.getCredential().getUserCredential() != null) { @@ -2940,8 +2941,11 @@ public class WifiMetrics { passpointType = WifiMetricsProto.PasspointProfileTypeCount.TYPE_UNKNOWN; } - int count = mInstalledPasspointProfileType.get(passpointType); - mInstalledPasspointProfileType.put(passpointType, count + 1); + if (config.validateForR2()) { + mInstalledPasspointProfileTypeForR2.increment(passpointType); + } else { + mInstalledPasspointProfileTypeForR1.increment(passpointType); + } } } } @@ -3157,21 +3161,10 @@ public class WifiMetrics { notificationActionCountArray[i] = keyVal; } - /** - * Convert the SparseIntArray of saved Passpoint profile types and counts to proto's - * repeated IntKeyVal array. - */ - int counts = mInstalledPasspointProfileType.size(); - mWifiLogProto.installedPasspointProfileType = - new WifiMetricsProto.PasspointProfileTypeCount[counts]; - for (int i = 0; i < counts; i++) { - mWifiLogProto.installedPasspointProfileType[i] = - new WifiMetricsProto.PasspointProfileTypeCount(); - mWifiLogProto.installedPasspointProfileType[i].eapMethodType = - mInstalledPasspointProfileType.keyAt(i); - mWifiLogProto.installedPasspointProfileType[i].count = - mInstalledPasspointProfileType.valueAt(i); - } + mWifiLogProto.installedPasspointProfileTypeForR1 = + convertPasspointProfilesToProto(mInstalledPasspointProfileTypeForR1); + mWifiLogProto.installedPasspointProfileTypeForR2 = + convertPasspointProfilesToProto(mInstalledPasspointProfileTypeForR2); mWifiLogProto.connectToNetworkNotificationActionCount = notificationActionCountArray; @@ -3458,7 +3451,8 @@ public class WifiMetrics { mWifiWakeMetrics.clear(); mObserved80211mcApInScanHistogram.clear(); mWifiIsUnusableList.clear(); - mInstalledPasspointProfileType.clear(); + mInstalledPasspointProfileTypeForR1.clear(); + mInstalledPasspointProfileTypeForR2.clear(); mWifiUsabilityStatsListGood.clear(); mWifiUsabilityStatsListBad.clear(); mWifiUsabilityStatsEntriesList.clear(); @@ -4531,6 +4525,22 @@ public class WifiMetrics { } /** + * Convert the IntCounter of passpoint profile types and counts to proto's + * repeated IntKeyVal array. + * + * @param passpointProfileTypes passpoint profile types and counts. + */ + private PasspointProfileTypeCount[] convertPasspointProfilesToProto( + IntCounter passpointProfileTypes) { + return passpointProfileTypes.toProto(PasspointProfileTypeCount.class, (key, count) -> { + PasspointProfileTypeCount entry = new PasspointProfileTypeCount(); + entry.eapMethodType = key; + entry.count = count; + return entry; + }); + } + + /** * Reports that the device entered a new mobility state. * * @param newState the new device mobility state. |