Search in sources :

Example 81 with WifiInfo

use of android.net.wifi.WifiInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DevelopmentSettings method updateAdbOverNetwork.

private void updateAdbOverNetwork() {
    int port = CMSettings.Secure.getInt(getActivity().getContentResolver(), CMSettings.Secure.ADB_PORT, 0);
    boolean enabled = port > 0;
    updateSwitchPreference(mAdbOverNetwork, enabled);
    WifiInfo wifiInfo = null;
    if (enabled) {
        IWifiManager wifiManager = IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE));
        try {
            wifiInfo = wifiManager.getConnectionInfo();
        } catch (RemoteException e) {
            Log.e(TAG, "wifiManager, getConnectionInfo()", e);
        }
    }
    if (wifiInfo != null) {
        String hostAddress = NetworkUtils.intToInetAddress(wifiInfo.getIpAddress()).getHostAddress();
        mAdbOverNetwork.setSummary(hostAddress + ":" + String.valueOf(port));
    } else {
        mAdbOverNetwork.setSummary(R.string.adb_over_network_summary);
    }
}
Also used : RemoteException(android.os.RemoteException) WifiInfo(android.net.wifi.WifiInfo) IWifiManager(android.net.wifi.IWifiManager)

Example 82 with WifiInfo

use of android.net.wifi.WifiInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class Status method setWifiStatus.

private void setWifiStatus() {
    WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
    String macAddress = wifiInfo == null ? null : wifiInfo.getMacAddress();
    mWifiMacAddress.setSummary(!TextUtils.isEmpty(macAddress) ? macAddress : mUnavailable);
}
Also used : WifiInfo(android.net.wifi.WifiInfo)

Example 83 with WifiInfo

use of android.net.wifi.WifiInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WpsDialog method handleEvent.

private void handleEvent(Context context, Intent intent) {
    String action = intent.getAction();
    if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) {
        NetworkInfo info = (NetworkInfo) intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
        final NetworkInfo.DetailedState state = info.getDetailedState();
        if (state == DetailedState.CONNECTED && mDialogState == DialogState.WPS_COMPLETE) {
            WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
            if (wifiInfo != null) {
                String msg = String.format(mContext.getString(R.string.wifi_wps_connected), wifiInfo.getSSID());
                updateDialog(DialogState.CONNECTED, msg);
            }
        }
    }
}
Also used : NetworkInfo(android.net.NetworkInfo) WifiInfo(android.net.wifi.WifiInfo) DetailedState(android.net.NetworkInfo.DetailedState)

Example 84 with WifiInfo

use of android.net.wifi.WifiInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiStatusTest method handleNetworkStateChanged.

private void handleNetworkStateChanged(NetworkInfo networkInfo) {
    if (mWifiManager.isWifiEnabled()) {
        WifiInfo info = mWifiManager.getConnectionInfo();
        String summary = AccessPoint.getSummary(this, info.getSSID(), networkInfo.getDetailedState(), info.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID, null);
        mNetworkState.setText(summary);
    }
}
Also used : WifiInfo(android.net.wifi.WifiInfo)

Example 85 with WifiInfo

use of android.net.wifi.WifiInfo in project android_frameworks_base by ResurrectionRemix.

the class WifiNetworkAdapter method getActiveWifiConfig.

public WifiConfiguration getActiveWifiConfig() {
    WifiInfo wifiInfo = getConnectionInfo();
    if (wifiInfo == null) {
        return null;
    }
    WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
    for (WifiConfiguration config : wifiManager.getConfiguredNetworks()) {
        if (config.networkId == wifiInfo.getNetworkId()) {
            return config;
        }
    }
    return null;
}
Also used : WifiManager(android.net.wifi.WifiManager) WifiConfiguration(android.net.wifi.WifiConfiguration) WifiInfo(android.net.wifi.WifiInfo)

Aggregations

WifiInfo (android.net.wifi.WifiInfo)99 WifiManager (android.net.wifi.WifiManager)53 WifiConfiguration (android.net.wifi.WifiConfiguration)16 NetworkInfo (android.net.NetworkInfo)13 Intent (android.content.Intent)11 IOException (java.io.IOException)8 Test (org.junit.Test)8 Bundle (android.os.Bundle)7 ScanResult (android.net.wifi.ScanResult)6 WifiAssociationTestRunner (com.android.connectivitymanagertest.WifiAssociationTestRunner)6 PendingIntent (android.app.PendingIntent)5 ConnectivityManager (android.net.ConnectivityManager)5 Network (android.net.Network)5 CellIdentityCdma (android.telephony.CellIdentityCdma)5 CellIdentityGsm (android.telephony.CellIdentityGsm)5 CellIdentityLte (android.telephony.CellIdentityLte)5 CellIdentityWcdma (android.telephony.CellIdentityWcdma)5 CellInfo (android.telephony.CellInfo)5 CellInfoCdma (android.telephony.CellInfoCdma)5 CellInfoGsm (android.telephony.CellInfoGsm)5