OSDN Git Service

Fix Bluetooth tethering
authorGrzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Thu, 5 Feb 2015 12:56:03 +0000 (13:56 +0100)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 22 Dec 2015 04:13:53 +0000 (12:13 +0800)
Ignore linkstate down events for bt-pan interface which cause its
remove. Interface should only be removed when we receive the interface
remove event.

At connect init to bluetooth PAN service, bridge pan device adds
tetherable bt-pan interface as set in bluetooth regexs. Before bt-pan
interface gets tethered, multiple linkstate events are received by
linkstate change notifier.
Receiving multiple time of linkstate down may cause remove of tetherable
interface (bt-pan), before we call tether method. Finally when tethering
method is called and bt-pan tether interface is removed, error is
returned because of not available tetherable interfaces.

Bug found during bluetooth PTS PAN testing. It affects multiple test
cases.

Change-Id: Ifb0d16657ca238aa62064fee0fc4ee974a2518ad

services/core/java/com/android/server/connectivity/Tethering.java

index 9566f93..f9ca459 100644 (file)
@@ -240,6 +240,10 @@ public class Tethering extends BaseNetworkObserver {
                     // ignore usb0 down after enabling RNDIS
                     // we will handle disconnect in interfaceRemoved instead
                     if (VDBG) Log.d(TAG, "ignore interface down for " + iface);
+                } else if (isBluetooth(iface)) {
+                    // ignore interface down for bt liskstate change
+                    // disconnect will only be handled in interfaceRemoved
+                    if (VDBG) Log.d(TAG, "ignore interface down for " + iface);
                 } else if (sm != null) {
                     sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
                     mIfaces.remove(iface);