Pre-emptively mark BLE device as lost if the bluetooth disconnect was detected on the same device.

Bug: 241513315
Test: Manually tested
      atest CtsCompanionDeviceManagerCoreTestCases
Change-Id: I8f5fc6c3776761707083c7a5e5a1a95ea5d88a8d
This commit is contained in:
Raphael Kim
2023-01-23 08:56:49 -08:00
parent 4eea6a18ba
commit 5d091ca850

View File

@@ -164,6 +164,12 @@ public class CompanionDevicePresenceMonitor implements AssociationStore.OnChange
@Override
public void onBluetoothCompanionDeviceDisconnected(int associationId) {
// If disconnected device is also a BLE device, skip the 2-minute timer and mark it as gone.
boolean isConnectableBleDevice = mNearbyBleDevices.remove(associationId);
if (DEBUG && isConnectableBleDevice) {
Log.d(TAG, "Bluetooth device disconnect was detected."
+ " Pre-emptively marking the BLE device as lost.");
}
onDeviceGone(mConnectedBtDevices, associationId, /* sourceLoggingTag */ "bt");
}