Loading core/java/android/bluetooth/BluetoothAdapter.java +5 −1 Original line number Diff line number Diff line Loading @@ -1472,9 +1472,13 @@ public final class BluetoothAdapter { try { IBluetoothGatt iGatt = mManagerService.getBluetoothGatt(); if (iGatt == null) { // BLE is not supported return false; } UUID uuid = UUID.randomUUID(); GattCallbackWrapper wrapper = new GattCallbackWrapper(this, callback, serviceUuids); iGatt.registerClient(new ParcelUuid(uuid), wrapper); if (wrapper.scanStarted()) { mLeScanClients.put(callback, wrapper); Loading core/java/android/bluetooth/BluetoothDevice.java +4 −0 Original line number Diff line number Diff line Loading @@ -1187,6 +1187,10 @@ public final class BluetoothDevice implements Parcelable { IBluetoothManager managerService = adapter.getBluetoothManager(); try { IBluetoothGatt iGatt = managerService.getBluetoothGatt(); if (iGatt == null) { // BLE is not supported return null; } BluetoothGatt gatt = new BluetoothGatt(context, iGatt, this); gatt.connect(autoConnect, callback); return gatt; Loading services/java/com/android/server/BluetoothManagerService.java +8 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Handler; import android.os.HandlerThread; Loading Loading @@ -1092,11 +1093,14 @@ class BluetoothManagerService extends IBluetoothManager.Stub { if (isUp) { // connect to GattService if (mContext.getPackageManager().hasSystemFeature( PackageManager.FEATURE_BLUETOOTH_LE)) { Intent i = new Intent(IBluetoothGatt.class.getName()); if (!mContext.bindServiceAsUser(i, mConnection, Context.BIND_AUTO_CREATE, UserHandle.CURRENT)) { Log.e(TAG, "Fail to bind to: " + IBluetoothGatt.class.getName()); } } } else { //If Bluetooth is off, send service down event to proxy objects, and unbind if (!isUp && canUnbindBluetoothService()) { Loading Loading
core/java/android/bluetooth/BluetoothAdapter.java +5 −1 Original line number Diff line number Diff line Loading @@ -1472,9 +1472,13 @@ public final class BluetoothAdapter { try { IBluetoothGatt iGatt = mManagerService.getBluetoothGatt(); if (iGatt == null) { // BLE is not supported return false; } UUID uuid = UUID.randomUUID(); GattCallbackWrapper wrapper = new GattCallbackWrapper(this, callback, serviceUuids); iGatt.registerClient(new ParcelUuid(uuid), wrapper); if (wrapper.scanStarted()) { mLeScanClients.put(callback, wrapper); Loading
core/java/android/bluetooth/BluetoothDevice.java +4 −0 Original line number Diff line number Diff line Loading @@ -1187,6 +1187,10 @@ public final class BluetoothDevice implements Parcelable { IBluetoothManager managerService = adapter.getBluetoothManager(); try { IBluetoothGatt iGatt = managerService.getBluetoothGatt(); if (iGatt == null) { // BLE is not supported return null; } BluetoothGatt gatt = new BluetoothGatt(context, iGatt, this); gatt.connect(autoConnect, callback); return gatt; Loading
services/java/com/android/server/BluetoothManagerService.java +8 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Handler; import android.os.HandlerThread; Loading Loading @@ -1092,11 +1093,14 @@ class BluetoothManagerService extends IBluetoothManager.Stub { if (isUp) { // connect to GattService if (mContext.getPackageManager().hasSystemFeature( PackageManager.FEATURE_BLUETOOTH_LE)) { Intent i = new Intent(IBluetoothGatt.class.getName()); if (!mContext.bindServiceAsUser(i, mConnection, Context.BIND_AUTO_CREATE, UserHandle.CURRENT)) { Log.e(TAG, "Fail to bind to: " + IBluetoothGatt.class.getName()); } } } else { //If Bluetooth is off, send service down event to proxy objects, and unbind if (!isUp && canUnbindBluetoothService()) { Loading