Merge "SuspendSepolicyTests: Use target device grep" into main am: b3bf3983d8

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

Change-Id: I04f62aafb2c708003c9fba16714a8fc927edfbc4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/wifi/keystore/1.0/default/test/WifiLegacyKeystoreIntegrationTest.cpp b/wifi/keystore/1.0/default/test/WifiLegacyKeystoreIntegrationTest.cpp
index ac801e5..68b993e 100644
--- a/wifi/keystore/1.0/default/test/WifiLegacyKeystoreIntegrationTest.cpp
+++ b/wifi/keystore/1.0/default/test/WifiLegacyKeystoreIntegrationTest.cpp
@@ -110,6 +110,9 @@
 class WifiLegacyKeystoreTest : public TestWithParam<std::string> {
    protected:
     void SetUp() override {
+        if (!isLegacyKeystoreEnabled()) {
+            GTEST_SKIP() << "Legacy Keystore is not fully supported";
+        }
         wifiKeystoreHal = IKeystore::getService(GetParam());
         ASSERT_TRUE(wifiKeystoreHal);
 
@@ -134,6 +137,11 @@
         return false;
     }
 
+    bool isLegacyKeystoreEnabled() {
+        // Legacy Keystore is partly deprecated after Android U
+        return property_get_int32("ro.board.api_level", 0) <= __ANDROID_API_U__;
+    }
+
     sp<IKeystore> wifiKeystoreHal;
     uid_t myRUid;
 };