From 12156937ee28c595c6d07357edb599fc58e6e34d Mon Sep 17 00:00:00 2001 From: Guogang Li Date: Sun, 19 Mar 2023 20:25:16 -0700 Subject: [PATCH] Check device name before calling update callback PiperOrigin-RevId: 517851883 --- .../implementation/windows/bluetooth_classic_medium.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/platform/implementation/windows/bluetooth_classic_medium.cc b/internal/platform/implementation/windows/bluetooth_classic_medium.cc index 2428ceee..2a14c61e 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_medium.cc +++ b/internal/platform/implementation/windows/bluetooth_classic_medium.cc @@ -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)