diff options
| author | Ruben Brunk <rubenbrunk@google.com> | 2017-05-01 16:57:31 -0700 |
|---|---|---|
| committer | Andre Eisenbach <eisenbach@google.com> | 2017-05-05 22:22:50 +0000 |
| commit | bfde0feb1b9ceb056b38a66985614fa2fa1a4390 (patch) | |
| tree | b00a7b243347600a82f0704ea2f745f3c6be7275 /framework/java/android/bluetooth/BluetoothDevice.java | |
| parent | b6285e087757a16ee2d712c707af876a4ca25b2e (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
(cherry picked from commit 98024a83d50f8cfcc02701403de5f99bcf8e50d6)
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 e0b03d22ab..f158f5f29e 100644 --- a/framework/java/android/bluetooth/BluetoothDevice.java +++ b/framework/java/android/bluetooth/BluetoothDevice.java @@ -1714,7 +1714,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, @@ -1723,9 +1723,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(); |
