Example usage for android.telephony CellInfo getClass

List of usage examples for android.telephony CellInfo getClass

Introduction

In this page you can find the example usage for android.telephony CellInfo getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.restcomm.app.qoslib.UtilsOld.CellHistory.java

public String updateNeighborHistory(int[] _list, int[] _list_rssi) {
    int i;/*www  . j a  v a  2s .c om*/
    //if (tmLastNeighborUpdate + 2000 > System.currentTimeMillis())
    //   return "";

    //if (!_isTravelling)
    {
        String txt = "";
        String stringNeighboring = "";
        String[] _type = null;
        try {
            int netType = telephonyManager.getNetworkType();
            int gen = PhoneState.getNetworkGeneration(netType);
            int n = 0, len = 0;
            boolean bValid = true;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                try {
                    List<CellInfo> cells = null;
                    cells = telephonyManager.getAllCellInfo();
                    if (cells != null && cells.size() > 0 && cells.get(0) instanceof CellInfoLte
                            && telephonyManager.getNetworkType() == PhoneState.NETWORK_NEWTYPE_LTE) {
                        return updateLteNeighborHistory(cells);
                    }
                    //if (cells == null)
                    //   LoggerUtil.logToFile(LoggerUtil.Level.ERROR, TAG, "updateNeighborHistory", "cells = null");

                    if (cells != null && cells.size() > 1)//1)
                    {

                        len = cells.size();
                        if (len > 8)
                            len = 8;
                        _list = new int[len];
                        _list_rssi = new int[len];
                        _type = new String[len];
                        for (i = 0; i < len; i++) {
                            bValid = true;
                            CellInfo neighbor = cells.get(i);
                            String msg = "cells[" + i + "]=" + neighbor.toString();
                            String classname = neighbor.getClass().toString();
                            //LoggerUtil.logToFile(LoggerUtil.Level.ERROR, TAG, "updateNeighborHistory", "cells[" + i + "]=" + neighbor.toString());
                            //Log.d(TAG, "cells[" + c + "]=" + cells.get(c).toString());
                            if (gen < 3)
                                _type[i] = "2G";
                            else
                                _type[i] = "3G";
                            if (neighbor.isRegistered())
                                _type[i] += "*";
                            if (neighbor instanceof CellInfoCdma) {
                                CellIdentityCdma cdmacell = ((CellInfoCdma) neighbor).getCellIdentity();
                                CellSignalStrengthCdma cdmasig = ((CellInfoCdma) neighbor)
                                        .getCellSignalStrength();
                                if (cdmacell.getBasestationId() > 0) {
                                    _list[n] = cdmacell.getBasestationId();
                                    _list_rssi[n] = cdmasig.getEvdoDbm();
                                    n++;
                                    //else if (neighbor.getSystemId() > 0)
                                    //   _list[n] = (neighbor.getLac()<<16) + neighbor.getCid();
                                } else
                                    bValid = false;
                            } else if (neighbor instanceof CellInfoGsm) {
                                CellIdentityGsm gsmcell = ((CellInfoGsm) neighbor).getCellIdentity();
                                CellSignalStrengthGsm gsmsig = ((CellInfoGsm) neighbor).getCellSignalStrength();
                                if (gsmcell.getPsc() > 0 && gsmcell.getPsc() < 1000) {
                                    _list[n] = gsmcell.getPsc();
                                    _list_rssi[n] = gsmsig.getDbm();
                                    n++;
                                } else if (gsmcell.getCid() > 0) {
                                    _list[n] = (gsmcell.getLac() << 16) + gsmcell.getCid();
                                    _list_rssi[n] = gsmsig.getDbm();
                                } else
                                    bValid = false;
                            } else if (neighbor.getClass().toString()
                                    .equals("class android.telephony.CellInfoWcdma")) {
                                try {
                                    Object gsmcell = neighbor.getClass().getDeclaredMethod("getCellIdentity")
                                            .invoke(neighbor, (Object[]) null);
                                    Object gsmsig = neighbor.getClass()
                                            .getDeclaredMethod("getCellSignalStrength")
                                            .invoke(neighbor, (Object[]) null);
                                    Integer psc = (Integer) gsmcell.getClass().getDeclaredMethod("getPsc")
                                            .invoke(gsmcell, (Object[]) null);
                                    Integer cid = (Integer) gsmcell.getClass().getDeclaredMethod("getCid")
                                            .invoke(gsmcell, (Object[]) null);
                                    Integer dbm = (Integer) gsmsig.getClass().getDeclaredMethod("getDbm")
                                            .invoke(gsmsig, (Object[]) null);
                                    if (psc > 0 && psc < 1000) {
                                        _list[n] = psc;
                                        //if (neighbor.isRegistered())
                                        //   _list[n] += 10000;
                                        _list_rssi[n] = dbm;
                                        n++;
                                    } else if (cid > 0 && cid < 65536) {
                                        _list[n] = cid;
                                        //if (neighbor.isRegistered())
                                        //   _list[n] += 10000;
                                        _list_rssi[n] = dbm;
                                        n++;
                                    } else
                                        bValid = false;
                                } catch (Exception e) {
                                    //Log.d(TAG, "Field does not exist - " + fieldname);
                                }

                                //                     CellIdentityWcdma gsmcell =((CellInfoWcdma) neighbor).getCellIdentity();
                                //                     CellSignalStrengthWcdma gsmsig = ((CellInfoWcdma) neighbor).getCellSignalStrength();
                                //                     if (gsmcell.getPsc() > 0)
                                //                     {   _list[n] = gsmcell.getPsc();
                                //                        if (neighbor.isRegistered())
                                //                           _list[n] += 0;
                                //                        _list_rssi[n] = gsmsig.getDbm();
                                //                        n++;
                                //                     }
                                //                     else if (gsmcell.getCid() > 0)
                                //                     {
                                //                        _list[n] = (gsmcell.getLac()<<16) + gsmcell.getCid();
                                //                     }
                                //                     else
                                //                        bValid = false;
                            }
                        }

                    }

                } catch (Exception e) {

                }
            }
            if (_list == null) {
                // Try to obtain the Neighbor list from the API
                // If the API neighbor list has more active entries than what the log provided, use it instead
                List<NeighboringCellInfo> neighboringList = telephonyManager.getNeighboringCellInfo();
                len = neighboringList.size();
                if (neighboringList != null && len > 0) {
                    int activeN = 0; // how many of the API neighbors are active?

                    for (i = 0; i < neighboringList.size(); i++) {
                        NeighboringCellInfo neighbor = neighboringList.get(i);
                        if (neighbor.getPsc() > 0 && neighbor.getRssi() > -120 && neighbor.getRssi() < -10)
                            activeN++;
                        else if (neighbor.getCid() > 0 && neighbor.getRssi() > 0 && neighbor.getRssi() < 32)
                            activeN++;
                    }
                    _list = new int[len];
                    _list_rssi = new int[len];
                    _type = new String[len];

                    for (i = 0; i < len; i++) {
                        bValid = true;
                        NeighboringCellInfo neighbor = neighboringList.get(i);
                        if (gen < 3)
                            _type[n] = "2G";
                        else
                            _type[n] = "3G";
                        if (neighbor.getPsc() > 0)
                            _list[n] = neighbor.getPsc();
                        else if (neighbor.getLac() > 0)
                            _list[n] = (neighbor.getLac() << 16) + neighbor.getCid();
                        else
                            bValid = false;

                        if (bValid) {
                            _list_rssi[n] = neighbor.getRssi();
                            if (_list_rssi[n] >= 0)
                                _list_rssi[n] = getDbmValue(_list_rssi[n]);
                            n++;
                        }
                    }
                }
            }

            if (_list == null)
                return null;
            tmLastNeighborUpdate = System.currentTimeMillis();
            // create and add a neighbor cell item for each neighbor
            for (i = 0; i < _list.length; i++) {
                if (_list[i] != 0) {
                    CellidSample smp = new CellidSample(_type[i], _list[i], _list_rssi[i]);
                    // Update Neighbor list history a maximum of once per 2 seconds
                    neighbor_history.add(smp);
                    stringNeighboring = stringNeighboring + String.valueOf(_list[i] & 0xFFFF) + "@"
                            + _list_rssi[i] + ",";

                }
            }
            // Report the API neighbor list in the Log, build a string of neighbors
            if (lastCellString == stringNeighboring)
                return null;
            lastCellString = stringNeighboring;
            //if (neighboringList.size() > 0)
            //MMCLogger.logToFile(MMCLogger.Level.DEBUG, TAG, "updateNeighborHistory", stringNeighboring);

            return stringNeighboring;
        } catch (Exception e) {
            return "";
        } finally {
            //if (txt.length() > 0 && (txt.indexOf("might") > 0 || txt.indexOf("detect") > 0))
            //   MMCLogger.logToFile(MMCLogger.Level.DEBUG, TAG, "detectTravellingFromNeighbors", "\n"+txt.substring(0,txt.length()));
        }
    }
}

From source file:com.mobilyzer.util.PhoneUtils.java

public HashMap<String, Integer> getAllCellInfoSignalStrength() {
    if (!(ContextCompat.checkSelfPermission(context,
            Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) {
        return null;
    }//from w w  w  . jav  a  2 s  . c o m
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    List<CellInfo> cellInfos = (List<CellInfo>) telephonyManager.getAllCellInfo();

    HashMap<String, Integer> results = new HashMap<String, Integer>();

    if (cellInfos == null) {
        return results;
    }

    for (CellInfo cellInfo : cellInfos) {
        if (cellInfo.getClass().equals(CellInfoLte.class)) {
            results.put("LTE", ((CellInfoLte) cellInfo).getCellSignalStrength().getDbm());
        } else if (cellInfo.getClass().equals(CellInfoGsm.class)) {
            results.put("GSM", ((CellInfoGsm) cellInfo).getCellSignalStrength().getDbm());
        } else if (cellInfo.getClass().equals(CellInfoCdma.class)) {
            results.put("CDMA", ((CellInfoCdma) cellInfo).getCellSignalStrength().getDbm());
        } else if (cellInfo.getClass().equals(CellInfoWcdma.class)) {
            results.put("WCDMA", ((CellInfoWcdma) cellInfo).getCellSignalStrength().getDbm());
        }
    }

    return results;
}

From source file:com.landenlabs.all_devtool.NetFragment.java

public void updateList() {
    // Time today = new Time(Time.getCurrentTimezone());
    // today.setToNow();
    // today.format(" %H:%M:%S")
    Date dt = new Date();
    m_titleTime.setText(m_timeFormat.format(dt));

    boolean expandAll = m_list.isEmpty();
    m_list.clear();/*from  w  w  w . j a  v a2  s.c om*/

    // Swap colors
    int color = m_rowColor1;
    m_rowColor1 = m_rowColor2;
    m_rowColor2 = color;

    ActivityManager actMgr = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE);

    try {
        String androidIDStr = Settings.Secure.getString(getContext().getContentResolver(),
                Settings.Secure.ANDROID_ID);
        addBuild("Android ID", androidIDStr);

        try {
            AdvertisingIdClient.Info adInfo = AdvertisingIdClient.getAdvertisingIdInfo(getContext());
            final String adIdStr = adInfo.getId();
            final boolean isLAT = adInfo.isLimitAdTrackingEnabled();
            addBuild("Ad ID", adIdStr);
        } catch (IOException e) {
            // Unrecoverable error connecting to Google Play services (e.g.,
            // the old version of the service doesn't support getting AdvertisingId).
        } catch (GooglePlayServicesNotAvailableException e) {
            // Google Play services is not available entirely.
        }

        /*
        try {
        InstanceID instanceID = InstanceID.getInstance(getContext());
        if (instanceID != null) {
            // Requires a Google Developer project ID.
            String authorizedEntity = "<need to make this on google developer site>";
            instanceID.getToken(authorizedEntity, GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
            addBuild("Instance ID", instanceID.getId());
        }
        } catch (Exception ex) {
        }
        */

        ConfigurationInfo info = actMgr.getDeviceConfigurationInfo();
        addBuild("OpenGL", info.getGlEsVersion());
    } catch (Exception ex) {
        m_log.e(ex.getMessage());
    }

    // --------------- Connection Services -------------
    try {
        ConnectivityManager connMgr = (ConnectivityManager) getActivity()
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        final NetworkInfo netInfo = connMgr.getActiveNetworkInfo();
        if (netInfo != null) {
            Map<String, String> netListStr = new LinkedHashMap<String, String>();

            putIf(netListStr, "Available", "Yes", netInfo.isAvailable());
            putIf(netListStr, "Connected", "Yes", netInfo.isConnected());
            putIf(netListStr, "Connecting", "Yes", !netInfo.isConnected() && netInfo.isConnectedOrConnecting());
            putIf(netListStr, "Roaming", "Yes", netInfo.isRoaming());
            putIf(netListStr, "Extra", netInfo.getExtraInfo(), !TextUtils.isEmpty(netInfo.getExtraInfo()));
            putIf(netListStr, "WhyFailed", netInfo.getReason(), !TextUtils.isEmpty(netInfo.getReason()));
            if (Build.VERSION.SDK_INT >= 16) {
                putIf(netListStr, "Metered", "Avoid heavy use", connMgr.isActiveNetworkMetered());
            }

            netListStr.put("NetworkType", netInfo.getTypeName());
            if (connMgr.getAllNetworkInfo().length > 1) {
                netListStr.put("Available Networks:", " ");
                for (NetworkInfo netI : connMgr.getAllNetworkInfo()) {
                    if (netI.isAvailable()) {
                        netListStr.put(" " + netI.getTypeName(), netI.isAvailable() ? "Yes" : "No");
                    }
                }
            }

            if (netInfo.isConnected()) {
                try {
                    for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en
                            .hasMoreElements();) {
                        NetworkInterface intf = en.nextElement();
                        for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr
                                .hasMoreElements();) {
                            InetAddress inetAddress = enumIpAddr.nextElement();
                            if (!inetAddress.isLoopbackAddress()) {
                                if (inetAddress.getHostAddress() != null) {
                                    String ipType = (inetAddress instanceof Inet4Address) ? "IPv4" : "IPv6";
                                    netListStr.put(intf.getName() + " " + ipType, inetAddress.getHostAddress());
                                }
                                // if (!TextUtils.isEmpty(inetAddress.getHostName()))
                                //     listStr.put( "HostName", inetAddress.getHostName());
                            }
                        }
                    }
                } catch (Exception ex) {
                    m_log.e("Network %s", ex.getMessage());
                }
            }

            addBuild("Network...", netListStr);
        }
    } catch (Exception ex) {
        m_log.e("Network %s", ex.getMessage());
    }

    // --------------- Telephony Services -------------
    TelephonyManager telephonyManager = (TelephonyManager) getActivity()
            .getSystemService(Context.TELEPHONY_SERVICE);
    if (telephonyManager != null) {
        Map<String, String> cellListStr = new LinkedHashMap<String, String>();
        try {
            cellListStr.put("Version", telephonyManager.getDeviceSoftwareVersion());
            cellListStr.put("Number", telephonyManager.getLine1Number());
            cellListStr.put("Service", telephonyManager.getNetworkOperatorName());
            cellListStr.put("Roaming", telephonyManager.isNetworkRoaming() ? "Yes" : "No");
            cellListStr.put("Type", getNetworkTypeName(telephonyManager.getNetworkType()));

            if (Build.VERSION.SDK_INT >= 17) {
                if (telephonyManager.getAllCellInfo() != null) {
                    for (CellInfo cellInfo : telephonyManager.getAllCellInfo()) {
                        String cellName = cellInfo.getClass().getSimpleName();
                        int level = 0;
                        if (cellInfo instanceof CellInfoCdma) {
                            level = ((CellInfoCdma) cellInfo).getCellSignalStrength().getLevel();
                        } else if (cellInfo instanceof CellInfoGsm) {
                            level = ((CellInfoGsm) cellInfo).getCellSignalStrength().getLevel();
                        } else if (cellInfo instanceof CellInfoLte) {
                            level = ((CellInfoLte) cellInfo).getCellSignalStrength().getLevel();
                        } else if (cellInfo instanceof CellInfoWcdma) {
                            if (Build.VERSION.SDK_INT >= 18) {
                                level = ((CellInfoWcdma) cellInfo).getCellSignalStrength().getLevel();
                            }
                        }
                        cellListStr.put(cellName, "Level% " + String.valueOf(100 * level / 4));
                    }
                }
            }

            for (NeighboringCellInfo cellInfo : telephonyManager.getNeighboringCellInfo()) {
                int level = cellInfo.getRssi();
                cellListStr.put("Cell level%", String.valueOf(100 * level / 31));
            }

        } catch (Exception ex) {
            m_log.e("Cell %s", ex.getMessage());
        }

        if (!cellListStr.isEmpty()) {
            addBuild("Cell...", cellListStr);
        }
    }

    // --------------- Bluetooth Services (API18) -------------
    if (Build.VERSION.SDK_INT >= 18) {
        try {
            BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
            if (bluetoothAdapter != null) {

                Map<String, String> btListStr = new LinkedHashMap<String, String>();

                btListStr.put("Enabled", bluetoothAdapter.isEnabled() ? "yes" : "no");
                btListStr.put("Name", bluetoothAdapter.getName());
                btListStr.put("ScanMode", String.valueOf(bluetoothAdapter.getScanMode()));
                btListStr.put("State", String.valueOf(bluetoothAdapter.getState()));
                Set<BluetoothDevice> pairedDevices = bluetoothAdapter.getBondedDevices();
                // If there are paired devices
                if (pairedDevices.size() > 0) {
                    // Loop through paired devices
                    for (BluetoothDevice device : pairedDevices) {
                        // Add the name and address to an array adapter to show in a ListView
                        btListStr.put("Paired:" + device.getName(), device.getAddress());
                    }
                }

                BluetoothManager btMgr = (BluetoothManager) getActivity()
                        .getSystemService(Context.BLUETOOTH_SERVICE);
                if (btMgr != null) {
                    // btMgr.getAdapter().
                }
                addBuild("Bluetooth", btListStr);
            }

        } catch (Exception ex) {

        }
    }

    // --------------- Wifi Services -------------
    final WifiManager wifiMgr = (WifiManager) getContext().getApplicationContext()
            .getSystemService(Context.WIFI_SERVICE);

    if (wifiMgr != null && wifiMgr.isWifiEnabled() && wifiMgr.getDhcpInfo() != null) {

        if (mSystemBroadcastReceiver == null) {
            mSystemBroadcastReceiver = new SystemBroadcastReceiver(wifiMgr);
            getActivity().registerReceiver(mSystemBroadcastReceiver, INTENT_FILTER_SCAN_AVAILABLE);
        }

        if (ActivityCompat.checkSelfPermission(getContext(),
                Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
                || ActivityCompat.checkSelfPermission(getContext(),
                        Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
            if (wifiMgr.getScanResults() == null || wifiMgr.getScanResults().size() != mLastScanSize) {
                mLastScanSize = wifiMgr.getScanResults().size();
                wifiMgr.startScan();
            }
        }

        Map<String, String> wifiListStr = new LinkedHashMap<String, String>();
        try {
            DhcpInfo dhcpInfo = wifiMgr.getDhcpInfo();

            wifiListStr.put("DNS1", Formatter.formatIpAddress(dhcpInfo.dns1));
            wifiListStr.put("DNS2", Formatter.formatIpAddress(dhcpInfo.dns2));
            wifiListStr.put("Default Gateway", Formatter.formatIpAddress(dhcpInfo.gateway));
            wifiListStr.put("IP Address", Formatter.formatIpAddress(dhcpInfo.ipAddress));
            wifiListStr.put("Subnet Mask", Formatter.formatIpAddress(dhcpInfo.netmask));
            wifiListStr.put("Server IP", Formatter.formatIpAddress(dhcpInfo.serverAddress));
            wifiListStr.put("Lease Time(sec)", String.valueOf(dhcpInfo.leaseDuration));

            WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
            if (wifiInfo != null) {
                wifiListStr.put("LinkSpeed Mbps", String.valueOf(wifiInfo.getLinkSpeed()));
                int numberOfLevels = 10;
                int level = WifiManager.calculateSignalLevel(wifiInfo.getRssi(), numberOfLevels + 1);
                wifiListStr.put("Signal%", String.valueOf(100 * level / numberOfLevels));
                if (Build.VERSION.SDK_INT >= 23) {
                    wifiListStr.put("MAC", getMacAddr());
                } else {
                    wifiListStr.put("MAC", wifiInfo.getMacAddress());
                }
            }

        } catch (Exception ex) {
            m_log.e("Wifi %s", ex.getMessage());
        }

        if (!wifiListStr.isEmpty()) {
            addBuild("WiFi...", wifiListStr);
        }

        try {
            if (ActivityCompat.checkSelfPermission(getContext(),
                    Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
                    || ActivityCompat.checkSelfPermission(getContext(),
                            Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
                List<ScanResult> listWifi = wifiMgr.getScanResults();
                if (listWifi != null && !listWifi.isEmpty()) {
                    int idx = 0;

                    for (ScanResult scanResult : listWifi) {
                        Map<String, String> wifiScanListStr = new LinkedHashMap<String, String>();
                        wifiScanListStr.put("SSID", scanResult.SSID);
                        if (Build.VERSION.SDK_INT >= 23) {
                            wifiScanListStr.put("  Name", scanResult.operatorFriendlyName.toString());
                            wifiScanListStr.put("  Venue", scanResult.venueName.toString());
                        }

                        //        wifiScanListStr.put("  BSSID ",scanResult.BSSID);
                        wifiScanListStr.put("  Capabilities", scanResult.capabilities);
                        //       wifiScanListStr.put("  Center Freq", String.valueOf(scanResult.centerFreq0));
                        //       wifiScanListStr.put("  Freq width", String.valueOf(scanResult.channelWidth));
                        wifiScanListStr.put("  Level, Freq",
                                String.format("%d, %d", scanResult.level, scanResult.frequency));
                        if (Build.VERSION.SDK_INT >= 17) {
                            Date wifiTime = new Date(scanResult.timestamp);
                            wifiScanListStr.put("  Time", wifiTime.toLocaleString());
                        }
                        addBuild(String.format("WiFiScan #%d", ++idx), wifiScanListStr);
                    }
                }
            }
        } catch (Exception ex) {
            m_log.e("WifiList %s", ex.getMessage());
        }

        try {
            List<WifiConfiguration> listWifiCfg = wifiMgr.getConfiguredNetworks();

            for (WifiConfiguration wifiCfg : listWifiCfg) {
                Map<String, String> wifiCfgListStr = new LinkedHashMap<String, String>();
                if (Build.VERSION.SDK_INT >= 23) {
                    wifiCfgListStr.put("Name", wifiCfg.providerFriendlyName);
                }
                wifiCfgListStr.put("SSID", wifiCfg.SSID);
                String netStatus = "";
                switch (wifiCfg.status) {
                case WifiConfiguration.Status.CURRENT:
                    netStatus = "Connected";
                    break;
                case WifiConfiguration.Status.DISABLED:
                    netStatus = "Disabled";
                    break;
                case WifiConfiguration.Status.ENABLED:
                    netStatus = "Enabled";
                    break;
                }
                wifiCfgListStr.put(" Status", netStatus);
                wifiCfgListStr.put(" Priority", String.valueOf(wifiCfg.priority));
                if (null != wifiCfg.wepKeys) {
                    //               wifiCfgListStr.put(" wepKeys", TextUtils.join(",", wifiCfg.wepKeys));
                }
                String protocols = "";
                if (wifiCfg.allowedProtocols.get(WifiConfiguration.Protocol.RSN))
                    protocols = "RSN ";
                if (wifiCfg.allowedProtocols.get(WifiConfiguration.Protocol.WPA))
                    protocols = protocols + "WPA ";
                wifiCfgListStr.put(" Protocols", protocols);

                String keyProt = "";
                if (wifiCfg.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.NONE))
                    keyProt = "none";
                if (wifiCfg.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WPA_EAP))
                    keyProt = "WPA+EAP ";
                if (wifiCfg.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WPA_PSK))
                    keyProt = "WPA+PSK ";
                wifiCfgListStr.put(" Keys", keyProt);

                if (wifiCfg.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.NONE)) {
                    // Remove network connections with no Password.
                    // wifiMgr.removeNetwork(wifiCfg.networkId);
                }

                addBuild("WiFiCfg #" + wifiCfg.networkId, wifiCfgListStr);
            }

        } catch (Exception ex) {
            m_log.e("Wifi Cfg List %s", ex.getMessage());
        }
    }

    if (expandAll) {
        // updateList();
        int count = m_list.size();
        for (int position = 0; position < count; position++)
            m_listView.expandGroup(position);
    }

    m_adapter.notifyDataSetChanged();
}