QS: Deal with null uuids in BT controller.

Fix crash when the device is no longer available.

Bug:16355690
Change-Id: I1cf652a408fa221649950d728bc88dd93fc93b65
This commit is contained in:
John Spurlock
2014-07-16 21:14:50 -04:00
parent bcc0eae1dc
commit 27bdff7750

View File

@@ -180,8 +180,13 @@ public class BluetoothControllerImpl implements BluetoothController {
final BluetoothDevice device = (BluetoothDevice) pd.tag;
final String action = connect ? "connect" : "disconnect";
if (DEBUG) Log.d(TAG, action + " " + deviceToString(device));
final ParcelUuid[] uuids = device.getUuids();
if (uuids == null) {
Log.w(TAG, "No uuids returned, aborting " + action + " for " + deviceToString(device));
return;
}
final SparseBooleanArray profiles = new SparseBooleanArray();
for (ParcelUuid uuid : device.getUuids()) {
for (ParcelUuid uuid : uuids) {
final int profile = uuidToProfile(uuid);
if (profile == 0) {
Log.w(TAG, "Device " + deviceToString(device) + " has an unsupported uuid: "