diff options
author | Jack Yu <jackyu@google.com> | 2015-08-04 07:16:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-08-04 07:16:02 +0000 |
commit | 870b4faa87c2cc67e2cc214da7ed31693ebb13fc (patch) | |
tree | cfa9d477f46542664e1d9757893683725b9edf80 | |
parent | db67df1f6c753963318cdc508c8342cdc941271f (diff) | |
parent | 631632ab58391fc1be9c08d5e473731def0c9b0f (diff) | |
download | CellBroadcastReceiver-marshmallow-dev.tar.gz |
Merge "Fixed that CMAS duplicate detection is not working" into mnc-devmarshmallow-dev
-rw-r--r-- | src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java index f646abdfa..c51dc3920 100644 --- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java +++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java @@ -168,12 +168,19 @@ public class CellBroadcastAlertService extends Service { return; } + // If this is an ETWS message, then we want to include the body message to be a factor for + // duplicate detection. We found that some Japanese carriers send ETWS messages + // with the same serial number, therefore the subsequent messages were all ignored. + // In the other hand, US carriers have the requirement that only serial number, location, + // and category should be used for duplicate detection. + int hashCode = message.isEtwsMessage() ? message.getMessageBody().hashCode() : 0; + // Check for duplicate message IDs according to CMAS carrier requirements. Message IDs // are stored in volatile memory. If the maximum of 65535 messages is reached, the // message ID of the oldest message is deleted from the list. MessageServiceCategoryAndScope newCmasId = new MessageServiceCategoryAndScope( message.getServiceCategory(), message.getSerialNumber(), message.getLocation(), - message.getMessageBody().hashCode()); + hashCode); // Add the new message ID to the list. It's okay if this is a duplicate message ID, // because the list is only used for removing old message IDs from the hash set. |