Hide error logs for passive provider

The passive provider sees locations from multiple other providers
interleaved, so seeing non-monotonic locations is more expected than it
would be for any normal provider. Hide the error message in this case.

Test: n/a
Change-Id: Ifd96ddca6fc7e7162c5cf64e1653e228e1ba54a6
This commit is contained in:
Soonil Nagarkar
2022-06-27 10:20:30 -07:00
parent 5d5f191c47
commit 78cc50faa7

View File

@@ -2523,10 +2523,16 @@ public class LocationProviderManager extends
filtered = locationResult;
}
Location last = getLastLocationUnsafe(USER_CURRENT, PERMISSION_FINE, true, Long.MAX_VALUE);
if (last != null && locationResult.get(0).getElapsedRealtimeNanos()
< last.getElapsedRealtimeNanos()) {
Log.e(TAG, "non-monotonic location received from " + mName + " provider");
// check for non-monotonic locations if we're not the passive manager. the passive manager
// is much more likely to see non-monotonic locations since it gets locations from all
// providers, so this error log is not very useful there.
if (mPassiveManager != null) {
Location last = getLastLocationUnsafe(USER_CURRENT, PERMISSION_FINE, true,
Long.MAX_VALUE);
if (last != null && locationResult.get(0).getElapsedRealtimeNanos()
< last.getElapsedRealtimeNanos()) {
Log.e(TAG, "non-monotonic location received from " + mName + " provider");
}
}
// update last location