Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f4278a6 authored by Erik Kline's avatar Erik Kline
Browse files

Better error handling when NetworkManagementService#untetherInterface() fails.

Additionally, catch ServiceSpecificException when making netd binder calls.

Test:
  Flipped back and forth between USB and wifi tethering and no longer
  some of the unrecoverable errors.

Bug: 30882741
Change-Id: I470b7cfdaaa82013db35b500a5df10dcfaad2d8c
parent 69115b8e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1310,9 +1310,10 @@ public class NetworkManagementService extends INetworkManagementService.Stub
            mConnector.execute("tether", "interface", "remove", iface);
        } catch (NativeDaemonConnectorException e) {
            throw e.rethrowAsParcelableException();
        }
        } finally {
            removeInterfaceFromLocalNetwork(iface);
        }
    }

    @Override
    public String[] listTetheredInterfaces() {
+4 −3
Original line number Diff line number Diff line
@@ -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();
        }