Search in sources :

Example 11 with CellInfoCdma

use of android.telephony.CellInfoCdma 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();
}
Also used : CellInfoLte(android.telephony.CellInfoLte) CellInfo(android.telephony.CellInfo) NeighboringCellInfo(android.telephony.NeighboringCellInfo) CellInfoCdma(android.telephony.CellInfoCdma) CellInfoWcdma(android.telephony.CellInfoWcdma) CellInfoGsm(android.telephony.CellInfoGsm)

Example 12 with CellInfoCdma

use of android.telephony.CellInfoCdma 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;
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) CellInfo(android.telephony.CellInfo) CellInfoCdma(android.telephony.CellInfoCdma) ArrayList(java.util.ArrayList)

Example 13 with CellInfoCdma

use of android.telephony.CellInfoCdma in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class CellInfoUtil method wrapCellInfoWithCellIdentity.

/**
 * Wrap a CellIdentity into a CellInfo.
 */
public static CellInfo wrapCellInfoWithCellIdentity(CellIdentity cellIdentity) {
    if (cellIdentity instanceof CellIdentityLte) {
        CellInfoLte cellInfo = new CellInfoLte();
        cellInfo.setCellIdentity((CellIdentityLte) cellIdentity);
        return cellInfo;
    } else if (cellIdentity instanceof CellIdentityCdma) {
        CellInfoCdma cellInfo = new CellInfoCdma();
        cellInfo.setCellIdentity((CellIdentityCdma) cellIdentity);
        return cellInfo;
    } else if (cellIdentity instanceof CellIdentityWcdma) {
        CellInfoWcdma cellInfo = new CellInfoWcdma();
        cellInfo.setCellIdentity((CellIdentityWcdma) cellIdentity);
        return cellInfo;
    } else if (cellIdentity instanceof CellIdentityGsm) {
        CellInfoGsm cellInfo = new CellInfoGsm();
        cellInfo.setCellIdentity((CellIdentityGsm) cellIdentity);
        return cellInfo;
    } else {
        Log.e(TAG, "Invalid CellInfo type");
        return null;
    }
}
Also used : CellInfoLte(android.telephony.CellInfoLte) CellIdentityCdma(android.telephony.CellIdentityCdma) CellInfoCdma(android.telephony.CellInfoCdma) CellIdentityLte(android.telephony.CellIdentityLte) CellInfoWcdma(android.telephony.CellInfoWcdma) CellIdentityGsm(android.telephony.CellIdentityGsm) CellIdentityWcdma(android.telephony.CellIdentityWcdma) CellInfoGsm(android.telephony.CellInfoGsm)

Example 14 with CellInfoCdma

use of android.telephony.CellInfoCdma in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class CellInfoUtil method getOperatorInfoFromCellInfo.

/**
 * Wrap a cell info into an operator info.
 */
public static OperatorInfo getOperatorInfoFromCellInfo(CellInfo cellInfo) {
    OperatorInfo oi;
    if (cellInfo instanceof CellInfoLte) {
        CellInfoLte lte = (CellInfoLte) cellInfo;
        oi = new OperatorInfo((String) lte.getCellIdentity().getOperatorAlphaLong(), (String) lte.getCellIdentity().getOperatorAlphaShort(), lte.getCellIdentity().getMobileNetworkOperator());
    } else if (cellInfo instanceof CellInfoWcdma) {
        CellInfoWcdma wcdma = (CellInfoWcdma) cellInfo;
        oi = new OperatorInfo((String) wcdma.getCellIdentity().getOperatorAlphaLong(), (String) wcdma.getCellIdentity().getOperatorAlphaShort(), wcdma.getCellIdentity().getMobileNetworkOperator());
    } else if (cellInfo instanceof CellInfoGsm) {
        CellInfoGsm gsm = (CellInfoGsm) cellInfo;
        oi = new OperatorInfo((String) gsm.getCellIdentity().getOperatorAlphaLong(), (String) gsm.getCellIdentity().getOperatorAlphaShort(), gsm.getCellIdentity().getMobileNetworkOperator());
    } else if (cellInfo instanceof CellInfoCdma) {
        CellInfoCdma cdma = (CellInfoCdma) cellInfo;
        oi = new OperatorInfo((String) cdma.getCellIdentity().getOperatorAlphaLong(), (String) cdma.getCellIdentity().getOperatorAlphaShort(), "");
    } else {
        Log.e(TAG, "Invalid CellInfo type");
        oi = new OperatorInfo("", "", "");
    }
    return oi;
}
Also used : CellInfoLte(android.telephony.CellInfoLte) CellInfoCdma(android.telephony.CellInfoCdma) CellInfoWcdma(android.telephony.CellInfoWcdma) OperatorInfo(com.android.internal.telephony.OperatorInfo) CellInfoGsm(android.telephony.CellInfoGsm)

Example 15 with CellInfoCdma

use of android.telephony.CellInfoCdma in project Resurrection_packages_apps_Settings by ResurrectionRemix.

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 %-2.2s %-4.4s %-4.4s %-2.2s\n", "SRV", "MCC", "MNC", "TAC", "CID", "PCI", "EARFCN", "BW", "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();
}
Also used : CellInfoLte(android.telephony.CellInfoLte) CellInfo(android.telephony.CellInfo) CellInfoCdma(android.telephony.CellInfoCdma) CellInfoWcdma(android.telephony.CellInfoWcdma) CellInfoGsm(android.telephony.CellInfoGsm)

Aggregations

CellInfoCdma (android.telephony.CellInfoCdma)23 CellInfoGsm (android.telephony.CellInfoGsm)22 CellInfoLte (android.telephony.CellInfoLte)19 CellInfoWcdma (android.telephony.CellInfoWcdma)19 CellInfo (android.telephony.CellInfo)18 CellIdentityCdma (android.telephony.CellIdentityCdma)15 CellIdentityGsm (android.telephony.CellIdentityGsm)14 CellIdentityLte (android.telephony.CellIdentityLte)11 CellIdentityWcdma (android.telephony.CellIdentityWcdma)11 CellSignalStrengthCdma (android.telephony.CellSignalStrengthCdma)6 CellSignalStrengthGsm (android.telephony.CellSignalStrengthGsm)6 NeighboringCellInfo (android.telephony.NeighboringCellInfo)6 PendingIntent (android.app.PendingIntent)5 Intent (android.content.Intent)5 WifiInfo (android.net.wifi.WifiInfo)5 CellSignalStrengthLte (android.telephony.CellSignalStrengthLte)3 CellSignalStrengthWcdma (android.telephony.CellSignalStrengthWcdma)3 TargetApi (android.annotation.TargetApi)2 SuppressLint (android.annotation.SuppressLint)1 OperatorInfo (com.android.internal.telephony.OperatorInfo)1