diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-05-18 17:34:52 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-05-18 17:34:52 +0000 |
commit | d94eb7a0e5d182f9dce6ff04bb0329dedd879327 (patch) | |
tree | 0f6721b9d1f3814a8942691b0cbf60f4771e715e /service | |
parent | 89b55624576c60a1a42b9111c8bde2011f57a407 (diff) | |
parent | b4846aff56ffd388ff02400a144da80ff73b87bd (diff) |
Merge "WifiMetrics: Add metrics when softap band preference unsatisfied" into pi-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/SoftApManager.java | 27 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 11 |
2 files changed, 38 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java index 99bdb5b98..2faf11577 100644 --- a/service/java/com/android/server/wifi/SoftApManager.java +++ b/service/java/com/android/server/wifi/SoftApManager.java @@ -26,6 +26,7 @@ import android.content.Intent; import android.database.ContentObserver; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; +import android.net.wifi.WifiScanner; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -37,6 +38,7 @@ import android.util.Log; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.util.ArrayUtils; import com.android.internal.util.IState; import com.android.internal.util.State; import com.android.internal.util.StateMachine; @@ -47,7 +49,9 @@ import com.android.server.wifi.util.ApConfigUtil; import java.io.FileDescriptor; import java.io.PrintWriter; +import java.util.Arrays; import java.util.Locale; +import java.util.stream.Stream; /** * Manage WiFi in AP mode. @@ -530,6 +534,29 @@ public class SoftApManager implements ActiveModeManager { + " Bandwidth: " + mReportedBandwidth); mWifiMetrics.addSoftApChannelSwitchedEvent(mReportedFrequency, mReportedBandwidth, mMode); + int[] allowedChannels = new int[0]; + if (mApConfig.apBand == WifiConfiguration.AP_BAND_2GHZ) { + allowedChannels = + mWifiNative.getChannelsForBand(WifiScanner.WIFI_BAND_24_GHZ); + } else if (mApConfig.apBand == WifiConfiguration.AP_BAND_5GHZ) { + allowedChannels = + mWifiNative.getChannelsForBand(WifiScanner.WIFI_BAND_5_GHZ); + } else if (mApConfig.apBand == WifiConfiguration.AP_BAND_ANY) { + int[] allowed2GChannels = + mWifiNative.getChannelsForBand(WifiScanner.WIFI_BAND_24_GHZ); + int[] allowed5GChannels = + mWifiNative.getChannelsForBand(WifiScanner.WIFI_BAND_5_GHZ); + allowedChannels = Stream.concat( + Arrays.stream(allowed2GChannels).boxed(), + Arrays.stream(allowed5GChannels).boxed()) + .mapToInt(Integer::valueOf) + .toArray(); + } + if (!ArrayUtils.contains(allowedChannels, mReportedFrequency)) { + Log.e(TAG, "Channel does not satisfy user band preference: " + + mReportedFrequency); + mWifiMetrics.incrementNumSoftApUserBandPreferenceUnsatisfied(); + } break; case CMD_TIMEOUT_TOGGLE_CHANGED: boolean isEnabled = (message.arg1 == 1); diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 93dec11eb..3097658d3 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -1549,6 +1549,15 @@ public class WifiMetrics { } /** + * Increment number of times we detected a channel did not satisfy user band preference. + */ + public void incrementNumSoftApUserBandPreferenceUnsatisfied() { + synchronized (mLock) { + mWifiLogProto.numSoftApUserBandPreferenceUnsatisfied++; + } + } + + /** * Increment N-Way network selection decision histograms: * Counts the size of various sets of scanDetails within a scan, and increment the occurrence * of that size for the associated histogram. There are ten histograms generated for each @@ -1994,6 +2003,8 @@ public class WifiMetrics { + mWifiLogProto.numRadioModeChangeToSbs); pw.println("mWifiLogProto.numRadioModeChangeToDbs=" + mWifiLogProto.numRadioModeChangeToDbs); + pw.println("mWifiLogProto.numSoftApUserBandPreferenceUnsatisfied=" + + mWifiLogProto.numSoftApUserBandPreferenceUnsatisfied); pw.println("mTotalSsidsInScanHistogram:" + mTotalSsidsInScanHistogram.toString()); pw.println("mTotalBssidsInScanHistogram:" |