Bug 1195854: getNeighboringCells() is deprecated on Android M. r=sebastian

This commit is contained in:
Garvan Keeley 2015-08-31 00:35:53 -04:00
parent 6b74c9bbf9
commit 3950e83406

View File

@ -85,7 +85,7 @@ public class CellScannerImplementation implements CellScanner.CellScannerImpl {
mIsStarted = true;
if (mTelephonyManager == null) {
if (Build.VERSION.SDK_INT >= 18 /*Build.VERSION_CODES.JELLY_BEAN_MR2 */) { // Fennec: no Build.VERSION_CODES
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
mGetAllInfoCellScanner = new GetAllCellInfoScannerMr2();
} else {
mGetAllInfoCellScanner = new GetAllCellInfoScannerDummy();
@ -170,6 +170,11 @@ public class CellScannerImplementation implements CellScanner.CellScannerImpl {
}
private List<CellInfo> getNeighboringCells() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
return Collections.emptyList();
}
@SuppressWarnings("deprecation")
Collection<NeighboringCellInfo> cells = mTelephonyManager.getNeighboringCellInfo();
if (cells == null || cells.isEmpty()) {
return Collections.emptyList();