@SuppressWarnings("ChainOfInstanceofChecks")
private Cell parseCellInfo(CellInfo info) {
try {
if (info instanceof CellInfoGsm) {
CellIdentityGsm identity = ((CellInfoGsm) info).getCellIdentity();
if (identity.getMcc() == Integer.MAX_VALUE) return null;
CellSignalStrengthGsm strength = ((CellInfoGsm) info).getCellSignalStrength();
return new Cell(Cell.CellType.GSM, identity.getMcc(), identity.getMnc(),
identity.getLac(), identity.getCid(), -1, strength.getDbm());
} else if (info instanceof CellInfoCdma) {
CellIdentityCdma identity = ((CellInfoCdma) info).getCellIdentity();
CellSignalStrengthCdma strength = ((CellInfoCdma) info).getCellSignalStrength();
return new Cell(Cell.CellType.CDMA, getMcc(), identity.getSystemId(),
identity.getNetworkId(), identity.getBasestationId(), -1, strength.getDbm());
} else {
return parceCellInfo18(info);
}
} catch (Exception ignored) {
}
return null;
}