protected void setSubtype(int subtype, String subtypeName) { if (mNetworkInfo.isConnected()) { int oldSubtype = mNetworkInfo.getSubtype(); if (subtype != oldSubtype) { mNetworkInfo.setSubtype(subtype, subtypeName); Message msg = mTarget.obtainMessage(EVENT_NETWORK_SUBTYPE_CHANGED, oldSubtype, 0, mNetworkInfo); msg.sendToTarget(); } } }
@Override public LinkQualityInfo getLinkQualityInfo() { if (mNetworkInfo == null || mNetworkInfo.getType() == ConnectivityManager.TYPE_NONE) { // no data available yet; just return return null; } MobileLinkQualityInfo li = new MobileLinkQualityInfo(); li.setNetworkType(mNetworkInfo.getType()); mSamplingDataTracker.setCommonLinkQualityInfoFields(li); if (mNetworkInfo.getSubtype() != TelephonyManager.NETWORK_TYPE_UNKNOWN) { li.setMobileNetworkType(mNetworkInfo.getSubtype()); NetworkDataEntry entry = getNetworkDataEntry(mNetworkInfo.getSubtype()); if (entry != null) { li.setTheoreticalRxBandwidth(entry.downloadBandwidth); li.setTheoreticalRxBandwidth(entry.uploadBandwidth); li.setTheoreticalLatency(entry.latency); } if (mSignalStrength != null) { li.setNormalizedSignalStrength( getNormalizedSignalStrength(li.getMobileNetworkType(), mSignalStrength)); } } SignalStrength ss = mSignalStrength; if (ss != null) { li.setRssi(ss.getGsmSignalStrength()); li.setGsmErrorRate(ss.getGsmBitErrorRate()); li.setCdmaDbm(ss.getCdmaDbm()); li.setCdmaEcio(ss.getCdmaEcio()); li.setEvdoDbm(ss.getEvdoDbm()); li.setEvdoEcio(ss.getEvdoEcio()); li.setEvdoSnr(ss.getEvdoSnr()); li.setLteSignalStrength(ss.getLteSignalStrength()); li.setLteRsrp(ss.getLteRsrp()); li.setLteRsrq(ss.getLteRsrq()); li.setLteRssnr(ss.getLteRssnr()); li.setLteCqi(ss.getLteCqi()); } if (VDBG) { Slog.d( TAG, "Returning LinkQualityInfo with" + " MobileNetworkType = " + String.valueOf(li.getMobileNetworkType()) + " Theoretical Rx BW = " + String.valueOf(li.getTheoreticalRxBandwidth()) + " gsm Signal Strength = " + String.valueOf(li.getRssi()) + " cdma Signal Strength = " + String.valueOf(li.getCdmaDbm()) + " evdo Signal Strength = " + String.valueOf(li.getEvdoDbm()) + " Lte Signal Strength = " + String.valueOf(li.getLteSignalStrength())); } return li; }