Search in sources :

Example 11 with CellInfo

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();
}
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 CellInfo

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;
}
Also used : CellInfo(android.telephony.CellInfo) TelephonyManager(android.telephony.TelephonyManager)

Example 13 with CellInfo

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();
}
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 14 with CellInfo

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);
}
Also used : CellSignalStrengthLte(android.telephony.CellSignalStrengthLte) CellInfoLte(android.telephony.CellInfoLte) CellInfo(android.telephony.CellInfo) CellSignalStrengthGsm(android.telephony.CellSignalStrengthGsm) CellIdentityLte(android.telephony.CellIdentityLte) Parcel(android.os.Parcel) ArrayList(java.util.ArrayList) CellIdentityGsm(android.telephony.CellIdentityGsm) CellInfoGsm(android.telephony.CellInfoGsm) SmallTest(android.support.test.filters.SmallTest) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Example 15 with CellInfo

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

Aggregations

CellInfo (android.telephony.CellInfo)40 CellInfoGsm (android.telephony.CellInfoGsm)26 CellInfoLte (android.telephony.CellInfoLte)25 CellInfoWcdma (android.telephony.CellInfoWcdma)23 CellInfoCdma (android.telephony.CellInfoCdma)18 CellIdentityGsm (android.telephony.CellIdentityGsm)12 CellIdentityLte (android.telephony.CellIdentityLte)12 CellIdentityCdma (android.telephony.CellIdentityCdma)11 CellIdentityWcdma (android.telephony.CellIdentityWcdma)11 NeighboringCellInfo (android.telephony.NeighboringCellInfo)8 ArrayList (java.util.ArrayList)6 PendingIntent (android.app.PendingIntent)5 Intent (android.content.Intent)5 WifiInfo (android.net.wifi.WifiInfo)5 CellSignalStrengthLte (android.telephony.CellSignalStrengthLte)5 Parcel (android.os.Parcel)4 CellSignalStrengthGsm (android.telephony.CellSignalStrengthGsm)4 Test (org.junit.Test)4 SuppressLint (android.annotation.SuppressLint)3 TargetApi (android.annotation.TargetApi)3