summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-03-17 16:43:58 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-17 16:43:58 -0700
commit6bfafc7265e172c746b3e724641f51a3258b1e7e (patch)
tree2b4b6dcd27b663ede7e35a52b9d7dc32d09adc02
parent355655e6de2ec3a96785a525f68649a5c1545cb6 (diff)
parent20436002dd9ee018643dc74d3684222165b3a463 (diff)
Merge "Fix early break bug in reliable message duplication check" into main
-rw-r--r--services/core/java/com/android/server/location/contexthub/ContextHubEndpointBroker.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/location/contexthub/ContextHubEndpointBroker.java b/services/core/java/com/android/server/location/contexthub/ContextHubEndpointBroker.java
index 41fd29da64f1..bbf7732c9596 100644
--- a/services/core/java/com/android/server/location/contexthub/ContextHubEndpointBroker.java
+++ b/services/core/java/com/android/server/location/contexthub/ContextHubEndpointBroker.java
@@ -184,8 +184,11 @@ public class ContextHubEndpointBroker extends IContextHubEndpoint.Stub
long expiryMillis = RELIABLE_MESSAGE_DUPLICATE_DETECTION_TIMEOUT.toMillis();
if (nowMillis >= nextEntry.getValue() + expiryMillis) {
iterator.remove();
+ } else {
+ // Safe to break since LinkedHashMap is insertion-ordered, so the next entry
+ // will have a later timestamp and will not be expired.
+ break;
}
- break;
}
return mRxMessageHistoryMap.containsKey(message.getMessageSequenceNumber());