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

Commit 63625002 authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "Fix USB tethering again"

parents 84935dc2 485861c4
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -202,7 +202,11 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
                    sm.start();
                    sm.start();
                }
                }
            } else {
            } else {
                if (sm != null) {
                if (isUsb(iface)) {
                    // ignore usb0 down after enabling RNDIS
                    // we will handle disconnect in interfaceRemoved instead
                    Log.d(TAG, "ignoring interface down for " + iface);
                } else if (sm != null) {
                    sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
                    sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
                    mIfaces.remove(iface);
                    mIfaces.remove(iface);
                }
                }
@@ -237,6 +241,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
    }
    }


    public void interfaceAdded(String iface) {
    public void interfaceAdded(String iface) {
        if (DEBUG) Log.d(TAG, "interfaceAdded " + iface);
        boolean found = false;
        boolean found = false;
        boolean usb = false;
        boolean usb = false;
        if (isWifi(iface)) {
        if (isWifi(iface)) {
@@ -268,6 +273,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
    }
    }


    public void interfaceRemoved(String iface) {
    public void interfaceRemoved(String iface) {
        if (DEBUG) Log.d(TAG, "interfaceRemoved " + iface);
        synchronized (mIfaces) {
        synchronized (mIfaces) {
            TetherInterfaceSM sm = mIfaces.get(iface);
            TetherInterfaceSM sm = mIfaces.get(iface);
            if (sm == null) {
            if (sm == null) {
@@ -542,6 +548,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
    }
    }


    public int setUsbTethering(boolean enable) {
    public int setUsbTethering(boolean enable) {
        if (DEBUG) Log.d(TAG, "setUsbTethering(" + enable + ")");
        UsbManager usbManager = (UsbManager)mContext.getSystemService(Context.USB_SERVICE);
        UsbManager usbManager = (UsbManager)mContext.getSystemService(Context.USB_SERVICE);


        synchronized (this) {
        synchronized (this) {