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);
}
}
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);
}
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);
}
}
}
}
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);
}
}
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;
}
Aggregations