summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorPeter Qiu <zqiu@google.com>2017-06-22 14:49:02 -0700
committerPeter Qiu <zqiu@google.com>2017-07-11 13:41:51 -0700
commit26b97ef6a6d8e755e7db541afa84aacd807599d7 (patch)
tree4bac866df81ac8dfbdf1bcbce7a67bea872c6ab4 /service
parent35eb2c8f6479eec50cf681c23f1a21a8ce14a691 (diff)
WifiMetrics: add support for Passpoint related metrics
The support for tracking number of Passpoint providers that provided successful network connection will be added in the upcoming CL. Bug: 36358031 Test: frameworks/wifi/tests/wifitests/runtests.sh Change-Id: Id0dc3bc6a3d30785c883b8a478be9b23911d3747
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java3
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java59
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java1
-rw-r--r--service/java/com/android/server/wifi/hotspot2/PasspointManager.java10
4 files changed, 71 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index c4be62570..0b0c38002 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -216,7 +216,8 @@ public class WifiInjector {
mWifiNetworkScoreCache);
mSimAccessor = new SIMAccessor(mContext);
mPasspointManager = new PasspointManager(mContext, mWifiNative, mWifiKeyStore, mClock,
- mSimAccessor, new PasspointObjectFactory(), mWifiConfigManager, mWifiConfigStore);
+ mSimAccessor, new PasspointObjectFactory(), mWifiConfigManager, mWifiConfigStore,
+ mWifiMetrics);
mPasspointNetworkEvaluator = new PasspointNetworkEvaluator(
mPasspointManager, mWifiConfigManager, mConnectivityLocalLog);
// mWifiStateMachine has an implicit dependency on mJavaRuntime due to WifiDiagnostics.
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index 0caf79e79..1128d3c77 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -1025,6 +1025,41 @@ public class WifiMetrics {
}
}
+ /**
+ * Increment number of times Passpoint provider being installed.
+ */
+ public void incrementNumPasspointProviderInstallation() {
+ synchronized (mLock) {
+ mWifiLogProto.numPasspointProviderInstallation++;
+ }
+ }
+
+ /**
+ * Increment number of times Passpoint provider is installed successfully.
+ */
+ public void incrementNumPasspointProviderInstallSuccess() {
+ synchronized (mLock) {
+ mWifiLogProto.numPasspointProviderInstallSuccess++;
+ }
+ }
+
+ /**
+ * Increment number of times Passpoint provider being uninstalled.
+ */
+ public void incrementNumPasspointProviderUninstallation() {
+ synchronized (mLock) {
+ mWifiLogProto.numPasspointProviderUninstallation++;
+ }
+ }
+
+ /**
+ * Increment number of times Passpoint provider is uninstalled successfully.
+ */
+ public void incrementNumPasspointProviderUninstallSuccess() {
+ synchronized (mLock) {
+ mWifiLogProto.numPasspointProviderUninstallSuccess++;
+ }
+ }
public static final String PROTO_DUMP_ARG = "wifiMetricsProto";
public static final String CLEAN_DUMP_ARG = "clean";
@@ -1228,6 +1263,19 @@ public class WifiMetrics {
pw.println(staEventToString(event));
}
+ pw.println("mWifiLogProto.numPasspointProviders="
+ + mWifiLogProto.numPasspointProviders);
+ pw.println("mWifiLogProto.numPasspointProviderInstallation="
+ + mWifiLogProto.numPasspointProviderInstallation);
+ pw.println("mWifiLogProto.numPasspointProviderInstallSuccess="
+ + mWifiLogProto.numPasspointProviderInstallSuccess);
+ pw.println("mWifiLogProto.numPasspointProviderUninstallation="
+ + mWifiLogProto.numPasspointProviderUninstallation);
+ pw.println("mWifiLogProto.numPasspointProviderUninstallSuccess="
+ + mWifiLogProto.numPasspointProviderUninstallSuccess);
+ pw.println("mWifiLogProto.numPasspointProvidersSuccessfullyConnected="
+ + mWifiLogProto.numPasspointProvidersSuccessfullyConnected);
+
pw.println("mWifiAwareMetrics:");
mWifiAwareMetrics.dump(fd, pw, args);
}
@@ -1273,6 +1321,17 @@ public class WifiMetrics {
}
/**
+ * Update number of saved Passpoint profiles.
+ *
+ * @param numSavedProfiles The number of saved Passpoint profiles
+ */
+ public void updateSavedPasspointProfiles(int numSavedProfiles) {
+ synchronized (mLock) {
+ mWifiLogProto.numPasspointProviders = numSavedProfiles;
+ }
+ }
+
+ /**
* append the separate ConnectionEvent, SystemStateEntry and ScanReturnCode collections to their
* respective lists within mWifiLogProto
*
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 0fb61df17..688a53cb8 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -6985,6 +6985,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
*/
public void updateWifiMetrics() {
mWifiMetrics.updateSavedNetworks(mWifiConfigManager.getSavedNetworks());
+ mWifiMetrics.updateSavedPasspointProfiles(mPasspointManager.getProviderConfigs().size());
}
/**
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java
index 3695ba35f..dad622136 100644
--- a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java
+++ b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java
@@ -45,6 +45,7 @@ import com.android.server.wifi.SIMAccessor;
import com.android.server.wifi.WifiConfigManager;
import com.android.server.wifi.WifiConfigStore;
import com.android.server.wifi.WifiKeyStore;
+import com.android.server.wifi.WifiMetrics;
import com.android.server.wifi.WifiNative;
import com.android.server.wifi.hotspot2.anqp.ANQPElement;
import com.android.server.wifi.hotspot2.anqp.Constants;
@@ -97,6 +98,7 @@ public class PasspointManager {
private final ANQPRequestManager mAnqpRequestManager;
private final WifiConfigManager mWifiConfigManager;
private final CertificateVerifier mCertVerifier;
+ private final WifiMetrics mWifiMetrics;
// Counter used for assigning unique identifier to each provider.
private long mProviderIndex;
@@ -194,7 +196,8 @@ public class PasspointManager {
public PasspointManager(Context context, WifiNative wifiNative, WifiKeyStore keyStore,
Clock clock, SIMAccessor simAccessor, PasspointObjectFactory objectFactory,
- WifiConfigManager wifiConfigManager, WifiConfigStore wifiConfigStore) {
+ WifiConfigManager wifiConfigManager, WifiConfigStore wifiConfigStore,
+ WifiMetrics wifiMetrics) {
mHandler = objectFactory.makePasspointEventHandler(wifiNative,
new CallbackHandler(context));
mKeyStore = keyStore;
@@ -205,6 +208,7 @@ public class PasspointManager {
mAnqpRequestManager = objectFactory.makeANQPRequestManager(mHandler, clock);
mCertVerifier = objectFactory.makeCertificateVerifier();
mWifiConfigManager = wifiConfigManager;
+ mWifiMetrics = wifiMetrics;
mProviderIndex = 0;
wifiConfigStore.registerStoreData(objectFactory.makePasspointConfigStoreData(
mKeyStore, mSimAccessor, new DataSourceHandler()));
@@ -222,6 +226,7 @@ public class PasspointManager {
* @return true if provider is added, false otherwise
*/
public boolean addOrUpdateProvider(PasspointConfiguration config, int uid) {
+ mWifiMetrics.incrementNumPasspointProviderInstallation();
if (config == null) {
Log.e(TAG, "Configuration not provided");
return false;
@@ -266,6 +271,7 @@ public class PasspointManager {
mWifiConfigManager.saveToStore(true /* forceWrite */);
Log.d(TAG, "Added/updated Passpoint configuration: " + config.getHomeSp().getFqdn()
+ " by " + uid);
+ mWifiMetrics.incrementNumPasspointProviderInstallSuccess();
return true;
}
@@ -276,6 +282,7 @@ public class PasspointManager {
* @return true if a provider is removed, false otherwise
*/
public boolean removeProvider(String fqdn) {
+ mWifiMetrics.incrementNumPasspointProviderUninstallation();
if (!mProviders.containsKey(fqdn)) {
Log.e(TAG, "Config doesn't exist");
return false;
@@ -285,6 +292,7 @@ public class PasspointManager {
mProviders.remove(fqdn);
mWifiConfigManager.saveToStore(true /* forceWrite */);
Log.d(TAG, "Removed Passpoint configuration: " + fqdn);
+ mWifiMetrics.incrementNumPasspointProviderUninstallSuccess();
return true;
}