summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryoungtaecha <youngtaecha@google.com>2021-11-03 23:09:17 +0000
committerHui Wang <huiwang@google.com>2021-11-05 18:52:32 +0000
commitedac6f1c264370fe4998d657f1f2bd8fe2aa9797 (patch)
tree6e656eed9e6eb569526aa8dacf9ecdce960e928f
parent91e79eb03535902fab21c90d3a12fae01fa9da9b (diff)
downloadCellBroadcastReceiver-edac6f1c264370fe4998d657f1f2bd8fe2aa9797.tar.gz
Show alert dialog with notification for Telefonica channel 50
Add config "dialog_with_notification" per channel and apply to Telefonica channel 50 for LATAM Bug: 202638978 Test: Manual Change-Id: I7ea2ad7d0d81d9a2c317c6a674b27a06539ca0ae
-rw-r--r--res/values-mcc334-mnc03/config.xml2
l---------res/values-mcc334-mnc0301
-rw-r--r--res/values-mcc706-mnc04/config.xml2
-rw-r--r--res/values-mcc712-mnc04/config.xml2
-rw-r--r--res/values-mcc716-mnc06/config.xml2
-rw-r--r--res/values-mcc722-mnc07/config.xml2
-rw-r--r--res/values-mcc730-mnc02/config.xml2
-rw-r--r--res/values-mcc732-mnc123/config.xml2
-rw-r--r--res/values-mcc734-mnc04/config.xml2
-rw-r--r--res/values-mcc740-mnc00/config.xml2
-rw-r--r--res/values-mcc748-mnc07/config.xml2
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java8
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastChannelManager.java14
-rw-r--r--tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastChannelManagerTest.java9
14 files changed, 37 insertions, 15 deletions
diff --git a/res/values-mcc334-mnc03/config.xml b/res/values-mcc334-mnc03/config.xml
index 10923253c..667abcd5e 100644
--- a/res/values-mcc334-mnc03/config.xml
+++ b/res/values-mcc334-mnc03/config.xml
@@ -19,7 +19,7 @@
<bool name="emergency_alerts_enabled_default">false</bool>
<!-- 50 -->
<string-array name="emergency_alerts_channels_range_strings" translatable="false">
- <item>0x0032:rat=gsm, emergency=true</item>
+ <item>0x0032:rat=gsm, emergency=true, dialog_with_notification=true</item>
</string-array>
<!-- Channel 919, 6400, and 4396-4399 -->
<string-array name="additional_cbs_channels_strings" translatable="false">
diff --git a/res/values-mcc334-mnc030 b/res/values-mcc334-mnc030
new file mode 120000
index 000000000..f13e2df45
--- /dev/null
+++ b/res/values-mcc334-mnc030
@@ -0,0 +1 @@
+values-mcc334-mnc03 \ No newline at end of file
diff --git a/res/values-mcc706-mnc04/config.xml b/res/values-mcc706-mnc04/config.xml
index 2278b090f..c941edfed 100644
--- a/res/values-mcc706-mnc04/config.xml
+++ b/res/values-mcc706-mnc04/config.xml
@@ -19,7 +19,7 @@
<bool name="emergency_alerts_enabled_default">false</bool>
<!-- 50, 919 -->
<string-array name="emergency_alerts_channels_range_strings" translatable="false">
- <item>0x0032:rat=gsm, emergency=true</item>
+ <item>0x0032:rat=gsm, emergency=true, dialog_with_notification=true</item>
<item>0x0397:rat=gsm, emergency=true</item>
</string-array>
</resources>
diff --git a/res/values-mcc712-mnc04/config.xml b/res/values-mcc712-mnc04/config.xml
index 2278b090f..c941edfed 100644
--- a/res/values-mcc712-mnc04/config.xml
+++ b/res/values-mcc712-mnc04/config.xml
@@ -19,7 +19,7 @@
<bool name="emergency_alerts_enabled_default">false</bool>
<!-- 50, 919 -->
<string-array name="emergency_alerts_channels_range_strings" translatable="false">
- <item>0x0032:rat=gsm, emergency=true</item>
+ <item>0x0032:rat=gsm, emergency=true, dialog_with_notification=true</item>
<item>0x0397:rat=gsm, emergency=true</item>
</string-array>
</resources>
diff --git a/res/values-mcc716-mnc06/config.xml b/res/values-mcc716-mnc06/config.xml
index f1f2111e1..f540844c2 100644
--- a/res/values-mcc716-mnc06/config.xml
+++ b/res/values-mcc716-mnc06/config.xml
@@ -19,7 +19,7 @@
<bool name="emergency_alerts_enabled_default">false</bool>
<!-- 50, 519, 919 -->
<string-array name="emergency_alerts_channels_range_strings" translatable="false">
- <item>0x0032:rat=gsm, emergency=true</item>
+ <item>0x0032:rat=gsm, emergency=true, dialog_with_notification=true</item>
<item>0x0207:rat=gsm, emergency=true</item>
<item>0x0397:rat=gsm, emergency=true</item>
</string-array>
diff --git a/res/values-mcc722-mnc07/config.xml b/res/values-mcc722-mnc07/config.xml
index 821fb2f52..c1f2f2a68 100644
--- a/res/values-mcc722-mnc07/config.xml
+++ b/res/values-mcc722-mnc07/config.xml
@@ -19,6 +19,6 @@
<bool name="emergency_alerts_enabled_default">false</bool>
<!-- 50 -->
<string-array name="emergency_alerts_channels_range_strings" translatable="false">
- <item>0x032:rat=gsm, emergency=true</item>
+ <item>0x032:rat=gsm, emergency=true, dialog_with_notification=true</item>
</string-array>
</resources>
diff --git a/res/values-mcc730-mnc02/config.xml b/res/values-mcc730-mnc02/config.xml
index f1e56119e..73b13d772 100644
--- a/res/values-mcc730-mnc02/config.xml
+++ b/res/values-mcc730-mnc02/config.xml
@@ -19,7 +19,7 @@
<bool name="emergency_alerts_enabled_default">false</bool>
<!-- 50, 920 -->
<string-array name="emergency_alerts_channels_range_strings" translatable="false">
- <item>0x0032:rat=gsm, emergency=true</item>
+ <item>0x0032:rat=gsm, emergency=true, dialog_with_notification=true</item>
<item>0x0398:rat=gsm, emergency=true</item>
</string-array>
</resources>
diff --git a/res/values-mcc732-mnc123/config.xml b/res/values-mcc732-mnc123/config.xml
index 24eea620d..61a931942 100644
--- a/res/values-mcc732-mnc123/config.xml
+++ b/res/values-mcc732-mnc123/config.xml
@@ -19,7 +19,7 @@
<bool name="emergency_alerts_enabled_default">false</bool>
<!-- 50 -->
<string-array name="emergency_alerts_channels_range_strings" translatable="false">
- <item>0x0032:rat=gsm, emergency=true</item>
+ <item>0x0032:rat=gsm, emergency=true, dialog_with_notification=true</item>
</string-array>
<!-- Channel 919 -->
<string-array name="additional_cbs_channels_strings" translatable="false">
diff --git a/res/values-mcc734-mnc04/config.xml b/res/values-mcc734-mnc04/config.xml
index 32436497a..67e1546d4 100644
--- a/res/values-mcc734-mnc04/config.xml
+++ b/res/values-mcc734-mnc04/config.xml
@@ -19,7 +19,7 @@
<bool name="emergency_alerts_enabled_default">false</bool>
<!-- 50, 919 -->
<string-array name="emergency_alerts_channels_range_strings" translatable="false">
- <item>0x0032:rat=gsm, emergency=true</item>
+ <item>0x0032:rat=gsm, emergency=true, dialog_with_notification=true</item>
<item>0x0397:rat=gsm, emergency=true</item>
</string-array>
</resources>
diff --git a/res/values-mcc740-mnc00/config.xml b/res/values-mcc740-mnc00/config.xml
index 5bb3d2158..1bd641d7b 100644
--- a/res/values-mcc740-mnc00/config.xml
+++ b/res/values-mcc740-mnc00/config.xml
@@ -19,7 +19,7 @@
<bool name="emergency_alerts_enabled_default">false</bool>
<!-- 50, 519, 919 -->
<string-array name="emergency_alerts_channels_range_strings" translatable="false">
- <item>0x0032:rat=gsm, emergency=true</item>
+ <item>0x0032:rat=gsm, emergency=true, dialog_with_notification=true</item>
<item>0x0207:rat=gsm, emergency=true</item>
<item>0x0397:rat=gsm, emergency=true</item>
</string-array>
diff --git a/res/values-mcc748-mnc07/config.xml b/res/values-mcc748-mnc07/config.xml
index 32436497a..67e1546d4 100644
--- a/res/values-mcc748-mnc07/config.xml
+++ b/res/values-mcc748-mnc07/config.xml
@@ -19,7 +19,7 @@
<bool name="emergency_alerts_enabled_default">false</bool>
<!-- 50, 919 -->
<string-array name="emergency_alerts_channels_range_strings" translatable="false">
- <item>0x0032:rat=gsm, emergency=true</item>
+ <item>0x0032:rat=gsm, emergency=true, dialog_with_notification=true</item>
<item>0x0397:rat=gsm, emergency=true</item>
</string-array>
</resources>
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
index f1b83c4df..b5edce295 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
@@ -421,12 +421,18 @@ public class CellBroadcastAlertService extends Service {
// start alert sound / vibration / TTS and display full-screen alert
openEmergencyAlertNotification(cbm);
Resources res = CellBroadcastSettings.getResources(mContext, cbm.getSubscriptionId());
+
+ CellBroadcastChannelRange range = channelManager
+ .getCellBroadcastChannelRangeFromMessage(cbm);
+
// KR carriers mandate to always show notifications along with alert dialog.
if (res.getBoolean(R.bool.show_alert_dialog_with_notification) ||
// to support emergency alert on companion devices use flag
// show_notification_if_connected_to_companion_devices instead.
(res.getBoolean(R.bool.show_notification_if_connected_to_companion_devices)
- && isConnectedToCompanionDevices())) {
+ && isConnectedToCompanionDevices())
+ // show dialog and notification for specific channel
+ || (range != null && range.mDisplayDialogWithNotification)) {
// add notification to the bar by passing the list of unread non-emergency
// cell broadcast messages. The notification should be of LOW_IMPORTANCE if the
// notification is shown together with full-screen dialog.
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastChannelManager.java b/src/com/android/cellbroadcastreceiver/CellBroadcastChannelManager.java
index 1873e923c..a56cd0a42 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastChannelManager.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastChannelManager.java
@@ -116,7 +116,8 @@ public class CellBroadcastChannelManager {
private static final String KEY_DEBUG_BUILD_ONLY = "debug_build";
/** Define the ISO-639-1 language code associated with the alert message. */
private static final String KEY_LANGUAGE_CODE = "language";
-
+ /** Define whether to display dialog and notification */
+ private static final String KEY_DIALOG_WITH_NOTIFICATION = "dialog_with_notification";
/**
* Defines whether the channel needs language filter or not. True indicates that the alert
@@ -163,6 +164,8 @@ public class CellBroadcastChannelManager {
public boolean mIsDebugBuildOnly = false;
// This is used to override dialog title language
public String mLanguageCode;
+ // Display both ways dialog and notification
+ public boolean mDisplayDialogWithNotification = false;
public CellBroadcastChannelRange(Context context, int subId, String channelRange) {
mAlertType = AlertType.DEFAULT;
@@ -277,7 +280,11 @@ public class CellBroadcastChannelManager {
case KEY_LANGUAGE_CODE:
mLanguageCode = value;
break;
-
+ case KEY_DIALOG_WITH_NOTIFICATION:
+ if (value.equalsIgnoreCase("true")) {
+ mDisplayDialogWithNotification = true;
+ }
+ break;
}
}
}
@@ -312,7 +319,8 @@ public class CellBroadcastChannelManager {
+ mAlwaysOn + ",ScreenOnDuration=" + mScreenOnDuration + ", displayIcon="
+ mDisplayIcon + "dismissOnOutsideTouch=" + mDismissOnOutsideTouch
+ ", mIsDebugBuildOnly =" + mIsDebugBuildOnly
- + ", languageCode=" + mLanguageCode + "]";
+ + ", languageCode=" + mLanguageCode
+ + ", mDisplayDialogWithNotification=" + mDisplayDialogWithNotification + "]";
}
}
diff --git a/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastChannelManagerTest.java b/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastChannelManagerTest.java
index bca39f6c8..cfd58fa35 100644
--- a/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastChannelManagerTest.java
+++ b/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastChannelManagerTest.java
@@ -60,7 +60,8 @@ public class CellBroadcastChannelManagerTest extends CellBroadcastTest {
"456:type=etws_tsunami, emergency=true, alert_duration=60000, "
+ "scope=domestic", "0xAC00-0xAFED:type=other, emergency=false, "
+ "override_dnd=true, scope=carrier", "54-60:emergency=true, "
- + "testing_mode=true", "100-200", "0xA804:type=test, "
+ + "testing_mode=true, " + "dialog_with_notification=true",
+ "100-200", "0xA804:type=test, "
+ "emergency=true, exclude_from_sms_inbox=true, vibration=0|350|250|350",
"0x111E:debug_build=true"});
@@ -79,6 +80,7 @@ public class CellBroadcastChannelManagerTest extends CellBroadcastTest {
assertFalse(list.get(0).mOverrideDnd);
assertTrue(list.get(0).mWriteToSmsInbox);
assertFalse(list.get(0).mTestMode);
+ assertFalse(list.get(0).mDisplayDialogWithNotification);
assertEquals(456, list.get(1).mStartId);
assertEquals(456, list.get(1).mEndId);
@@ -90,6 +92,7 @@ public class CellBroadcastChannelManagerTest extends CellBroadcastTest {
assertTrue(list.get(1).mWriteToSmsInbox);
assertFalse(list.get(1).mTestMode);
assertEquals(60000, list.get(1).mAlertDuration);
+ assertFalse(list.get(1).mDisplayDialogWithNotification);
assertEquals(0xAC00, list.get(2).mStartId);
assertEquals(0xAFED, list.get(2).mEndId);
@@ -101,6 +104,7 @@ public class CellBroadcastChannelManagerTest extends CellBroadcastTest {
assertTrue(list.get(2).mWriteToSmsInbox);
assertFalse(list.get(2).mTestMode);
assertEquals(list.get(2).mScope, CellBroadcastChannelRange.SCOPE_CARRIER);
+ assertFalse(list.get(2).mDisplayDialogWithNotification);
assertEquals(54, list.get(3).mStartId);
assertEquals(60, list.get(3).mEndId);
@@ -111,6 +115,7 @@ public class CellBroadcastChannelManagerTest extends CellBroadcastTest {
assertFalse(list.get(3).mOverrideDnd);
assertTrue(list.get(3).mWriteToSmsInbox);
assertTrue(list.get(3).mTestMode);
+ assertTrue(list.get(3).mDisplayDialogWithNotification);
assertEquals(100, list.get(4).mStartId);
assertEquals(200, list.get(4).mEndId);
@@ -121,6 +126,7 @@ public class CellBroadcastChannelManagerTest extends CellBroadcastTest {
assertFalse(list.get(4).mOverrideDnd);
assertTrue(list.get(4).mWriteToSmsInbox);
assertFalse(list.get(4).mTestMode);
+ assertFalse(list.get(4).mDisplayDialogWithNotification);
assertEquals(0xA804, list.get(5).mStartId);
assertEquals(0xA804, list.get(5).mEndId);
@@ -133,6 +139,7 @@ public class CellBroadcastChannelManagerTest extends CellBroadcastTest {
assertFalse(list.get(5).mTestMode);
assertTrue(Arrays.equals(new int[]{0, 350, 250, 350}, list.get(5).mVibrationPattern));
assertNotEquals(list.get(4).toString(), list.get(5).toString());
+ assertFalse(list.get(5).mDisplayDialogWithNotification);
assertEquals(6, list.size());
}