diff options
author | Jaikumar Ganesh <jaikumar@google.com> | 2010-12-21 22:42:04 -0800 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2010-12-22 15:24:18 -0800 |
commit | 057898a9b5d50e0d8eed52bdaa74a5f17bf85c1a (patch) | |
tree | 41dca037028b3a0d5877a6acb32a89d0ec62b633 /core/java | |
parent | 15c7439acb22ab079dd2ebe42bdf0d2ffd525c5d (diff) | |
download | frameworks_base-057898a9b5d50e0d8eed52bdaa74a5f17bf85c1a.zip frameworks_base-057898a9b5d50e0d8eed52bdaa74a5f17bf85c1a.tar.gz frameworks_base-057898a9b5d50e0d8eed52bdaa74a5f17bf85c1a.tar.bz2 |
Enable Bluetooth reverse tethering.
Change-Id: I84a508b64f18a1445b8ac424f2a36d56ef432375
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/server/BluetoothEventLoop.java | 8 | ||||
-rw-r--r-- | core/java/android/server/BluetoothService.java | 17 |
2 files changed, 18 insertions, 7 deletions
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index ff8be15..c04bb52 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -425,9 +425,11 @@ class BluetoothEventLoop { } } else if (name.equals("Interface")) { String iface = propValues[1]; - mBluetoothService.handlePanDeviceStateChange(device, iface, - BluetoothPan.STATE_CONNECTED, - BluetoothPan.LOCAL_PANU_ROLE); + if (!iface.equals("")) { + mBluetoothService.handlePanDeviceStateChange(device, iface, + BluetoothPan.STATE_CONNECTED, + BluetoothPan.LOCAL_PANU_ROLE); + } } } diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index eaf49bb..9261ff6 100644 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -34,6 +34,7 @@ import android.bluetooth.BluetoothPan; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfileState; import android.bluetooth.BluetoothSocket; +import android.bluetooth.BluetoothTetheringDataTracker; import android.bluetooth.BluetoothUuid; import android.bluetooth.IBluetooth; import android.bluetooth.IBluetoothCallback; @@ -54,7 +55,6 @@ import android.os.Message; import android.os.ParcelUuid; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.SystemService; import android.provider.Settings; import android.util.Log; import android.util.Pair; @@ -79,11 +79,9 @@ import java.net.InetAddress; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; public class BluetoothService extends IBluetooth.Stub { private static final String TAG = "BluetoothService"; @@ -169,6 +167,8 @@ public class BluetoothService extends IBluetooth.Stub { private static String mDockAddress; private String mDockPin; + private String mIface; + private int mAdapterConnectionState = BluetoothAdapter.STATE_DISCONNECTED; private static class RemoteService { @@ -1582,7 +1582,6 @@ public class BluetoothService extends IBluetooth.Stub { } if (prevState == state) return; - // TODO: We might need this for PANU role too. if (role == BluetoothPan.LOCAL_NAP_ROLE) { if (state == BluetoothPan.STATE_CONNECTED) { ifaceAddr = enableTethering(iface); @@ -1593,6 +1592,16 @@ public class BluetoothService extends IBluetooth.Stub { ifaceAddr = null; } } + } else { + // PANU Role = reverse Tether + if (state == BluetoothPan.STATE_CONNECTED) { + mIface = iface; + BluetoothTetheringDataTracker.getInstance().startReverseTether(iface, device); + } else if (state == BluetoothPan.STATE_DISCONNECTED && + (prevState == BluetoothPan.STATE_CONNECTED || + prevState == BluetoothPan.STATE_DISCONNECTING)) { + BluetoothTetheringDataTracker.getInstance().stopReverseTether(mIface); + } } Pair<Integer, String> value = new Pair<Integer, String>(state, ifaceAddr); |