summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2018-05-14 15:55:26 -0700
committerRoshan Pius <rpius@google.com>2018-05-17 14:53:08 -0700
commitb4846aff56ffd388ff02400a144da80ff73b87bd (patch)
treec94a93c37f5c5f0311fea7747ef828ce82dcc0b2 /service
parent8964a106164d84089c1ee52b62973c346115822b (diff)
WifiMetrics: Add metrics when softap band preference unsatisfied
Bug: 79701630 Test: Unit tests Test: Validated that the metric is updated when STA + AP forces the AP to not satisfy the band preference. (act.py -c softap_cross_onhub.config -tb dut-name -tc WifiStaApConcurrencyTest:test_wifi_connection_5G_DFS_softap_5G) Change-Id: Ib3131d25969a9d89f8b46f6dc788fb2a16324909
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:"