Merge "Fix disconnect from wired ethernet issues." into ics-aah
This commit is contained in:
@@ -79,10 +79,7 @@ public class EthernetDataTracker implements NetworkStateTracker {
|
||||
if (up) {
|
||||
mTracker.reconnect();
|
||||
} else {
|
||||
NetworkUtils.stopDhcp(mIface);
|
||||
mTracker.mNetworkInfo.setIsAvailable(false);
|
||||
mTracker.mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED,
|
||||
null, null);
|
||||
mTracker.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,11 +126,7 @@ public class EthernetDataTracker implements NetworkStateTracker {
|
||||
runDhcp();
|
||||
}
|
||||
|
||||
private void interfaceRemoved(String iface) {
|
||||
if (!iface.equals(mIface))
|
||||
return;
|
||||
|
||||
Log.d(TAG, "Removing " + iface);
|
||||
public void disconnect() {
|
||||
|
||||
NetworkUtils.stopDhcp(mIface);
|
||||
|
||||
@@ -147,6 +140,21 @@ public class EthernetDataTracker implements NetworkStateTracker {
|
||||
msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
|
||||
msg.sendToTarget();
|
||||
|
||||
IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
|
||||
INetworkManagementService service = INetworkManagementService.Stub.asInterface(b);
|
||||
try {
|
||||
service.clearInterfaceAddresses(mIface);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to clear addresses or disable ipv6" + e);
|
||||
}
|
||||
}
|
||||
|
||||
private void interfaceRemoved(String iface) {
|
||||
if (!iface.equals(mIface))
|
||||
return;
|
||||
|
||||
Log.d(TAG, "Removing " + iface);
|
||||
disconnect();
|
||||
mIface = "";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user