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

Commit 20436002 authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Fix early break bug in reliable message duplication check

Bug: 404315335
Flag: android.chre.flags.offload_implementation
Test: Presubmits
Change-Id: If55f6ada56132a5fc5d7c47287a830839676cf0e
parent acbbc9c3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -182,9 +182,12 @@ 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;
                }
            }

            return mRxMessageHistoryMap.containsKey(message.getMessageSequenceNumber());
        }