summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorJimmy Chen <jimmycmchen@google.com>2020-03-11 08:14:46 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-03-11 08:14:46 +0000
commit22a0e13df9041d2e977209441dc61e27472297d4 (patch)
tree13ca1f20cdf1927c1301bc07553cef75c3ff9298 /service
parent2527b242a269131a480a48bf0ea4b396eef988a4 (diff)
parentb5766e42817888f251458461f3e693ccd2f62dcc (diff)
Merge "Wifi: add enterprise connection metrics" into rvc-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/SupplicantStaIfaceHal.java8
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java2
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java38
-rw-r--r--service/proto/src/metrics.proto21
4 files changed, 65 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
index 2f4e0b4b1..9d8f4eecd 100644
--- a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
+++ b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
@@ -123,6 +123,7 @@ public class SupplicantStaIfaceHal {
private final Handler mEventHandler;
private DppEventCallback mDppCallback = null;
private final Clock mClock;
+ private final WifiMetrics mWifiMetrics;
private final IServiceNotification mServiceNotificationCallback =
new IServiceNotification.Stub() {
@@ -178,12 +179,13 @@ public class SupplicantStaIfaceHal {
public SupplicantStaIfaceHal(Context context, WifiMonitor monitor,
FrameworkFacade frameworkFacade, Handler handler,
- Clock clock) {
+ Clock clock, WifiMetrics wifiMetrics) {
mContext = context;
mWifiMonitor = monitor;
mFrameworkFacade = frameworkFacade;
mEventHandler = handler;
mClock = clock;
+ mWifiMetrics = wifiMetrics;
mServiceManagerDeathRecipient = new ServiceManagerDeathRecipient();
mSupplicantDeathRecipient = new SupplicantDeathRecipient();
@@ -987,8 +989,8 @@ public class SupplicantStaIfaceHal {
if (pmkData != null
&& pmkData.expirationTimeInSec > mClock.getElapsedSinceBootMillis() / 1000) {
logi("Set PMK cache for config id " + config.networkId);
- if (!networkHandle.setPmkCache(pmkData.data)) {
- loge("Set PMK cache failed.");
+ if (networkHandle.setPmkCache(pmkData.data)) {
+ mWifiMetrics.setConnectionPmkCache(true);
}
}
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 60e1d60db..1a364c18d 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -220,7 +220,7 @@ public class WifiInjector {
mHalDeviceManager = new HalDeviceManager(mClock, wifiHandler);
mWifiVendorHal = new WifiVendorHal(mHalDeviceManager, wifiHandler);
mSupplicantStaIfaceHal = new SupplicantStaIfaceHal(
- mContext, mWifiMonitor, mFrameworkFacade, wifiHandler, mClock);
+ mContext, mWifiMonitor, mFrameworkFacade, wifiHandler, mClock, mWifiMetrics);
mHostapdHal = new HostapdHal(mContext, wifiHandler);
mWifiCondManager = (WifiNl80211Manager) mContext.getSystemService(
Context.WIFI_NL80211_SERVICE);
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index bd369f84b..141da8a3d 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -476,6 +476,8 @@ public class WifiMetrics {
sb.append(", mSupportsIpv6=" + mRouterFingerPrintProto.supportsIpv6);
sb.append(", mEapMethod=" + mRouterFingerPrintProto.eapMethod);
sb.append(", mAuthPhase2Method=" + mRouterFingerPrintProto.authPhase2Method);
+ sb.append(", mOcspType=" + mRouterFingerPrintProto.ocspType);
+ sb.append(", mPmkCache=" + mRouterFingerPrintProto.pmkCacheEnabled);
}
return sb.toString();
}
@@ -521,10 +523,19 @@ public class WifiMetrics {
int phase2Method = config.enterpriseConfig.getPhase2Method();
mCurrentConnectionEvent.mRouterFingerPrint.mRouterFingerPrintProto
.authPhase2Method = getAuthPhase2MethodProto(phase2Method);
+ int ocspType = config.enterpriseConfig.getOcsp();
+ mCurrentConnectionEvent.mRouterFingerPrint.mRouterFingerPrintProto
+ .ocspType = getOcspTypeProto(ocspType);
}
}
}
}
+
+ public void setPmkCache(boolean isEnabled) {
+ synchronized (mLock) {
+ mRouterFingerPrintProto.pmkCacheEnabled = isEnabled;
+ }
+ }
}
private int getEapMethodProto(int eapMethod) {
switch (eapMethod) {
@@ -571,6 +582,22 @@ public class WifiMetrics {
}
}
+ private int getOcspTypeProto(int ocspType) {
+ switch (ocspType) {
+ case WifiEnterpriseConfig.OCSP_NONE:
+ return WifiMetricsProto.RouterFingerPrint.TYPE_OCSP_NONE;
+ case WifiEnterpriseConfig.OCSP_REQUEST_CERT_STATUS:
+ return WifiMetricsProto.RouterFingerPrint.TYPE_OCSP_REQUEST_CERT_STATUS;
+ case WifiEnterpriseConfig.OCSP_REQUIRE_CERT_STATUS:
+ return WifiMetricsProto.RouterFingerPrint.TYPE_OCSP_REQUIRE_CERT_STATUS;
+ case WifiEnterpriseConfig.OCSP_REQUIRE_ALL_NON_TRUSTED_CERTS_STATUS:
+ return WifiMetricsProto.RouterFingerPrint
+ .TYPE_OCSP_REQUIRE_ALL_NON_TRUSTED_CERTS_STATUS;
+ default:
+ return WifiMetricsProto.RouterFingerPrint.TYPE_OCSP_NONE;
+ }
+ }
+
class BssidBlocklistStats {
public IntCounter networkSelectionFilteredBssidCount = new IntCounter();
public int numHighMovementConnectionSkipped = 0;
@@ -1282,6 +1309,17 @@ public class WifiMetrics {
}
/**
+ * Set PMK cache status for a connection event
+ */
+ public void setConnectionPmkCache(boolean isEnabled) {
+ synchronized (mLock) {
+ if (mCurrentConnectionEvent != null) {
+ mCurrentConnectionEvent.mRouterFingerPrint.setPmkCache(isEnabled);
+ }
+ }
+ }
+
+ /**
* End a Connection event record. Call when wifi connection attempt succeeds or fails.
* If a Connection event has not been started and is active when .end is called, then this
* method will do nothing.
diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto
index 138c1e143..c3d88bb0f 100644
--- a/service/proto/src/metrics.proto
+++ b/service/proto/src/metrics.proto
@@ -720,6 +720,21 @@ message RouterFingerPrint {
TYPE_PHASE2_AKA_PRIME = 7;
}
+ enum OcspType {
+ // Do not use OCSP stapling
+ TYPE_OCSP_NONE = 0;
+
+ // Try to use OCSP stapling, but not require response
+ TYPE_OCSP_REQUEST_CERT_STATUS = 1;
+
+ // Require valid OCSP stapling response
+ TYPE_OCSP_REQUIRE_CERT_STATUS = 2;
+
+ // Require valid OCSP stapling response for all not-trusted certificates
+ // in the server certificate chain
+ TYPE_OCSP_REQUIRE_ALL_NON_TRUSTED_CERTS_STATUS = 3;
+ }
+
optional RoamType roam_type = 1;
// Channel on which the connection takes place.
@@ -748,6 +763,12 @@ message RouterFingerPrint {
// Phase 2 authentication method after setting up a secure channel
optional AuthPhase2Method auth_phase2_method = 10;
+
+ // Online certificate status protocol stapling type
+ optional OcspType ocsp_type = 11;
+
+ // PMK caching enablement
+ optional bool pmk_cache_enabled = 12;
}
message ConnectionEvent {