Snap for 11206181 from d80d52539520911de81142e00148cfee098d130c to 24Q1-release
Change-Id: I66cfcaaced1cd794ae8e428f18eab142d0a0dac8
diff --git a/framework/java/android/net/wifi/ScanResult.java b/framework/java/android/net/wifi/ScanResult.java
index 539423f..1eb35e4 100644
--- a/framework/java/android/net/wifi/ScanResult.java
+++ b/framework/java/android/net/wifi/ScanResult.java
@@ -539,6 +539,20 @@
public static final int WIFI_BAND_60_GHZ = WifiScanner.WIFI_BAND_60_GHZ;
/**
+ * Constant used for dual 5GHz multi-internet use-case only. Not to be used for regular scan
+ * result reporting.
+ * @hide
+ */
+ public static final int WIFI_BAND_5_GHZ_LOW = WifiScanner.WIFI_BAND_5_GHZ_LOW;
+
+ /**
+ * Constant used for dual 5GHz multi-internet use-case only. Not to be used for regular scan
+ * result reporting.
+ * @hide
+ */
+ public static final int WIFI_BAND_5_GHZ_HIGH = WifiScanner.WIFI_BAND_5_GHZ_HIGH;
+
+ /**
* @hide
*/
@Retention(RetentionPolicy.SOURCE)
@@ -873,6 +887,16 @@
* @hide
*/
public static final int BAND_60_GHZ_END_FREQ_MHZ = 70200;
+ /**
+ * The highest frequency in 5GHz low
+ * @hide
+ */
+ public static final int BAND_5_GHZ_LOW_HIGHEST_FREQ_MHZ = 5320;
+ /**
+ * The lowest frequency in 5GHz high
+ * @hide
+ */
+ public static final int BAND_5_GHZ_HIGH_LOWEST_FREQ_MHZ = 5500;
/**
* Utility function to check if a frequency within 2.4 GHz band
@@ -936,6 +960,35 @@
}
/**
+ * Utility function to check whether 2 frequencies are valid for multi-internet connection
+ * when dual-5GHz is supported.
+ *
+ * The allowed combinations are:
+ * - 2.4GHz + Any 5GHz
+ * - 2.4GHz + 6Ghz
+ * - 5GHz low + 5GHz high
+ * - 5GHz low + 6GHz
+ * @hide
+ */
+ public static boolean isValidCombinedBandForDual5GHz(int freqMhz1, int freqMhz2) {
+ int band1 = toBand(freqMhz1);
+ int band2 = toBand(freqMhz2);
+ if (band1 == WIFI_BAND_24_GHZ || band2 == WIFI_BAND_24_GHZ) {
+ return band1 != band2;
+ }
+
+ // 5GHz Low : b1 36-48 b2 52-64(5320)
+ // 5GHz High : b3 100(5500)-144 b4 149-165
+ if ((freqMhz1 <= BAND_5_GHZ_LOW_HIGHEST_FREQ_MHZ
+ && freqMhz2 >= BAND_5_GHZ_HIGH_LOWEST_FREQ_MHZ)
+ || (freqMhz2 <= BAND_5_GHZ_LOW_HIGHEST_FREQ_MHZ
+ && freqMhz1 >= BAND_5_GHZ_HIGH_LOWEST_FREQ_MHZ)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Utility function to convert Wi-Fi channel number to frequency in MHz.
*
* Reference the Wi-Fi channel numbering and the channelization in IEEE 802.11-2016
diff --git a/framework/java/android/net/wifi/SoftApCapability.java b/framework/java/android/net/wifi/SoftApCapability.java
index 9a5afaa..0607db4 100644
--- a/framework/java/android/net/wifi/SoftApCapability.java
+++ b/framework/java/android/net/wifi/SoftApCapability.java
@@ -234,6 +234,20 @@
}
/**
+ * Set SoftAp Capabilities
+ * @param value Boolean to set value 0 or 1
+ * @param features @HotspotFeatures represents which feature to access
+ * @hide
+ */
+ public void setSupportedFeatures(boolean value, @HotspotFeatures long features) {
+ if (value) {
+ mSupportedFeatures |= features;
+ } else {
+ mSupportedFeatures &= ~features;
+ }
+ }
+
+ /**
* Set supported channel list in target band type.
*
* @param band One of the following band types:
diff --git a/framework/java/android/net/wifi/WifiNetworkAgentSpecifier.java b/framework/java/android/net/wifi/WifiNetworkAgentSpecifier.java
index a39a83b..260a0f9 100644
--- a/framework/java/android/net/wifi/WifiNetworkAgentSpecifier.java
+++ b/framework/java/android/net/wifi/WifiNetworkAgentSpecifier.java
@@ -133,7 +133,15 @@
if (!mMatchLocalOnlySpecifiers) {
// Specifiers that match non-local-only networks only match against the band.
- return ns.getBand() == mBand;
+ if (mBand == ScanResult.WIFI_BAND_5_GHZ_LOW) {
+ return ns.getBand() == ScanResult.WIFI_BAND_5_GHZ_LOW
+ || ns.getBand() == ScanResult.WIFI_BAND_5_GHZ;
+ } else if (mBand == ScanResult.WIFI_BAND_5_GHZ_HIGH) {
+ return ns.getBand() == ScanResult.WIFI_BAND_5_GHZ_HIGH
+ || ns.getBand() == ScanResult.WIFI_BAND_5_GHZ;
+ } else {
+ return ns.getBand() == mBand;
+ }
}
if (ns.getBand() != ScanResult.UNSPECIFIED && ns.getBand() != mBand) {
return false;
diff --git a/framework/java/android/net/wifi/WifiNetworkSpecifier.java b/framework/java/android/net/wifi/WifiNetworkSpecifier.java
index 409773d..a137b22 100644
--- a/framework/java/android/net/wifi/WifiNetworkSpecifier.java
+++ b/framework/java/android/net/wifi/WifiNetworkSpecifier.java
@@ -110,6 +110,8 @@
case UNSPECIFIED:
case ScanResult.WIFI_BAND_24_GHZ:
case ScanResult.WIFI_BAND_5_GHZ:
+ case ScanResult.WIFI_BAND_5_GHZ_LOW:
+ case ScanResult.WIFI_BAND_5_GHZ_HIGH:
case ScanResult.WIFI_BAND_6_GHZ:
case ScanResult.WIFI_BAND_60_GHZ:
return true;
diff --git a/framework/java/android/net/wifi/WifiScanner.java b/framework/java/android/net/wifi/WifiScanner.java
index cb53afe..526ca7c 100644
--- a/framework/java/android/net/wifi/WifiScanner.java
+++ b/framework/java/android/net/wifi/WifiScanner.java
@@ -76,6 +76,18 @@
/** @hide */
public static final int WIFI_BAND_COUNT = 5;
+ /**
+ * Reserved bit for Multi-internet connection only, not for scanning.
+ * @hide
+ */
+ public static final int WIFI_BAND_INDEX_5_GHZ_LOW = 29;
+
+ /**
+ * Reserved bit for Multi-internet connection only, not for scanning.
+ * @hide
+ */
+ public static final int WIFI_BAND_INDEX_5_GHZ_HIGH = 30;
+
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"WIFI_BAND_INDEX_"}, value = {
@@ -100,6 +112,17 @@
public static final int WIFI_BAND_60_GHZ = 1 << WIFI_BAND_INDEX_60_GHZ;
/**
+ * Reserved for Multi-internet connection only, not for scanning.
+ * @hide
+ */
+ public static final int WIFI_BAND_5_GHZ_LOW = 1 << WIFI_BAND_INDEX_5_GHZ_LOW;
+ /**
+ * Reserved for Multi-internet connection only, not for scanning.
+ * @hide
+ */
+ public static final int WIFI_BAND_5_GHZ_HIGH = 1 << WIFI_BAND_INDEX_5_GHZ_HIGH;
+
+ /**
* Combination of bands
* Note that those are only the common band combinations,
* other combinations can be created by combining any of the basic bands above
diff --git a/framework/tests/src/android/net/wifi/WifiNetworkAgentSpecifierTest.java b/framework/tests/src/android/net/wifi/WifiNetworkAgentSpecifierTest.java
index 53a0130..bc22b80 100644
--- a/framework/tests/src/android/net/wifi/WifiNetworkAgentSpecifierTest.java
+++ b/framework/tests/src/android/net/wifi/WifiNetworkAgentSpecifierTest.java
@@ -340,6 +340,77 @@
}
/**
+ * Validate {@link WifiNetworkAgentSpecifier} with {@link WifiNetworkSpecifier}
+ * WIFI_BAND_5_GHZ_LOW and WIFI_BAND_5_GHZ_HIGH band matching.
+ */
+ @Test
+ public void testWifiNetworkAgentSpecifierDual5GHZBandMatching() {
+ WifiConfiguration wifiConfigurationNetworkAgent = createDefaultWifiConfiguration();
+ wifiConfigurationNetworkAgent.SSID = "\"" + TEST_SSID + "\"";
+
+ PatternMatcher ssidPattern =
+ new PatternMatcher(TEST_SSID_PATTERN, PatternMatcher.PATTERN_PREFIX);
+ Pair<MacAddress, MacAddress> bssidPattern =
+ Pair.create(MacAddress.fromString(TEST_BSSID_OUI_BASE_ADDRESS),
+ MacAddress.fromString(TEST_BSSID_OUI_MASK));
+ WifiConfiguration wificonfigurationNetworkSpecifier = new WifiConfiguration();
+ wificonfigurationNetworkSpecifier.allowedKeyManagement
+ .set(WifiConfiguration.KeyMgmt.WPA_PSK);
+
+ // Define three types of WifiNetworkAgentSpecifier: 5G, 5GLow, and 5GHigh
+ WifiNetworkAgentSpecifier wifi5GNetworkAgentSpecifier =
+ new WifiNetworkAgentSpecifier(
+ wifiConfigurationNetworkAgent, ScanResult.WIFI_BAND_5_GHZ, false);
+ WifiNetworkAgentSpecifier wifi5GLowNetworkAgentSpecifier =
+ new WifiNetworkAgentSpecifier(
+ wifiConfigurationNetworkAgent, ScanResult.WIFI_BAND_5_GHZ_LOW, false);
+ WifiNetworkAgentSpecifier wifi5GHighNetworkAgentSpecifier =
+ new WifiNetworkAgentSpecifier(
+ wifiConfigurationNetworkAgent, ScanResult.WIFI_BAND_5_GHZ_HIGH, false);
+
+ // Define three types of WifiNetworkSpecifier: 5G, 5GLow, and 5GHigh.
+ WifiNetworkSpecifier wifiNetworkSpecifier = new WifiNetworkSpecifier(
+ ssidPattern,
+ bssidPattern,
+ ScanResult.WIFI_BAND_5_GHZ,
+ wificonfigurationNetworkSpecifier, new int[0]);
+ WifiNetworkSpecifier wifi5GLowNetworkSpecifier = new WifiNetworkSpecifier(
+ ssidPattern,
+ bssidPattern,
+ ScanResult.WIFI_BAND_5_GHZ_LOW,
+ wificonfigurationNetworkSpecifier, new int[0]);
+ WifiNetworkSpecifier wifi5GHighNetworkSpecifier = new WifiNetworkSpecifier(
+ ssidPattern,
+ bssidPattern,
+ ScanResult.WIFI_BAND_5_GHZ_HIGH,
+ wificonfigurationNetworkSpecifier, new int[0]);
+
+ // mBand = WIFI_BAND_5_GHZ_LOW
+ // Same band matches.
+ assertTrue(wifi5GLowNetworkSpecifier.canBeSatisfiedBy(wifi5GLowNetworkAgentSpecifier));
+ assertTrue(wifi5GLowNetworkAgentSpecifier.canBeSatisfiedBy(wifi5GLowNetworkSpecifier));
+ // WIFI_BAND_5_GHZ_LOW matches with WIFI_BAND_5_GHZ
+ assertTrue(wifiNetworkSpecifier.canBeSatisfiedBy(wifi5GLowNetworkAgentSpecifier));
+ assertTrue(wifi5GLowNetworkAgentSpecifier.canBeSatisfiedBy(wifiNetworkSpecifier));
+
+ // mBand = WIFI_BAND_5_GHZ_HIGH
+ // Same band matches.
+ assertTrue(wifi5GHighNetworkSpecifier.canBeSatisfiedBy(wifi5GHighNetworkAgentSpecifier));
+ assertTrue(wifi5GHighNetworkAgentSpecifier.canBeSatisfiedBy(wifi5GHighNetworkSpecifier));
+ // WIFI_BAND_5_GHZ_HIGH matches with WIFI_BAND_5_GHZ
+ assertTrue(wifiNetworkSpecifier.canBeSatisfiedBy(wifi5GHighNetworkAgentSpecifier));
+ assertTrue(wifi5GHighNetworkAgentSpecifier.canBeSatisfiedBy(wifiNetworkSpecifier));
+
+ // mBand = WIFI_BAND_5_GHZ
+ // WIFI_BAND_5_GHZ matches with WIFI_BAND_5_GHZ_LOW
+ assertFalse(wifi5GLowNetworkSpecifier.canBeSatisfiedBy(wifi5GNetworkAgentSpecifier));
+ assertFalse(wifi5GNetworkAgentSpecifier.canBeSatisfiedBy(wifi5GLowNetworkSpecifier));
+ // WIFI_BAND_5_GHZ matches with WIFI_BAND_5_GHZ_HIGH
+ assertFalse(wifi5GHighNetworkSpecifier.canBeSatisfiedBy(wifi5GNetworkAgentSpecifier));
+ assertFalse(wifi5GNetworkAgentSpecifier.canBeSatisfiedBy(wifi5GHighNetworkSpecifier));
+ }
+
+ /**
* Validate {@link WifiNetworkAgentSpecifier} local-only matching.
*/
@Test
diff --git a/service/ServiceWifiResources/res/values/config.xml b/service/ServiceWifiResources/res/values/config.xml
index 10aef8b..70c845e 100644
--- a/service/ServiceWifiResources/res/values/config.xml
+++ b/service/ServiceWifiResources/res/values/config.xml
@@ -985,6 +985,9 @@
name. It is STRONGLY RECOMMENDED to be set to false -->
<bool translatable="false" name="config_wifiAllowInsecureEnterpriseConfigurationsForSettingsAndSUW">false</bool>
+ <!-- Configuration that allows Multi-internet to connect simultaneously to both 5GHz high and 5GHz low -->
+ <bool translatable="false" name="config_wifiAllowMultiInternetConnectDual5GFrequency">false</bool>
+
<!-- Indicate the max lines for connectivity local log based on the device ram size -->
<integer translatable="false" name="config_wifiConnectivityLocalLogMaxLinesLowRam">256</integer>
<integer translatable="false" name="config_wifiConnectivityLocalLogMaxLinesHighRam">512</integer>
diff --git a/service/ServiceWifiResources/res/values/overlayable.xml b/service/ServiceWifiResources/res/values/overlayable.xml
index 369fe75..fda090e 100644
--- a/service/ServiceWifiResources/res/values/overlayable.xml
+++ b/service/ServiceWifiResources/res/values/overlayable.xml
@@ -277,6 +277,7 @@
<item type="integer" name="config_wifiMaxNumWifiConfigurations" />
<item type="integer" name="config_wifiMaxNumWifiConfigurationsAddedByAllApps" />
<item type="bool" name="config_wifiAllowInsecureEnterpriseConfigurationsForSettingsAndSUW" />
+ <item type="bool" name="config_wifiAllowMultiInternetConnectDual5GFrequency" />
<item type="integer" name="config_wifiConnectivityLocalLogMaxLinesLowRam" />
<item type="integer" name="config_wifiConnectivityLocalLogMaxLinesHighRam" />
<item type="integer" name="config_wifiClientModeImplNumLogRecs" />
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index b92ae26..50732d6 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -5074,10 +5074,20 @@
// Defensive copy to avoid mutating the passed argument
final WifiConfiguration conf = new WifiConfiguration(currentWifiConfiguration);
conf.BSSID = currentBssid;
+
+ int band = WifiNetworkSpecifier.getBand(mWifiInfo.getFrequency());
+
+ if (!isPrimary() && mWifiGlobals.isSupportMultiInternetDual5G()
+ && band == ScanResult.WIFI_BAND_5_GHZ) {
+ if (mWifiInfo.getFrequency() <= ScanResult.BAND_5_GHZ_LOW_HIGHEST_FREQ_MHZ) {
+ band = ScanResult.WIFI_BAND_5_GHZ_LOW;
+ } else {
+ band = ScanResult.WIFI_BAND_5_GHZ_HIGH;
+ }
+ }
+
WifiNetworkAgentSpecifier wns =
- new WifiNetworkAgentSpecifier(conf,
- WifiNetworkSpecifier.getBand(mWifiInfo.getFrequency()),
- matchLocationSensitiveInformation);
+ new WifiNetworkAgentSpecifier(conf, band, matchLocationSensitiveInformation);
return wns;
}
diff --git a/service/java/com/android/server/wifi/HostapdHalAidlImp.java b/service/java/com/android/server/wifi/HostapdHalAidlImp.java
index 6187748..e453eb8 100644
--- a/service/java/com/android/server/wifi/HostapdHalAidlImp.java
+++ b/service/java/com/android/server/wifi/HostapdHalAidlImp.java
@@ -912,9 +912,7 @@
R.bool.config_wifiSoftapHeMuBeamformerSupported);
hwModeParams.enableHeTargetWakeTime = mContext.getResources().getBoolean(
R.bool.config_wifiSoftapHeTwtSupported);
- hwModeParams.enable80211BE = ApConfigUtil.isIeee80211beSupported(mContext);
- //Update 80211be support with the configuration.
- hwModeParams.enable80211BE &= config.isIeee80211beEnabledInternal();
+ hwModeParams.enable80211BE = config.isIeee80211beEnabledInternal();
if (SdkLevel.isAtLeastT()) {
hwModeParams.maximumChannelBandwidth =
diff --git a/service/java/com/android/server/wifi/ThroughputScorer.java b/service/java/com/android/server/wifi/ThroughputScorer.java
index db8135f..9be9d64 100644
--- a/service/java/com/android/server/wifi/ThroughputScorer.java
+++ b/service/java/com/android/server/wifi/ThroughputScorer.java
@@ -110,9 +110,9 @@
? mScoringParams.getBand6GhzBonus() : 0;
int currentNetworkBoost = (candidate.isCurrentNetwork() && !unExpectedNoInternet)
? currentNetworkBonus : 0;
- int rssiBoost = (candidate.isCurrentNetwork() && unExpectedNoInternet)
+ int rssiBoost = unExpectedNoInternet && candidate.getNumRebootsSinceLastUse() == 0
? 0 : rssiBaseScore;
- int throughputBoost = (candidate.isCurrentNetwork() && unExpectedNoInternet)
+ int throughputBoost = unExpectedNoInternet && candidate.getNumRebootsSinceLastUse() == 0
? 0 : throughputBonusScore;
int securityAward = candidate.isOpenNetwork()
diff --git a/service/java/com/android/server/wifi/WifiCandidates.java b/service/java/com/android/server/wifi/WifiCandidates.java
index d471fc5..93e2e71 100644
--- a/service/java/com/android/server/wifi/WifiCandidates.java
+++ b/service/java/com/android/server/wifi/WifiCandidates.java
@@ -188,6 +188,11 @@
MacAddress getApMldMacAddress();
/**
+ * Gets the number of reboots since the WifiConfiguration is last connected or updated.
+ */
+ int getNumRebootsSinceLastUse();
+
+ /**
* Gets statistics from the scorecard.
*/
@Nullable WifiScoreCardProto.Signal getEventStatistics(WifiScoreCardProto.Event event);
@@ -239,6 +244,7 @@
private final boolean mCarrierOrPrivileged;
private final int mPredictedThroughputMbps;
private int mPredictedMultiLinkThroughputMbps;
+ private final int mNumRebootsSinceLastUse;
private final int mEstimatedPercentInternetAvailability;
private final MacAddress mApMldMacAddress;
private final boolean mIpProvisioningTimedOut;
@@ -278,6 +284,7 @@
this.mOemPrivate = config.oemPrivate;
this.mCarrierOrPrivileged = isCarrierOrPrivileged;
this.mPredictedThroughputMbps = predictedThroughputMbps;
+ this.mNumRebootsSinceLastUse = config.numRebootsSinceLastUse;
this.mEstimatedPercentInternetAvailability = perBssid == null ? 50 :
perBssid.estimatePercentInternetAvailability();
this.mRestricted = config.restricted;
@@ -412,6 +419,11 @@
}
@Override
+ public int getNumRebootsSinceLastUse() {
+ return mNumRebootsSinceLastUse;
+ }
+
+ @Override
public int getEstimatedPercentInternetAvailability() {
return mEstimatedPercentInternetAvailability;
}
@@ -456,6 +468,7 @@
+ "Mbps = " + getPredictedThroughputMbps() + ", "
+ "nominator = " + getNominatorId() + ", "
+ "pInternet = " + getEstimatedPercentInternetAvailability() + ", "
+ + "numRebootsSinceLastUse = " + getNumRebootsSinceLastUse() + ", "
+ lastSelectionWeightString
+ (isCurrentBssid() ? "connected, " : "")
+ (isCurrentNetwork() ? "current, " : "")
@@ -469,7 +482,8 @@
+ (hasNoInternetAccess() ? "noInternet, " : "")
+ (isNoInternetAccessExpected() ? "noInternetExpected, " : "")
+ (isPasspoint() ? "passpoint, " : "")
- + (isOpenNetwork() ? "open" : "secure") + " }";
+ + (isOpenNetwork() ? "open" : "secure")
+ + " }";
}
}
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 3b63277..574b0b0 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -377,6 +377,16 @@
}
/**
+ * Utility band filter method for multi-internet use-case.
+ */
+ @VisibleForTesting
+ public boolean filterMultiInternetFrequency(int primaryFreq, int secondaryFreq) {
+ return mWifiGlobals.isSupportMultiInternetDual5G()
+ ? ScanResult.isValidCombinedBandForDual5GHz(primaryFreq, secondaryFreq)
+ : ScanResult.toBand(primaryFreq) != ScanResult.toBand(secondaryFreq);
+ }
+
+ /**
* Helper method to consolidate handling of scan results when multi internet is enabled.
*/
private boolean handleConnectToMultiInternetConnectionInternal(
@@ -413,13 +423,16 @@
// A BSSID can only exist in one band, so when evaluating candidates, only those
// with a different band from the primary will be considered.
secondaryCmmCandidates = candidates.stream()
- .filter(c -> ScanResult.toBand(c.getFrequency()) != primaryBand)
+ .filter(c -> {
+ return filterMultiInternetFrequency(
+ primaryInfo.getFrequency(), c.getFrequency());
+ })
.collect(Collectors.toList());
}
} else {
// Only allow the candidates have the same SSID as the primary.
secondaryCmmCandidates = candidates.stream().filter(c -> {
- return ScanResult.toBand(c.getFrequency()) != primaryBand
+ return filterMultiInternetFrequency(primaryInfo.getFrequency(), c.getFrequency())
&& !primaryCcm.isAffiliatedLinkBssid(c.getKey().bssid) && TextUtils.equals(
c.getKey().matchInfo.networkSsid, primaryInfo.getSSID())
&& c.getKey().networkId == primaryInfo.getNetworkId()
diff --git a/service/java/com/android/server/wifi/WifiGlobals.java b/service/java/com/android/server/wifi/WifiGlobals.java
index d3176cc..1725ed7 100644
--- a/service/java/com/android/server/wifi/WifiGlobals.java
+++ b/service/java/com/android/server/wifi/WifiGlobals.java
@@ -74,6 +74,7 @@
private final int mClientRssiMonitorThresholdDbm;
private final int mClientRssiMonitorHysteresisDb;
private boolean mDisableFirmwareRoamingInIdleMode = false;
+ private final boolean mIsSupportMultiInternetDual5G;
private final boolean mAdjustPollRssiIntervalEnabled;
private final boolean mWifiInterfaceAddedSelfRecoveryEnabled;
private final int mNetworkNotFoundEventThreshold;
@@ -135,6 +136,8 @@
R.bool.config_wifiAdjustPollRssiIntervalEnabled);
mDisableFirmwareRoamingInIdleMode = mContext.getResources()
.getBoolean(R.bool.config_wifiDisableFirmwareRoamingInIdleMode);
+ mIsSupportMultiInternetDual5G = mContext.getResources().getBoolean(
+ R.bool.config_wifiAllowMultiInternetConnectDual5GFrequency);
mWifiInterfaceAddedSelfRecoveryEnabled = mContext.getResources().getBoolean(
R.bool.config_wifiInterfaceAddedSelfRecoveryEnabled);
mDisableUnwantedNetworkOnLowRssi = mContext.getResources().getBoolean(
@@ -353,6 +356,14 @@
}
/**
+ * Get the configuration for whether Multi-internet are allowed to
+ * connect simultaneously to both 5GHz high and 5GHz low.
+ */
+ public boolean isSupportMultiInternetDual5G() {
+ return mIsSupportMultiInternetDual5G;
+ }
+
+ /**
* Helper method to check if the device may not connect to the configuration
* due to deprecated security type
*/
@@ -610,5 +621,6 @@
+ ", durationMs=" + perFailureMap.valueAt(j).durationMs);
}
}
+ pw.println("mIsSupportMultiInternetDual5G=" + mIsSupportMultiInternetDual5G);
}
}
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index e3da759..82835c0 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -4593,6 +4593,15 @@
if (iface.phyCapabilities == null) {
iface.phyCapabilities = mWifiCondManager.getDeviceWiphyCapabilities(ifaceName);
}
+ if (iface.phyCapabilities != null
+ && iface.phyCapabilities.isWifiStandardSupported(ScanResult.WIFI_STANDARD_11BE)
+ != mWifiInjector.getSettingsConfigStore()
+ .get(WifiSettingsConfigStore.WIFI_WIPHY_11BE_SUPPORTED)) {
+ mWifiInjector.getSettingsConfigStore().put(
+ WifiSettingsConfigStore.WIFI_WIPHY_11BE_SUPPORTED,
+ iface.phyCapabilities.isWifiStandardSupported(
+ ScanResult.WIFI_STANDARD_11BE));
+ }
return iface.phyCapabilities;
}
}
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index ce3d000..3795d4a 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -2025,6 +2025,8 @@
synchronized (mLock) {
if (mSoftApCapability == null) {
mSoftApCapability = ApConfigUtil.updateCapabilityFromResource(mContext);
+ mSoftApCapability = ApConfigUtil.updateCapabilityFromConfigStore(
+ mSoftApCapability, mWifiInjector.getSettingsConfigStore());
// Default country code
mSoftApCapability = updateSoftApCapabilityWithAvailableChannelList(
mSoftApCapability, mCountryCode.getCountryCode());
diff --git a/service/java/com/android/server/wifi/WifiSettingsConfigStore.java b/service/java/com/android/server/wifi/WifiSettingsConfigStore.java
index 0162d76..c49ec13 100644
--- a/service/java/com/android/server/wifi/WifiSettingsConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiSettingsConfigStore.java
@@ -187,6 +187,12 @@
*/
public static final Key<Boolean> WIFI_WEP_ALLOWED = new Key<>("wep_allowed", true);
+ /**
+ * Store wiphy capability for 11be support.
+ */
+ public static final Key<Boolean> WIFI_WIPHY_11BE_SUPPORTED =
+ new Key<>("wifi_wiphy_11be_supported", true);
+
/******** Wifi shared pref keys ***************/
private final Context mContext;
diff --git a/service/java/com/android/server/wifi/util/ApConfigUtil.java b/service/java/com/android/server/wifi/util/ApConfigUtil.java
index 8b5b8e1..0c5534c 100644
--- a/service/java/com/android/server/wifi/util/ApConfigUtil.java
+++ b/service/java/com/android/server/wifi/util/ApConfigUtil.java
@@ -52,6 +52,7 @@
import com.android.modules.utils.build.SdkLevel;
import com.android.server.wifi.SoftApManager;
import com.android.server.wifi.WifiNative;
+import com.android.server.wifi.WifiSettingsConfigStore;
import com.android.server.wifi.coex.CoexManager;
import com.android.wifi.resources.R;
@@ -1001,6 +1002,27 @@
}
/**
+ * Helper function to update SoftApCapability instance based on config store.
+ *
+ * @param capability the original softApCapability
+ * @param configStore where we stored the Capability after first time fetch from driver.
+ * @return SoftApCapability which updated from the config store.
+ */
+ @NonNull
+ public static SoftApCapability updateCapabilityFromConfigStore(
+ SoftApCapability capability,
+ WifiSettingsConfigStore configStore) {
+ if (capability == null) {
+ return null;
+ }
+ if (capability.areFeaturesSupported(SOFTAP_FEATURE_IEEE80211_BE)) {
+ capability.setSupportedFeatures(isIeee80211beEnabledInConfig(configStore),
+ SOFTAP_FEATURE_IEEE80211_BE);
+ }
+ return capability;
+ }
+
+ /**
* Helper function to get device support 802.11 AX on Soft AP or not
*
* @param context the caller context used to get value from resource file.
@@ -1023,6 +1045,18 @@
}
/**
+ * Helper function to check Config supports 802.11 BE on Soft AP or not
+ *
+ * @param configStore to check the support from WifiSettingsConfigStore
+ * @return true if supported, false otherwise.
+ */
+ public static boolean isIeee80211beEnabledInConfig(
+ WifiSettingsConfigStore configStore) {
+ return configStore.get(
+ WifiSettingsConfigStore.WIFI_WIPHY_11BE_SUPPORTED);
+ }
+
+ /**
* Helper function to get device support AP MAC randomization or not.
*
* @param context the caller context used to get value from resource file.
diff --git a/service/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java b/service/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java
index 77b69f8..fd3edcb 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java
@@ -293,6 +293,31 @@
}
/**
+ * With everything else the same, the current network and another candidate both without
+ * internet should get the same score.
+ */
+ @Test
+ public void testNoInternetNetworksEvaluateTheSame() throws Exception {
+ if (mExpectedExpId != ThroughputScorer.THROUGHPUT_SCORER_DEFAULT_EXPID) return;
+ double score1 = evaluate(mCandidate1.setScanRssi(-57)
+ .setCurrentNetwork(true)
+ .setPredictedThroughputMbps(560)
+ .setNoInternetAccess(true)
+ .setNoInternetAccessExpected(false));
+ double score2 = evaluate(mCandidate2.setScanRssi(-57)
+ .setPredictedThroughputMbps(560)
+ .setNoInternetAccess(true)
+ .setNoInternetAccessExpected(false));
+
+ // Both networks no internet and have no reboot since last use. Expect same same.
+ assertEquals(score1, score2, TOL);
+
+ // score candidate 2 but after a reboot. It should have higher score.
+ double score3 = evaluate(mCandidate2.setNumRebootsSinceLastUse(1));
+ assertThat(score3, greaterThan(score1));
+ }
+
+ /**
* Prefer to switch with a larger rssi difference.
*/
@Test
@@ -488,19 +513,19 @@
@Test
public void testPreferCurrentNetworkWithInternetOverNetworkWithNoInternet() throws Exception {
if (mExpectedExpId == ThroughputScorer.THROUGHPUT_SCORER_DEFAULT_EXPID) {
- // First verify that when evaluated separately, mCandidate2 has a higher score due
- // to it having better RSSI and throughput.
+ // mCandidate2 should have lower score due to not having internet
mCandidate1.setScanRssi(-77)
.setPredictedThroughputMbps(30)
.setCurrentNetwork(true)
- .setNoInternetAccess(false);
+ .setNoInternetAccess(false)
+ .setNoInternetAccessExpected(false);
mCandidate2.setScanRssi(-40)
.setPredictedThroughputMbps(100)
.setCurrentNetwork(false)
.setNoInternetAccess(true)
.setNoInternetAccessExpected(false);
double score1 = evaluate(mCandidate1);
- assertThat(evaluate(mCandidate2), greaterThan(score1));
+ assertThat(evaluate(mCandidate2), lessThan(score1));
// Then verify that when evaluated together, mCandidate1 wins because it is the current
// network and has internet
diff --git a/service/tests/wifitests/src/com/android/server/wifi/ConcreteCandidate.java b/service/tests/wifitests/src/com/android/server/wifi/ConcreteCandidate.java
index 2b10a01..00a3564 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/ConcreteCandidate.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/ConcreteCandidate.java
@@ -50,6 +50,7 @@
private int mEstimatedPercentInternetAvailability = 50;
private int mPredictedMultiLinkThroughputMbps = 0;
private MacAddress mApMldMacAddress;
+ private int mNumRebootsSinceLastUse;
private boolean mIpProvisioningTimedOut;
@@ -90,6 +91,7 @@
}
}
mPredictedMultiLinkThroughputMbps = candidate.getPredictedMultiLinkThroughputMbps();
+ mNumRebootsSinceLastUse = candidate.getNumRebootsSinceLastUse();
mApMldMacAddress = candidate.getApMldMacAddress();
mIpProvisioningTimedOut = candidate.isIpProvisioningTimedOut();
}
@@ -324,6 +326,19 @@
return mApMldMacAddress;
}
+ @Override
+ public int getNumRebootsSinceLastUse() {
+ return mNumRebootsSinceLastUse;
+ }
+
+ /**
+ * Setter for mNumRebootsSinceLastUse.
+ */
+ public ConcreteCandidate setNumRebootsSinceLastUse(int numRebootsSinceLastUse) {
+ mNumRebootsSinceLastUse = numRebootsSinceLastUse;
+ return this;
+ }
+
public ConcreteCandidate setEventStatistics(
WifiScoreCardProto.Event event,
WifiScoreCardProto.Signal signal) {
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
index b8a7219..ece4ea1 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
@@ -4924,6 +4924,44 @@
verify(mPrimaryClientModeManager, times(0)).startRoamToNetwork(anyInt(), anyObject());
}
+ @Test
+ public void testMultiInternetSimultaneous5GHz() {
+ // Enable dual 5GHz multi-internet mode
+ when(mWifiGlobals.isSupportMultiInternetDual5G()).thenReturn(true);
+
+ // 2.4GHz + 5GHz should be allowed
+ assertTrue(mWifiConnectivityManager.filterMultiInternetFrequency(TEST_FREQUENCY,
+ TEST_FREQUENCY_5G));
+
+ // 5GHz low + 5GHz high should be allowed
+ assertTrue(mWifiConnectivityManager.filterMultiInternetFrequency(
+ ScanResult.BAND_5_GHZ_LOW_HIGHEST_FREQ_MHZ,
+ ScanResult.BAND_5_GHZ_HIGH_LOWEST_FREQ_MHZ));
+
+ // 5GHz low + other 5GHz (that's neither low nor high) should not be allowed
+ assertFalse(mWifiConnectivityManager.filterMultiInternetFrequency(
+ ScanResult.BAND_5_GHZ_LOW_HIGHEST_FREQ_MHZ,
+ ScanResult.BAND_5_GHZ_HIGH_LOWEST_FREQ_MHZ - 1));
+
+ // 2 frequencies in 5GHz low band should not be allowed
+ assertFalse(mWifiConnectivityManager.filterMultiInternetFrequency(
+ ScanResult.BAND_5_GHZ_LOW_HIGHEST_FREQ_MHZ,
+ ScanResult.BAND_5_GHZ_LOW_HIGHEST_FREQ_MHZ - 1));
+
+ // 2 frequencies in 5GHz high band should not be allowed
+ assertFalse(mWifiConnectivityManager.filterMultiInternetFrequency(
+ ScanResult.BAND_5_GHZ_HIGH_LOWEST_FREQ_MHZ,
+ ScanResult.BAND_5_GHZ_HIGH_LOWEST_FREQ_MHZ + 1));
+
+ // Disable dual 5GHz multi-internet mode
+ when(mWifiGlobals.isSupportMultiInternetDual5G()).thenReturn(false);
+
+ // 5GHz low + 5GHz high should no longer be allowed
+ assertFalse(mWifiConnectivityManager.filterMultiInternetFrequency(
+ ScanResult.BAND_5_GHZ_LOW_HIGHEST_FREQ_MHZ,
+ ScanResult.BAND_5_GHZ_HIGH_LOWEST_FREQ_MHZ));
+ }
+
/**
* Dump local log buffer.
*
diff --git a/service/tests/wifitests/src/com/android/server/wifi/util/ApConfigUtilTest.java b/service/tests/wifitests/src/com/android/server/wifi/util/ApConfigUtilTest.java
index fc393d3..8ec2650 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/util/ApConfigUtilTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/util/ApConfigUtilTest.java
@@ -16,6 +16,8 @@
package com.android.server.wifi.util;
+import static android.net.wifi.SoftApCapability.SOFTAP_FEATURE_IEEE80211_BE;
+
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -49,6 +51,7 @@
import com.android.server.wifi.SoftApManager;
import com.android.server.wifi.WifiBaseTest;
import com.android.server.wifi.WifiNative;
+import com.android.server.wifi.WifiSettingsConfigStore;
import com.android.server.wifi.coex.CoexManager;
import com.android.wifi.resources.R;
@@ -155,6 +158,7 @@
@Mock Resources mResources;
@Mock WifiNative mWifiNative;
@Mock CoexManager mCoexManager;
+ @Mock WifiSettingsConfigStore mConfigStore;
private SoftApCapability mCapability;
/**
* Setup test.
@@ -174,6 +178,8 @@
when(mResources.getBoolean(R.bool.config_wifiSoftap24ghzSupported)).thenReturn(true);
when(mResources.getBoolean(R.bool.config_wifiSoftap5ghzSupported)).thenReturn(true);
when(mWifiNative.getUsableChannels(anyInt(), anyInt(), anyInt())).thenReturn(null);
+ when(mConfigStore.get(
+ WifiSettingsConfigStore.WIFI_WIPHY_11BE_SUPPORTED)).thenReturn(false);
}
/**
@@ -812,6 +818,23 @@
capability);
}
+
+ /**
+ * Verify updating capability from config store.
+ * Force 11BE capa to be true and then try to set it to false
+ * using updateCapabilityFromConfigStore
+ * assert if capability still has 11BE enabled.
+ */
+ @Test
+ public void testSoftApCapabilityInitWithWifiConfiguration() throws Exception {
+ long features = 0;
+ // Forcefully make 11BE as true in capability
+ features |= SOFTAP_FEATURE_IEEE80211_BE;
+ SoftApCapability capability = new SoftApCapability(features);
+ ApConfigUtil.updateCapabilityFromConfigStore(capability, mConfigStore);
+ assertFalse(capability.areFeaturesSupported(SOFTAP_FEATURE_IEEE80211_BE));
+ }
+
@Test
public void testConvertInvalidWifiConfigurationToSoftApConfiguration() throws Exception {
WifiConfiguration wifiConfig = new WifiConfiguration();