b/2318290 connect should be called instead of connect(profile) if device is unpaired.
Change-Id: I5d665d1c3149ffc77387f96c3822e80b84c78de1
This commit is contained in:
@@ -459,19 +459,19 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli
|
|||||||
|
|
||||||
mPendingDevice = null;
|
mPendingDevice = null;
|
||||||
|
|
||||||
|
boolean callConnect = false;
|
||||||
|
CachedBluetoothDevice cachedDevice = getCachedBluetoothDevice(mContext, mBtManager,
|
||||||
|
device);
|
||||||
for (int i = 0; i < mProfiles.length; i++) {
|
for (int i = 0; i < mProfiles.length; i++) {
|
||||||
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
|
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
|
||||||
.getProfileManager(mBtManager, mProfiles[i]);
|
.getProfileManager(mBtManager, mProfiles[i]);
|
||||||
boolean isConnected = profileManager.isConnected(device);
|
boolean isConnected = profileManager.isConnected(device);
|
||||||
CachedBluetoothDevice cachedDevice = getCachedBluetoothDevice(mContext, mBtManager,
|
|
||||||
device);
|
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, mProfiles[i].toString() + " = " + mCheckedItems[i]);
|
if (DEBUG) Log.d(TAG, mProfiles[i].toString() + " = " + mCheckedItems[i]);
|
||||||
|
|
||||||
if (mCheckedItems[i] && !isConnected) {
|
if (mCheckedItems[i] && !isConnected) {
|
||||||
// Checked but not connected
|
// Checked but not connected
|
||||||
if (DEBUG) Log.d(TAG, "applyBtSettings - Connecting");
|
callConnect = true;
|
||||||
cachedDevice.connect(mProfiles[i]);
|
|
||||||
} else if (!mCheckedItems[i] && isConnected) {
|
} else if (!mCheckedItems[i] && isConnected) {
|
||||||
// Unchecked but connected
|
// Unchecked but connected
|
||||||
if (DEBUG) Log.d(TAG, "applyBtSettings - Disconnecting");
|
if (DEBUG) Log.d(TAG, "applyBtSettings - Disconnecting");
|
||||||
@@ -484,6 +484,11 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (callConnect) {
|
||||||
|
if (DEBUG) Log.d(TAG, "applyBtSettings - Connecting");
|
||||||
|
cachedDevice.connect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleUndocked(Context context, LocalBluetoothManager localManager,
|
void handleUndocked(Context context, LocalBluetoothManager localManager,
|
||||||
|
Reference in New Issue
Block a user