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

Commit bf4f6db4 authored by Wyatt Riley's avatar Wyatt Riley Committed by Keun Soo Yim
Browse files

Loosen speed check for first GPS location

As it is often found in a short integration
window with very high Doppler uncertainty.

Bug: 67877519
Merged-In: Ia05359f572f4ea7be81f9d5fe30bd619322bebd3
Test: Verified Pixel still passes VTS
Change-Id: Ia05359f572f4ea7be81f9d5fe30bd619322bebd3
(cherry picked from commit 763b4eab)
parent c312e21b
Loading
Loading
Loading
Loading
+18 −11
Original line number Original line Diff line number Diff line
@@ -208,10 +208,13 @@ TEST_F(GnssHalTest, SetCallbackCapabilitiesCleanup) {}
 * CheckLocation:
 * CheckLocation:
 * Helper function to vet Location fields
 * 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_LAT_LONG);
  EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
  EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
  if (checkSpeed) {
    EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED);
    EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED);
  }
  EXPECT_TRUE(location.gnssLocationFlags &
  EXPECT_TRUE(location.gnssLocationFlags &
              GnssLocationFlags::HAS_HORIZONTAL_ACCURACY);
              GnssLocationFlags::HAS_HORIZONTAL_ACCURACY);
  // New uncertainties available in O must be provided,
  // New uncertainties available in O must be provided,
@@ -232,13 +235,16 @@ void CheckLocation(GnssLocation& location, bool checkAccuracies) {
  EXPECT_LE(location.longitudeDegrees, 180.0);
  EXPECT_LE(location.longitudeDegrees, 180.0);
  EXPECT_GE(location.altitudeMeters, -1000.0);
  EXPECT_GE(location.altitudeMeters, -1000.0);
  EXPECT_LE(location.altitudeMeters, 30000.0);
  EXPECT_LE(location.altitudeMeters, 30000.0);
  if (checkSpeed) {
    // VTS tests are stationary.  5.0m/s max allows for measurement noise.
    EXPECT_GE(location.speedMetersPerSec, 0.0);
    EXPECT_GE(location.speedMetersPerSec, 0.0);
  EXPECT_LE(location.speedMetersPerSec, 5.0);  // VTS tests are stationary.
    EXPECT_LE(location.speedMetersPerSec, 5.0);


    // Non-zero speeds must be reported with an associated bearing
    // Non-zero speeds must be reported with an associated bearing
    if (location.speedMetersPerSec > 0.0) {
    if (location.speedMetersPerSec > 0.0) {
      EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING);
      EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING);
    }
    }
  }


  /*
  /*
   * Tolerating some especially high values for accuracy estimate, in case of
   * Tolerating some especially high values for accuracy estimate, in case of
@@ -299,7 +305,8 @@ bool StartAndGetSingleLocation(GnssHalTest* test, bool checkAccuracies) {
    EXPECT_EQ(test->location_called_count_, 1);
    EXPECT_EQ(test->location_called_count_, 1);
  }
  }
  if (test->location_called_count_ > 0) {
  if (test->location_called_count_ > 0) {
    CheckLocation(test->last_location_, checkAccuracies);
    // don't require speed on first fix
    CheckLocation(test->last_location_, checkAccuracies, false /* checkSpeed */ );
    return true;
    return true;
  }
  }
  return false;
  return false;
@@ -340,7 +347,7 @@ TEST_F(GnssHalTest, GetLocation) {
      EXPECT_EQ(std::cv_status::no_timeout,
      EXPECT_EQ(std::cv_status::no_timeout,
          wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC));
          wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC));
      EXPECT_EQ(location_called_count_, i + 1);
      EXPECT_EQ(location_called_count_, i + 1);
      CheckLocation(last_location_, checkMoreAccuracies);
      CheckLocation(last_location_, checkMoreAccuracies, true /* checkSpeed */);
    }
    }
  }
  }