Helium314 / Local-NLP-Backend

Yet another network location backend for the UnifiedNLP/microG project
GNU General Public License v3.0
64 stars 4 forks source link

Location scanning seems stuck on in 1.2.0-beta.3 #2

Open ProjectMoon opened 1 year ago

ProjectMoon commented 1 year ago

Love the update to Deja Vu.

I noticed that my location indicator was stuck "on" while using Local NLP Backend. It was not microG using the location either, but rather Local NLP Backend itself. Not sure what it was doing, but the location indicator was on for many many minutes. I don't know if this is intended behavior. No GPS app was running either. Phone was otherwise idle.

I had to kill the app to make it stop attempting to acquire location. I also noticed that afterwards when trying to manually scan from the NLP settings, it didn't work until I toggled Local NLP Backend off and on in the microG settings.

Helium314 commented 1 year ago

I'm not sure what you mean with "location indicator". Is it the icon showing that some app requests a GPS location? If yes, this really should not happen.

Local NLP Backend should never request GPS location, but only receive location if some other app uses GPS. And this GPS monitoring code is unchanged taken from Deja Vu. The manual scan only requests a network location, but not GPS...

Which Android version are you using? All my testing was done on Android 9, so I fear there may be issues with changed behavior in newer versions.

ProjectMoon commented 1 year ago

Screenshot_20220910-132415

I'm on Android 12, Calyx OS 3.8.0. When the backend is enabled, this indicator just says that Local NLP Backend is always using the location.

ProjectMoon commented 1 year ago

When the backend is disabled, the location use stops.

Helium314 commented 1 year ago

Could you test whether the same thing happens if you use GPSLogger and set it to only use passive location provider? This basically does the same: it always checks whether some other app uses GPS, and fetches the GPS locations.

If not, then the issue may be that Local NLP Backend still targets API 28 (Android 9). There are some differences and new background location permission in newer API versions...

DocSniper commented 1 year ago

On Android 11 (LOS 18) both backends are in the list. 55db1e7b-3302-47a9-be85-2a219be8a9e6

Helium314 commented 1 year ago

@ProjectMoon could you try whether it also happens when the app targets API 33? APK You may need to disable and enable again, so microG asks for background location permission. If it doesn't work you can simply install previous beta3 apk over it again.

ProjectMoon commented 1 year ago

So the new APK seems to work much better. Location doesn't get stuck on. But the backend does acquire location by itself separately sometimes. Don't know if that's intentional or not.

Helium314 commented 1 year ago

But the backend does acquire location by itself separately sometimes

I don't know what this exactly means... maybe Android 12 reports WiFi scanning as acquiring location. If this is the case probably there is nothing I can do. How is it with DejaVu? Does it also appear to be scanning location permanently?

ProjectMoon commented 1 year ago

Don't think I've ever seen deja Vu scan for location. But then again, I've never checked. It definitely doesn't get stuck on permanently though.

What does mean is that the location in use indicator shows up periodically as "location in use by local NLP Backend." Wifi scanning is a likely culprit. How often does it scan?

Helium314 commented 1 year ago

WiFi scans happen when any app requests a network based location (via microG), or when the device gets a GPS position.

Helium314 commented 1 year ago

Actually you could check whether the WiFi scans cause the issues: In the settings you can simply disable WiFi scanning (under Use WiFi locations).

This is not a solution, as the locations will be very inaccurate, but at least this way we know whether WiFi scanning is causing the "being used by..." to show up. (you can also try disabling cell tower locations if WiFI locations doesn't change anything...)

ProjectMoon commented 1 year ago

I actually currently have wifi scanning turned off. Didn't even know it was off.

ProjectMoon commented 1 year ago

Do you mean we wifi scanning in the app? Or android settings?

Helium314 commented 1 year ago

I mean in the app, in the settings you can access via microG.

ProjectMoon commented 1 year ago

Turned off the wifi scans in the app, and it still grabs location sometimes.

famo commented 1 year ago

I can confirm the issue with the permanent location on. Happened to me on two devices with Android 8.1 and 10.

Helium314 commented 1 year ago

Android 8 doesn't have an indicator as shown in https://github.com/Helium314/Local-NLP-Backend/issues/2#issuecomment-1242711610. On Android 8 there only is a GPS indicator that shows when GPS is being used. But 1.2.0-beta.3 doesn't even have the capability of enabling GPS.

Can you maybe describe what you mean?

famo commented 1 year ago

Well, the location icon is permanently displayed (ie. location is requested) in the status bar. Normally you enable location and the icon only pops up once you actually have a location request (eg opened a map app). I hope this makes it more clear...?

Helium314 commented 1 year ago

So this is the GPS indicator then... Android 8 doesn't show any icon when only network based location is requested, as far as I know.

Which version are you using? Ability to enable GPS was only added in 1.2.1 (active mode in settings), but it's disabled by default, and additionally it shows a notification when GPS is enabled.

famo commented 1 year ago

I'm using Version 1.2.2-beta.1 from F-Droid repo. And the active mode is disabled (everything was left to default values).

Helium314 commented 1 year ago

So how does it happen? If you enable the backend, the location symbol shows up, and if you disable it the symbol is gone?

Does the same happen when you use DejaVu? If not, do you remember if this also happened in 1.2.0? Is there a notification shown?

Mrnofish commented 1 year ago

Not sure how relevant, the location warning comes up when viewing the location module details in MicroG and goes away soon afterwards. LOS20 and 1.2.5.