Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d091ca8 authored by Raphael Kim's avatar Raphael Kim
Browse files

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
parent 4eea6a18
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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");
    }