summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/BubbleFunScorer.java3
-rw-r--r--service/java/com/android/server/wifi/CompatibilityScorer.java6
-rw-r--r--service/java/com/android/server/wifi/ScoreCardBasedScorer.java6
-rw-r--r--service/java/com/android/server/wifi/ScoringParams.java23
-rw-r--r--service/java/com/android/server/wifi/ThroughputPredictor.java2
-rw-r--r--service/java/com/android/server/wifi/VelocityBasedConnectedScore.java3
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java7
-rw-r--r--service/java/com/android/server/wifi/WifiDataStall.java14
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java8
-rw-r--r--service/java/com/android/server/wifi/WifiShellCommand.java2
-rw-r--r--service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java20
-rw-r--r--service/java/com/android/server/wifi/util/ApConfigUtil.java75
-rw-r--r--tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ScoringParamsTest.java21
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WakeupEvaluatorTest.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java15
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/KnownBandsChannelHelperTest.java92
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/ScanScheduleUtilFilterTest.java88
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java132
-rw-r--r--tests/wifitests/src/com/android/server/wifi/util/ApConfigUtilTest.java23
21 files changed, 253 insertions, 299 deletions
diff --git a/service/java/com/android/server/wifi/BubbleFunScorer.java b/service/java/com/android/server/wifi/BubbleFunScorer.java
index e14fef0eb..fd18c14eb 100644
--- a/service/java/com/android/server/wifi/BubbleFunScorer.java
+++ b/service/java/com/android/server/wifi/BubbleFunScorer.java
@@ -17,6 +17,7 @@
package com.android.server.wifi;
import android.annotation.NonNull;
+import android.net.wifi.ScanResult;
import com.android.server.wifi.WifiCandidates.Candidate;
import com.android.server.wifi.WifiCandidates.ScoredCandidate;
@@ -74,7 +75,7 @@ final class BubbleFunScorer implements WifiCandidates.CandidateScorer {
// Prefer 5GHz/6GHz when all are strong, but at the fringes, 2.4 might be better
// Typically the entry rssi is lower for the 2.4 band, which provides the fringe boost
- if (candidate.getFrequency() < ScoringParams.MINIMUM_5GHZ_BAND_FREQUENCY_IN_MEGAHERTZ) {
+ if (ScanResult.is24GHz(candidate.getFrequency())) {
score *= LOW_BAND_FACTOR;
gain *= LOW_BAND_FACTOR;
}
diff --git a/service/java/com/android/server/wifi/CompatibilityScorer.java b/service/java/com/android/server/wifi/CompatibilityScorer.java
index 996324b0a..96b5004f5 100644
--- a/service/java/com/android/server/wifi/CompatibilityScorer.java
+++ b/service/java/com/android/server/wifi/CompatibilityScorer.java
@@ -17,6 +17,7 @@
package com.android.server.wifi;
import android.annotation.NonNull;
+import android.net.wifi.ScanResult;
import com.android.server.wifi.WifiCandidates.Candidate;
import com.android.server.wifi.WifiCandidates.ScoredCandidate;
@@ -79,10 +80,9 @@ final class CompatibilityScorer implements WifiCandidates.CandidateScorer {
int rssi = Math.min(candidate.getScanRssi(), rssiSaturationThreshold);
int score = (rssi + RSSI_SCORE_OFFSET) * RSSI_SCORE_SLOPE_IS_4;
- if (candidate.getFrequency() > ScoringParams.MINIMUM_6GHZ_BAND_FREQUENCY_IN_MEGAHERTZ) {
+ if (ScanResult.is6GHz(candidate.getFrequency())) {
score += BAND_6GHZ_AWARD_IS_40;
- } else if (candidate.getFrequency()
- >= ScoringParams.MINIMUM_5GHZ_BAND_FREQUENCY_IN_MEGAHERTZ) {
+ } else if (ScanResult.is5GHz(candidate.getFrequency())) {
score += BAND_5GHZ_AWARD_IS_40;
}
score += (int) (candidate.getLastSelectionWeight() * LAST_SELECTION_AWARD_IS_480);
diff --git a/service/java/com/android/server/wifi/ScoreCardBasedScorer.java b/service/java/com/android/server/wifi/ScoreCardBasedScorer.java
index 3ced720c3..7363a771b 100644
--- a/service/java/com/android/server/wifi/ScoreCardBasedScorer.java
+++ b/service/java/com/android/server/wifi/ScoreCardBasedScorer.java
@@ -17,6 +17,7 @@
package com.android.server.wifi;
import android.annotation.NonNull;
+import android.net.wifi.ScanResult;
import com.android.server.wifi.WifiCandidates.Candidate;
import com.android.server.wifi.WifiCandidates.ScoredCandidate;
@@ -88,10 +89,9 @@ final class ScoreCardBasedScorer implements WifiCandidates.CandidateScorer {
int cutoff = estimatedCutoff(candidate);
int score = (rssi - cutoff) * RSSI_SCORE_SLOPE_IS_4;
- if (candidate.getFrequency() > ScoringParams.MINIMUM_6GHZ_BAND_FREQUENCY_IN_MEGAHERTZ) {
+ if (ScanResult.is6GHz(candidate.getFrequency())) {
score += BAND_6GHZ_AWARD_IS_40;
- } else if (candidate.getFrequency()
- >= ScoringParams.MINIMUM_5GHZ_BAND_FREQUENCY_IN_MEGAHERTZ) {
+ } else if (ScanResult.is5GHz(candidate.getFrequency())) {
score += BAND_5GHZ_AWARD_IS_40;
}
score += (int) (candidate.getLastSelectionWeight() * LAST_SELECTION_AWARD_IS_480);
diff --git a/service/java/com/android/server/wifi/ScoringParams.java b/service/java/com/android/server/wifi/ScoringParams.java
index 16230fa34..460cb9c20 100644
--- a/service/java/com/android/server/wifi/ScoringParams.java
+++ b/service/java/com/android/server/wifi/ScoringParams.java
@@ -18,6 +18,7 @@ package com.android.server.wifi;
import android.annotation.NonNull;
import android.content.Context;
+import android.net.wifi.ScanResult;
import android.net.wifi.WifiInfo;
import android.util.Log;
@@ -33,10 +34,6 @@ import com.android.wifi.resources.R;
*
*/
public class ScoringParams {
- // A long name that describes itself pretty well
- public static final int MINIMUM_5GHZ_BAND_FREQUENCY_IN_MEGAHERTZ = 5000;
- public static final int MINIMUM_6GHZ_BAND_FREQUENCY_IN_MEGAHERTZ = 5925;
-
private final Context mContext;
private static final String TAG = "WifiScoringParams";
@@ -337,15 +334,6 @@ public class ScoringParams {
return printable;
}
- /** Constant to denote someplace in the 2.4 GHz band */
- public static final int BAND2 = 2400;
-
- /** Constant to denote someplace in the 5 GHz band */
- public static final int BAND5 = 5000;
-
- /** Constant to denote someplace in the 6 GHz band */
- public static final int BAND6 = 6000;
-
/**
* Returns the RSSI value at which the connection is deemed to be unusable,
* in the absence of other indications.
@@ -498,13 +486,16 @@ public class ScoringParams {
private int[] getRssiArray(int frequency) {
loadResources(mContext);
- if (frequency < MINIMUM_5GHZ_BAND_FREQUENCY_IN_MEGAHERTZ) {
+ if (ScanResult.is24GHz(frequency)) {
return mVal.rssi2;
- } else if (frequency < MINIMUM_6GHZ_BAND_FREQUENCY_IN_MEGAHERTZ) {
+ } else if (ScanResult.is5GHz(frequency)) {
return mVal.rssi5;
- } else {
+ } else if (ScanResult.is6GHz(frequency)) {
return mVal.rssi6;
}
+ // Invalid frequency use
+ Log.e(TAG, "Invalid frequency(" + frequency + "), using 5G as default rssi array");
+ return mVal.rssi5;
}
@Override
diff --git a/service/java/com/android/server/wifi/ThroughputPredictor.java b/service/java/com/android/server/wifi/ThroughputPredictor.java
index 0e750efc5..5cd8a5ce9 100644
--- a/service/java/com/android/server/wifi/ThroughputPredictor.java
+++ b/service/java/com/android/server/wifi/ThroughputPredictor.java
@@ -381,7 +381,7 @@ public class ThroughputPredictor {
private int getValidChannelUtilization(int frequency, int channelUtilizationBssLoad,
int channelUtilizationLinkLayerStats, boolean isBluetoothConnected) {
int channelUtilization;
- boolean is2G = (frequency < ScoringParams.MINIMUM_5GHZ_BAND_FREQUENCY_IN_MEGAHERTZ);
+ boolean is2G = ScanResult.is24GHz(frequency);
if (isValidUtilizationRatio(channelUtilizationBssLoad)) {
channelUtilization = channelUtilizationBssLoad;
} else if (isValidUtilizationRatio(channelUtilizationLinkLayerStats)) {
diff --git a/service/java/com/android/server/wifi/VelocityBasedConnectedScore.java b/service/java/com/android/server/wifi/VelocityBasedConnectedScore.java
index b7f45dbec..b931689a2 100644
--- a/service/java/com/android/server/wifi/VelocityBasedConnectedScore.java
+++ b/service/java/com/android/server/wifi/VelocityBasedConnectedScore.java
@@ -16,6 +16,7 @@
package com.android.server.wifi;
+import android.net.wifi.ScanResult;
import android.net.wifi.WifiInfo;
import com.android.server.wifi.util.KalmanFilter;
@@ -29,7 +30,7 @@ public class VelocityBasedConnectedScore extends ConnectedScore {
private final ScoringParams mScoringParams;
- private int mFrequency = ScoringParams.BAND5;
+ private int mFrequency = ScanResult.BAND_5_GHZ_START_FREQ_MHZ;
private double mThresholdAdjustment;
private final KalmanFilter mFilter;
private long mLastMillis;
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 9148e3a9e..975d446ea 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -1388,9 +1388,10 @@ public class WifiConnectivityManager {
pnoSettings.networkList = new PnoSettings.PnoNetwork[listSize];
pnoSettings.networkList = pnoNetworkList.toArray(pnoSettings.networkList);
- pnoSettings.min6GHzRssi = mScoringParams.getEntryRssi(ScoringParams.BAND6);
- pnoSettings.min5GHzRssi = mScoringParams.getEntryRssi(ScoringParams.BAND5);
- pnoSettings.min24GHzRssi = mScoringParams.getEntryRssi(ScoringParams.BAND2);
+ pnoSettings.min6GHzRssi = mScoringParams.getEntryRssi(ScanResult.BAND_6_GHZ_START_FREQ_MHZ);
+ pnoSettings.min5GHzRssi = mScoringParams.getEntryRssi(ScanResult.BAND_5_GHZ_START_FREQ_MHZ);
+ pnoSettings.min24GHzRssi = mScoringParams.getEntryRssi(
+ ScanResult.BAND_24_GHZ_START_FREQ_MHZ);
// Initialize scan settings
ScanSettings scanSettings = new ScanSettings();
diff --git a/service/java/com/android/server/wifi/WifiDataStall.java b/service/java/com/android/server/wifi/WifiDataStall.java
index ba1de327c..8dea0df61 100644
--- a/service/java/com/android/server/wifi/WifiDataStall.java
+++ b/service/java/com/android/server/wifi/WifiDataStall.java
@@ -19,6 +19,7 @@ package com.android.server.wifi;
import static com.android.server.wifi.util.InformationElementUtil.BssLoad.CHANNEL_UTILIZATION_SCALE;
import android.content.Context;
+import android.net.wifi.ScanResult;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager.DeviceMobilityState;
import android.os.Handler;
@@ -501,18 +502,18 @@ public class WifiDataStall {
private int getBand(int frequency) {
int band;
- if (frequency >= KnownBandsChannelHelper.BAND_24_GHZ_START_FREQ
- && frequency <= KnownBandsChannelHelper.BAND_24_GHZ_END_FREQ) {
+ if (ScanResult.is24GHz(frequency)) {
band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_2G;
- } else if (frequency >= KnownBandsChannelHelper.BAND_5_GHZ_START_FREQ
- && frequency <= KnownBandsChannelHelper.BAND_6_GHZ_END_FREQ) {
+ } else if (ScanResult.is5GHz(frequency)) {
if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_LOW_END_FREQ) {
band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_5G_LOW;
} else if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_MID_END_FREQ) {
band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_5G_MIDDLE;
- } else if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_END_FREQ) {
+ } else {
band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_5G_HIGH;
- } else if (frequency <= KnownBandsChannelHelper.BAND_6_GHZ_LOW_END_FREQ) {
+ }
+ } else if (ScanResult.is6GHz(frequency)) {
+ if (frequency <= KnownBandsChannelHelper.BAND_6_GHZ_LOW_END_FREQ) {
band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_6G_LOW;
} else if (frequency <= KnownBandsChannelHelper.BAND_6_GHZ_MID_END_FREQ) {
band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_6G_MIDDLE;
@@ -524,6 +525,7 @@ public class WifiDataStall {
}
return band;
}
+
private void logd(String string) {
if (mVerboseLoggingEnabled) {
Log.d(TAG, string);
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index da07edfc1..8aa027c60 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -2114,7 +2114,7 @@ public class WifiMetrics {
return;
}
synchronized (mLock) {
- if (frequency <= KnownBandsChannelHelper.BAND_24_GHZ_END_FREQ) {
+ if (ScanResult.is24GHz(frequency)) {
mTxLinkSpeedCount2g.increment(txLinkSpeed);
} else if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_LOW_END_FREQ) {
mTxLinkSpeedCount5gLow.increment(txLinkSpeed);
@@ -2139,7 +2139,7 @@ public class WifiMetrics {
return;
}
synchronized (mLock) {
- if (frequency <= KnownBandsChannelHelper.BAND_24_GHZ_END_FREQ) {
+ if (ScanResult.is24GHz(frequency)) {
mRxLinkSpeedCount2g.increment(rxLinkSpeed);
} else if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_LOW_END_FREQ) {
mRxLinkSpeedCount5gLow.increment(rxLinkSpeed);
@@ -2163,7 +2163,7 @@ public class WifiMetrics {
return;
}
synchronized (mLock) {
- if (frequency <= KnownBandsChannelHelper.BAND_24_GHZ_END_FREQ) {
+ if (ScanResult.is24GHz(frequency)) {
mChannelUtilizationHistogram2G.increment(channelUtilization);
} else {
mChannelUtilizationHistogramAbove2G.increment(channelUtilization);
@@ -2181,7 +2181,7 @@ public class WifiMetrics {
public void incrementThroughputKbpsCount(int txThroughputKbps, int rxThroughputKbps,
int frequency) {
synchronized (mLock) {
- if (frequency <= KnownBandsChannelHelper.BAND_24_GHZ_END_FREQ) {
+ if (ScanResult.is24GHz(frequency)) {
if (txThroughputKbps >= 0) {
mTxThroughputMbpsHistogram2G.increment(txThroughputKbps / 1000);
}
diff --git a/service/java/com/android/server/wifi/WifiShellCommand.java b/service/java/com/android/server/wifi/WifiShellCommand.java
index fd3649fec..842493c6d 100644
--- a/service/java/com/android/server/wifi/WifiShellCommand.java
+++ b/service/java/com/android/server/wifi/WifiShellCommand.java
@@ -281,7 +281,7 @@ public class WifiShellCommand extends BasicShellCommandHandler {
+ "- must be a positive integer");
return -1;
}
- int apChannel = ApConfigUtil.convertFrequencyToChannel(apChannelMHz);
+ int apChannel = ScanResult.convertFrequencyMhzToChannel(apChannelMHz);
int band = ApConfigUtil.convertFrequencyToBand(apChannelMHz);
if (apChannel == -1 || band == -1 || !isApChannelMHzValid(apChannelMHz)) {
pw.println("Invalid argument to 'force-softap-channel enabled' "
diff --git a/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java b/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java
index f2a744c31..ec43cde6c 100644
--- a/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java
+++ b/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java
@@ -28,6 +28,7 @@ import static android.net.wifi.WifiScanner.WIFI_BAND_INDEX_6_GHZ;
import static android.net.wifi.WifiScanner.WIFI_BAND_MAX;
import static android.net.wifi.WifiScanner.WIFI_BAND_UNSPECIFIED;
+import android.net.wifi.ScanResult;
import android.net.wifi.WifiAnnotations.WifiBandBasic;
import android.net.wifi.WifiScanner;
import android.net.wifi.WifiScanner.WifiBandIndex;
@@ -44,25 +45,18 @@ import java.util.stream.Collectors;
* This allows more fine operations on channels than if band channels are not known.
*/
public class KnownBandsChannelHelper extends ChannelHelper {
- public static final int BAND_24_GHZ_START_FREQ = 2400;
- public static final int BAND_24_GHZ_END_FREQ = 2500;
- public static final int BAND_5_GHZ_START_FREQ = 4900;
- public static final int BAND_5_GHZ_END_FREQ = 5875;
- public static final int BAND_6_GHZ_START_FREQ = 5925;
- public static final int BAND_6_GHZ_END_FREQ = 7125;
-
// 5G low includes U-NII-1 and Japan 4.9G band
public static final int BAND_5_GHZ_LOW_END_FREQ = 5240;
// 5G middle includes U-NII-2A and U-NII-2C
public static final int BAND_5_GHZ_MID_END_FREQ = 5710;
// 5G high includes U-NII-3
- public static final int BAND_5_GHZ_HIGH_END_FREQ = BAND_5_GHZ_END_FREQ;
+ public static final int BAND_5_GHZ_HIGH_END_FREQ = ScanResult.BAND_5_GHZ_END_FREQ_MHZ;
// 6G low includes UNII-5
public static final int BAND_6_GHZ_LOW_END_FREQ = 6425;
// 6G middle includes UNII-6 and UNII-7
public static final int BAND_6_GHZ_MID_END_FREQ = 6875;
// 6G high includes UNII-8
- public static final int BAND_6_GHZ_HIGH_END_FREQ = BAND_6_GHZ_END_FREQ;
+ public static final int BAND_6_GHZ_HIGH_END_FREQ = ScanResult.BAND_6_GHZ_END_FREQ_MHZ;
private WifiScanner.ChannelSpec[][] mBandsToChannels;
@@ -175,15 +169,15 @@ public class KnownBandsChannelHelper extends ChannelHelper {
// TODO this should be rewritten to be based on the input data instead of hardcoded ranges
private int getBandFromChannel(int frequency) {
- if (BAND_24_GHZ_START_FREQ <= frequency && frequency < BAND_24_GHZ_END_FREQ) {
+ if (ScanResult.is24GHz(frequency)) {
return WIFI_BAND_24_GHZ;
- } else if (BAND_5_GHZ_START_FREQ <= frequency && frequency < BAND_5_GHZ_END_FREQ) {
+ } else if (ScanResult.is5GHz(frequency)) {
if (isDfsChannel(frequency)) {
return WIFI_BAND_5_GHZ_DFS_ONLY;
} else {
return WIFI_BAND_5_GHZ;
}
- } else if (BAND_6_GHZ_START_FREQ <= frequency && frequency < BAND_6_GHZ_END_FREQ) {
+ } else if (ScanResult.is6GHz(frequency)) {
return WIFI_BAND_6_GHZ;
} else {
return WIFI_BAND_UNSPECIFIED;
@@ -198,6 +192,8 @@ public class KnownBandsChannelHelper extends ChannelHelper {
return WIFI_BAND_INDEX_5_GHZ;
case WIFI_BAND_5_GHZ_DFS_ONLY:
return WIFI_BAND_INDEX_5_GHZ_DFS_ONLY;
+ case WIFI_BAND_6_GHZ:
+ return WIFI_BAND_INDEX_6_GHZ;
default:
return -1;
}
diff --git a/service/java/com/android/server/wifi/util/ApConfigUtil.java b/service/java/com/android/server/wifi/util/ApConfigUtil.java
index cc286fad7..b385369a7 100644
--- a/service/java/com/android/server/wifi/util/ApConfigUtil.java
+++ b/service/java/com/android/server/wifi/util/ApConfigUtil.java
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.content.res.Resources;
+import android.net.wifi.ScanResult;
import android.net.wifi.SoftApCapability;
import android.net.wifi.SoftApConfiguration;
import android.net.wifi.SoftApConfiguration.BandType;
@@ -89,59 +90,33 @@ public class ApConfigUtil {
}
/**
- * Convert channel/band to frequency.
- * Note: the utility does not perform any regulatory domain compliance.
- * @param channel number to convert
- * @param band of channel to convert
- * @return center frequency in Mhz of the channel, -1 if no match
+ * Convert band from SoftApConfiguration.BandType to WifiScanner.WifiBand
+ * @param band in SoftApConfiguration.BandType
+ * @return band in WifiScanner.WifiBand
*/
- public static int convertChannelToFrequency(int channel, @BandType int band) {
- if (band == SoftApConfiguration.BAND_2GHZ) {
- if (channel == 14) {
- return 2484;
- } else if (channel >= 1 && channel <= 14) {
- return ((channel - 1) * 5) + 2412;
- } else {
- return -1;
- }
- }
- if (band == SoftApConfiguration.BAND_5GHZ) {
- if (channel >= 34 && channel <= 173) {
- return ((channel - 34) * 5) + 5170;
- } else {
- return -1;
- }
- }
- if (band == SoftApConfiguration.BAND_6GHZ) {
- if (channel >= 1 && channel <= 254) {
- return (channel * 5) + 5940;
- } else {
- return -1;
- }
+ public static @WifiScanner.WifiBand int apConfig2wifiScannerBand(@BandType int band) {
+ switch(band) {
+ case SoftApConfiguration.BAND_2GHZ:
+ return WifiScanner.WIFI_BAND_24_GHZ;
+ case SoftApConfiguration.BAND_5GHZ:
+ return WifiScanner.WIFI_BAND_5_GHZ;
+ case SoftApConfiguration.BAND_6GHZ:
+ return WifiScanner.WIFI_BAND_6_GHZ;
+ default:
+ return WifiScanner.WIFI_BAND_UNSPECIFIED;
}
-
- return -1;
}
/**
- * Convert frequency to channel.
+ * Convert channel/band to frequency.
* Note: the utility does not perform any regulatory domain compliance.
- * @param frequency frequency to convert
- * @return channel number associated with given frequency, -1 if no match
+ * @param channel number to convert
+ * @param band of channel to convert
+ * @return center frequency in Mhz of the channel, -1 if no match
*/
- public static int convertFrequencyToChannel(int frequency) {
- if (frequency >= 2412 && frequency <= 2472) {
- return (frequency - 2412) / 5 + 1;
- } else if (frequency == 2484) {
- return 14;
- } else if (frequency >= 5170 && frequency <= 5865) {
- /* DFS is included. */
- return (frequency - 5170) / 5 + 34;
- } else if (frequency > 5940 && frequency < 7210) {
- return ((frequency - 5940) / 5);
- }
-
- return -1;
+ public static int convertChannelToFrequency(int channel, @BandType int band) {
+ return ScanResult.convertChannelToFrequencyMhz(channel,
+ apConfig2wifiScannerBand(band));
}
/**
@@ -151,11 +126,11 @@ public class ApConfigUtil {
* @return band, -1 if no match
*/
public static int convertFrequencyToBand(int frequency) {
- if (frequency >= 2412 && frequency <= 2484) {
+ if (ScanResult.is24GHz(frequency)) {
return SoftApConfiguration.BAND_2GHZ;
- } else if (frequency >= 5170 && frequency <= 5865) {
+ } else if (ScanResult.is5GHz(frequency)) {
return SoftApConfiguration.BAND_5GHZ;
- } else if (frequency > 5940 && frequency < 7210) {
+ } else if (ScanResult.is6GHz(frequency)) {
return SoftApConfiguration.BAND_6GHZ;
}
@@ -400,7 +375,7 @@ public class ApConfigUtil {
return ERROR_NO_CHANNEL;
}
configBuilder.setChannel(
- convertFrequencyToChannel(freq), convertFrequencyToBand(freq));
+ ScanResult.convertFrequencyMhzToChannel(freq), convertFrequencyToBand(freq));
}
return SUCCESS;
diff --git a/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java b/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java
index 427a5b36c..7562da206 100644
--- a/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java
@@ -148,7 +148,7 @@ public class CandidateScorerTest extends WifiBaseTest {
@Test
public void testPrefer5GhzOver2GhzInNonFringeConditionsSimilarRssi() throws Exception {
assertThat(evaluate(mCandidate1.setFrequency(5180).setScanRssi(-44)),
- greaterThan(evaluate(mCandidate2.setFrequency(2024).setScanRssi(-44))));
+ greaterThan(evaluate(mCandidate2.setFrequency(2432).setScanRssi(-44))));
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/ScoringParamsTest.java b/tests/wifitests/src/com/android/server/wifi/ScoringParamsTest.java
index 3c07bce1c..bea0a1af6 100644
--- a/tests/wifitests/src/com/android/server/wifi/ScoringParamsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ScoringParamsTest.java
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.res.Resources;
+import android.net.wifi.ScanResult;
import android.net.wifi.WifiInfo;
import androidx.test.filters.SmallTest;
@@ -304,20 +305,20 @@ public class ScoringParamsTest extends WifiBaseTest {
assertEquals(mBad2GHz, mScoringParams.getExitRssi(2412));
assertEquals(mEntry2GHz, mScoringParams.getEntryRssi(2480));
- assertEquals(mSufficient2GHz, mScoringParams.getSufficientRssi(2400));
- assertEquals(mGood2GHz, mScoringParams.getGoodRssi(2499));
- assertEquals(mGood2GHz, mScoringParams.getGoodRssi(ScoringParams.BAND2));
+ assertEquals(mSufficient2GHz, mScoringParams.getSufficientRssi(2457));
+ assertEquals(mGood2GHz, mScoringParams.getGoodRssi(2442));
+ assertEquals(mGood2GHz, mScoringParams.getGoodRssi(ScanResult.BAND_24_GHZ_START_FREQ_MHZ));
- assertEquals(mBad5GHz, mScoringParams.getExitRssi(5000));
- assertEquals(mEntry5GHz, mScoringParams.getEntryRssi(5010));
- assertEquals(mSufficient5GHz, mScoringParams.getSufficientRssi(5100));
- assertEquals(mGood5GHz, mScoringParams.getGoodRssi(5678));
- assertEquals(mGood5GHz, mScoringParams.getGoodRssi(ScoringParams.BAND5));
+ assertEquals(mBad5GHz, mScoringParams.getExitRssi(5200));
+ assertEquals(mEntry5GHz, mScoringParams.getEntryRssi(5220));
+ assertEquals(mSufficient5GHz, mScoringParams.getSufficientRssi(5300));
+ assertEquals(mGood5GHz, mScoringParams.getGoodRssi(5745));
+ assertEquals(mGood5GHz, mScoringParams.getGoodRssi(ScanResult.BAND_5_GHZ_START_FREQ_MHZ));
- assertEquals(mBad6GHz, mScoringParams.getExitRssi(5935));
+ assertEquals(mBad6GHz, mScoringParams.getExitRssi(5965));
assertEquals(mEntry6GHz, mScoringParams.getEntryRssi(6095));
assertEquals(mSufficient6GHz, mScoringParams.getSufficientRssi(6255));
assertEquals(mGood6GHz, mScoringParams.getGoodRssi(6275));
- assertEquals(mGood6GHz, mScoringParams.getGoodRssi(ScoringParams.BAND6));
+ assertEquals(mGood6GHz, mScoringParams.getGoodRssi(ScanResult.BAND_6_GHZ_START_FREQ_MHZ));
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WakeupEvaluatorTest.java b/tests/wifitests/src/com/android/server/wifi/WakeupEvaluatorTest.java
index fcbc7e2fd..bc28ce193 100644
--- a/tests/wifitests/src/com/android/server/wifi/WakeupEvaluatorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WakeupEvaluatorTest.java
@@ -46,8 +46,8 @@ public class WakeupEvaluatorTest extends WifiBaseTest {
private static final String SAVED_SSID_2 = "saved ssid 2";
private static final String UNSAVED_SSID = "unsaved ssid";
- private static final int FREQ_24 = 2402;
- private static final int FREQ_5 = 5000;
+ private static final int FREQ_24 = 2412;
+ private static final int FREQ_5 = 5200;
private static final int THRESHOLD_24 = -100;
private static final int THRESHOLD_5 = -90;
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
index 093abfe50..cd9ef0243 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
@@ -2742,9 +2742,9 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
scanSettingsCaptor.capture(), any(), any(), any());
assertEquals(scanSettingsCaptor.getValue().periodInMs,
WifiConnectivityManager.STATIONARY_PNO_SCAN_INTERVAL_MS);
- verify(mScoringParams, times(2)).getEntryRssi(ScoringParams.BAND6);
- verify(mScoringParams, times(2)).getEntryRssi(ScoringParams.BAND5);
- verify(mScoringParams, times(2)).getEntryRssi(ScoringParams.BAND2);
+ verify(mScoringParams, times(2)).getEntryRssi(ScanResult.BAND_6_GHZ_START_FREQ_MHZ);
+ verify(mScoringParams, times(2)).getEntryRssi(ScanResult.BAND_5_GHZ_START_FREQ_MHZ);
+ verify(mScoringParams, times(2)).getEntryRssi(ScanResult.BAND_24_GHZ_START_FREQ_MHZ);
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
index f8c47a2f6..0bd14a470 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
@@ -281,11 +281,14 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
}
private void setupThresholds() {
- mThresholdMinimumRssi2G = mScoringParams.getEntryRssi(ScoringParams.BAND2);
- mThresholdMinimumRssi5G = mScoringParams.getEntryRssi(ScoringParams.BAND5);
-
- mThresholdQualifiedRssi2G = mScoringParams.getSufficientRssi(ScoringParams.BAND2);
- mThresholdQualifiedRssi5G = mScoringParams.getSufficientRssi(ScoringParams.BAND5);
+ mThresholdMinimumRssi2G = mScoringParams.getEntryRssi(
+ ScanResult.BAND_24_GHZ_START_FREQ_MHZ);
+ mThresholdMinimumRssi5G = mScoringParams.getEntryRssi(ScanResult.BAND_5_GHZ_START_FREQ_MHZ);
+
+ mThresholdQualifiedRssi2G = mScoringParams.getSufficientRssi(
+ ScanResult.BAND_24_GHZ_START_FREQ_MHZ);
+ mThresholdQualifiedRssi5G = mScoringParams.getSufficientRssi(
+ ScanResult.BAND_5_GHZ_START_FREQ_MHZ);
}
private void setupWifiInfo() {
@@ -1591,4 +1594,4 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
WifiConfiguration wifiConfiguration = mWifiNetworkSelector.selectNetwork(candidates);
assertNotNull(wifiConfiguration);
}
-} \ No newline at end of file
+}
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/KnownBandsChannelHelperTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/KnownBandsChannelHelperTest.java
index c19da30e2..3e7ad7166 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/KnownBandsChannelHelperTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/KnownBandsChannelHelperTest.java
@@ -49,8 +49,8 @@ import java.util.HashSet;
@RunWith(Enclosed.class) // WARNING: tests cannot be declared in the outer class
public class KnownBandsChannelHelperTest {
- private static final int[] CHANNELS_24_GHZ = new int[]{2400, 2450};
- private static final int[] CHANNELS_5_GHZ = new int[]{5150, 5175};
+ private static final int[] CHANNELS_24_GHZ = new int[]{2412, 2450};
+ private static final int[] CHANNELS_5_GHZ = new int[]{5160, 5175};
private static final int[] CHANNELS_DFS = new int[]{5600, 5650, 5660};
private static final int[] CHANNELS_DFS_OTHER = new int[]{5600, 5650, 5660, 5680};
private static final int[] CHANNELS_6_GHZ = new int[]{5945, 5985};
@@ -81,7 +81,7 @@ public class KnownBandsChannelHelperTest {
*/
@Test
public void fewChannels() {
- WifiScanner.ScanSettings testSettings = createRequest(channelsToSpec(2400, 2450, 5100),
+ WifiScanner.ScanSettings testSettings = createRequest(channelsToSpec(2412, 2450, 5200),
10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
assertEquals(ChannelHelper.SCAN_PERIOD_PER_CHANNEL_MS * 3,
@@ -221,8 +221,8 @@ public class KnownBandsChannelHelperTest {
WifiScanner.ScanSettings testSettings = createRequest(channelsToSpec(),
10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- assertFalse(mChannelHelper.settingsContainChannel(testSettings, 2400));
- assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5150));
+ assertFalse(mChannelHelper.settingsContainChannel(testSettings, 2412));
+ assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5160));
assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5650));
}
@@ -231,11 +231,11 @@ public class KnownBandsChannelHelperTest {
*/
@Test
public void settingsWithChannels() {
- WifiScanner.ScanSettings testSettings = createRequest(channelsToSpec(2400, 5650),
+ WifiScanner.ScanSettings testSettings = createRequest(channelsToSpec(2412, 5650),
10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2400));
- assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5150));
+ assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2412));
+ assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5160));
assertTrue(mChannelHelper.settingsContainChannel(testSettings, 5650));
}
@@ -247,9 +247,9 @@ public class KnownBandsChannelHelperTest {
WifiScanner.ScanSettings testSettings = createRequest(WifiScanner.WIFI_BAND_24_GHZ,
10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2400));
+ assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2412));
assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2450));
- assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5150));
+ assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5160));
assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5650));
}
@@ -261,9 +261,9 @@ public class KnownBandsChannelHelperTest {
WifiScanner.ScanSettings testSettings = createRequest(WifiScanner.WIFI_BAND_BOTH,
10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2400));
+ assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2412));
assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2450));
- assertTrue(mChannelHelper.settingsContainChannel(testSettings, 5150));
+ assertTrue(mChannelHelper.settingsContainChannel(testSettings, 5160));
assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5650));
}
}
@@ -346,8 +346,8 @@ public class KnownBandsChannelHelperTest {
mChannelCollection.getScanFreqs());
assertTrue(mChannelCollection.isEmpty());
- assertFalse(mChannelCollection.containsChannel(2400));
- assertFalse(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.containsChannel(2412));
+ assertFalse(mChannelCollection.containsChannel(5160));
assertFalse(mChannelCollection.isAllChannels());
}
@@ -367,8 +367,8 @@ public class KnownBandsChannelHelperTest {
mChannelCollection.getScanFreqs());
assertTrue(mChannelCollection.isEmpty());
- assertFalse(mChannelCollection.containsChannel(2400));
- assertFalse(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.containsChannel(2412));
+ assertFalse(mChannelCollection.containsChannel(5160));
assertFalse(mChannelCollection.isAllChannels());
}
@@ -383,12 +383,12 @@ public class KnownBandsChannelHelperTest {
mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
assertThat(bucketSettings, bandIs(WifiScanner.WIFI_BAND_24_GHZ));
- assertEquals(new HashSet<Integer>(Arrays.asList(2400, 2450)),
+ assertEquals(new HashSet<Integer>(Arrays.asList(2412, 2450)),
mChannelCollection.getScanFreqs());
assertFalse(mChannelCollection.isEmpty());
- assertTrue(mChannelCollection.containsChannel(2400));
- assertFalse(mChannelCollection.containsChannel(5150));
+ assertTrue(mChannelCollection.containsChannel(2412));
+ assertFalse(mChannelCollection.containsChannel(5160));
assertFalse(mChannelCollection.isAllChannels());
}
@@ -397,18 +397,18 @@ public class KnownBandsChannelHelperTest {
*/
@Test
public void addChannel_single() {
- mChannelCollection.addChannel(2400);
+ mChannelCollection.addChannel(2412);
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
- assertThat(bucketSettings, channelsAre(2400));
+ assertThat(bucketSettings, channelsAre(2412));
- assertEquals(new HashSet<Integer>(Arrays.asList(2400)),
+ assertEquals(new HashSet<Integer>(Arrays.asList(2412)),
mChannelCollection.getScanFreqs());
assertFalse(mChannelCollection.isEmpty());
- assertTrue(mChannelCollection.containsChannel(2400));
- assertFalse(mChannelCollection.containsChannel(5150));
+ assertTrue(mChannelCollection.containsChannel(2412));
+ assertFalse(mChannelCollection.containsChannel(5160));
assertFalse(mChannelCollection.isAllChannels());
}
@@ -417,19 +417,19 @@ public class KnownBandsChannelHelperTest {
*/
@Test
public void addChannel_multiple() {
- mChannelCollection.addChannel(2400);
+ mChannelCollection.addChannel(2412);
mChannelCollection.addChannel(2450);
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
- assertThat(bucketSettings, channelsAre(2400, 2450));
+ assertThat(bucketSettings, channelsAre(2412, 2450));
- assertEquals(new HashSet<Integer>(Arrays.asList(2400, 2450)),
+ assertEquals(new HashSet<Integer>(Arrays.asList(2412, 2450)),
mChannelCollection.getScanFreqs());
assertFalse(mChannelCollection.isEmpty());
- assertTrue(mChannelCollection.containsChannel(2400));
- assertFalse(mChannelCollection.containsChannel(5150));
+ assertTrue(mChannelCollection.containsChannel(2412));
+ assertFalse(mChannelCollection.containsChannel(5160));
assertFalse(mChannelCollection.isAllChannels());
}
@@ -439,18 +439,18 @@ public class KnownBandsChannelHelperTest {
@Test
public void addChannel_and_addBand_sameBand() {
mChannelCollection.addBand(WifiScanner.WIFI_BAND_24_GHZ);
- mChannelCollection.addChannel(2400);
+ mChannelCollection.addChannel(2412);
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
assertThat(bucketSettings, bandIs(WifiScanner.WIFI_BAND_24_GHZ));
- assertEquals(new HashSet<Integer>(Arrays.asList(2400, 2450)),
+ assertEquals(new HashSet<Integer>(Arrays.asList(2412, 2450)),
mChannelCollection.getScanFreqs());
assertFalse(mChannelCollection.isEmpty());
- assertTrue(mChannelCollection.containsChannel(2400));
- assertFalse(mChannelCollection.containsChannel(5150));
+ assertTrue(mChannelCollection.containsChannel(2412));
+ assertFalse(mChannelCollection.containsChannel(5160));
assertFalse(mChannelCollection.isAllChannels());
}
@@ -460,18 +460,18 @@ public class KnownBandsChannelHelperTest {
@Test
public void addChannel_and_addBand_withDifferentBandChannel() {
mChannelCollection.addBand(WifiScanner.WIFI_BAND_24_GHZ);
- mChannelCollection.addChannel(5150);
+ mChannelCollection.addChannel(5160);
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
- assertThat(bucketSettings, channelsAre(2400, 2450, 5150));
+ assertThat(bucketSettings, channelsAre(2412, 2450, 5160));
- assertEquals(new HashSet<Integer>(Arrays.asList(2400, 2450, 5150)),
+ assertEquals(new HashSet<Integer>(Arrays.asList(2412, 2450, 5160)),
mChannelCollection.getScanFreqs());
assertFalse(mChannelCollection.isEmpty());
- assertTrue(mChannelCollection.containsChannel(2400));
- assertTrue(mChannelCollection.containsChannel(5150));
+ assertTrue(mChannelCollection.containsChannel(2412));
+ assertTrue(mChannelCollection.containsChannel(5160));
assertFalse(mChannelCollection.isAllChannels());
}
@@ -481,7 +481,7 @@ public class KnownBandsChannelHelperTest {
@Test
public void addChannel_and_addBand_all() {
mChannelCollection.addBand(WifiScanner.WIFI_BAND_24_5_WITH_DFS_6_GHZ);
- mChannelCollection.addChannel(5150);
+ mChannelCollection.addChannel(5160);
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
@@ -490,8 +490,8 @@ public class KnownBandsChannelHelperTest {
assertNull(mChannelCollection.getScanFreqs());
assertFalse(mChannelCollection.isEmpty());
- assertTrue(mChannelCollection.containsChannel(2400));
- assertTrue(mChannelCollection.containsChannel(5150));
+ assertTrue(mChannelCollection.containsChannel(2412));
+ assertTrue(mChannelCollection.containsChannel(5160));
assertTrue(mChannelCollection.containsChannel(5600));
assertTrue(mChannelCollection.isAllChannels());
}
@@ -516,9 +516,9 @@ public class KnownBandsChannelHelperTest {
*/
@Test
public void addChannel_exceedMaxChannelsOnMultipleBands() {
- mChannelCollection.addChannel(2400);
+ mChannelCollection.addChannel(2412);
mChannelCollection.addChannel(2450);
- mChannelCollection.addChannel(5150);
+ mChannelCollection.addChannel(5160);
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, 2);
@@ -532,9 +532,9 @@ public class KnownBandsChannelHelperTest {
*/
@Test
public void addChannel_addAllAvailableChannels() {
- mChannelCollection.addChannel(2400);
+ mChannelCollection.addChannel(2412);
mChannelCollection.addChannel(2450);
- mChannelCollection.addChannel(5150);
+ mChannelCollection.addChannel(5160);
mChannelCollection.addChannel(5175);
mChannelCollection.addChannel(5600);
mChannelCollection.addChannel(5650);
@@ -545,7 +545,7 @@ public class KnownBandsChannelHelperTest {
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
assertThat(bucketSettings,
- channelsAre(2400, 2450, 5150, 5175, 5600, 5650, 5660, 5945, 5985));
+ channelsAre(2412, 2450, 5160, 5175, 5600, 5650, 5660, 5945, 5985));
assertTrue(mChannelCollection.isAllChannels());
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/ScanScheduleUtilFilterTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/ScanScheduleUtilFilterTest.java
index 69a8c0ce1..429da3f7f 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/ScanScheduleUtilFilterTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/ScanScheduleUtilFilterTest.java
@@ -50,8 +50,8 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
@Before
public void setUp() throws Exception {
mChannelHelper = new PresetKnownBandsChannelHelper(
- new int[]{2400, 2450},
- new int[]{5150, 5175},
+ new int[]{2412, 2450},
+ new int[]{5160, 5175},
new int[]{5600, 5650},
new int[]{5945, 5985});
}
@@ -64,7 +64,7 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
);
assertTrue(ScanScheduleUtil.shouldReportFullScanResultForSettings(mChannelHelper,
- createScanResult(2400), 0, settings, -1));
+ createScanResult(2412), 0, settings, -1));
}
@Test
@@ -75,24 +75,24 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
);
assertFalse(ScanScheduleUtil.shouldReportFullScanResultForSettings(mChannelHelper,
- createScanResult(5150), 0, settings, 0));
+ createScanResult(5160), 0, settings, 0));
}
@Test
public void reportFullResultTrueForChannelsWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
assertTrue(ScanScheduleUtil.shouldReportFullScanResultForSettings(mChannelHelper,
- createScanResult(2400), 0, settings, 0));
+ createScanResult(2412), 0, settings, 0));
}
@Test
public void reportFullResultFalseForChannelsWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
@@ -103,29 +103,29 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
@Test
public void reportFullResultTrueForChannelsWithBucketDefinitlyScanned() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
assertTrue(ScanScheduleUtil.shouldReportFullScanResultForSettings(mChannelHelper,
- createScanResult(2400), 5, settings, 2));
+ createScanResult(2412), 5, settings, 2));
}
@Test
public void reportFullResultFalseForChannelsWithBucketDefinitlyNotScanned() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
assertFalse(ScanScheduleUtil.shouldReportFullScanResultForSettings(mChannelHelper,
- createScanResult(2400), 1, settings, 1));
+ createScanResult(2412), 1, settings, 1));
}
@Test
public void filterScanDataEmptyWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
@@ -137,7 +137,7 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
@Test
public void filterScanDataSingleNotMatchingWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
@@ -149,7 +149,7 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
@Test
public void filterScanDataSingleNotMatchingWithDefinitlyScannedBucketIndex() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
@@ -161,7 +161,7 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
@Test
public void filterScanDataSingleNotMatchingWithBucketDefinitlyScanned() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
@@ -173,25 +173,25 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
@Test
public void filterScanDataSingleMatchingWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
ScanData[] results = ScanScheduleUtil.filterResultsForSettings(mChannelHelper,
- createScanDatas(new int[][]{ { 2400 } }), settings, 0);
+ createScanDatas(new int[][]{ { 2412 } }), settings, 0);
- assertScanDataFreqsEquals(new int[][]{ { 2400 } }, results);
+ assertScanDataFreqsEquals(new int[][]{ { 2412 } }, results);
}
@Test
public void filterScanDataSingleMatchingWithBucketDefinitlyNotScanned() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
ScanData[] results = ScanScheduleUtil.filterResultsForSettings(mChannelHelper,
- createScanDatas(new int[][]{ { 2400 } }, new int[] { 5 }), settings, 1);
+ createScanDatas(new int[][]{ { 2412 } }, new int[] { 5 }), settings, 1);
assertScanDataFreqsEquals(null, results);
}
@@ -199,20 +199,20 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
@Test
public void filterScanDataSinglePartialMatchingWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
ScanData[] results = ScanScheduleUtil.filterResultsForSettings(mChannelHelper,
- createScanDatas(new int[][]{ { 2400, 2450, 5150, 5175 } }), settings, 0);
+ createScanDatas(new int[][]{ { 2412, 2450, 5160, 5175 } }), settings, 0);
- assertScanDataFreqsEquals(new int[][]{ { 2400, 5150 } }, results);
+ assertScanDataFreqsEquals(new int[][]{ { 2412, 5160 } }, results);
}
@Test
public void filterScanDataMultipleNotMatchingWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
@@ -224,7 +224,7 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
@Test
public void filterScanDataMultipleNotMatchingWithOneDefinitlyScanned() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
@@ -237,76 +237,76 @@ public class ScanScheduleUtilFilterTest extends WifiBaseTest {
@Test
public void filterScanDataMultipleMatchingWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
ScanData[] results = ScanScheduleUtil.filterResultsForSettings(mChannelHelper,
- createScanDatas(new int[][]{ { 2400 }, {2400, 5150} }), settings, 0);
+ createScanDatas(new int[][]{ { 2412 }, {2412, 5160} }), settings, 0);
- assertScanDataFreqsEquals(new int[][]{ { 2400 }, {2400, 5150} }, results);
+ assertScanDataFreqsEquals(new int[][]{ { 2412 }, {2412, 5160} }, results);
}
@Test
public void filterScanDataMultiplePartialMatchingWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
ScanData[] results = ScanScheduleUtil.filterResultsForSettings(mChannelHelper,
- createScanDatas(new int[][]{ { 2400, 2450, 5150, 5175 }, { 2400, 2450, 5175 } }),
+ createScanDatas(new int[][]{ { 2412, 2450, 5160, 5175 }, { 2412, 2450, 5175 } }),
settings, -1);
- assertScanDataFreqsEquals(new int[][]{ { 2400, 5150 }, { 2400 } }, results);
+ assertScanDataFreqsEquals(new int[][]{ { 2412, 5160 }, { 2412 } }, results);
}
@Test
public void filterScanDataMultipleDuplicateFrequenciesWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
ScanData[] results = ScanScheduleUtil.filterResultsForSettings(mChannelHelper,
createScanDatas(new int[][]{
- { 2400, 2450, 5150, 5175, 2400 },
- { 2400, 2450, 5175 },
- { 5175, 5175, 5150 } }), settings, 0);
+ { 2412, 2450, 5160, 5175, 2412 },
+ { 2412, 2450, 5175 },
+ { 5175, 5175, 5160 } }), settings, 0);
- assertScanDataFreqsEquals(new int[][]{ { 2400, 5150, 2400 }, { 2400 }, { 5150 } }, results);
+ assertScanDataFreqsEquals(new int[][]{ { 2412, 5160, 2412 }, { 2412 }, { 5160 } }, results);
}
@Test
public void filterScanDataMultipleSomeNotMatchingWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 20,
+ channelsToSpec(2412, 5160), 30000, 0, 20,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
ScanData[] results = ScanScheduleUtil.filterResultsForSettings(mChannelHelper,
createScanDatas(new int[][]{
- { 2400, 2450, 5150, 5175, 2400 },
+ { 2412, 2450, 5160, 5175, 2412 },
{ 5175 },
- { 5175, 5175, 5150 } }), settings, 0);
+ { 5175, 5175, 5160 } }), settings, 0);
- assertScanDataFreqsEquals(new int[][]{ { 2400, 5150, 2400 }, { 5150 } }, results);
+ assertScanDataFreqsEquals(new int[][]{ { 2412, 5160, 2412 }, { 5160 } }, results);
}
@Test
public void filterScanDataExceedMaxBssidsPerScanWithNoBucketInfo() {
ScanSettings settings = createRequest(
- channelsToSpec(2400, 5150), 30000, 0, 3,
+ channelsToSpec(2412, 5160), 30000, 0, 3,
WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
);
ScanData[] results = ScanScheduleUtil.filterResultsForSettings(mChannelHelper,
createScanDatas(new int[][]{
- { 2400, 2450, 5150, 5175, 2400, 2400},
+ { 2412, 2450, 5160, 5175, 2412, 2412},
{ 5175 },
- { 5175, 5175, 5150, 2400, 2400, 5150 } }), settings, 0);
+ { 5175, 5175, 5160, 2412, 2412, 5160 } }), settings, 0);
- assertScanDataFreqsEquals(new int[][]{ { 2400, 5150, 2400 }, { 5150, 2400, 2400 } },
+ assertScanDataFreqsEquals(new int[][]{ { 2412, 5160, 2412 }, { 5160, 2412, 2412 } },
results);
}
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
index bf70af312..bccf6b49a 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
@@ -160,13 +160,13 @@ public class WifiScanningServiceTest extends WifiBaseTest {
.thenReturn(mWifiPermissionsUtil);
mChannelHelper0 = new PresetKnownBandsChannelHelper(
- new int[]{2400, 2450},
- new int[]{5150, 5175},
+ new int[]{2412, 2450},
+ new int[]{5160, 5175},
new int[]{5600, 5650, 5660},
new int[]{5945, 5985});
mChannelHelper1 = new PresetKnownBandsChannelHelper(
- new int[]{2400, 2450},
- new int[]{5150, 5175},
+ new int[]{2412, 2450},
+ new int[]{5160, 5175},
new int[]{5600, 5660, 5680}, // 5650 is missing from channelHelper0
new int[]{5945, 5985});
mLooper = new TestLooper();
@@ -701,7 +701,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH_WITH_DFS,
0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings),
- ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 2400, 5150, 5175));
+ ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 2412, 5160, 5175));
}
/**
@@ -709,10 +709,10 @@ public class WifiScanningServiceTest extends WifiBaseTest {
*/
@Test
public void sendSingleScanChannelsRequest() throws Exception {
- WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2400, 5150, 5175),
+ WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2412, 5160, 5175),
0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings),
- ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400, 5150, 5175));
+ ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412, 5160, 5175));
}
/**
@@ -721,10 +721,10 @@ public class WifiScanningServiceTest extends WifiBaseTest {
@Test
public void sendSingleScanAllChannelsRequest() throws Exception {
WifiScanner.ScanSettings requestSettings = createRequest(
- channelsToSpec(2400, 2450, 5150, 5175, 5600, 5650, 5660),
+ channelsToSpec(2412, 2450, 5160, 5175, 5600, 5650, 5660),
0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings),
- ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400, 5150, 5175));
+ ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412, 5160, 5175));
}
/**
@@ -749,7 +749,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
// Create a set of scan results that has results not matching the request settings, but is
// limited to zero results for the expected results.
ScanResults results = ScanResults.createOverflowing(0, WifiScanner.WIFI_BAND_24_GHZ, 0,
- ScanResults.generateNativeResults(0, 5150, 5171));
+ ScanResults.generateNativeResults(0, 5160, 5171));
doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings),
results);
}
@@ -910,10 +910,10 @@ public class WifiScanningServiceTest extends WifiBaseTest {
when(mContext.checkPermission(
Manifest.permission.NETWORK_STACK, -1, Binder.getCallingUid()))
.thenReturn(PERMISSION_DENIED);
- WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2400, 5150, 5175),
+ WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2412, 5160, 5175),
0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings),
- ScanResults.create(0, 2400, 5150, 5175));
+ ScanResults.create(0, 2412, 5160, 5175));
}
/**
@@ -1066,7 +1066,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
*/
@Test
public void sendSingleScanRequestThenDisableWifi() {
- WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2400), 0,
+ WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2412), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
int requestId = 2293;
@@ -1100,9 +1100,9 @@ public class WifiScanningServiceTest extends WifiBaseTest {
*/
@Test
public void sendSingleScanRequestThenDisableWifiAfterScanCompleteButBeforeReportingResults() {
- WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2400), 0,
+ WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2412), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- ScanResults results = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400);
+ ScanResults results = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412);
int requestId = 2293;
startServiceAndLoadDriver();
@@ -1141,7 +1141,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
*/
@Test
public void sendSingleScanAndPendingScanAndListenerThenDisableWifi() {
- WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2400), 0,
+ WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2412), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
int requestId1 = 2293;
@@ -1196,10 +1196,10 @@ public class WifiScanningServiceTest extends WifiBaseTest {
*/
@Test
public void sendSingleScanRequestAfterPreviousCompletes() {
- WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2400), 0,
+ WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2412), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
int requestId1 = 12;
- ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400);
+ ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412);
WifiScanner.ScanSettings requestSettings2 = createRequest(channelsToSpec(2450, 5175), 0,
@@ -1265,10 +1265,10 @@ public class WifiScanningServiceTest extends WifiBaseTest {
*/
@Test
public void sendSingleScanRequestWhilePreviousScanRunning() {
- WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2400), 0,
+ WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2412), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
int requestId1 = 12;
- ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400);
+ ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412);
WifiScanner.ScanSettings requestSettings2 = createRequest(channelsToSpec(2450, 5175), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
@@ -1334,17 +1334,17 @@ public class WifiScanningServiceTest extends WifiBaseTest {
@Test
public void sendSingleScanRequestWhilePreviousScanRunningWithTypesThatDoesNotSatisfy() {
// Create identitical scan requests other than the types being different.
- WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2400), 0,
+ WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2412), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
requestSettings1.type = WifiScanner.SCAN_TYPE_LOW_LATENCY;
int requestId1 = 12;
- ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400);
+ ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412);
- WifiScanner.ScanSettings requestSettings2 = createRequest(channelsToSpec(2400), 0,
+ WifiScanner.ScanSettings requestSettings2 = createRequest(channelsToSpec(2412), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
requestSettings2.type = WifiScanner.SCAN_TYPE_HIGH_ACCURACY;
int requestId2 = 13;
- ScanResults results2 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400);
+ ScanResults results2 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412);
startServiceAndLoadDriver();
mWifiScanningServiceImpl.setWifiHandlerLogForTest(mLog);
@@ -1403,12 +1403,12 @@ public class WifiScanningServiceTest extends WifiBaseTest {
*/
@Test
public void sendMultipleSingleScanRequestWhilePreviousScanRunning() throws RemoteException {
- WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2400), 0,
+ WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2412), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
requestSettings1.type = WifiScanner.SCAN_TYPE_LOW_LATENCY;
int requestId1 = 12;
WorkSource workSource1 = new WorkSource(1121);
- ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400);
+ ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412);
WifiScanner.ScanSettings requestSettings2 = createRequest(channelsToSpec(2450, 5175), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
@@ -1418,7 +1418,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
ScanResults results2 =
ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2450, 5175, 2450);
- WifiScanner.ScanSettings requestSettings3 = createRequest(channelsToSpec(5150), 0,
+ WifiScanner.ScanSettings requestSettings3 = createRequest(channelsToSpec(5160), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
requestSettings3.type = WifiScanner.SCAN_TYPE_LOW_POWER;
int requestId3 = 15;
@@ -1427,11 +1427,11 @@ public class WifiScanningServiceTest extends WifiBaseTest {
workSource3.createWorkChain()
.addNode(2292, "tag1");
ScanResults results3 =
- ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 5150, 5150, 5150, 5150);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 5160, 5160, 5160, 5160);
WifiNative.ScanSettings nativeSettings2and3 = createSingleScanNativeSettingsForChannels(
WifiScanner.SCAN_TYPE_HIGH_ACCURACY, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN,
- channelsToSpec(2450, 5175, 5150));
+ channelsToSpec(2450, 5175, 5160));
ScanResults results2and3 =
ScanResults.merge(WifiScanner.WIFI_BAND_UNSPECIFIED, results2, results3);
WorkSource workSource2and3 = new WorkSource();
@@ -1521,9 +1521,9 @@ public class WifiScanningServiceTest extends WifiBaseTest {
public void sendSingleScanRequestWhilePreviousScanRunningAndMergeIntoFirstScan() {
// Split by frequency to make it easier to determine which results each request is expecting
ScanResults results24GHz =
- ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 2400, 2400, 2400, 2450);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 2412, 2412, 2412, 2450);
ScanResults results5GHz =
- ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 5150, 5150, 5175);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 5160, 5160, 5175);
ScanResults resultsBoth =
ScanResults.merge(WifiScanner.WIFI_BAND_BOTH, results24GHz, results5GHz);
@@ -1588,13 +1588,13 @@ public class WifiScanningServiceTest extends WifiBaseTest {
public void sendMultipleSingleScanRequestWhilePreviousScanRunningAndMergeOneIntoFirstScan()
throws RemoteException {
// Split by frequency to make it easier to determine which results each request is expecting
- ScanResults results2400 =
- ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400, 2400, 2400);
+ ScanResults results2412 =
+ ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412, 2412, 2412);
ScanResults results2450 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2450);
ScanResults results1and3 =
- ScanResults.merge(WifiScanner.WIFI_BAND_UNSPECIFIED, results2400, results2450);
+ ScanResults.merge(WifiScanner.WIFI_BAND_UNSPECIFIED, results2412, results2450);
- WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2400, 2450), 0,
+ WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2412, 2450), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
requestSettings1.type = WifiScanner.SCAN_TYPE_LOW_LATENCY;
int requestId1 = 12;
@@ -1608,12 +1608,12 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WorkSource workSource2 = new WorkSource(Binder.getCallingUid()); // don't explicitly set
ScanResults results2 = ScanResults.create(0, 2450, 5175, 2450);
- WifiScanner.ScanSettings requestSettings3 = createRequest(channelsToSpec(2400), 0,
+ WifiScanner.ScanSettings requestSettings3 = createRequest(channelsToSpec(2412), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
requestSettings3.type = WifiScanner.SCAN_TYPE_LOW_POWER;
int requestId3 = 15;
WorkSource workSource3 = new WorkSource(2292);
- ScanResults results3 = results2400;
+ ScanResults results3 = results2412;
startServiceAndLoadDriver();
mWifiScanningServiceImpl.setWifiHandlerLogForTest(mLog);
@@ -1697,7 +1697,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
createRequest(WifiScanner.WIFI_BAND_BOTH_WITH_DFS,
0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
ScanResults expectedResults =
- ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 2400, 5150, 5175);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 2412, 5160, 5175);
doSuccessfulSingleScan(requestSettings,
computeSingleScanNativeSettings(requestSettings),
expectedResults);
@@ -1775,7 +1775,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
ScanResults expectedResults = ScanResults.create(
- 0, WifiScanner.WIFI_BAND_BOTH, 2400, 5150, 5175);
+ 0, WifiScanner.WIFI_BAND_BOTH, 2412, 5160, 5175);
doSuccessfulSingleScan(requestSettings,
computeSingleScanNativeSettings(requestSettings),
expectedResults);
@@ -1795,7 +1795,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
// now update with a new scan that only has one result
int secondScanRequestId = 35;
- ScanResults expectedSingleResult = ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 5150);
+ ScanResults expectedSingleResult = ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 5160);
sendSingleScanRequest(controlChannel, secondScanRequestId, requestSettings, null);
mLooper.dispatchAll();
@@ -1832,7 +1832,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings fullRequestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
ScanResults expectedFullResults =
- ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 2400, 5150, 5175);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 2412, 5160, 5175);
doSuccessfulSingleScan(fullRequestSettings,
computeSingleScanNativeSettings(fullRequestSettings),
expectedFullResults);
@@ -1855,7 +1855,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings partialRequestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH,
0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
ScanResults expectedPartialResults =
- ScanResults.create(0, WifiScanner.WIFI_BAND_5_GHZ, 5150);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_5_GHZ, 5160);
sendSingleScanRequest(controlChannel, secondScanRequestId, partialRequestSettings, null);
mLooper.dispatchAll();
@@ -1893,7 +1893,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
ScanResults scanResults =
- ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 2400, 5150, 5175);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 2412, 5160, 5175);
// Out of the 3 scan results, modify the timestamp of 2 of them to be within the expiration
// age and 1 out of it.
@@ -1935,7 +1935,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
createRequest(WifiScanner.WIFI_BAND_BOTH_WITH_DFS,
0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
ScanResults expectedResults = ScanResults.create(
- 0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 2400, 5150, 5175);
+ 0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 2412, 5160, 5175);
doSuccessfulSingleScan(requestSettings,
computeSingleScanNativeSettings(requestSettings),
expectedResults);
@@ -1972,7 +1972,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
WifiNative.ScanSettings nativeSettings = computeSingleScanNativeSettings(requestSettings);
- ScanResults results = ScanResults.create(0, 2400, 5150, 5175);
+ ScanResults results = ScanResults.create(0, 2412, 5160, 5175);
int requestId = 12;
int listenerRequestId = 13;
@@ -2020,7 +2020,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
WifiNative.ScanSettings nativeSettings = computeSingleScanNativeSettings(requestSettings);
- ScanResults results = ScanResults.create(0, 2400, 5150, 5175);
+ ScanResults results = ScanResults.create(0, 2412, 5160, 5175);
int requestId = 12;
int listenerRequestId = 13;
@@ -2067,10 +2067,10 @@ public class WifiScanningServiceTest extends WifiBaseTest {
*/
@Test
public void scanListenerReceivesAllResults() throws RemoteException {
- WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2400), 0,
+ WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2412), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
int requestId1 = 12;
- ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400);
+ ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412);
WifiScanner.ScanSettings requestSettings2 = createRequest(channelsToSpec(2450, 5175), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
@@ -2078,14 +2078,14 @@ public class WifiScanningServiceTest extends WifiBaseTest {
ScanResults results2 =
ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2450, 5175, 2450);
- WifiScanner.ScanSettings requestSettings3 = createRequest(channelsToSpec(5150), 0,
+ WifiScanner.ScanSettings requestSettings3 = createRequest(channelsToSpec(5160), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
int requestId3 = 15;
ScanResults results3 =
- ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 5150, 5150, 5150, 5150);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 5160, 5160, 5160, 5160);
WifiNative.ScanSettings nativeSettings2and3 = createSingleScanNativeSettingsForChannels(
- WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN, channelsToSpec(2450, 5175, 5150));
+ WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN, channelsToSpec(2450, 5175, 5160));
ScanResults results2and3 =
ScanResults.merge(WifiScanner.WIFI_BAND_UNSPECIFIED, results2, results3);
@@ -2233,13 +2233,13 @@ public class WifiScanningServiceTest extends WifiBaseTest {
*/
@Test
public void sendBackgroundScanChannelsRequest() throws Exception {
- WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(5150), 30000,
+ WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(5160), 30000,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
WifiNative.ScanSettings nativeSettings = new NativeScanSettingsBuilder()
.withBasePeriod(30000)
.withMaxApPerScan(MAX_AP_PER_SCAN)
.withMaxScansToCache(BackgroundScanScheduler.DEFAULT_MAX_SCANS_TO_BATCH)
- .addBucketWithChannels(30000, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN, 5150)
+ .addBucketWithChannels(30000, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN, 5160)
.build();
doSuccessfulBackgroundScan(requestSettings, nativeSettings);
}
@@ -2247,14 +2247,14 @@ public class WifiScanningServiceTest extends WifiBaseTest {
private Pair<WifiScanner.ScanSettings, WifiNative.ScanSettings> createScanSettingsForHwPno()
throws Exception {
WifiScanner.ScanSettings requestSettings = createRequest(
- channelsToSpec(0, 2400, 5150, 5175), 30000, 0, 20,
+ channelsToSpec(0, 2412, 5160, 5175), 30000, 0, 20,
WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
WifiNative.ScanSettings nativeSettings = new NativeScanSettingsBuilder()
.withBasePeriod(30000)
.withMaxApPerScan(MAX_AP_PER_SCAN)
.withMaxScansToCache(BackgroundScanScheduler.DEFAULT_MAX_SCANS_TO_BATCH)
.addBucketWithChannels(30000, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN,
- 0, 2400, 5150, 5175)
+ 0, 2412, 5160, 5175)
.build();
return Pair.create(requestSettings, nativeSettings);
}
@@ -2289,7 +2289,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
}
private ScanResults createScanResultsForPno() {
- return ScanResults.create(0, 2400, 5150, 5175);
+ return ScanResults.create(0, 2412, 5160, 5175);
}
private WifiNative.PnoEventHandler verifyHwPnoForImpl(WifiScannerImpl impl, InOrder order,
@@ -2484,7 +2484,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
when(mWifiScannerImpl0.startSingleScan(any(WifiNative.ScanSettings.class),
any(WifiNative.ScanEventHandler.class))).thenReturn(true);
- ScanResults results = ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 2400);
+ ScanResults results = ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 2412);
when(mWifiScannerImpl0.getLatestSingleScanResults())
.thenReturn(results.getRawScanData());
@@ -2566,10 +2566,10 @@ public class WifiScanningServiceTest extends WifiBaseTest {
int requestId = 12;
WorkSource workSource = new WorkSource(2292);
- WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2400, 5150, 5175),
+ WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2412, 5160, 5175),
0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
ScanResults results =
- ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400, 5150, 5175);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412, 5160, 5175);
when(mWifiScannerImpl0.startSingleScan(any(WifiNative.ScanSettings.class),
any(WifiNative.ScanEventHandler.class))).thenReturn(true);
@@ -3032,8 +3032,8 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
doSuccessfulSingleScanOnImpls(requestSettings,
computeSingleScanNativeSettings(requestSettings),
- ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 2400),
- ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 5150));
+ ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 2412),
+ ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 5160));
}
/**
@@ -3044,11 +3044,11 @@ public class WifiScanningServiceTest extends WifiBaseTest {
public void sendSingleScanChannelsRequestOnMultipleImpls() throws Exception {
when(mWifiNative.getClientInterfaceNames())
.thenReturn(new ArraySet<>(Arrays.asList(TEST_IFACE_NAME_0, TEST_IFACE_NAME_1)));
- WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2400, 5150, 5175),
+ WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2412, 5160, 5175),
0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
doSuccessfulSingleScanOnImpls(requestSettings,
computeSingleScanNativeSettings(requestSettings),
- ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400),
+ ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412),
ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 5175));
}
@@ -3123,7 +3123,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
WifiNative.ScanSettings nativeSettings = computeSingleScanNativeSettings(requestSettings);
ScanResults results =
- ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400, 5150, 5175);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412, 5160, 5175);
int requestId = 33;
WorkSource workSource = new WorkSource(2292);
@@ -3235,7 +3235,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
WifiNative.ScanSettings nativeSettings = computeSingleScanNativeSettings(requestSettings);
ScanResults results =
- ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400, 5150, 5175);
+ ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2412, 5160, 5175);
int requestId = 33;
WorkSource workSource = new WorkSource(Binder.getCallingUid()); // don't explicitly set
@@ -3534,7 +3534,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
mLooper.stopAutoDispatchAndIgnoreExceptions();
List<Integer> actual = bundle.getIntegerArrayList(GET_AVAILABLE_CHANNELS_EXTRA);
- List<Integer> expected = Arrays.asList(2400, 2450);
+ List<Integer> expected = Arrays.asList(2412, 2450);
assertEquals(expected, actual);
}
diff --git a/tests/wifitests/src/com/android/server/wifi/util/ApConfigUtilTest.java b/tests/wifitests/src/com/android/server/wifi/util/ApConfigUtilTest.java
index 7ec492256..16c915729 100644
--- a/tests/wifitests/src/com/android/server/wifi/util/ApConfigUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/util/ApConfigUtilTest.java
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.res.Resources;
import android.net.MacAddress;
+import android.net.wifi.ScanResult;
import android.net.wifi.SoftApCapability;
import android.net.wifi.SoftApConfiguration;
import android.net.wifi.SoftApConfiguration.Builder;
@@ -221,25 +222,6 @@ public class ApConfigUtilTest extends WifiBaseTest {
}
/**
- * verify frequency to channel conversion for all possible frequencies.
- */
- @Test
- public void convertFrequencyToChannel() throws Exception {
- for (int i = 0; i < FREQUENCY_TO_CHANNEL_MAP.length; i += 3) {
- assertEquals(FREQUENCY_TO_CHANNEL_MAP[i + 2],
- ApConfigUtil.convertFrequencyToChannel(FREQUENCY_TO_CHANNEL_MAP[i]));
- }
- }
-
- /**
- * Verify frequency to channel conversion failed for an invalid frequency.
- */
- @Test
- public void convertFrequencyToChannelWithInvalidFreq() throws Exception {
- assertEquals(-1, ApConfigUtil.convertFrequencyToChannel(8000));
- }
-
- /**
* verify frequency to band conversion for all possible frequencies.
*/
@Test
@@ -295,7 +277,8 @@ public class ApConfigUtilTest extends WifiBaseTest {
.thenReturn(allowed2gChannels);
int freq = ApConfigUtil.chooseApChannel(SoftApConfiguration.BAND_2GHZ, mWifiNative,
mResources);
- assertEquals(ApConfigUtil.DEFAULT_AP_CHANNEL, ApConfigUtil.convertFrequencyToChannel(freq));
+ assertEquals(ApConfigUtil.DEFAULT_AP_CHANNEL,
+ ScanResult.convertFrequencyMhzToChannel(freq));
}
/**