Commit 48966322 authored by Tiansong Cui's avatar Tiansong Cui Committed by Commit Bot

[Chromecast][BLE] Declare device as not connected when disconnect starts

When disconnect starts, device can be disconnected any time so we
shouldn't treat it as still connected.

Bug: internal b/136211218
Test: cast_bluetooth_unittests
Change-Id: I84d2bf996d8cef956ae612f0fbfe1fc1d2fe56d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1681306Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Commit-Queue: Tiansong Cui <tiansong@google.com>
Auto-Submit: Tiansong Cui <tiansong@google.com>
Cr-Commit-Position: refs/heads/master@{#673396}
parent c75d4e2d
......@@ -302,7 +302,8 @@ TEST_F(GattClientManagerTest, RemoteDeviceConnect) {
EXPECT_CALL(*gatt_client_, Disconnect(kTestAddr1)).WillOnce(Return(true));
device->Disconnect({});
EXPECT_TRUE(device->IsConnected());
// Should declare device as not connected after disconnect starts
EXPECT_FALSE(device->IsConnected());
EXPECT_CALL(*observer_, OnConnectChanged(device, false));
delegate->OnConnectChanged(kTestAddr1, true /* status */,
......
......@@ -220,7 +220,7 @@ void RemoteDeviceImpl::ConnectionParameterUpdate(int min_interval,
}
bool RemoteDeviceImpl::IsConnected() {
return connected_;
return connected_ && !disconnect_pending_;
}
bool RemoteDeviceImpl::IsBonded() {
......
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