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

Commit 634ac05a authored by Devi Sandeep Endluri V V's avatar Devi Sandeep Endluri V V Committed by Gerrit - the friendly Code Review server
Browse files

Tether: fix bt-pan and wlan0 timing issue

In a situation where bt-pan or wlan
interface comes up later than the tether
command, tethering will fail with
interface not found error. This can
happen when the wifi hotspot is quickly
and repeatedly enabled and disabled.
Fix is to ignore interface down for
these cases

Change-Id: I464b87f1a6470401b2ef4e7507b804b1da5b5af2
CRs-Fixed: 784379
parent b81e5ee8
Loading
Loading
Loading
Loading
+2 −21
Original line number Diff line number Diff line
@@ -278,29 +278,10 @@ public class Tethering extends BaseNetworkObserver {
                    sm.start();
                }
            } else {
                if (isUsb(iface)) {
                    // ignore usb0 down after enabling RNDIS
                if (isUsb(iface) || isBluetooth(iface) || isWifi(iface) ) {
                    // ignore usb0, bt-pan or wlan0 down after enabling tethering
                    // we will handle disconnect in interfaceRemoved instead
                    if (VDBG) Log.d(TAG, "ignore interface down for " + iface);
                } else if (isWifi(iface) && (mWifiManager != null) &&
                              mWifiManager.getWifiStaSapConcurrency()) {
                    int wifiApState = 0;
                    wifiApState = mWifiManager.getWifiApState();

                    // Ignore AP interface down after enabling STA connection.
                    // If STA connects to same  band the SAP is enabled, the
                    // driver stops SAP before it proceeds for STA connection
                    // hence ignore interface down. After STA connection,
                    // driver starts SAP on STA channel.

                    if ((wifiApState == WifiManager.WIFI_AP_STATE_DISABLING) ||
                       (wifiApState == WifiManager.WIFI_AP_STATE_DISABLED)) {
                        if (VDBG) Log.d(TAG, "Got interface down for " + iface);
                        sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
                        mIfaces.remove(iface);
                    } else {
                        if (VDBG) Log.d(TAG, "ignore interface down for " + iface);
                    }
                } else if (sm != null) {
                    sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
                    mIfaces.remove(iface);