Decouple BluetoothDevicePreference and DeviceListPreferenceFragment
The BluetoothDevicePreference need to know whether to display with an invalid name. However pass in the whole fragment is over-killing. This cl decouple it for several reasons: 1. In P, BluetoothDevicePreference will be used in other fragment. 2. In preference lifecycle from end user side, this flag is constant. Bug: 69333961 Test: RunSettingsRoboTests Change-Id: I3dbcd2a4aafa3ead74371534250e5e7c3ee221f7
This commit is contained in:
@@ -98,6 +98,8 @@ public abstract class DeviceListPreferenceFragment extends
|
||||
return;
|
||||
}
|
||||
mLocalAdapter = mLocalManager.getBluetoothAdapter();
|
||||
mShowDevicesWithoutNames = SystemProperties.getBoolean(
|
||||
BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY, false);
|
||||
|
||||
initPreferencesFromPreferenceScreen();
|
||||
|
||||
@@ -110,8 +112,6 @@ public abstract class DeviceListPreferenceFragment extends
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
mShowDevicesWithoutNames = SystemProperties.getBoolean(
|
||||
BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY, false);
|
||||
if (mLocalManager == null || isUiRestricted()) return;
|
||||
|
||||
mLocalManager.setForegroundActivity(getActivity());
|
||||
@@ -190,7 +190,8 @@ public abstract class DeviceListPreferenceFragment extends
|
||||
BluetoothDevicePreference preference = (BluetoothDevicePreference) getCachedPreference(key);
|
||||
|
||||
if (preference == null) {
|
||||
preference = new BluetoothDevicePreference(getPrefContext(), cachedDevice, this);
|
||||
preference = new BluetoothDevicePreference(getPrefContext(), cachedDevice,
|
||||
mShowDevicesWithoutNames);
|
||||
preference.setKey(key);
|
||||
mDeviceListGroup.addPreference(preference);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user