Do not blocklist BDS on CN builds
Bug: 354865513
Test: atest VtsHalGnssTargetTest
Change-Id: Idb2addc4200c99f3cf8944982ad7e5b50930a786
diff --git a/gnss/common/utils/vts/Utils.cpp b/gnss/common/utils/vts/Utils.cpp
index e3ff0f3..38afaf3 100644
--- a/gnss/common/utils/vts/Utils.cpp
+++ b/gnss/common/utils/vts/Utils.cpp
@@ -319,6 +319,24 @@
return d * 1000; // meters
}
+// Returns true iff the device has the specified feature.
+bool Utils::deviceSupportsFeature(const char* feature) {
+ bool device_supports_feature = false;
+ FILE* p = popen("/system/bin/pm list features", "re");
+ if (p) {
+ char* line = NULL;
+ size_t len = 0;
+ while (getline(&line, &len, p) > 0) {
+ if (strstr(line, feature)) {
+ device_supports_feature = true;
+ break;
+ }
+ }
+ pclose(p);
+ }
+ return device_supports_feature;
+}
+
} // namespace common
} // namespace gnss
} // namespace hardware
diff --git a/gnss/common/utils/vts/include/Utils.h b/gnss/common/utils/vts/include/Utils.h
index 62d409a..09b99c4 100644
--- a/gnss/common/utils/vts/include/Utils.h
+++ b/gnss/common/utils/vts/include/Utils.h
@@ -60,6 +60,11 @@
static bool isAutomotiveDevice();
static double distanceMeters(double lat1, double lon1, double lat2, double lon2);
+ // Returns true iff the device has the specified feature.
+ static bool deviceSupportsFeature(const char* feature);
+
+ static bool isCnBuild() { return deviceSupportsFeature("cn.google.services"); }
+
private:
template <class T>
static int64_t getLocationTimestampMillis(const T&);