summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOscar Shu <xshu@google.com>2024-02-09 18:20:03 +0000
committerAndroid Build Cherrypicker Worker <android-build-cherrypicker-worker@google.com>2024-02-09 18:20:03 +0000
commit2eaa36e6162239c2392cd0e83bf729e895299820 (patch)
tree1144a557d4507eb4d3c7c6380898a8775ed56b41
parent9943ad166600f7140e950a911b90a2392e33bf91 (diff)
downloadWifi-2eaa36e6162239c2392cd0e83bf729e895299820.tar.gz
Local only STA bypass path for single load devices
There are devices which have a dynamically changing supported set of iface combinations. These devices will have the STA+STA feature overlay set to true, but will be unable to change the overlay value when their underlaying supported iface combination changes. Thus, need to check for STA+STA again when processing the local only STA bypass path. For devices that don't support STA+STA, the expected behavior should be we give the requestor the primary STA. Therefore the bypass should be allowed. Bug: 319178298 Test: atest com.android.server.wifi (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e19e24b1837e6327c52ccabea3c72448db4521e1) Merged-In: Icdb9505011b7a511a90208adadc7021825cf911a Change-Id: Icdb9505011b7a511a90208adadc7021825cf911a
-rw-r--r--service/java/com/android/server/wifi/ActiveModeWarden.java3
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java58
2 files changed, 43 insertions, 18 deletions
diff --git a/service/java/com/android/server/wifi/ActiveModeWarden.java b/service/java/com/android/server/wifi/ActiveModeWarden.java
index ef410993bb..c08adde32f 100644
--- a/service/java/com/android/server/wifi/ActiveModeWarden.java
+++ b/service/java/com/android/server/wifi/ActiveModeWarden.java
@@ -2431,8 +2431,7 @@ public class ActiveModeWarden {
// fallback decision
if (requestInfo.clientRole == ROLE_CLIENT_LOCAL_ONLY
- && mContext.getResources().getBoolean(
- R.bool.config_wifiMultiStaLocalOnlyConcurrencyEnabled)
+ && isStaStaConcurrencySupportedForLocalOnlyConnections()
&& !mWifiPermissionsUtil.isTargetSdkLessThan(
requestInfo.requestorWs.getPackageName(0), Build.VERSION_CODES.S,
requestInfo.requestorWs.getUid(0))) {
diff --git a/service/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java b/service/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java
index 2755116975..6be17516af 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java
@@ -3048,8 +3048,9 @@ public class ActiveModeWardenTest extends WifiBaseTest {
}
private void requestRemoveAdditionalClientModeManagerWhenNotAllowed(
- ClientConnectivityRole role, boolean clientIsExpected) throws Exception {
- enterClientModeActiveState();
+ ClientConnectivityRole role, boolean clientIsExpected,
+ long featureSet) throws Exception {
+ enterClientModeActiveState(false, featureSet);
// Connected to ssid1/bssid1
WifiConfiguration config1 = new WifiConfiguration();
@@ -3264,7 +3265,8 @@ public class ActiveModeWardenTest extends WifiBaseTest {
when(mWifiNative.isItPossibleToCreateStaIface(any())).thenReturn(false);
assertFalse(mActiveModeWarden.canRequestMoreClientModeManagersInRole(
TEST_WORKSOURCE, ROLE_CLIENT_LOCAL_ONLY, false));
- requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_LOCAL_ONLY, true);
+ requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_LOCAL_ONLY, true,
+ TEST_FEATURE_SET);
}
@Test
@@ -3275,7 +3277,8 @@ public class ActiveModeWardenTest extends WifiBaseTest {
.thenReturn(false);
assertFalse(mActiveModeWarden.canRequestMoreClientModeManagersInRole(
TEST_WORKSOURCE, ROLE_CLIENT_LOCAL_ONLY, false));
- requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_LOCAL_ONLY, true);
+ requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_LOCAL_ONLY, true,
+ TEST_FEATURE_SET);
}
@Test
@@ -3345,7 +3348,8 @@ public class ActiveModeWardenTest extends WifiBaseTest {
WorkSource workSource = new WorkSource(TEST_WORKSOURCE);
workSource.add(SETTINGS_WORKSOURCE);
verify(mWifiNative).isItPossibleToCreateStaIface(eq(workSource));
- requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_LOCAL_ONLY, true);
+ requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_LOCAL_ONLY,
+ true, TEST_FEATURE_SET);
}
@Test
@@ -3369,6 +3373,7 @@ public class ActiveModeWardenTest extends WifiBaseTest {
throws Exception {
// Ensure that we can't create more client ifaces - so will attempt to fallback (which we
// should be able to do for <S apps)
+ when(mWifiNative.isStaStaConcurrencySupported()).thenReturn(true);
when(mWifiNative.isItPossibleToCreateStaIface(any())).thenReturn(false);
when(mResources.getBoolean(R.bool.config_wifiMultiStaLocalOnlyConcurrencyEnabled))
.thenReturn(true);
@@ -3378,14 +3383,12 @@ public class ActiveModeWardenTest extends WifiBaseTest {
.thenReturn(true);
assertFalse(mActiveModeWarden.canRequestMoreClientModeManagersInRole(
TEST_WORKSOURCE, ROLE_CLIENT_LOCAL_ONLY, false));
- requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_LOCAL_ONLY, true);
+ requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_LOCAL_ONLY,
+ true, TEST_FEATURE_SET | WifiManager.WIFI_FEATURE_ADDITIONAL_STA_LOCAL_ONLY);
}
- @Test
- public void requestRemoveLoClientModeManagerWhenNotSystemAppAndTargetSdkEqualToSAndCantCreate()
- throws Exception {
- // Ensure that we can't create more client ifaces - so will attempt to fallback (which we
- // can't for >=S apps)
+ private void testLoFallbackAboveAndroidS(boolean isStaStaSupported) throws Exception {
+ when(mWifiNative.isStaStaConcurrencySupported()).thenReturn(isStaStaSupported);
when(mWifiNative.isItPossibleToCreateStaIface(any())).thenReturn(false);
when(mResources.getBoolean(R.bool.config_wifiMultiStaLocalOnlyConcurrencyEnabled))
.thenReturn(true);
@@ -3395,7 +3398,30 @@ public class ActiveModeWardenTest extends WifiBaseTest {
.thenReturn(false);
assertFalse(mActiveModeWarden.canRequestMoreClientModeManagersInRole(
TEST_WORKSOURCE, ROLE_CLIENT_LOCAL_ONLY, false));
- requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_LOCAL_ONLY, false);
+ long expectedFeatureSet = TEST_FEATURE_SET;
+ if (isStaStaSupported) {
+ expectedFeatureSet |= WifiManager.WIFI_FEATURE_ADDITIONAL_STA_LOCAL_ONLY;
+ }
+
+ requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_LOCAL_ONLY,
+ !isStaStaSupported,
+ expectedFeatureSet);
+ }
+
+ @Test
+ public void requestRemoveLoClientModeManagerWhenNotSystemAppAndTargetSdkEqualToSAndCantCreate()
+ throws Exception {
+ // Ensure that we can't create more client ifaces - so will attempt to fallback (which we
+ // can't for >=S apps)
+ testLoFallbackAboveAndroidS(true);
+ }
+
+ @Test
+ public void requestRemoveLoClientModeManagerWhenNotSystemAppAndTargetSdkEqualToSAndCantCreate2()
+ throws Exception {
+ // Ensure that we can't create more client ifaces and STA+STA is not supported, we
+ // fallback even for >=S apps
+ testLoFallbackAboveAndroidS(false);
}
@Test
@@ -3418,7 +3444,7 @@ public class ActiveModeWardenTest extends WifiBaseTest {
assertFalse(mActiveModeWarden.canRequestMoreClientModeManagersInRole(
TEST_WORKSOURCE, ROLE_CLIENT_SECONDARY_LONG_LIVED, false));
requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_SECONDARY_LONG_LIVED,
- true);
+ true, TEST_FEATURE_SET);
}
@Test
@@ -3431,7 +3457,7 @@ public class ActiveModeWardenTest extends WifiBaseTest {
assertFalse(mActiveModeWarden.canRequestMoreClientModeManagersInRole(
TEST_WORKSOURCE, ROLE_CLIENT_SECONDARY_LONG_LIVED, false));
requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_SECONDARY_LONG_LIVED,
- true);
+ true, TEST_FEATURE_SET);
}
@Test
@@ -3507,7 +3533,7 @@ public class ActiveModeWardenTest extends WifiBaseTest {
assertFalse(mActiveModeWarden.canRequestMoreClientModeManagersInRole(
TEST_WORKSOURCE, ROLE_CLIENT_SECONDARY_TRANSIENT, false));
requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_SECONDARY_TRANSIENT,
- true);
+ true, TEST_FEATURE_SET);
}
@Test
@@ -3521,7 +3547,7 @@ public class ActiveModeWardenTest extends WifiBaseTest {
assertFalse(mActiveModeWarden.canRequestMoreClientModeManagersInRole(
TEST_WORKSOURCE, ROLE_CLIENT_SECONDARY_TRANSIENT, false));
requestRemoveAdditionalClientModeManagerWhenNotAllowed(ROLE_CLIENT_SECONDARY_TRANSIENT,
- true);
+ true, TEST_FEATURE_SET);
}
@Test