summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2011-01-21 12:06:16 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-21 12:06:16 -0800
commita9a4f5cc88a373ffcea8902f178fe0a6572c0aa8 (patch)
tree224bf59010c8c767e98ca6538c47facae39ca833 /wifi
parent7bc7e368185f643065a2d1d8adfcd9ab3dcb5603 (diff)
parent27d3c5907cc6f4366a7af3f0941d8d29d9b2440b (diff)
downloadframeworks_base-a9a4f5cc88a373ffcea8902f178fe0a6572c0aa8.zip
frameworks_base-a9a4f5cc88a373ffcea8902f178fe0a6572c0aa8.tar.gz
frameworks_base-a9a4f5cc88a373ffcea8902f178fe0a6572c0aa8.tar.bz2
Merge "Switch from NetworkUtils to netd for iface config."
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 3b5eef0..42a27d1 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -44,7 +44,9 @@ import android.net.NetworkInfo;
import android.net.DhcpInfo;
import android.net.NetworkUtils;
import android.net.ConnectivityManager;
+import android.net.InterfaceConfiguration;
import android.net.NetworkInfo.DetailedState;
+import android.net.NetworkUtils;
import android.net.LinkProperties;
import android.net.wifi.NetworkUpdateResult;
import android.net.wifi.WpsResult.Status;
@@ -2528,14 +2530,24 @@ public class WifiStateMachine extends HierarchicalStateMachine {
mDhcpThread.start();
} else {
DhcpInfo dhcpInfo = WifiConfigStore.getIpConfiguration(mLastNetworkId);
- if (NetworkUtils.configureInterface(mInterfaceName, dhcpInfo)) {
+ IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
+ INetworkManagementService netd = INetworkManagementService.Stub.asInterface(b);
+ InterfaceConfiguration ifcg = new InterfaceConfiguration();
+ ifcg.interfaceFlags = "[up]";
+ ifcg.addr = NetworkUtils.intToInetAddress(dhcpInfo.ipAddress);
+ ifcg.mask = NetworkUtils.intToInetAddress(dhcpInfo.netmask);
+ try {
+ netd.setInterfaceConfig(mInterfaceName, ifcg);
Log.v(TAG, "Static IP configuration succeeded");
synchronized (mDhcpInfo) {
mDhcpInfo = dhcpInfo;
}
sendMessage(CMD_IP_CONFIG_SUCCESS);
- } else {
- Log.v(TAG, "Static IP configuration failed");
+ } catch (RemoteException re) {
+ Log.v(TAG, "Static IP configuration failed: " + re);
+ sendMessage(CMD_IP_CONFIG_FAILURE);
+ } catch (IllegalStateException e) {
+ Log.v(TAG, "Static IP configuration failed: " + e);
sendMessage(CMD_IP_CONFIG_FAILURE);
}
}