Merge "Update APF VTS to include the vendor API level check" into udc-dev am: 51d7c99586 am: 43e19e7a90

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/23303618

Change-Id: Ie2ba9d46b1c7f59ed1d55179cf09ac52d5b73d32
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
index 288f20a..f12d873 100644
--- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
+++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
@@ -24,6 +24,7 @@
 #include <android/binder_status.h>
 #include <binder/IServiceManager.h>
 #include <binder/ProcessState.h>
+#include <cutils/properties.h>
 
 #include "wifi_aidl_test_utils.h"
 
@@ -98,16 +99,23 @@
  */
 // @VsrTest = 5.3.12
 TEST_P(WifiStaIfaceAidlTest, CheckApfIsSupported) {
-    // It is not required to check the vendor API level is at least U here
-    // because the Wi-Fi AIDL interface is launched with Android U(VSR-14).
-    // TODO: Add wavier list to the chipsets that doesn't support APF.
-    EXPECT_TRUE(isFeatureSupported(IWifiStaIface::FeatureSetMask::APF));
-    StaApfPacketFilterCapabilities apf_caps = {};
-    EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk());
-    // The APF version must be 4 and the usable memory must be at least
-    // 1024 bytes.
-    EXPECT_EQ(apf_caps.version, 4);
-    EXPECT_GE(apf_caps.maxLength, 1024);
+    int vendor_api_level = property_get_int32("ro.vendor.api_level", 0);
+    // Before VSR 14, APF support is optional.
+    if (vendor_api_level < __ANDROID_API_U__) {
+        if (!isFeatureSupported(IWifiStaIface::FeatureSetMask::APF)) {
+            GTEST_SKIP() << "APF packet filter capabilities are not supported.";
+        }
+        StaApfPacketFilterCapabilities apf_caps = {};
+        EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk());
+    } else {
+        EXPECT_TRUE(isFeatureSupported(IWifiStaIface::FeatureSetMask::APF));
+        StaApfPacketFilterCapabilities apf_caps = {};
+        EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk());
+        // The APF version must be 4 and the usable memory must be at least
+        // 1024 bytes.
+        EXPECT_EQ(apf_caps.version, 4);
+        EXPECT_GE(apf_caps.maxLength, 1024);
+    }
 }
 
 /*