diff options
| author | 2016-08-17 17:53:30 +0000 | |
|---|---|---|
| committer | 2016-08-17 17:53:30 +0000 | |
| commit | 121a2384080b839eeac529e1756eb9d8167940a1 (patch) | |
| tree | 676a158734e809b6ed6cb7d9d7aa49e1c7e8a70b | |
| parent | ccc3794f779b82ca41c1080b6ef331e928523d15 (diff) | |
| parent | 1f4278a67a96af3cae66dd9806c3daa776dade0d (diff) | |
Better error handling when NetworkManagementService#untetherInterface() fails.
am: 1f4278a67a
Change-Id: I4072169a768fb6a59487e5b149b558993671ca49
| -rw-r--r-- | services/core/java/com/android/server/NetworkManagementService.java | 3 | ||||
| -rw-r--r-- | services/core/java/com/android/server/connectivity/tethering/IPv6TetheringInterfaceServices.java | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java index ec53c16b312e..bdbd06640e49 100644 --- a/services/core/java/com/android/server/NetworkManagementService.java +++ b/services/core/java/com/android/server/NetworkManagementService.java @@ -1310,8 +1310,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub mConnector.execute("tether", "interface", "remove", iface); } catch (NativeDaemonConnectorException e) { throw e.rethrowAsParcelableException(); + } finally { + removeInterfaceFromLocalNetwork(iface); } - removeInterfaceFromLocalNetwork(iface); } @Override diff --git a/services/core/java/com/android/server/connectivity/tethering/IPv6TetheringInterfaceServices.java b/services/core/java/com/android/server/connectivity/tethering/IPv6TetheringInterfaceServices.java index edb4347f56a3..7525f302c141 100644 --- a/services/core/java/com/android/server/connectivity/tethering/IPv6TetheringInterfaceServices.java +++ b/services/core/java/com/android/server/connectivity/tethering/IPv6TetheringInterfaceServices.java @@ -26,6 +26,7 @@ import android.net.RouteInfo; import android.net.ip.RouterAdvertisementDaemon; import android.net.ip.RouterAdvertisementDaemon.RaParams; import android.os.INetworkManagementService; +import android.os.ServiceSpecificException; import android.os.RemoteException; import android.util.Log; import android.util.Slog; @@ -205,7 +206,7 @@ class IPv6TetheringInterfaceServices { final String dnsString = dns.getHostAddress(); try { netd.interfaceDelAddress(mIfName, dnsString, RFC7421_IP_PREFIX_LENGTH); - } catch (RemoteException e) { + } catch (ServiceSpecificException | RemoteException e) { Log.e(TAG, "Failed to remove local dns IP: " + dnsString, e); } } @@ -222,7 +223,7 @@ class IPv6TetheringInterfaceServices { final String dnsString = dns.getHostAddress(); try { netd.interfaceAddAddress(mIfName, dnsString, RFC7421_IP_PREFIX_LENGTH); - } catch (RemoteException e) { + } catch (ServiceSpecificException | RemoteException e) { Log.e(TAG, "Failed to add local dns IP: " + dnsString, e); newDnses.remove(dns); } @@ -231,7 +232,7 @@ class IPv6TetheringInterfaceServices { try { netd.tetherApplyDnsInterfaces(); - } catch (RemoteException e) { + } catch (ServiceSpecificException | RemoteException e) { Log.e(TAG, "Failed to update local DNS caching server"); if (newDnses != null) newDnses.clear(); } |