diff options
author | Matthew Xie <mattx@google.com> | 2013-05-09 21:14:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-05-09 21:14:47 +0000 |
commit | b566c466c73d351d01e64d1c9ba609133efc4ffd (patch) | |
tree | 31e64f2af2eee2edcf266a74d19339bd384fabab /services | |
parent | ffe3b5b89fa58f7b12a2fc690c89480fc16a9fd6 (diff) | |
parent | 32ab77b4c52db78aea22cb32824c7fd68d6f8c21 (diff) | |
download | frameworks_base-b566c466c73d351d01e64d1c9ba609133efc4ffd.zip frameworks_base-b566c466c73d351d01e64d1c9ba609133efc4ffd.tar.gz frameworks_base-b566c466c73d351d01e64d1c9ba609133efc4ffd.tar.bz2 |
Merge "Donot bind to GATT service when BLE is not supported" into jb-mr2-dev
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/BluetoothManagerService.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/services/java/com/android/server/BluetoothManagerService.java b/services/java/com/android/server/BluetoothManagerService.java index ea7b696..f7a7fdf 100644 --- a/services/java/com/android/server/BluetoothManagerService.java +++ b/services/java/com/android/server/BluetoothManagerService.java @@ -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; @@ -1092,10 +1093,13 @@ class BluetoothManagerService extends IBluetoothManager.Stub { if (isUp) { // connect to GattService - 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()); + 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 |