b/2238546 Fixed NPE in Settings when Bluetooth "class" is null
This commit is contained in:
@@ -616,12 +616,16 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getBtClassDrawable() {
|
public int getBtClassDrawable() {
|
||||||
switch (mBtClass.getMajorDeviceClass()) {
|
if (mBtClass != null) {
|
||||||
case BluetoothClass.Device.Major.COMPUTER:
|
switch (mBtClass.getMajorDeviceClass()) {
|
||||||
return R.drawable.ic_bt_laptop;
|
case BluetoothClass.Device.Major.COMPUTER:
|
||||||
|
return R.drawable.ic_bt_laptop;
|
||||||
|
|
||||||
case BluetoothClass.Device.Major.PHONE:
|
case BluetoothClass.Device.Major.PHONE:
|
||||||
return R.drawable.ic_bt_cellphone;
|
return R.drawable.ic_bt_cellphone;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "mBtClass is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mProfiles.size() > 0) {
|
if (mProfiles.size() > 0) {
|
||||||
@@ -630,7 +634,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
|||||||
} else if (mProfiles.contains(Profile.HEADSET)) {
|
} else if (mProfiles.contains(Profile.HEADSET)) {
|
||||||
return R.drawable.ic_bt_headset_hfp;
|
return R.drawable.ic_bt_headset_hfp;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (mBtClass != null) {
|
||||||
if (mBtClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) {
|
if (mBtClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) {
|
||||||
return R.drawable.ic_bt_headphones_a2dp;
|
return R.drawable.ic_bt_headphones_a2dp;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user