Ignore scheduled onDeviceGone call on simulated device if it is already no longer present.

Bug: 259286481
Bug: 253637009
Test: atest CtsCompanionDeviceManagerCoreTestCases
      atest CtsCompanionDeviceManagerUiAutomationTestCases
Change-Id: Ia7f5eabde8879ff4f6bc5b5cc19455bbd4164ac9
Merged-In: Ia7f5eabde8879ff4f6bc5b5cc19455bbd4164ac9
(cherry picked from commit bfbf0e4b3b)
This commit is contained in:
Raphael Kim
2022-10-14 10:43:35 -07:00
parent 2e55c7c46f
commit dd5a3ff6e0

View File

@@ -363,7 +363,9 @@ public class CompanionDevicePresenceMonitor implements AssociationStore.OnChange
@Override
public void handleMessage(@NonNull Message msg) {
final int associationId = msg.what;
onDeviceGone(mSimulated, associationId, /* sourceLoggingTag */ "simulated");
if (mSimulated.contains(associationId)) {
onDeviceGone(mSimulated, associationId, /* sourceLoggingTag */ "simulated");
}
}
}
}