Loading core/java/android/os/INetworkManagementService.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,16 @@ interface INetworkManagementService */ void clearInterfaceAddresses(String iface); /** * Set interface down */ void setInterfaceDown(String iface); /** * Set interface up */ void setInterfaceUp(String iface); /** * Retrieves the network routes currently configured on the specified * interface Loading services/java/com/android/server/NetworkManagementService.java +22 −0 Original line number Diff line number Diff line Loading @@ -446,6 +446,28 @@ class NetworkManagementService extends INetworkManagementService.Stub { } } public void setInterfaceDown(String iface) throws IllegalStateException { try { InterfaceConfiguration ifcg = getInterfaceConfig(iface); ifcg.interfaceFlags = ifcg.interfaceFlags.replace("up", "down"); setInterfaceConfig(iface, ifcg); } catch (NativeDaemonConnectorException e) { throw new IllegalStateException( "Unable to communicate with native daemon for interface down - " + e); } } public void setInterfaceUp(String iface) throws IllegalStateException { try { InterfaceConfiguration ifcg = getInterfaceConfig(iface); ifcg.interfaceFlags = ifcg.interfaceFlags.replace("down", "up"); setInterfaceConfig(iface, ifcg); } catch (NativeDaemonConnectorException e) { throw new IllegalStateException( "Unable to communicate with native daemon for interface up - " + e); } } /* TODO: This is right now a IPv4 only function. Works for wifi which loses its IPv6 addresses on interface down, but we need to do full clean up here */ public void clearInterfaceAddresses(String iface) throws IllegalStateException { Loading wifi/java/android/net/wifi/WifiStateMachine.java +11 −0 Original line number Diff line number Diff line Loading @@ -1911,6 +1911,17 @@ public class WifiStateMachine extends StateMachine { transitionTo(mDriverUnloadingState); break; case CMD_START_SUPPLICANT: //A runtime crash can leave the interface up and //this affects connectivity when supplicant starts up. //Ensure interface is down before a supplicant start. try { mNwService.setInterfaceDown(mInterfaceName); } catch (RemoteException re) { if (DBG) Log.w(TAG, "Unable to bring down wlan interface: " + re); } catch (IllegalStateException ie) { if (DBG) Log.w(TAG, "Unable to bring down wlan interface: " + ie); } if(WifiNative.startSupplicant()) { Log.d(TAG, "Supplicant start successful"); mWifiMonitor.startMonitoring(); Loading Loading
core/java/android/os/INetworkManagementService.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,16 @@ interface INetworkManagementService */ void clearInterfaceAddresses(String iface); /** * Set interface down */ void setInterfaceDown(String iface); /** * Set interface up */ void setInterfaceUp(String iface); /** * Retrieves the network routes currently configured on the specified * interface Loading
services/java/com/android/server/NetworkManagementService.java +22 −0 Original line number Diff line number Diff line Loading @@ -446,6 +446,28 @@ class NetworkManagementService extends INetworkManagementService.Stub { } } public void setInterfaceDown(String iface) throws IllegalStateException { try { InterfaceConfiguration ifcg = getInterfaceConfig(iface); ifcg.interfaceFlags = ifcg.interfaceFlags.replace("up", "down"); setInterfaceConfig(iface, ifcg); } catch (NativeDaemonConnectorException e) { throw new IllegalStateException( "Unable to communicate with native daemon for interface down - " + e); } } public void setInterfaceUp(String iface) throws IllegalStateException { try { InterfaceConfiguration ifcg = getInterfaceConfig(iface); ifcg.interfaceFlags = ifcg.interfaceFlags.replace("down", "up"); setInterfaceConfig(iface, ifcg); } catch (NativeDaemonConnectorException e) { throw new IllegalStateException( "Unable to communicate with native daemon for interface up - " + e); } } /* TODO: This is right now a IPv4 only function. Works for wifi which loses its IPv6 addresses on interface down, but we need to do full clean up here */ public void clearInterfaceAddresses(String iface) throws IllegalStateException { Loading
wifi/java/android/net/wifi/WifiStateMachine.java +11 −0 Original line number Diff line number Diff line Loading @@ -1911,6 +1911,17 @@ public class WifiStateMachine extends StateMachine { transitionTo(mDriverUnloadingState); break; case CMD_START_SUPPLICANT: //A runtime crash can leave the interface up and //this affects connectivity when supplicant starts up. //Ensure interface is down before a supplicant start. try { mNwService.setInterfaceDown(mInterfaceName); } catch (RemoteException re) { if (DBG) Log.w(TAG, "Unable to bring down wlan interface: " + re); } catch (IllegalStateException ie) { if (DBG) Log.w(TAG, "Unable to bring down wlan interface: " + ie); } if(WifiNative.startSupplicant()) { Log.d(TAG, "Supplicant start successful"); mWifiMonitor.startMonitoring(); Loading