summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Yun <justinyun@google.com>2021-10-27 00:50:31 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-10-27 00:50:31 +0000
commit79cfc9e98445e409eb99fe403ceba2f72f7c9713 (patch)
tree0168597604d1d42e471c504db31570db0b882fd3
parent19dc0b52a0212638a409d2e74899efd533a20322 (diff)
parentd24d80923087f5f91dd2af50b494a85fe78e6613 (diff)
downloadsuite_harness-79cfc9e98445e409eb99fe403ceba2f72f7c9713.tar.gz
Provide getVsrApiLevel() to read the Vsr API level of DUT am: 7a1e90d302 am: 9a76600c46 am: d24d809230
Original change: https://android-review.googlesource.com/c/platform/test/suite_harness/+/1864135 Change-Id: I39063949103f1e6881213d7f45415a860e034833
-rw-r--r--common/host-side/util/src/com/android/compatibility/common/util/PropertyUtil.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/common/host-side/util/src/com/android/compatibility/common/util/PropertyUtil.java b/common/host-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
index aff2086f..2f890866 100644
--- a/common/host-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
+++ b/common/host-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
@@ -34,12 +34,14 @@ public class PropertyUtil {
* shipped. Property should be undefined for factory ROM products.
*/
public static final String FIRST_API_LEVEL = "ro.product.first_api_level";
+
+ private static final String BOARD_API_LEVEL = "ro.board.api_level";
+ private static final String BOARD_FIRST_API_LEVEL = "ro.board.first_api_level";
private static final String BUILD_TAGS_PROPERTY = "ro.build.tags";
private static final String BUILD_TYPE_PROPERTY = "ro.build.type";
private static final String MANUFACTURER_PROPERTY = "ro.product.manufacturer";
private static final String TAG_DEV_KEYS = "dev-keys";
- private static final String VENDOR_API_LEVEL = "ro.board.api_level";
- private static final String VENDOR_FIRST_API_LEVEL = "ro.board.first_api_level";
+ private static final String VENDOR_BUILD_VERSION_SDK = "ro.vendor.build.version.sdk";
private static final String VNDK_VERSION = "ro.vndk.version";
/** Value to be returned by getPropertyInt() if property is not found */
@@ -79,6 +81,25 @@ public class PropertyUtil {
}
/**
+ * Return the API level that the VSR requirement must be fulfilled. It reads
+ * ro.product.first_api_level, ro.board.first_api_level, and ro.board.api_level to find the
+ * minimum required VSR api_level for the DUT.
+ */
+ public static int getVsrApiLevel(ITestDevice device) throws DeviceNotAvailableException {
+ // Api level properties of the board. The order of the properties must be kept.
+ String[] boardApiLevelProps = {
+ BOARD_API_LEVEL, BOARD_FIRST_API_LEVEL, VENDOR_BUILD_VERSION_SDK
+ };
+ for (String apiLevelProp : boardApiLevelProps) {
+ int apiLevel = getPropertyInt(device, apiLevelProp);
+ if (apiLevel != INT_VALUE_IF_UNSET) {
+ return Math.min(apiLevel, getFirstApiLevel(device));
+ }
+ }
+ return getFirstApiLevel(device);
+ }
+
+ /**
* Return the API level of the vendor partition. It will read the following properties in order
* and returns the value of the first defined property. If none of them are defined, or the
* value is a VERSION CODENAME, returns the current API level which is defined in
@@ -93,7 +114,7 @@ public class PropertyUtil {
public static int getVendorApiLevel(ITestDevice device) throws DeviceNotAvailableException {
String[] vendorApiLevelProps = {
// Use the properties in order.
- VENDOR_API_LEVEL, VENDOR_FIRST_API_LEVEL, VNDK_VERSION,
+ BOARD_API_LEVEL, BOARD_FIRST_API_LEVEL, VNDK_VERSION,
};
for (String prop : vendorApiLevelProps) {
int apiLevel = getPropertyInt(device, prop);