summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.java13
-rw-r--r--tests/testapp/res/values-gl/strings.xml12
-rw-r--r--tests/testapp/res/values-sv/strings.xml2
-rw-r--r--tests/testapp/res/values-ta/strings.xml2
7 files changed, 24 insertions, 14 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 5e4864c0..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,
@@ -442,6 +441,8 @@ public class CellBroadcastAlertService extends Service {
}
return false;
}
+
+ return emergencyAlertEnabled;
}
}
}
diff --git a/tests/testapp/res/values-gl/strings.xml b/tests/testapp/res/values-gl/strings.xml
index 1c61f11d..502cce7c 100644
--- a/tests/testapp/res/values-gl/strings.xml
+++ b/tests/testapp/res/values-gl/strings.xml
@@ -17,12 +17,12 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_label" msgid="2704349695846064655">"Probas da difusión móbil"</string>
- <string name="button_etws_earthquake_type" msgid="5391060421937195923">"Enviar emisión de terremotos de ETWS"</string>
- <string name="button_etws_tsunami_type" msgid="5866338269041475786">"Enviar emisión de tsunamis de ETWS"</string>
- <string name="button_etws_earthquake_tsunami_type" msgid="8045617992086252152">"Enviar emisión de terremotos e tsunamis de ETWS"</string>
- <string name="button_etws_other_type" msgid="4129451610585426791">"Enviar difusión doutra emerxencia de ETWS"</string>
- <string name="button_etws_cancel_type" msgid="4770911191572322801">"Enviar emisión de cancelación de ETWS"</string>
- <string name="button_etws_test_type" msgid="5520113823851979673">"Enviar emisión de proba de ETWS"</string>
+ <string name="button_etws_earthquake_type" msgid="5391060421937195923">"Enviar emisión de terremotos do ETWS"</string>
+ <string name="button_etws_tsunami_type" msgid="5866338269041475786">"Enviar emisión de tsunamis do ETWS"</string>
+ <string name="button_etws_earthquake_tsunami_type" msgid="8045617992086252152">"Enviar emisión de terremotos e tsunamis do ETWS"</string>
+ <string name="button_etws_other_type" msgid="4129451610585426791">"Enviar difusión doutra emerxencia do ETWS"</string>
+ <string name="button_etws_cancel_type" msgid="4770911191572322801">"Enviar emisión de cancelación do ETWS"</string>
+ <string name="button_etws_test_type" msgid="5520113823851979673">"Enviar emisión de proba do ETWS"</string>
<string name="button_cmas_pres_alert" msgid="1269455100893365889">"Enviar alerta presidencial de CMAS"</string>
<string name="button_cmas_extreme_alert" msgid="5922644977169679386">"Enviar alerta extrema de CMAS"</string>
<string name="button_cmas_severe_alert" msgid="5197711586353552255">"Enviar alerta grave de CMAS"</string>
diff --git a/tests/testapp/res/values-sv/strings.xml b/tests/testapp/res/values-sv/strings.xml
index 7fc8fe51..56a3e1e0 100644
--- a/tests/testapp/res/values-sv/strings.xml
+++ b/tests/testapp/res/values-sv/strings.xml
@@ -23,7 +23,7 @@
<string name="button_etws_other_type" msgid="4129451610585426791">"Gör en annan nödsituationssändning från ETWS (Earthquake and Tsunami Warning System)"</string>
<string name="button_etws_cancel_type" msgid="4770911191572322801">"Skicka ETWS avbryt sändning"</string>
<string name="button_etws_test_type" msgid="5520113823851979673">"Skicka ETWS testsändning"</string>
- <string name="button_cmas_pres_alert" msgid="1269455100893365889">"Skicka varningar utfärdade av presidenten via CMAS"</string>
+ <string name="button_cmas_pres_alert" msgid="1269455100893365889">"Skicka nationella varningar via CMAS"</string>
<string name="button_cmas_extreme_alert" msgid="5922644977169679386">"Skicka varningar om extrem fara via CMAS"</string>
<string name="button_cmas_severe_alert" msgid="5197711586353552255">"Skicka varningar om allvarlig fara via CMAS"</string>
<string name="button_cmas_amber_alert" msgid="860091654456014191">"Skicka AMBER-meddelanden via CMAS"</string>
diff --git a/tests/testapp/res/values-ta/strings.xml b/tests/testapp/res/values-ta/strings.xml
index 12b10a9d..1ec63622 100644
--- a/tests/testapp/res/values-ta/strings.xml
+++ b/tests/testapp/res/values-ta/strings.xml
@@ -23,7 +23,7 @@
<string name="button_etws_other_type" msgid="4129451610585426791">"ETWS பிற அவசரகால எச்சரிக்கையை அனுப்பு"</string>
<string name="button_etws_cancel_type" msgid="4770911191572322801">"ETWS ரத்துசெய்தல் அலைபரப்பை அனுப்பு"</string>
<string name="button_etws_test_type" msgid="5520113823851979673">"ETWS சோதனை அலைபரப்பை அனுப்பு"</string>
- <string name="button_cmas_pres_alert" msgid="1269455100893365889">"CMAS ஜனாதிபதி விழிப்பூட்டலை அனுப்பு"</string>
+ <string name="button_cmas_pres_alert" msgid="1269455100893365889">"CMAS ஜனாதிபதியின் எச்சரிக்கை அனுப்பு"</string>
<string name="button_cmas_extreme_alert" msgid="5922644977169679386">"CMAS எக்ஸ்ட்ரீம் விழிப்பூட்டலை அனுப்பு"</string>
<string name="button_cmas_severe_alert" msgid="5197711586353552255">"CMAS கடுமையான விழிப்பூட்டலை அனுப்பு"</string>
<string name="button_cmas_amber_alert" msgid="860091654456014191">"CMAS AMBER விழிப்பூட்டலை அனுப்பு"</string>