Check device name before calling update callback

PiperOrigin-RevId: 517851883
This commit is contained in:
Guogang Li
2023-03-19 20:26:56 -07:00
committed by Copybara-Service
parent 44e6ff7bb1
commit 12156937ee
@@ -592,6 +592,12 @@ winrt::fire_and_forget BluetoothClassicMedium::DeviceWatcher_Updated(
std::string new_device_name = InspectableReader::ReadString(
properties.Lookup(L"System.ItemNameDisplay"));
if (it->second->GetName() == new_device_name) {
NEARBY_LOGS(INFO)
<< "Device name is same as old name, ignore the update.";
return {};
}
it->second->SetName(new_device_name);
NEARBY_LOGS(INFO)