[android] remove previous location quality check

This commit is contained in:
gekeleda
2025-12-28 20:51:58 +01:00
committed by Konstantin Pastbin
parent f3fd814d07
commit ca6b0286c8
2 changed files with 2 additions and 25 deletions

View File

@@ -208,17 +208,8 @@ public class LocationHelper implements BaseLocationProvider.Listener
return;
}
// if (mSavedLocation != null)
// {
// if (!LocationUtils.isLocationBetterThanLast(location, mSavedLocation))
// {
// Logger.d(TAG, "The new " + location + " is worse than the last " + mSavedLocation);
// return;
// }
// }
updateProviderDecision(location);
if(mCurrentProvider == null || !mCurrentProvider.equals(location.getProvider())) {
if(mCurrentProvider != null && !mCurrentProvider.equals(location.getProvider())) {
Logger.d(TAG, "Rejected update from provider = " + location.getProvider());
return;
}
@@ -249,7 +240,7 @@ public class LocationHelper implements BaseLocationProvider.Listener
if(timeDiff > INTERVAL_PROVIDER_DECISION) {
mCurrentProvider = getMinAccuracyProvider();
Logger.d("ProviderDecision", "Selected: " + mCurrentProvider + ", with acc. " + mProviderAccuracyMeans.get(mCurrentProvider));
Logger.d(TAG, "Selected: " + mCurrentProvider + ", with acc. " + mProviderAccuracyMeans.get(mCurrentProvider));
mTimeAtLastProviderChange = currentTime;
mProviderLocationCounts.clear();
mProviderAccuracyMeans.clear();

View File

@@ -81,20 +81,6 @@ public class LocationUtils
return location.getAccuracy() > 0.0f;
}
public static boolean isLocationBetterThanLast(@NonNull Location newLocation, @NonNull Location lastLocation)
{
if (newLocation.getElapsedRealtimeNanos() < lastLocation.getElapsedRealtimeNanos())
return false;
// As described in isAccuracySatisfied, GPS may have zero accuracy "for some reasons".
if (isFromGpsProvider(lastLocation) && lastLocation.getAccuracy() == 0.0f)
return true;
double speed = Math.max(DEFAULT_SPEED_MPS, (newLocation.getSpeed() + lastLocation.getSpeed()) / 2.0);
double lastAccuracy = lastLocation.getAccuracy() + speed * LocationUtils.getTimeDiff(lastLocation, newLocation);
return newLocation.getAccuracy() < lastAccuracy;
}
public static boolean areLocationServicesTurnedOn(@NonNull Context context)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)