Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3200996d authored by Wyatt Riley's avatar Wyatt Riley Committed by android-build-merger
Browse files

Loosen speed check for first GPS location

am: f926e11c

Change-Id: Icb4b4a21afcc86d743f2f2c159cb54c9b0231a96
parents 3a29e0d0 f926e11c
Loading
Loading
Loading
Loading
+20 −13
Original line number Diff line number Diff line
@@ -147,7 +147,8 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
          EXPECT_EQ(location_called_count_, 1);
      }
      if (location_called_count_ > 0) {
          CheckLocation(last_location_, checkAccuracies);
          // don't require speed on first fix
          CheckLocation(last_location_, checkAccuracies, false);
          return true;
      }
      return false;
@@ -178,26 +179,31 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
   * CheckLocation:
   *   Helper function to vet Location fields
   */
  void CheckLocation(GnssLocation& location, bool checkAccuracies) {
  void CheckLocation(GnssLocation& location, bool checkAccuracies, bool checkSpeed) {
      EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG);
      EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
      if (checkSpeed) {
          EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED);
      }
      EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY);
      // New uncertainties available in O must be provided,
      // at least when paired with modern hardware (2017+)
      if (checkAccuracies) {
          EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY);
          if (checkSpeed) {
              EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY);
              if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
                  EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY);
              }
          }
      }
      EXPECT_GE(location.latitudeDegrees, -90.0);
      EXPECT_LE(location.latitudeDegrees, 90.0);
      EXPECT_GE(location.longitudeDegrees, -180.0);
      EXPECT_LE(location.longitudeDegrees, 180.0);
      EXPECT_GE(location.altitudeMeters, -1000.0);
      EXPECT_LE(location.altitudeMeters, 30000.0);
      if (checkSpeed) {
          EXPECT_GE(location.speedMetersPerSec, 0.0);
          EXPECT_LE(location.speedMetersPerSec, 5.0);  // VTS tests are stationary.

@@ -205,6 +211,7 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
          if (location.speedMetersPerSec > 0.0) {
              EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING);
          }
      }

      /*
       * Tolerating some especially high values for accuracy estimate, in case of
@@ -356,7 +363,7 @@ TEST_F(GnssHalTest, GetLocation) {
    for (int i = 1; i < LOCATIONS_TO_CHECK; i++) {
        EXPECT_EQ(std::cv_status::no_timeout, wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC));
        EXPECT_EQ(location_called_count_, i + 1);
        CheckLocation(last_location_, checkMoreAccuracies);
        CheckLocation(last_location_, checkMoreAccuracies, true);
    }
  }