am a87f2fd7: b/2320107 Fixed NPE for class bits. Docks do not have class bits.

Merge commit 'a87f2fd7d82e5055e0f9ea2c93704ed0b58f27ef' into eclair-mr2

* commit 'a87f2fd7d82e5055e0f9ea2c93704ed0b58f27ef':
  b/2320107 Fixed NPE for class bits. Docks do not have class bits.
This commit is contained in:
Michael Chan
2009-12-10 19:48:21 -08:00
committed by Android Git Automerger
2 changed files with 22 additions and 17 deletions

View File

@@ -332,7 +332,10 @@ public class BluetoothSettings extends PreferenceActivity
if (uuids != null) if (uuids != null)
if (BluetoothUuid.containsAnyUuid(uuids, if (BluetoothUuid.containsAnyUuid(uuids,
LocalBluetoothProfileManager.OPP_PROFILE_UUIDS)) return true; LocalBluetoothProfileManager.OPP_PROFILE_UUIDS)) return true;
if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_OPP)) return true; if (bluetoothClass != null
&& bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_OPP)) {
return true;
}
break; break;
case BluetoothDevicePicker.FILTER_TYPE_AUDIO: case BluetoothDevicePicker.FILTER_TYPE_AUDIO:
if (uuids != null) { if (uuids != null) {
@@ -341,7 +344,7 @@ public class BluetoothSettings extends PreferenceActivity
if (BluetoothUuid.containsAnyUuid(uuids, if (BluetoothUuid.containsAnyUuid(uuids,
LocalBluetoothProfileManager.HEADSET_PROFILE_UUIDS)) return true; LocalBluetoothProfileManager.HEADSET_PROFILE_UUIDS)) return true;
} else { } else if (bluetoothClass != null) {
if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) return true; if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) return true;
if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET)) return true; if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET)) return true;

View File

@@ -691,26 +691,28 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
boolean printUuids = true; boolean printUuids = true;
BluetoothClass bluetoothClass = mDevice.getBluetoothClass(); BluetoothClass bluetoothClass = mDevice.getBluetoothClass();
if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET) != if (bluetoothClass != null) {
mProfiles.contains(Profile.HEADSET)) { if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET) !=
Log.v(TAG, "headset classbits != uuid"); mProfiles.contains(Profile.HEADSET)) {
printUuids = true; Log.v(TAG, "headset classbits != uuid");
} printUuids = true;
}
if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_A2DP) != if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_A2DP) !=
mProfiles.contains(Profile.A2DP)) { mProfiles.contains(Profile.A2DP)) {
Log.v(TAG, "a2dp classbits != uuid"); Log.v(TAG, "a2dp classbits != uuid");
printUuids = true; printUuids = true;
} }
if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_OPP) != if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_OPP) !=
mProfiles.contains(Profile.OPP)) { mProfiles.contains(Profile.OPP)) {
Log.v(TAG, "opp classbits != uuid"); Log.v(TAG, "opp classbits != uuid");
printUuids = true; printUuids = true;
}
} }
if (printUuids) { if (printUuids) {
Log.v(TAG, "Class: " + bluetoothClass.toString()); if (bluetoothClass != null) Log.v(TAG, "Class: " + bluetoothClass.toString());
Log.v(TAG, "UUID:"); Log.v(TAG, "UUID:");
for (int i = 0; i < uuids.length; i++) { for (int i = 0; i < uuids.length; i++) {
Log.v(TAG, " " + uuids[i]); Log.v(TAG, " " + uuids[i]);