summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2017-07-11 23:53:15 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-07-11 23:53:15 +0000
commitaaa8b531e9d7bbd8287ada11fda2ef7bf973ee16 (patch)
tree1975a444595141c8314e20927197f3de199474b7
parent3038d30e9dc830ba5833eec4c12f330999c92cf1 (diff)
parent19878f8d33c6247736c76e78030dcbb602810a3a (diff)
downloadCellBroadcastReceiver-aaa8b531e9d7bbd8287ada11fda2ef7bf973ee16.tar.gz
Merge "Made message body duplicate detection customizable"
-rw-r--r--res/values-mcc440/config.xml2
-rw-r--r--res/values-mcc441/config.xml5
-rw-r--r--res/values/config.xml2
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java11
4 files changed, 14 insertions, 6 deletions
diff --git a/res/values-mcc440/config.xml b/res/values-mcc440/config.xml
index 6a80539bd..31a8fcda1 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 ca58e7f53..31a8fcda1 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 db592ae82..0e4d2ac52 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 17c7c956e..d80bff7ea 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,