Commit 0ec30308 authored by Qiyu Hu's avatar Qiyu Hu Committed by Commit Bot

arc: bluetooth: Remove SendCachedPairedDevices()

We don't have to SendCachedPairedDevices() whenever the adapter is up.
Android knows how to get all paired devices from adapter properties.
SendCachedPairedDevices() will create bogus pair state change to
Android.

Bug: 78593133
Test: Reboot and confirm that paired devices are still there
Change-Id: Ibcb29f3f3abb3ea30c5e9cdd1d13c72e119a1085
Reviewed-on: https://chromium-review.googlesource.com/1120695Reviewed-by: default avatarLuis Hector Chavez <lhchavez@chromium.org>
Commit-Queue: Qiyu Hu <qiyuh@google.com>
Cr-Commit-Position: refs/heads/master@{#572256}
parent fa48bec9
...@@ -1142,7 +1142,6 @@ void ArcBluetoothBridge::OnPoweredOn( ...@@ -1142,7 +1142,6 @@ void ArcBluetoothBridge::OnPoweredOn(
SetPrimaryUserBluetoothPowerSetting(true); SetPrimaryUserBluetoothPowerSetting(true);
std::move(callback).Run(mojom::BluetoothAdapterState::ON); std::move(callback).Run(mojom::BluetoothAdapterState::ON);
SendCachedPairedDevices();
} }
void ArcBluetoothBridge::OnPoweredOff( void ArcBluetoothBridge::OnPoweredOff(
...@@ -2744,27 +2743,6 @@ void ArcBluetoothBridge::SendCachedDevicesFound() const { ...@@ -2744,27 +2743,6 @@ void ArcBluetoothBridge::SendCachedDevicesFound() const {
SendDevice(device, /* include_cached_device = */ true); SendDevice(device, /* include_cached_device = */ true);
} }
void ArcBluetoothBridge::SendCachedPairedDevices() const {
DCHECK(bluetooth_adapter_);
BluetoothAdapter::DeviceList devices = bluetooth_adapter_->GetDevices();
for (auto* device : devices) {
if (!device->IsPaired())
continue;
SendDevice(device, /* include_cached_device = */ true);
// OnBondStateChanged must be called with mojom::BluetoothBondState::BONDING
// to make sure the bond state machine on Android is ready to take the
// pair-done event. Otherwise the pair-done event will be dropped as an
// invalid change of paired status.
mojom::BluetoothAddressPtr addr =
mojom::BluetoothAddress::From(device->GetAddress());
OnPairing(addr->Clone());
OnPairedDone(std::move(addr));
}
}
void ArcBluetoothBridge::OnGetServiceRecordsDone( void ArcBluetoothBridge::OnGetServiceRecordsDone(
mojom::BluetoothAddressPtr remote_addr, mojom::BluetoothAddressPtr remote_addr,
const BluetoothUUID& target_uuid, const BluetoothUUID& target_uuid,
......
...@@ -432,9 +432,6 @@ class ArcBluetoothBridge ...@@ -432,9 +432,6 @@ class ArcBluetoothBridge
// Send the power status change to Android via an intent. // Send the power status change to Android via an intent.
void SendBluetoothPoweredStateBroadcast(AdapterPowerState powered) const; void SendBluetoothPoweredStateBroadcast(AdapterPowerState powered) const;
// Propagates the list of paired device to Android.
void SendCachedPairedDevices() const;
bool IsGattServerAttributeHandleAvailable(int need); bool IsGattServerAttributeHandleAvailable(int need);
int32_t GetNextGattServerAttributeHandle(); int32_t GetNextGattServerAttributeHandle();
template <class LocalGattAttribute> template <class LocalGattAttribute>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment