summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/SoftApManager.java27
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java11
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:"