Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy GpsStatus listener #492

Closed
barbeau opened this issue Mar 22, 2021 · 2 comments · Fixed by #550
Closed

Remove legacy GpsStatus listener #492

barbeau opened this issue Mar 22, 2021 · 2 comments · Fixed by #550

Comments

@barbeau
Copy link
Owner

barbeau commented Mar 22, 2021

Describe the bug
Reported 23 times in the Google Play Developer Console over the last 30 days:

java.lang.ArrayIndexOutOfBoundsException: 
  at com.android.gpstest.view.GpsSkyView.setSats (GpsSkyView.java:316)
  at com.android.gpstest.GpsSkyFragment.onGpsStatusChanged (GpsSkyFragment.java:189)
  at com.android.gpstest.GpsTestActivity$4.onGpsStatusChanged (GpsTestActivity.java:1125)
  at android.location.LocationManager$GnssStatusListenerManager$1.onSatelliteStatusChanged (LocationManager.java:2958)
  at android.location.LocationManager$GnssStatusListenerManager$GnssStatusListener.lambda$onSvStatusChanged$1 (LocationManager.java:3014)
  at android.location.-$$Lambda$LocationManager$GnssStatusListenerManager$GnssStatusListener$4EPi22o4xuVnpNhFHnDvebH4TG8.accept (Unknown Source:4)
  at android.location.AbstractListenerManager$Registration.accept (AbstractListenerManager.java:83)
  at android.location.AbstractListenerManager$Registration.lambda$XpiThbVaDDpOnFWIkrt38Bf4yx0 (Unknown Source)
  at android.location.-$$Lambda$AbstractListenerManager$Registration$XpiThbVaDDpOnFWIkrt38Bf4yx0.accept (Unknown Source:4)
  at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke (PooledLambdaImpl.java:278)
  at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke (PooledLambdaImpl.java:201)
  at com.android.internal.util.function.pooled.OmniFunction.run (OmniFunction.java:97)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:236)
  at android.app.ActivityThread.main (ActivityThread.java:8057)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:656)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:967)

To Reproduce
Unknown

Expected behavior
Don't crash

Observed behavior
Crash

App, Device and Android version:

All crashes are with GPSTest version 18076 (v3.8.4) and all on Android 11. Devices are Samsung Galaxy M31, Xiaomi Mi 10T, Xiaomi Mi Note 10 Lite, Samsung Galaxy Z Flip 5G

@barbeau barbeau added the bug label Mar 22, 2021
@barbeau barbeau added this to the v3.9 milestone Mar 22, 2021
@barbeau barbeau changed the title java.lang.ArrayIndexOutOfBoundsException in GpsSkyView.setSats java.lang.ArrayIndexOutOfBoundsException in GpsSkyView.setSats() Mar 22, 2021
@stale
Copy link

stale bot commented Jun 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 3, 2021
@barbeau barbeau removed the stale label Jun 3, 2021
@barbeau barbeau changed the title java.lang.ArrayIndexOutOfBoundsException in GpsSkyView.setSats() Remove legacy GpsStatus listener Jun 28, 2021
@barbeau
Copy link
Owner Author

barbeau commented Jun 28, 2021

Looks like this is a bug in Android 11 that's triggered when the user unchecks the GPSTest "Use GNSS APIs" setting within the app, which then triggers the legacy onGpsStatusChanged() API.

That setting was introduced during the transition between Android 6 and 7 and can be removed now. Less than 3% of users are on devices less than Android 7, so going forward with the architectural changes required for #313 and #299 I may look at removing these listeners entirely and supporting only Android 7 and up going forward.

@barbeau barbeau modified the milestones: v3.9, v4.0 Nov 5, 2021
barbeau added a commit that referenced this issue Nov 11, 2021
This is a major overhaul of the app internals to support a foreground service (i.e., a notification that shows current GNSS status even when the main Activity UI is not showing).

This involves moving all the API listeners for GNSS events into their own "manager" classes based on Kotlin callbackFlow that exist the entire lifecycle of the app, so the various app components (Fragments, ViewModels, Activity, Service) can all receive updates from this single source.

This bumps minSdkVersion to Android N (24) so we we don't need to deal with the legacy GPS* APIs anymore, which greatly simplifies the data processing within the app.

*  Convert Activity and Fragments to Kotlin
*  Add service with notification
*  Remove legacy GPS* APIs (pre-Android N)
*  Convert all location / GNSS API registrations to data managers based on Kotlin callbackFlow as detailed in https://barbeau.medium.com/kotlin-callbackflow-a-lightweight-architecture-for-location-aware-android-apps-f97b5e66aaa2.
    *  NMEA
    *  Location
    *  GNSS measurement
    *  Antenna
    *  Nav message
    *  Sensor (orientation)
* Add view binding to fragments
* Fix filter bug - it currently shows # signals being filtered, not number satellites (doesn't match # Sats field)
* Move aggregation of signals to satellites into Flow/ViewModel.
* Change Status to Composable - Use LiveData in ViewModel instead - see https://bladecoder.medium.com/kotlins-flow-in-viewmodels-it-s-complicated-556b472e281a that says don't use Flows in ViewModels.

Closes #299
Closes #492
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant