From ffbe00b52bf0310ca2f68cb0b0283d9adfbe3fb6 Mon Sep 17 00:00:00 2001 From: Baili Feng Date: Wed, 27 Jun 2018 15:44:49 +0800 Subject: [PATCH] Set interval to large value for all MSA cases If position mode is MSA, set interval to 590 hours Change-Id: I552e0da679bf5b817bdc2463b32c8159c98b6e87 CRs-Fixed: 2268571 --- android/location_api/GnssAPIClient.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/android/location_api/GnssAPIClient.cpp b/android/location_api/GnssAPIClient.cpp index 61412120..a6e941ec 100644 --- a/android/location_api/GnssAPIClient.cpp +++ b/android/location_api/GnssAPIClient.cpp @@ -29,6 +29,7 @@ #define LOG_NDEBUG 0 #define LOG_TAG "LocSvc_GnssAPIClient" +#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours #include #include @@ -166,9 +167,12 @@ bool GnssAPIClient::gnssSetPositionMode(IGnss::GnssPositionMode mode, memset(&mTrackingOptions, 0, sizeof(TrackingOptions)); mTrackingOptions.size = sizeof(TrackingOptions); mTrackingOptions.minInterval = minIntervalMs; - if (IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) { - mTrackingOptions.minInterval = - std::numeric_limits::max(); + if (IGnss::GnssPositionMode::MS_ASSISTED == mode || + IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) { + // We set a very large interval to simulate SINGLE mode. Once we report a fix, + // the caller should take the responsibility to stop the session. + // For MSA, we always treat it as SINGLE mode. + mTrackingOptions.minInterval = SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC; } mTrackingOptions.minDistance = preferredAccuracyMeters; if (mode == IGnss::GnssPositionMode::STANDALONE)