mapbox / mapbox/mapbox-navigation-android

Please fix error "SecurityException: getDataNetworkTypeForSubscriber" for version 0.42.6 when targeting Android >= 11

Open
#4,793 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

archived
Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

Please fix the security exception caused by the READ_PHONE_STATE permission for all of us that are using the legacy version 0.42.6 and targeting android 11/12.

The exception happens in:
mapView.onCreate(savedInstanceState);

java.lang.SecurityException: getDataNetworkTypeForSubscriber
at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getNetworkTypeForSubscriber(ITelephony.java:8762)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:3021)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:2985)
at com.mapbox.android.telemetry.TelemetryUtils.obtainCellularNetworkType(TelemetryUtils.java:157)
at com.mapbox.mapboxsdk.module.telemetry.PhoneState.(PhoneState.java:39)
at com.mapbox.mapboxsdk.module.telemetry.TelemetryImpl.onAppUserTurnstileEvent(TelemetryImpl.java:46)
at com.mapbox.mapboxsdk.maps.MapView.onCreate(MapView.java:277)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with TelemetryUtils.java at obtainCellularNetworkType and trace the call from PhoneState.java through TelemetryImpl.java and MapView.java. Reproduce the failure on Android 11 or 12 with the reported target setup, then verify that MapView.onCreate no longer raises the SecurityException while telemetry behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.