use of android.telephony.CellInfo in project android_packages_apps_Settings by DirtyUnicorns.
the class RadioInfo method buildCellInfoString.
private final String buildCellInfoString(List<CellInfo> arrayCi) {
String value = new String();
StringBuilder cdmaCells = new StringBuilder(), gsmCells = new StringBuilder(), lteCells = new StringBuilder(), wcdmaCells = new StringBuilder();
if (arrayCi != null) {
for (CellInfo ci : arrayCi) {
if (ci instanceof CellInfoLte) {
lteCells.append(buildLteInfoString((CellInfoLte) ci));
} else if (ci instanceof CellInfoWcdma) {
wcdmaCells.append(buildWcdmaInfoString((CellInfoWcdma) ci));
} else if (ci instanceof CellInfoGsm) {
gsmCells.append(buildGsmInfoString((CellInfoGsm) ci));
} else if (ci instanceof CellInfoCdma) {
cdmaCells.append(buildCdmaInfoString((CellInfoCdma) ci));
}
}
if (lteCells.length() != 0) {
value += String.format("LTE\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-4.4s %-4.4s %-2.2s\n", "SRV", "MCC", "MNC", "TAC", "CID", "PCI", "EARFCN", "RSRP", "RSRQ", "TA");
value += lteCells.toString();
}
if (wcdmaCells.length() != 0) {
value += String.format("WCDMA\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n", "SRV", "MCC", "MNC", "LAC", "CID", "UARFCN", "PSC", "RSCP");
value += wcdmaCells.toString();
}
if (gsmCells.length() != 0) {
value += String.format("GSM\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n", "SRV", "MCC", "MNC", "LAC", "CID", "ARFCN", "BSIC", "RSSI");
value += gsmCells.toString();
}
if (cdmaCells.length() != 0) {
value += String.format("CDMA/EVDO\n%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s\n", "SRV", "SID", "NID", "BSID", "C-RSSI", "C-ECIO", "E-RSSI", "E-ECIO", "E-SNR");
value += cdmaCells.toString();
}
} else {
value = "unknown";
}
return value.toString();
}
use of android.telephony.CellInfo in project android_packages_apps_Dialer by MoKee.
the class WifiCallUtils method isCellularNetworkAvailable.
private static boolean isCellularNetworkAvailable(Context context) {
boolean available = false;
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> cellInfoList = tm.getAllCellInfo();
if (cellInfoList != null) {
for (CellInfo cellinfo : cellInfoList) {
if (cellinfo.isRegistered()) {
available = true;
}
}
}
return available;
}
use of android.telephony.CellInfo in project platform_packages_apps_Settings by BlissRoms.
the class RadioInfo method buildCellInfoString.
private final String buildCellInfoString(List<CellInfo> arrayCi) {
String value = new String();
StringBuilder cdmaCells = new StringBuilder(), gsmCells = new StringBuilder(), lteCells = new StringBuilder(), wcdmaCells = new StringBuilder();
if (arrayCi != null) {
for (CellInfo ci : arrayCi) {
if (ci instanceof CellInfoLte) {
lteCells.append(buildLteInfoString((CellInfoLte) ci));
} else if (ci instanceof CellInfoWcdma) {
wcdmaCells.append(buildWcdmaInfoString((CellInfoWcdma) ci));
} else if (ci instanceof CellInfoGsm) {
gsmCells.append(buildGsmInfoString((CellInfoGsm) ci));
} else if (ci instanceof CellInfoCdma) {
cdmaCells.append(buildCdmaInfoString((CellInfoCdma) ci));
}
}
if (lteCells.length() != 0) {
value += String.format("LTE\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-4.4s %-4.4s %-2.2s\n", "SRV", "MCC", "MNC", "TAC", "CID", "PCI", "EARFCN", "RSRP", "RSRQ", "TA");
value += lteCells.toString();
}
if (wcdmaCells.length() != 0) {
value += String.format("WCDMA\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n", "SRV", "MCC", "MNC", "LAC", "CID", "UARFCN", "PSC", "RSCP");
value += wcdmaCells.toString();
}
if (gsmCells.length() != 0) {
value += String.format("GSM\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n", "SRV", "MCC", "MNC", "LAC", "CID", "ARFCN", "BSIC", "RSSI");
value += gsmCells.toString();
}
if (cdmaCells.length() != 0) {
value += String.format("CDMA/EVDO\n%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s\n", "SRV", "SID", "NID", "BSID", "C-RSSI", "C-ECIO", "E-RSSI", "E-ECIO", "E-SNR");
value += cdmaCells.toString();
}
} else {
value = "unknown";
}
return value.toString();
}
use of android.telephony.CellInfo in project android_frameworks_opt_telephony by LineageOS.
the class NetworkScanResultTest method testParcel.
@Test
@SmallTest
public void testParcel() {
ArrayList<CellInfo> infos = new ArrayList<CellInfo>();
CellIdentityGsm cig = new CellIdentityGsm(310, 310, 1, 2, 3, 4);
CellSignalStrengthGsm cssg = new CellSignalStrengthGsm();
cssg.initialize(5, 6, 7);
CellInfoGsm gsm = new CellInfoGsm();
gsm.setRegistered(true);
gsm.setTimeStampType(8);
gsm.setTimeStamp(9);
gsm.setCellIdentity(cig);
gsm.setCellSignalStrength(cssg);
infos.add(gsm);
CellIdentityLte cil = new CellIdentityLte(320, 320, 11, 12, 13, 14);
CellSignalStrengthLte cssl = new CellSignalStrengthLte();
cssl.initialize(15, 16, 17, 18, 19, 20);
CellInfoLte lte = new CellInfoLte();
lte.setRegistered(false);
lte.setTimeStampType(21);
lte.setTimeStamp(22);
lte.setCellIdentity(cil);
lte.setCellSignalStrength(cssl);
infos.add(lte);
NetworkScanResult nsr = new NetworkScanResult(0, 0, infos);
Parcel p = Parcel.obtain();
nsr.writeToParcel(p, 0);
p.setDataPosition(0);
NetworkScanResult newNsr = NetworkScanResult.CREATOR.createFromParcel(p);
assertEquals(nsr, newNsr);
}
use of android.telephony.CellInfo in project android_frameworks_opt_telephony by LineageOS.
the class Phone method privatizeCellInfoList.
/**
* Clear CDMA base station lat/long values if location setting is disabled.
* @param cellInfoList the original cell info list from the RIL
* @return the original list with CDMA lat/long cleared if necessary
*/
private List<CellInfo> privatizeCellInfoList(List<CellInfo> cellInfoList) {
if (cellInfoList == null)
return null;
int mode = Settings.Secure.getInt(getContext().getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF);
if (mode == Settings.Secure.LOCATION_MODE_OFF) {
ArrayList<CellInfo> privateCellInfoList = new ArrayList<CellInfo>(cellInfoList.size());
// clear lat/lon values for location privacy
for (CellInfo c : cellInfoList) {
if (c instanceof CellInfoCdma) {
CellInfoCdma cellInfoCdma = (CellInfoCdma) c;
CellIdentityCdma cellIdentity = cellInfoCdma.getCellIdentity();
CellIdentityCdma maskedCellIdentity = new CellIdentityCdma(cellIdentity.getNetworkId(), cellIdentity.getSystemId(), cellIdentity.getBasestationId(), Integer.MAX_VALUE, Integer.MAX_VALUE);
CellInfoCdma privateCellInfoCdma = new CellInfoCdma(cellInfoCdma);
privateCellInfoCdma.setCellIdentity(maskedCellIdentity);
privateCellInfoList.add(privateCellInfoCdma);
} else {
privateCellInfoList.add(c);
}
}
cellInfoList = privateCellInfoList;
}
return cellInfoList;
}
Aggregations