summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Myles Watson <mylesgw@google.com> 2018-05-11 18:09:10 -0700
committer android-build-merger <android-build-merger@google.com> 2018-05-11 18:09:10 -0700
commitd13349ff6cb8a804e6cb90aa0593fc1de411079b (patch)
treeee2df0aad9f3d099df538d460b338495ea24b63a
parent2bbb36cb4fac93835a4b6ebc1885ca2dbdf78c5c (diff)
parent7e8c166d8e1ad7adbfa6e002bdcb16e6df629a0c (diff)
Merge "BluetoothManager: Continue when BLE not supported"
am: 7e8c166d8e Change-Id: I6bacffc9d9ed18e44b2c7c70a62d6c40a2835c30
-rw-r--r--services/core/java/com/android/server/BluetoothManagerService.java37
1 files changed, 11 insertions, 26 deletions
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index be3b5de602e6..378357e2b152 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -762,26 +762,16 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
}
/**
- * Action taken when GattService is turned on
+ * Call IBluetooth.onLeServiceUp() to continue if Bluetooth should be on.
*/
- private void onBluetoothGattServiceUp() {
+ private void continueFromBleOnState() {
if (DBG) {
- Slog.d(TAG, "BluetoothGatt Service is Up");
+ Slog.d(TAG, "continueFromBleOnState()");
}
try {
mBluetoothLock.readLock().lock();
if (mBluetooth == null) {
- if (DBG) {
- Slog.w(TAG, "onBluetoothServiceUp: mBluetooth is null!");
- }
- return;
- }
- int st = mBluetooth.getState();
- if (st != BluetoothAdapter.STATE_BLE_ON) {
- if (DBG) {
- Slog.v(TAG, "onBluetoothServiceUp: state isn't BLE_ON: "
- + BluetoothAdapter.nameForState(st));
- }
+ Slog.e(TAG, "onBluetoothServiceUp: mBluetooth is null!");
return;
}
if (isBluetoothPersistedStateOnBluetooth() || !isBleAppPresent()) {
@@ -1613,7 +1603,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
if (msg.arg1 == SERVICE_IBLUETOOTHGATT) {
mBluetoothGatt =
IBluetoothGatt.Stub.asInterface(Binder.allowBlocking(service));
- onBluetoothGattServiceUp();
+ continueFromBleOnState();
break;
} // else must be SERVICE_IBLUETOOTH
@@ -2030,21 +2020,16 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
if (DBG) {
Slog.d(TAG, "Bluetooth is in LE only mode");
}
- if (mBluetoothGatt != null) {
- if (DBG) {
- Slog.d(TAG, "Calling BluetoothGattServiceUp");
- }
- onBluetoothGattServiceUp();
+ if (mBluetoothGatt != null || !mContext.getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
+ continueFromBleOnState();
} else {
if (DBG) {
Slog.d(TAG, "Binding Bluetooth GATT service");
}
- if (mContext.getPackageManager()
- .hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
- Intent i = new Intent(IBluetoothGatt.class.getName());
- doBind(i, mConnection, Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,
- UserHandle.CURRENT);
- }
+ Intent i = new Intent(IBluetoothGatt.class.getName());
+ doBind(i, mConnection, Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,
+ UserHandle.CURRENT);
}
sendBleStateChanged(prevState, newState);
//Don't broadcase this as std intent