Exit QoS test early if the application
QoS feature is not enabled.
Bug: 289991006
Bug: 290417226
Test: atest WifiManagerTest#testAddAndRemoveQosPolicies
Using configurations:
- ToT build (supports feature)
- ToT build with overlay disabled
(overlay does not support feature)
- T base build with U GSI image
(HAL does not support feature)
Change-Id: Ia1ca8029d92de063e6ea7fbd233f1f29ec8e5337
Merged-In: Ia1ca8029d92de063e6ea7fbd233f1f29ec8e5337
(cherry picked from commit 479b618a600eff4bcbea04cf5448f08e4c7c9079)
diff --git a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
index 8b45d68..47132c3 100644
--- a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
@@ -6333,6 +6333,31 @@
}
/**
+ * Check whether the application QoS feature is enabled.
+ *
+ * The feature is enabled if the overlay is true, the experiment feature flag
+ * is true, and the supplicant service implements V2 of the AIDL interface.
+ */
+ private boolean applicationQosFeatureEnabled() {
+ boolean overlayEnabled;
+ try {
+ WifiResourceUtil resourceUtil = new WifiResourceUtil(mContext);
+ overlayEnabled = resourceUtil
+ .getWifiBoolean("config_wifiApplicationCentricQosPolicyFeatureEnabled");
+ } catch (Exception e) {
+ Log.i(TAG, "Unable to retrieve the QoS overlay value");
+ return false;
+ }
+
+ // Supplicant V2 is supported if the vendor partition indicates API > T.
+ boolean halSupport = PropertyUtil.isVendorApiLevelNewerThan(Build.VERSION_CODES.TIRAMISU);
+ boolean featureFlagEnabled = DeviceConfig.getBoolean(DEVICE_CONFIG_NAMESPACE,
+ "application_qos_policy_api_enabled", true);
+
+ return overlayEnabled && featureFlagEnabled && halSupport;
+ }
+
+ /**
* Tests that {@link WifiManager#addQosPolicies(List, Executor, Consumer)},
* {@link WifiManager#removeQosPolicies(int[])}, and
* {@link WifiManager#removeAllQosPolicies()} do not crash.
@@ -6377,10 +6402,9 @@
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
try {
uiAutomation.adoptShellPermissionIdentity();
- boolean enabled = DeviceConfig.getBoolean(DEVICE_CONFIG_NAMESPACE,
- "application_qos_policy_api_enabled", false);
+ boolean enabled = applicationQosFeatureEnabled();
- // If the feature flag is disabled, verify that all policies are rejected.
+ // If the feature is disabled, verify that all policies are rejected.
if (!enabled) {
Log.i(TAG, "QoS policy APIs are not enabled");
fillQosPolicyParamsList(policyParamsList, 4, true);