diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/RealLocationProvider.java b/play-services-location-core/src/main/java/org/microg/gms/location/RealLocationProvider.java index 0ae75148..0fe9e67b 100644 --- a/play-services-location-core/src/main/java/org/microg/gms/location/RealLocationProvider.java +++ b/play-services-location-core/src/main/java/org/microg/gms/location/RealLocationProvider.java @@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicBoolean; @SuppressWarnings("MissingPermission") public class RealLocationProvider { public static final String TAG = "GmsLocProviderReal"; + private static final int MIN_GPS_TIME = 30000; private final LocationManager locationManager; private final String name; @@ -119,6 +120,12 @@ public class RealLocationProvider { if (sb.length() != 0) sb.append(", "); sb.append(request.packageName).append(":").append(request.locationRequest.getInterval()).append("ms"); } + if (minTime > MIN_GPS_TIME && name.equals("gps")) { + Log.d(TAG, name + ": ignoring request as " + minTime + "ms (" + sb + "), is less than " + MIN_GPS_TIME); + locationManager.removeUpdates(listener); + connected.set(false); + return; + } Log.d(TAG, name + ": requesting location updates with interval " + minTime + "ms (" + sb + "), minDistance=" + minDistance); if (connected.get()) { if (connectedMinTime != minTime || connectedMinDistance != minDistance) {