Fixed Settings crash caused by null bluetooth adpater.

Emulator doesn't support bluetooth.

BUG: 123026204
Change-Id: I5fddfaff03dfd882688a73542278d8ef1e509ca2
Signed-off-by: Weilun Du <wdu@google.com>
This commit is contained in:
Weilun Du
2019-01-18 08:59:51 -08:00
parent c2d1050665
commit def4fd900d

View File

@@ -152,7 +152,7 @@ public class AccessibilityHearingAidPreferenceController extends BasePreferenceC
if (!mHearingAidProfileSupported) {
return null;
}
if (!mBluetoothAdapter.isEnabled()) {
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
return null;
}
final List<BluetoothDevice> deviceList = mLocalBluetoothManager.getProfileManager()
@@ -166,6 +166,9 @@ public class AccessibilityHearingAidPreferenceController extends BasePreferenceC
}
private boolean isHearingAidProfileSupported() {
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
return false;
}
final List<Integer> supportedList = mBluetoothAdapter.getSupportedProfiles();
if (supportedList.contains(BluetoothProfile.HEARING_AID)) {
return true;