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:
hughchen
2019-04-17 15:43:22 +08:00
parent 96b534951c
commit ef2c1a1526
8 changed files with 94 additions and 14 deletions

View File

@@ -83,9 +83,11 @@ public class AvailableMediaDeviceGroupController extends BasePreferenceControlle
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPreferenceGroup = screen.findPreference(KEY);
mPreferenceGroup.setVisible(false);
if (isAvailable()) {
mPreferenceGroup = screen.findPreference(KEY);
mPreferenceGroup.setVisible(false);
updateTitle();
mBluetoothDeviceUpdater.setPrefContext(screen.getContext());
mBluetoothDeviceUpdater.forceUpdate();