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