Closed Bug 1195854 Opened 10 years ago Closed 10 years ago

TelephonyManager.getNeighboringCellInfo() is deprecated in API level 23 (Android 6.0)

Categories

(Android Background Services Graveyard :: Geolocation, defect)

All
Android
defect
Not set
normal

Tracking

(firefox43 fixed)

RESOLVED FIXED
Firefox 43
Tracking Status
firefox43 --- fixed

People

(Reporter: sebastian, Assigned: garvan)

References

Details

Attachments

(1 file)

TelephonyManager.getNeighboringCellInfo() is now deprecated in API level 23. > 3:02.50 /Users/sebastian/Projects/Mozilla/fx-team/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellScannerImplementation.java:173: warning: [deprecation] getNeighboringCellInfo() in TelephonyManager has been deprecated > 3:02.50 Collection<NeighboringCellInfo> cells = mTelephonyManager.getNeighboringCellInfo(); http://developer.android.com/reference/android/telephony/TelephonyManager.html#getNeighboringCellInfo%28%29 > Use (@link getAllCellInfo} which returns a superset of the information from NeighboringCellInfo.
The alternative getAllCellInfo() was introduced in API level 17 (Android 4.2) so we might need to use a support library functionality or write it ourselves.
Component: General → Geolocation
Product: Firefox for Android → Android Background Services
Version: Trunk → unspecified
Hmm, there must be a missing annotation, there is a runtime check of android.os.Build.VERSION.SDK_INT to use getAllCellInfo() if available.
Attached patch bug1195854.diffSplinter Review
Removes the warning, and avoids using the call on Android M. We could do reflection here, but that is overkill. By the time the function is fully removed, we should just remove it completely, as the percentage of older devices that require this will likely be very small.
Attachment #8652860 - Flags: review?(s.kaspari)
Assignee: nobody → gkeeley
Comment on attachment 8652860 [details] [diff] [review] bug1195854.diff Review of attachment 8652860 [details] [diff] [review]: ----------------------------------------------------------------- LGTM. I see that we first query getAllCellInfo() and then add the result of getNeighboringCells() to that list. According to the Android documentation getNeighboringCellInfo() returns a subset of getAllCellInfo(). But a comment in our code says "getNeighboringCells() sometimes contains more information than that is already in getAllCellInfo(). Use the results of both of them.". Which one is correct? :)
Attachment #8652860 - Flags: review?(s.kaspari) → review+
Good question. The code predates my involvement, but I am trusting the comment. The contributor of that code was someone who contributes to the IMSI scanner project also, and on that project there are reports of older (or fringe market) devices producing more complete results with getNeighboringCells(). By the time getNeighboringCells() requires reflection (yuck!) to support, those devices will not be significant contributors -actually, they may not be ATM but there is no cost to keeping the code in there for now.
Thanks for the background information. :)
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Depends on: 1200696
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: