From 0ebd6c25997d35595a193a9f3cfe989f4cb9240a Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Thu, 2 Dec 2021 10:45:43 +0100 Subject: [PATCH 1/2] Treat LocationManager single requests as is LocationManager.requestSingleRequest() user API calls created 0ms requests that were handled as 30ms request for now. We now considerer them as single requests and call UnifiedLocationService to request a single request. --- .../java/org/microg/nlp/location/v2/LocationProvider.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/location-v2/src/main/java/org/microg/nlp/location/v2/LocationProvider.java b/location-v2/src/main/java/org/microg/nlp/location/v2/LocationProvider.java index 492b4dd..6b4bab7 100644 --- a/location-v2/src/main/java/org/microg/nlp/location/v2/LocationProvider.java +++ b/location-v2/src/main/java/org/microg/nlp/location/v2/LocationProvider.java @@ -64,7 +64,12 @@ public class LocationProvider extends LocationProviderBase implements UnifiedLoc } catch (Exception ignored) { } - long autoTime = Math.max(requests.getInterval(), FASTEST_REFRESH_INTERVAL); + long interval = requests.getInterval(); + long autoTime = 0; + if (interval > 0) { + autoTime = Math.max(interval, FASTEST_REFRESH_INTERVAL); + } + boolean autoUpdate = requests.getReportLocation(); Log.v(TAG, "using autoUpdate=" + autoUpdate + " autoTime=" + autoTime); -- GitLab From 56fd0783c0e1c93a2dcad3de55ee067b7353648f Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Thu, 2 Dec 2021 13:43:42 +0100 Subject: [PATCH 2/2] Force update on single requests Indeed, location requests with the FusedLocationProvider.getCurrentLocation() method were not forcing the backend to trigger a location request for now, even after the backend was not triggered for a while. --- .../main/kotlin/org/microg/nlp/client/UnifiedLocationClient.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/main/kotlin/org/microg/nlp/client/UnifiedLocationClient.kt b/client/src/main/kotlin/org/microg/nlp/client/UnifiedLocationClient.kt index 141a705..e670885 100644 --- a/client/src/main/kotlin/org/microg/nlp/client/UnifiedLocationClient.kt +++ b/client/src/main/kotlin/org/microg/nlp/client/UnifiedLocationClient.kt @@ -444,6 +444,7 @@ class UnifiedLocationClient private constructor(context: Context) { for (request in requests) { if (request.interval <= 0) { requestSingle = true + forceNextUpdate = true continue } interval = min(interval, request.interval) -- GitLab