Fix crash when no Bluetooth feature in Settings
- Move PreferenceGroup init method out of isAvailable() condition, then PreferenceGroup will not be null. - Update getAvailabilityStatus(), since the controller now may have usb and dock. Bug: 110712414 Test: make -j42 RunSettingsRoboTests Change-Id: I4d85a42c26fb20d319e7321177b271933be3fdb0
This commit is contained in:
@@ -109,6 +109,10 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
|
||||
* Force to update the list of bluetooth devices
|
||||
*/
|
||||
public void forceUpdate() {
|
||||
if (mLocalManager == null) {
|
||||
Log.e(TAG, "forceUpdate() Bluetooth is not supported on this device");
|
||||
return;
|
||||
}
|
||||
if (BluetoothAdapter.getDefaultAdapter().isEnabled()) {
|
||||
final Collection<CachedBluetoothDevice> cachedDevices =
|
||||
mLocalManager.getCachedDeviceManager().getCachedDevicesCopy();
|
||||
@@ -119,6 +123,10 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
|
||||
}
|
||||
|
||||
public void removeAllDevicesFromPreference() {
|
||||
if (mLocalManager == null) {
|
||||
Log.e(TAG, "removeAllDevicesFromPreference() BT is not supported on this device");
|
||||
return;
|
||||
}
|
||||
final Collection<CachedBluetoothDevice> cachedDevices =
|
||||
mLocalManager.getCachedDeviceManager().getCachedDevicesCopy();
|
||||
for (CachedBluetoothDevice cachedBluetoothDevice : cachedDevices) {
|
||||
|
Reference in New Issue
Block a user