diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-03-30 00:28:15 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-03-30 00:28:15 +0000 |
commit | fe62d25331c3d4b25055f9a519ecd039f253f476 (patch) | |
tree | cdf194ae3208f9f9303d5e4c14469b589bfa9b1f /service | |
parent | 9bb500a762043adce2fafe06ea3deddd7e8b5889 (diff) | |
parent | a79e9c8ea6461b65cef7a8542af088b8f2945ea2 (diff) |
Merge changes from topic "native_metrics" into pi-dev
* changes:
WifiNative: Add interface down metrics
WifiMetrics: Add new metrics for SoftAp on failure
WifiMetrics: Add new metrics for supplicant/hostapd crashes
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 86 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiNative.java | 27 |
2 files changed, 87 insertions, 26 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 99cbdb0c3..eaeb64618 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -1333,8 +1333,7 @@ public class WifiMetrics { */ public void incrementNumSupplicantCrashes() { synchronized (mLock) { - // TODO(b/71720421): Add metrics for supplicant crashes. - mWifiLogProto.numHalCrashes++; + mWifiLogProto.numSupplicantCrashes++; } } @@ -1343,36 +1342,79 @@ public class WifiMetrics { */ public void incrementNumHostapdCrashes() { synchronized (mLock) { - // TODO(b/71720421): Add metrics for hostapd crashes. - mWifiLogProto.numHalCrashes++; + mWifiLogProto.numHostapdCrashes++; } } /** * Increment number of times the wifi on failed due to an error in HAL. */ - public void incrementNumWifiOnFailureDueToHal() { + public void incrementNumSetupClientInterfaceFailureDueToHal() { synchronized (mLock) { - mWifiLogProto.numWifiOnFailureDueToHal++; + mWifiLogProto.numSetupClientInterfaceFailureDueToHal++; } } /** * Increment number of times the wifi on failed due to an error in wificond. */ - public void incrementNumWifiOnFailureDueToWificond() { + public void incrementNumSetupClientInterfaceFailureDueToWificond() { synchronized (mLock) { - mWifiLogProto.numWifiOnFailureDueToWificond++; + mWifiLogProto.numSetupClientInterfaceFailureDueToWificond++; } } /** - * Increment number of times the wifi on failed due to an error in wificond. + * Increment number of times the wifi on failed due to an error in supplicant. + */ + public void incrementNumSetupClientInterfaceFailureDueToSupplicant() { + synchronized (mLock) { + mWifiLogProto.numSetupClientInterfaceFailureDueToSupplicant++; + } + } + + /** + * Increment number of times the SoftAp on failed due to an error in HAL. + */ + public void incrementNumSetupSoftApInterfaceFailureDueToHal() { + synchronized (mLock) { + mWifiLogProto.numSetupSoftApInterfaceFailureDueToHal++; + } + } + + /** + * Increment number of times the SoftAp on failed due to an error in wificond. + */ + public void incrementNumSetupSoftApInterfaceFailureDueToWificond() { + synchronized (mLock) { + mWifiLogProto.numSetupSoftApInterfaceFailureDueToWificond++; + } + } + + /** + * Increment number of times the SoftAp on failed due to an error in hostapd. + */ + public void incrementNumSetupSoftApInterfaceFailureDueToHostapd() { + synchronized (mLock) { + mWifiLogProto.numSetupSoftApInterfaceFailureDueToHostapd++; + } + } + + /** + * Increment number of times we got client interface down. + */ + public void incrementNumClientInterfaceDown() { + synchronized (mLock) { + mWifiLogProto.numClientInterfaceDown++; + } + } + + /** + * Increment number of times we got client interface down. */ - public void incrementNumWifiOnFailureDueToSupplicant() { + public void incrementNumSoftApInterfaceDown() { synchronized (mLock) { - // TODO(b/71720421): Add metrics for supplicant failure during startup. - mWifiLogProto.numWifiOnFailureDueToHal++; + mWifiLogProto.numSoftApInterfaceDown++; } } @@ -1797,10 +1839,22 @@ public class WifiMetrics { + mWifiLogProto.numHalCrashes); pw.println("mWifiLogProto.numWificondCrashes=" + mWifiLogProto.numWificondCrashes); - pw.println("mWifiLogProto.numWifiOnFailureDueToHal=" - + mWifiLogProto.numWifiOnFailureDueToHal); - pw.println("mWifiLogProto.numWifiOnFailureDueToWificond=" - + mWifiLogProto.numWifiOnFailureDueToWificond); + pw.println("mWifiLogProto.numSupplicantCrashes=" + + mWifiLogProto.numSupplicantCrashes); + pw.println("mWifiLogProto.numHostapdCrashes=" + + mWifiLogProto.numHostapdCrashes); + pw.println("mWifiLogProto.numSetupClientInterfaceFailureDueToHal=" + + mWifiLogProto.numSetupClientInterfaceFailureDueToHal); + pw.println("mWifiLogProto.numSetupClientInterfaceFailureDueToWificond=" + + mWifiLogProto.numSetupClientInterfaceFailureDueToWificond); + pw.println("mWifiLogProto.numSetupClientInterfaceFailureDueToSupplicant=" + + mWifiLogProto.numSetupClientInterfaceFailureDueToSupplicant); + pw.println("mWifiLogProto.numSetupSoftApInterfaceFailureDueToHal=" + + mWifiLogProto.numSetupSoftApInterfaceFailureDueToHal); + pw.println("mWifiLogProto.numSetupSoftApInterfaceFailureDueToWificond=" + + mWifiLogProto.numSetupSoftApInterfaceFailureDueToWificond); + pw.println("mWifiLogProto.numSetupSoftApInterfaceFailureDueToHostapd=" + + mWifiLogProto.numSetupSoftApInterfaceFailureDueToHostapd); pw.println("StaEventList:"); for (StaEventWithTime event : mStaEventList) { pw.println(event); diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index 5d838b0fd..4beb6c332 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -557,6 +557,11 @@ public class WifiNative { iface.externalListener.onUp(iface.name); } else { iface.externalListener.onDown(iface.name); + if (iface.type == Iface.IFACE_TYPE_STA) { + mWifiMetrics.incrementNumClientInterfaceDown(); + } else if (iface.type == Iface.IFACE_TYPE_AP) { + mWifiMetrics.incrementNumSoftApInterfaceDown(); + } } iface.isUp = isUp; } @@ -796,12 +801,12 @@ public class WifiNative { synchronized (mLock) { if (!startHal()) { Log.e(TAG, "Failed to start Hal"); - mWifiMetrics.incrementNumWifiOnFailureDueToHal(); + mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToHal(); return null; } if (!startSupplicant()) { Log.e(TAG, "Failed to start supplicant"); - mWifiMetrics.incrementNumWifiOnFailureDueToSupplicant(); + mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToSupplicant(); return null; } Iface iface = mIfaceMgr.allocateIface(Iface.IFACE_TYPE_STA); @@ -814,19 +819,19 @@ public class WifiNative { if (TextUtils.isEmpty(iface.name)) { Log.e(TAG, "Failed to create STA iface in vendor HAL"); mIfaceMgr.removeIface(iface.id); - mWifiMetrics.incrementNumWifiOnFailureDueToHal(); + mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToHal(); return null; } if (mWificondControl.setupInterfaceForClientMode(iface.name) == null) { Log.e(TAG, "Failed to setup iface in wificond on " + iface); teardownInterface(iface.name); - mWifiMetrics.incrementNumWifiOnFailureDueToWificond(); + mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToWificond(); return null; } if (!mSupplicantStaIfaceHal.setupIface(iface.name)) { Log.e(TAG, "Failed to setup iface in supplicant on " + iface); teardownInterface(iface.name); - mWifiMetrics.incrementNumWifiOnFailureDueToSupplicant(); + mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToSupplicant(); return null; } iface.networkObserver = new NetworkObserverInternal(iface.id); @@ -857,7 +862,7 @@ public class WifiNative { synchronized (mLock) { if (!startHal()) { Log.e(TAG, "Failed to start Hal"); - mWifiMetrics.incrementNumWifiOnFailureDueToHal(); + mWifiMetrics.incrementNumSetupSoftApInterfaceFailureDueToHal(); return null; } Iface iface = mIfaceMgr.allocateIface(Iface.IFACE_TYPE_AP); @@ -870,15 +875,13 @@ public class WifiNative { if (TextUtils.isEmpty(iface.name)) { Log.e(TAG, "Failed to create AP iface in vendor HAL"); mIfaceMgr.removeIface(iface.id); - // TODO(b/68716726): Separate SoftAp metrics - mWifiMetrics.incrementNumWifiOnFailureDueToHal(); + mWifiMetrics.incrementNumSetupSoftApInterfaceFailureDueToHal(); return null; } if (mWificondControl.setupInterfaceForSoftApMode(iface.name) == null) { Log.e(TAG, "Failed to setup iface in wificond on " + iface); teardownInterface(iface.name); - // TODO(b/68716726): Separate SoftAp metrics - mWifiMetrics.incrementNumWifiOnFailureDueToWificond(); + mWifiMetrics.incrementNumSetupSoftApInterfaceFailureDueToWificond(); return null; } iface.networkObserver = new NetworkObserverInternal(iface.id); @@ -1198,18 +1201,22 @@ public class WifiNative { @NonNull String ifaceName, WifiConfiguration config, SoftApListener listener) { if (!mWificondControl.startHostapd(ifaceName, listener)) { Log.e(TAG, "Failed to start hostapd"); + mWifiMetrics.incrementNumSetupSoftApInterfaceFailureDueToHostapd(); return false; } if (!waitForHostapdConnection()) { Log.e(TAG, "Failed to establish connection to hostapd"); + mWifiMetrics.incrementNumSetupSoftApInterfaceFailureDueToHostapd(); return false; } if (!mHostapdHal.registerDeathHandler(new HostapdDeathHandlerInternal())) { Log.e(TAG, "Failed to register hostapd death handler"); + mWifiMetrics.incrementNumSetupSoftApInterfaceFailureDueToHostapd(); return false; } if (!mHostapdHal.addAccessPoint(ifaceName, config)) { Log.e(TAG, "Failed to add acccess point"); + mWifiMetrics.incrementNumSetupSoftApInterfaceFailureDueToHostapd(); return false; } return true; |