summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-07-12 07:32:58 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-07-12 07:32:58 +0000
commit0c159b229f7d1a4da51c3125390b0e60b4be2f12 (patch)
tree1975a444595141c8314e20927197f3de199474b7
parent640e8a13a51c55044b714259066b5af16c14ed93 (diff)
parentaaa8b531e9d7bbd8287ada11fda2ef7bf973ee16 (diff)
downloadandroid_packages_apps_CellBroadcastReceiver-0c159b229f7d1a4da51c3125390b0e60b4be2f12.tar.gz
android_packages_apps_CellBroadcastReceiver-0c159b229f7d1a4da51c3125390b0e60b4be2f12.tar.bz2
android_packages_apps_CellBroadcastReceiver-0c159b229f7d1a4da51c3125390b0e60b4be2f12.zip
release-request-b6f2d5b3-a3d6-410f-b58f-c85ba8187177-for-git_oc-mr1-release-4173087 snap-temp-L93200000081515229
Change-Id: I0d138389a18d0807bdbe720881756faaff5f2d19
-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
4 files changed, 16 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 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;
}
}
}