Skip to content

Speculative fix for issue #6468: [Bug]: GPS location does not work (for GMS-less phones)#6763

Open
Jason-Whitmore wants to merge 1 commit intocommons-app:mainfrom
Jason-Whitmore:issue_6468
Open

Speculative fix for issue #6468: [Bug]: GPS location does not work (for GMS-less phones)#6763
Jason-Whitmore wants to merge 1 commit intocommons-app:mainfrom
Jason-Whitmore:issue_6468

Conversation

@Jason-Whitmore
Copy link
Collaborator

Description (required)

Fixes #6468

What changes did you make and why?

This PR changes a logical operator from the logical AND to a logical OR to prevent a short circuit which I believe is causing the issue.

Specifically:
Location updates from providers are requested by calling LocationServiceManager.requestLocationUpdatesFromProvider() which returns true on success and false on failure.

This method is called twice with the logical AND operator. The first call is for the network provider and the second call is for the GPS provider. If the first call fails (network provider), then the AND operator will short circuit, preventing the second call (GPS provider) from occurring.

I believe some non GMS phones do not have a working network location provider, but may still have a working GPS location provider. Therefore, some non GMS phones will not receive location updates despite the ability to. This then causes both the recenter button to center, and the blue dot to appear, at the wrong location.

Replacing the logical AND to a logical OR stops the short circuiting behavior and allows the second call to happen regardless of the return value of the first call.

Tests performed (required)

Tested ProdDebug on Android Studio Emulator with API level 35.

I was able to reproduce the bug on main by creating a new virtual device in the emulator with the "Services" drop down menu set to "Android Open Source". Then, in the Nearby screen, the blue dot would not move despite changing the location in the emulator. Nor does the recenter button work.

On this PR, the bug appears fixed and Nearby works as intended. Since I cannot confirm that the "Android Open Source" setting actually removes GMS from the virtual device, this fix is speculative.

…cuit

Before this commit, the logical AND operator was used with the
successful/unsuccessful booleans returned from
requestLocationUpdatesFromProvider() calls. If the call on the first
provider returned false, the logical AND operator would short circuit,
therefore not attempting the call on the second provider,
even if the second provider was available to use.
In this situation, the LocationServiceManager would receive no
location updates.

This commit changes the logical AND operator to a logical OR operator.
Short-circuiting will no longer occur and
requestLocationUpdatesFromProvider() for the second provider will
be called. If the call for the first provider returned false and call
for the second provider returned true, then the LocationServiceManager
will receive location updates from the second provider.
@Jason-Whitmore
Copy link
Collaborator Author

Jason-Whitmore commented Mar 19, 2026

@mnalis

I apologize for the delay in fixing this bug. I think you should try this PR out since you have a lot of experience with this bug. Let me know if it works!

@github-actions
Copy link

✅ Generated APK variants!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: GPS location does not work (for GMS-less phones)

1 participant