Merge "Check GPS feature in GnssLocationValuesTest." into oreo-cts-dev
diff --git a/tests/tests/location/src/android/location/cts/GnssLocationValuesTest.java b/tests/tests/location/src/android/location/cts/GnssLocationValuesTest.java
index 4d32544..0a341cd 100644
--- a/tests/tests/location/src/android/location/cts/GnssLocationValuesTest.java
+++ b/tests/tests/location/src/android/location/cts/GnssLocationValuesTest.java
@@ -67,6 +67,13 @@
    * only test them if the hardware is later than 2017
    */
   public void testAccuracyFields() throws Exception {
+    // Checks if GPS hardware feature is present, skips test (pass) if not,
+    // and hard asserts that Location/GPS (Provider) is turned on if is Cts Verifier.
+    if (!TestMeasurementUtil.canTestRunOnCurrentDevice(mTestLocationManager,
+            TAG, MIN_HARDWARE_YEAR_MEASUREMENTS_REQUIRED, isCtsVerifierTest())) {
+        return;
+    }
+
     SoftAssert softAssert = new SoftAssert(TAG);
     mTestLocationManager.requestLocationUpdates(mLocationListener);
     boolean success = mLocationListener.await();
@@ -127,6 +134,13 @@
    * check whether all fields' value make sense
    */
   public void testLocationRegularFields() throws Exception {
+    // Checks if GPS hardware feature is present, skips test (pass) if not,
+    // and hard asserts that Location/GPS (Provider) is turned on if is Cts Verifier.
+    if (!TestMeasurementUtil.canTestRunOnCurrentDevice(mTestLocationManager,
+            TAG, MIN_HARDWARE_YEAR_MEASUREMENTS_REQUIRED, isCtsVerifierTest())) {
+        return;
+    }
+
     mTestLocationManager.requestLocationUpdates(mLocationListener);
     boolean success = mLocationListener.await();
     SoftAssert.failOrWarning(isMeasurementTestStrict(),