diff options
author | Raphael Kim <raphk@google.com> | 2022-10-14 10:43:35 -0700 |
---|---|---|
committer | Raphael Kim <raphk@google.com> | 2022-12-01 19:55:57 +0000 |
commit | dd5a3ff6e06e765f1582179e5dfcd29396a81698 (patch) | |
tree | 9ea1d37249b5c242e11d1321abed9cbcc04ccfe8 | |
parent | 2e55c7c46fc8fe78de471c4cf69fbe599119c459 (diff) | |
download | base-dd5a3ff6e06e765f1582179e5dfcd29396a81698.tar.gz |
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 bfbf0e4b3b32f8e672a306d19bd83072c6ee0bee)
-rw-r--r-- | services/companion/java/com/android/server/companion/presence/CompanionDevicePresenceMonitor.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/services/companion/java/com/android/server/companion/presence/CompanionDevicePresenceMonitor.java b/services/companion/java/com/android/server/companion/presence/CompanionDevicePresenceMonitor.java index 0e4870af9930..a1e734dead77 100644 --- a/services/companion/java/com/android/server/companion/presence/CompanionDevicePresenceMonitor.java +++ b/services/companion/java/com/android/server/companion/presence/CompanionDevicePresenceMonitor.java @@ -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"); + } } } } |