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

Commit f77de292 authored by Yu-Han Yang's avatar Yu-Han Yang
Browse files

interval change should restart thread reporting locations

Also updates the mockLocation's bearing and speed to be non-zero, since
a real location rarely has exactly 0 bearing or 0 speed.

Bug: 384699906
Test: atest android.location.cts.gnss.GnssLocationUpdateIntervalTest#testLocationUpdatesAtVariousIntervals
Change-Id: I67d513eea50d1399b52aef3e07a73ff31db24ace
parent 465d13f0
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -298,8 +298,14 @@ ScopedAStatus Gnss::deleteAidingData(GnssAidingData aidingDataFlags) {
ScopedAStatus Gnss::setPositionMode(const PositionModeOptions& options) {
    ALOGD("setPositionMode. minIntervalMs:%d, lowPowerMode:%d", options.minIntervalMs,
          (int)options.lowPowerMode);
    if (std::max(1000, options.minIntervalMs) != mMinIntervalMs) {
        mMinIntervalMs = std::max(1000, options.minIntervalMs);
        mGnssMeasurementInterface->setLocationInterval(mMinIntervalMs);
        if (mIsActive) {
            stop();
            start();
        }
    }
    return ScopedAStatus::ok();
}

+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ namespace android::hardware::gnss::common {
float gMockLatitudeDegrees{37.4219999};
float gMockLongitudeDegrees{-122.0840575};
float gMockAltitudeMeters{1.60062531};
float gMockBearingDegrees{0};
float gMockSpeedMetersPerSec{0};
float gMockBearingDegrees{0.0001};  // a real location rarely has exactly zero bearing
float gMockSpeedMetersPerSec{0.0001};

}  // namespace android::hardware::gnss::common