Loading core/java/android/bluetooth/BluetoothPan.java +2 −2 Original line number Diff line number Diff line Loading @@ -173,9 +173,9 @@ public final class BluetoothPan { Log.d(TAG, msg); } public void setBluetoothTethering(boolean value, String uuid, String bridge) { public void setBluetoothTethering(boolean value) { try { mService.setBluetoothTethering(value, uuid, bridge); mService.setBluetoothTethering(value); } catch (RemoteException e) { Log.e(TAG, "", e); } Loading core/java/android/bluetooth/IBluetooth.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ interface IBluetooth int getInputDevicePriority(in BluetoothDevice device); boolean isTetheringOn(); void setBluetoothTethering(boolean value, String uuid, String bridge); void setBluetoothTethering(boolean value); int getPanDeviceState(in BluetoothDevice device); BluetoothDevice[] getConnectedPanDevices(); boolean connectPanDevice(in BluetoothDevice device); Loading core/java/android/server/BluetoothEventLoop.java +2 −1 Original line number Diff line number Diff line Loading @@ -644,7 +644,8 @@ class BluetoothEventLoop { } else { Log.i(TAG, "Rejecting incoming HID connection from " + address); } } else if (BluetoothUuid.isBnep(uuid) || BluetoothUuid.isNap(uuid)){ } else if (BluetoothUuid.isBnep(uuid) || BluetoothUuid.isNap(uuid) && mBluetoothService.isTetheringOn()){ authorized = true; } else { Log.i(TAG, "Rejecting incoming " + deviceUuid + " connection from " + address); Loading core/java/android/server/BluetoothService.java +9 −7 Original line number Diff line number Diff line Loading @@ -352,7 +352,7 @@ public class BluetoothService extends IBluetooth.Stub { } setBluetoothState(BluetoothAdapter.STATE_TURNING_OFF); mHandler.removeMessages(MESSAGE_REGISTER_SDP_RECORDS); setBluetoothTethering(false, BluetoothPan.NAP_ROLE, BluetoothPan.NAP_BRIDGE); setBluetoothTetheringNative(false, BluetoothPan.NAP_ROLE, BluetoothPan.NAP_BRIDGE); // Allow 3 seconds for profiles to gracefully disconnect // TODO: Introduce a callback mechanism so that each profile can notify Loading Loading @@ -576,8 +576,12 @@ public class BluetoothService extends IBluetooth.Stub { mBondState.readAutoPairingData(); mBondState.loadBondState(); initProfileState(); //Register SDP records. mHandler.sendMessageDelayed( mHandler.obtainMessage(MESSAGE_REGISTER_SDP_RECORDS, 1, -1), 3000); setBluetoothTetheringNative(true, BluetoothPan.NAP_ROLE, BluetoothPan.NAP_BRIDGE); // Log bluetooth on to battery stats. long ident = Binder.clearCallingIdentity(); Loading Loading @@ -1258,14 +1262,12 @@ public class BluetoothService extends IBluetooth.Stub { private BroadcastReceiver mTetheringReceiver = null; public synchronized void setBluetoothTethering(boolean value, final String uuid, final String bridge) { mTetheringOn = value; public synchronized void setBluetoothTethering(boolean value) { if (!value) { disconnectPan(); } if (getBluetoothState() != BluetoothAdapter.STATE_ON && mTetheringOn) { if (getBluetoothState() != BluetoothAdapter.STATE_ON && value) { IntentFilter filter = new IntentFilter(); filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); mTetheringReceiver = new BroadcastReceiver() { Loading @@ -1273,14 +1275,14 @@ public class BluetoothService extends IBluetooth.Stub { public synchronized void onReceive(Context context, Intent intent) { if (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.STATE_OFF) == BluetoothAdapter.STATE_ON) { setBluetoothTethering(true, uuid, bridge); mTetheringOn = true; mContext.unregisterReceiver(mTetheringReceiver); } } }; mContext.registerReceiver(mTetheringReceiver, filter); } else { setBluetoothTetheringNative(value, uuid, bridge); mTetheringOn = value; } } Loading Loading
core/java/android/bluetooth/BluetoothPan.java +2 −2 Original line number Diff line number Diff line Loading @@ -173,9 +173,9 @@ public final class BluetoothPan { Log.d(TAG, msg); } public void setBluetoothTethering(boolean value, String uuid, String bridge) { public void setBluetoothTethering(boolean value) { try { mService.setBluetoothTethering(value, uuid, bridge); mService.setBluetoothTethering(value); } catch (RemoteException e) { Log.e(TAG, "", e); } Loading
core/java/android/bluetooth/IBluetooth.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ interface IBluetooth int getInputDevicePriority(in BluetoothDevice device); boolean isTetheringOn(); void setBluetoothTethering(boolean value, String uuid, String bridge); void setBluetoothTethering(boolean value); int getPanDeviceState(in BluetoothDevice device); BluetoothDevice[] getConnectedPanDevices(); boolean connectPanDevice(in BluetoothDevice device); Loading
core/java/android/server/BluetoothEventLoop.java +2 −1 Original line number Diff line number Diff line Loading @@ -644,7 +644,8 @@ class BluetoothEventLoop { } else { Log.i(TAG, "Rejecting incoming HID connection from " + address); } } else if (BluetoothUuid.isBnep(uuid) || BluetoothUuid.isNap(uuid)){ } else if (BluetoothUuid.isBnep(uuid) || BluetoothUuid.isNap(uuid) && mBluetoothService.isTetheringOn()){ authorized = true; } else { Log.i(TAG, "Rejecting incoming " + deviceUuid + " connection from " + address); Loading
core/java/android/server/BluetoothService.java +9 −7 Original line number Diff line number Diff line Loading @@ -352,7 +352,7 @@ public class BluetoothService extends IBluetooth.Stub { } setBluetoothState(BluetoothAdapter.STATE_TURNING_OFF); mHandler.removeMessages(MESSAGE_REGISTER_SDP_RECORDS); setBluetoothTethering(false, BluetoothPan.NAP_ROLE, BluetoothPan.NAP_BRIDGE); setBluetoothTetheringNative(false, BluetoothPan.NAP_ROLE, BluetoothPan.NAP_BRIDGE); // Allow 3 seconds for profiles to gracefully disconnect // TODO: Introduce a callback mechanism so that each profile can notify Loading Loading @@ -576,8 +576,12 @@ public class BluetoothService extends IBluetooth.Stub { mBondState.readAutoPairingData(); mBondState.loadBondState(); initProfileState(); //Register SDP records. mHandler.sendMessageDelayed( mHandler.obtainMessage(MESSAGE_REGISTER_SDP_RECORDS, 1, -1), 3000); setBluetoothTetheringNative(true, BluetoothPan.NAP_ROLE, BluetoothPan.NAP_BRIDGE); // Log bluetooth on to battery stats. long ident = Binder.clearCallingIdentity(); Loading Loading @@ -1258,14 +1262,12 @@ public class BluetoothService extends IBluetooth.Stub { private BroadcastReceiver mTetheringReceiver = null; public synchronized void setBluetoothTethering(boolean value, final String uuid, final String bridge) { mTetheringOn = value; public synchronized void setBluetoothTethering(boolean value) { if (!value) { disconnectPan(); } if (getBluetoothState() != BluetoothAdapter.STATE_ON && mTetheringOn) { if (getBluetoothState() != BluetoothAdapter.STATE_ON && value) { IntentFilter filter = new IntentFilter(); filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); mTetheringReceiver = new BroadcastReceiver() { Loading @@ -1273,14 +1275,14 @@ public class BluetoothService extends IBluetooth.Stub { public synchronized void onReceive(Context context, Intent intent) { if (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.STATE_OFF) == BluetoothAdapter.STATE_ON) { setBluetoothTethering(true, uuid, bridge); mTetheringOn = true; mContext.unregisterReceiver(mTetheringReceiver); } } }; mContext.registerReceiver(mTetheringReceiver, filter); } else { setBluetoothTetheringNative(value, uuid, bridge); mTetheringOn = value; } } Loading