diff options
| author | Ruben Brunk <rubenbrunk@google.com> | 2017-05-01 16:57:31 -0700 |
|---|---|---|
| committer | Andre Eisenbach <eisenbach@google.com> | 2017-05-03 00:11:10 +0000 |
| commit | 98024a83d50f8cfcc02701403de5f99bcf8e50d6 (patch) | |
| tree | 49c1474e97f7b1dd3e9e3e61aa37870381823fdf /framework/java/android/bluetooth/BluetoothDevice.java | |
| parent | 0992d6b5a9c39cfeeffe067ed1942fbd0349c8c2 (diff) | |
Fix Bluetooth GATT API default handler assignment
Restores previous behaviour where GATT callbacks are invoked on the
binder thread and not the calling process main looper thread.
This fixes performance regressions as well as some
NetworkOnMainThreadException's for some applications.
Bug: 37544152
Bug: 37871717
Test: Covered by prior API tests.
Change-Id: Id8ab705dd4d7f00030e6ac29e056dde5180670e9
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothDevice.java')
| -rw-r--r-- | framework/java/android/bluetooth/BluetoothDevice.java | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java index c4272688cb..e8ad69d2f5 100644 --- a/framework/java/android/bluetooth/BluetoothDevice.java +++ b/framework/java/android/bluetooth/BluetoothDevice.java @@ -1703,7 +1703,7 @@ public final class BluetoothDevice implements Parcelable { * an d{@link BluetoothDevice#PHY_LE_CODED_MASK}. This option does not take effect * if {@code autoConnect} is set to true. * @param handler The handler to use for the callback. If {@code null}, callbacks will happen - * on the service's main thread. + * on an un-specified background thread. * @throws NullPointerException if callback is null */ public BluetoothGatt connectGatt(Context context, boolean autoConnect, @@ -1712,9 +1712,6 @@ public final class BluetoothDevice implements Parcelable { if (callback == null) throw new NullPointerException("callback is null"); - if (handler == null) - handler = new Handler(Looper.getMainLooper()); - // TODO(Bluetooth) check whether platform support BLE // Do the check here or in GattServer? BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); |
