GKI 2.0 test should run on all 5.10+ kernel, regardless of product shipping api

GKI 2.0 requirement applies to all device that runs a 5.10+ kernel,
regardless of launching / upgrading version.

Bug: 211741246
Test: atest vts_gki_compliance_test
Change-Id: I45ebb581f393b6b60a5cb1a316a45925e1122722
diff --git a/avb/Android.bp b/avb/Android.bp
index 8a68f90..883626c 100644
--- a/avb/Android.bp
+++ b/avb/Android.bp
@@ -79,7 +79,4 @@
     ],
 
     require_root: true,
-    test_options: {
-        min_shipping_api_level: 30,
-    },
 }
diff --git a/avb/vts_gki_compliance_test.cpp b/avb/vts_gki_compliance_test.cpp
index 658080f..5506a62 100644
--- a/avb/vts_gki_compliance_test.cpp
+++ b/avb/vts_gki_compliance_test.cpp
@@ -17,7 +17,9 @@
 #include <vector>
 
 #include <android-base/file.h>
+#include <android-base/properties.h>
 #include <android-base/unique_fd.h>
+#include <android/api-level.h>
 #include <bootimg.h>
 #include <fs_avb/fs_avb_util.h>
 #include <gtest/gtest.h>
@@ -171,7 +173,7 @@
 }  // namespace
 
 class GkiComplianceTest : public testing::Test {
- public:
+ protected:
   void SetUp() override {
     auto vintf = android::vintf::VintfObject::GetInstance();
     ASSERT_NE(nullptr, vintf);
@@ -192,12 +194,22 @@
     if (tv_device || auto_device) {
       GTEST_SKIP() << "Exempt from GKI test on TV/Auto devices";
     }
+
+    product_first_api_level =
+        android::base::GetIntProperty("ro.product.first_api_level", 0);
+    ASSERT_TRUE(product_first_api_level)
+        << "ro.product.first_api_level is undefined";
   }
 
   std::shared_ptr<const android::vintf::RuntimeInfo> runtime_info;
+  int product_first_api_level;
 };
 
 TEST_F(GkiComplianceTest, GkiComplianceV1) {
+  if (product_first_api_level < __ANDROID_API_R__) {
+    GTEST_SKIP() << "Exempt from GKI 1.0 test: ro.product.first_api_level ("
+                 << product_first_api_level << ") < " << __ANDROID_API_R__;
+  }
   /* Skip for devices if the kernel version is not 5.4. */
   if (runtime_info->kernelVersion().dropMinor() !=
       android::vintf::Version{5, 4}) {