Donot bind to GATT service when BLE is not supported

bug 8664724

Change-Id: I9b9222cd5877babcded73798a5d1ff13fd10e791
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.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 @@
 
                 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