Merge "Fix non-hearing devices show in pair new hearing devices page" into udc-dev am: 59fa9de0cf

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23155081

Change-Id: I51b54455d5c2dd73c380fac22b345bc83570397f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-05-11 10:09:51 +00:00
committed by Automerger Merge Worker

View File

@@ -196,10 +196,11 @@ public abstract class DeviceListPreferenceFragment extends
} }
// Prevent updates while the list shows one of the state messages // Prevent updates while the list shows one of the state messages
if (mBluetoothAdapter.getState() != BluetoothAdapter.STATE_ON) return; if (mBluetoothAdapter.getState() != BluetoothAdapter.STATE_ON) {
return;
}
if (mLeScanFilters != null if (mFilter != null && mFilter.matches(cachedDevice.getDevice())) {
|| (mFilter != null && mFilter.matches(cachedDevice.getDevice()))) {
createDevicePreference(cachedDevice); createDevicePreference(cachedDevice);
} }
} }
@@ -325,7 +326,12 @@ public abstract class DeviceListPreferenceFragment extends
if (cachedDevice == null) { if (cachedDevice == null) {
cachedDevice = mCachedDeviceManager.addDevice(device); cachedDevice = mCachedDeviceManager.addDevice(device);
} }
onDeviceAdded(cachedDevice); // Only add device preference when it's not found in the map and there's no other
// state message showing in the list
if (mDevicePreferenceMap.get(cachedDevice) == null
&& mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) {
createDevicePreference(cachedDevice);
}
} }
@Override @Override