0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-14 23:15:06 +00:00

Ignore longstanding gps requests with more than 30s request interval

This commit is contained in:
Marvin W 2020-08-18 23:55:43 +02:00
parent aea55a5c90
commit 74c0e28e27
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A

View file

@ -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) {