diff options
author | Jack Yu <jackyu@google.com> | 2017-07-11 11:13:18 -0700 |
---|---|---|
committer | Jack Yu <jackyu@google.com> | 2017-07-11 11:13:18 -0700 |
commit | 19878f8d33c6247736c76e78030dcbb602810a3a (patch) | |
tree | 1975a444595141c8314e20927197f3de199474b7 | |
parent | a4e0fe3acade714a561c24bd822ccec0ff1d3de4 (diff) | |
download | android_packages_apps_CellBroadcastReceiver-19878f8d33c6247736c76e78030dcbb602810a3a.tar.gz android_packages_apps_CellBroadcastReceiver-19878f8d33c6247736c76e78030dcbb602810a3a.tar.bz2 android_packages_apps_CellBroadcastReceiver-19878f8d33c6247736c76e78030dcbb602810a3a.zip |
Made message body duplicate detection customizable
For all Japanese carriers, we should consider message
body when performing duplicate detection.
Test: Manual
bug: 62184395
Change-Id: I044b9c8d2e0fe71567ac5ae4fc0abf33284fb487
-rw-r--r-- | res/values-mcc440/config.xml | 2 | ||||
-rw-r--r-- | res/values-mcc441/config.xml | 5 | ||||
-rw-r--r-- | res/values/config.xml | 2 | ||||
-rw-r--r-- | src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java | 11 |
4 files changed, 14 insertions, 6 deletions
diff --git a/res/values-mcc440/config.xml b/res/values-mcc440/config.xml index 6a80539b..31a8fcda 100644 --- a/res/values-mcc440/config.xml +++ b/res/values-mcc440/config.xml @@ -21,4 +21,6 @@ <!-- Whether to always sound CBS alerts at full volume --> <!-- By default it's true for Japanese users --> <bool name="use_full_volume">true</bool> + <!-- Whether to compare message body when performing message duplicate dection --> + <bool name="duplicate_compare_body">true</bool> </resources> diff --git a/res/values-mcc441/config.xml b/res/values-mcc441/config.xml index ca58e7f5..31a8fcda 100644 --- a/res/values-mcc441/config.xml +++ b/res/values-mcc441/config.xml @@ -18,4 +18,9 @@ <!-- Whether to enable CMAS settings (United States) --> <!-- No need to show this for Japanese users --> <bool name="show_cmas_settings">false</bool> + <!-- Whether to always sound CBS alerts at full volume --> + <!-- By default it's true for Japanese users --> + <bool name="use_full_volume">true</bool> + <!-- Whether to compare message body when performing message duplicate dection --> + <bool name="duplicate_compare_body">true</bool> </resources> diff --git a/res/values/config.xml b/res/values/config.xml index db592ae8..0e4d2ac5 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -27,4 +27,6 @@ <string-array name="additional_cbs_channels_strings" translatable="false"></string-array> <!-- Emergecny alert tone duration in milliseconds. -1 indicates playing the tone with the tone's duration --> <integer name="alert_duration">-1</integer> + <!-- Whether to compare message body when performing message duplicate dection --> + <bool name="duplicate_compare_body">false</bool> </resources> diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java index 17c7c956..d80bff7e 100644 --- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java +++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java @@ -244,12 +244,11 @@ 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 - // duplication 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 if message body should be used for duplicate detection. + boolean shouldCompareMessageBody = + getApplicationContext().getResources().getBoolean(R.bool.duplicate_compare_body); + + int hashCode = shouldCompareMessageBody ? message.getMessageBody().hashCode() : 0; // If this is an ETWS message, we need to include primary/secondary message information to // be a factor for duplication detection as well. Per 3GPP TS 23.041 section 8.2, |