apps-android-commons icon indicating copy to clipboard operation
apps-android-commons copied to clipboard

[Bug]: Nearby searches the same location 2 or 3 times at app start, and the map can stay empty

Open Medhansh-741 opened this issue 2 weeks ago • 2 comments

Summary

Follow-up to #7357 (this comment). When the app starts on Nearby, it searches the same location 2 or 3 times within about 2 seconds, without the map being touched. In 2 of my 3 runs no pins showed up at all until I switched away, even though there are about 250 places there. Coming back to the app starts another search for the same location.

From the code, onResume goes to initializeMapOperations(), which unlocks Nearby and starts a search, and handleMapScrolled starts one 800 ms after the map scrolls, also when the app moves the map itself. I don't know yet why the map sometimes ends up empty.

Maybe related to #5482 (pins changing after switching apps), which was closed as working in 2024.

Steps to reproduce

  1. Deny location permission for the app, so Nearby opens at the last searched location. I set that to Shibuya, Tokyo (about 250 places) by editing LastLocation in the app's prefs.
  2. Empty the place cache (delete from place; on commons_room.db with the app stopped).
  3. Start the app with Nearby as the last used tab, so it opens on Nearby. Don't touch the map.
  4. Wait about 20 seconds, then switch to another app and come back.
  5. Watch adb logcat -s NearbyParentFragmentPresenter NearbyController.

Expected behaviour

Nearby searches once at app start and shows the pins. Coming back to the same area doesn't start a new search, or at least doesn't need one to show the pins.

Actual behaviour

  • At app start, a search for the same location starts 2 or 3 times within about 2 seconds. A third call is sometimes dropped because Nearby is locked.
  • In 2 of 3 runs, no pins showed up in the 20 seconds before I switched away. In the recorded run the app also said "No nearby places around".
  • After switching away and back, another search for the same location started. In the recorded run, the pins showed up after that.

Device name

OnePlus CPH2491

Android version

Android 16

Commons app version

main (c0f8020), betaDebug

Device logs

From the recorded run (map not touched):

22:36:23.009 D/NearbyParentFragmentPresenter: Presenter updates map and list
22:36:23.011 D/NearbyController: Loading attractions near lat/lng: (35.6595,139.7005)
22:36:23.559 D/NearbyParentFragmentPresenter: Presenter updates map and list
22:36:23.732 D/NearbyController: Loading attractions near lat/lng: (35.6595,139.7005)
22:36:25.373 D/NearbyParentFragmentPresenter: Presenter updates map and list
22:36:25.373 D/NearbyParentFragmentPresenter: Nearby is locked, so updateMapAndList returns
(switched to another app and back)
22:36:50.546 D/NearbyParentFragmentPresenter: Presenter updates map and list
22:36:50.548 D/NearbyController: Loading attractions near lat/lng: (35.6595,139.7005)

Screenshots

Screencast of the recorded run:

https://github.com/user-attachments/assets/2381c339-373e-4601-8b19-3078497a9e4d

Would you like to work on the issue?

Yes

Medhansh-741 avatar Nov 17 '26 17:11 Medhansh-741

Assigned to you, @Medhansh-741! Thanks!

nicolas-raoul avatar Nov 17 '26 17:11 nicolas-raoul

@nicolas-raoul I opened #7364 for this.

Medhansh-741 avatar Nov 17 '26 21:11 Medhansh-741