summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-03-05 22:39:04 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-03-05 22:39:04 +0000
commit018480509d05f93563e63b50592e763a015fcef7 (patch)
tree360df4110978517f162085442401907605ba05e6
parent70b740beac9e0628855a374221bc6111e744fa64 (diff)
parent56f2a710886ebdae38fb8a7969723dc985324290 (diff)
downloadCellBroadcastReceiver-android13-mainline-mediaprovider-release.tar.gz
Snap for 9691662 from 56f2a710886ebdae38fb8a7969723dc985324290 to mainline-mediaprovider-releaseaml_mpr_331812020aml_mpr_331711020android13-mainline-mediaprovider-release
Change-Id: I527bb47b1e13c24a7083c9e1b40976639d6e6c73
-rw-r--r--res/values-mcc284/config.xml62
-rw-r--r--res/values-mcc284/strings.xml66
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java8
-rw-r--r--tests/compliancetests/assets/emergency_alert_channels.json56
-rw-r--r--tests/compliancetests/assets/emergency_alert_settings.json26
-rw-r--r--tests/compliancetests/assets/region_plmn_list.json4
-rw-r--r--tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastActivityTestCase.java16
-rw-r--r--tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java26
8 files changed, 263 insertions, 1 deletions
diff --git a/res/values-mcc284/config.xml b/res/values-mcc284/config.xml
new file mode 100644
index 000000000..d02288075
--- /dev/null
+++ b/res/values-mcc284/config.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <!-- 4370, 4383 -->
+ <string-array name="cmas_presidential_alerts_channels_range_strings" translatable="false">
+ <item>0x1112:rat=gsm, emergency=true, alert_duration=31500, override_dnd=true, always_on=true</item>
+ <!-- additional language -->
+ <item>0x111F:rat=gsm, emergency=true, alert_duration=31500, override_dnd=true, always_on=true</item>
+ </string-array>
+ <!-- 4371~4372, 4384~4385 -->
+ <string-array name="cmas_alert_extreme_channels_range_strings" translatable="false">
+ <item>0x1113-0x1114:rat=gsm, emergency=true, alert_duration=31500, override_dnd=true</item>
+ <!-- additional language -->
+ <item>0x1120-0x1121:rat=gsm, emergency=true, alert_duration=31500, override_dnd=true</item>
+ </string-array>
+ <!-- 4373~4378, 4386~4391 -->
+ <string-array name="cmas_alerts_severe_range_strings" translatable="false">
+ <item>0x1115-0x111A:rat=gsm, emergency=true, alert_duration=31500, override_dnd=true</item>
+ <!-- additional language -->
+ <item>0x1122-0x1127:rat=gsm, emergency=true, alert_duration=31500, override_dnd=true</item>
+ </string-array>
+ <!-- 4379, 4392 loss / hijack alert notification for Bulgaria -->
+ <string-array name="cmas_amber_alerts_channels_range_strings" translatable="false">
+ <item>0x111B:rat=gsm, emergency=true, alert_duration=31500, override_dnd=true</item>
+ <!-- additional language -->
+ <item>0x1128:rat=gsm, emergency=true, alert_duration=31500, override_dnd=true</item>
+ </string-array>
+ <!-- Channel 4380, 4393 test notification for Bulgaria -->
+ <string-array name="required_monthly_test_range_strings" translatable="false">
+ <item>0x111C:rat=gsm, emergency=false, save=false</item>
+ <!-- additional language -->
+ <item>0x1129:rat=gsm, emergency=false, save=false</item>
+ </string-array>
+
+ <string-array name="exercise_alert_range_strings" translatable="false" />
+ <string-array name="operator_defined_alert_range_strings" translatable="false" />
+ <string-array name="etws_alerts_range_strings" translatable="false"/>
+ <string-array name="etws_test_alerts_range_strings" translatable="false"/>
+
+ <!-- Default value that in the ListPreference.
+ These must be a subset of the alert_reminder_interval_values list above. -->
+ <string name="alert_reminder_interval_in_min_default" translatable="false">15</string>
+
+ <!-- Allow user to enable/disable audio speech alert (text-to-speech for received messages)-->
+ <bool name="show_alert_speech_setting">true</bool>
+ <!-- Default value which determines whether spoken alerts enabled -->
+ <bool name="enable_alert_speech_default">true</bool>
+</resources>
diff --git a/res/values-mcc284/strings.xml b/res/values-mcc284/strings.xml
new file mode 100644
index 000000000..e04fcac57
--- /dev/null
+++ b/res/values-mcc284/strings.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Label for settings screen. [CHAR LIMIT=NONE] -->
+ <string name="sms_cb_settings" translatable="false">BG-ALERT</string>
+
+ <!-- CMAS dialog title for presidential level alert notification. [CHAR LIMIT=50] -->
+ <!-- Required Bulgarian (bg) translation for this message: "BG-ALERT: Внимание, опасност!" -->
+ <string name="cmas_presidential_level_alert">BG-ALERT: Emergency Alert</string>
+ <!-- CMAS dialog title for life threat alert notification. [CHAR LIMIT=50] -->
+ <!-- Required Bulgarian (bg) translation for this message: "BG-ALERT: Предупреждение" -->
+ <string name="cmas_extreme_alert">BG-ALERT: Warning</string>
+ <!-- CMAS dialog title for severe alert. [CHAR LIMIT=50] -->
+ <!-- Required Bulgarian (bg) translation for this message: "BG-ALERT: Информация" -->
+ <string name="cmas_severe_alert">BG-ALERT: Information</string>
+ <!-- CMAS dialog title for loss or kidnapping alert notification (amber alert). [CHAR LIMIT=50] -->
+ <!-- Required Bulgarian (bg) translation for this message: "BG-ALERT: Човек в неизвестност" -->
+ <string name="cmas_amber_alert">BG-ALERT: Missing Person Alert</string>
+ <!-- CMAS dialog title for test alert notification. [CHAR LIMIT=50] -->
+ <!-- Required Bulgarian (bg) translation for this message: "BG-ALERT: Тестово съобщение" -->
+ <string name="cmas_required_monthly_test">BG-ALERT: Test alert</string>
+
+ <!-- Preference title for enable CMAS extreme threat alerts checkbox. [CHAR LIMIT=50] -->
+ <!-- Required Bulgarian (bg) translation for this message: "Сериозни опасности" -->
+ <string name="enable_cmas_extreme_threat_alerts_title">Extreme and Severe Threats</string>
+ <!-- Preference summary for enable CMAS extreme threat alerts checkbox. [CHAR LIMIT=100] -->
+ <!-- Required Bulgarian (bg) translation for this message: "Съобщения за сериозни опасности" -->
+ <string name="enable_cmas_extreme_threat_alerts_summary">Extreme and Severe Threats to Life and Property</string>
+
+ <!-- Preference title for enable CMAS severe threat alerts checkbox. [CHAR LIMIT=50] -->
+ <!-- Required Bulgarian (bg) translation for this message: "Информация" -->
+ <string name="enable_cmas_severe_threat_alerts_title">Information</string>
+ <!-- Preference summary for enable CMAS severe threat alerts checkbox. [CHAR LIMIT=100] -->
+ <!-- Required Bulgarian (bg) translation for this message: "Информационни съобщения" -->
+ <string name="enable_cmas_severe_threat_alerts_summary">Information Messages</string>
+
+ <!-- Preference title for enable CMAS amber alerts checkbox. [CHAR LIMIT=50] -->
+ <!-- Required Bulgarian (bg) translation for this message: "Сигнали за човек в неизвестност" -->
+ <string name="enable_cmas_amber_alerts_title">Missing Person Alerts</string>
+ <!-- Preference summary for enable CMAS amber alerts checkbox. [CHAR LIMIT=100] -->
+ <!-- Required Bulgarian (bg) translation for this message: "Съобщения за хора в неизвестност" -->
+ <string name="enable_cmas_amber_alerts_summary">Messages for Missing Persons</string>
+
+ <!-- Preference title for other test alerts checkbox. [CHAR LIMIT=50] -->
+ <!-- Required Bulgarian (bg) translation for this message: "Тестови сигнали" -->
+ <string name="enable_cmas_test_alerts_title">Test Alerts</string>
+ <!-- Preference summary for other test alerts checkbox. [CHAR LIMIT=125] -->
+ <!-- Required Bulgarian (bg) translation for this message: "Получаване на тестови съобщения" -->
+ <string name="enable_cmas_test_alerts_summary">Receive Тest Мessages</string>
+
+</resources> \ No newline at end of file
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
index 4e7ca4a6d..d28753f48 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
@@ -924,6 +924,10 @@ public class CellBroadcastAlertDialog extends Activity {
private void setPictogram(Context context, SmsCbMessage message) {
int resId = CellBroadcastResources.getDialogPictogramResource(context, message);
ImageView image = findViewById(R.id.pictogramImage);
+ // not all layouts may have a pictogram image, e.g. watch
+ if (image == null) {
+ return;
+ }
if (resId != -1) {
image.setImageResource(resId);
image.setVisibility(View.VISIBLE);
@@ -939,6 +943,10 @@ public class CellBroadcastAlertDialog extends Activity {
*/
private void setPictogramAreaLayout(int orientation) {
ImageView image = findViewById(R.id.pictogramImage);
+ // not all layouts may have a pictogram image, e.g. watch
+ if (image == null) {
+ return;
+ }
if (image.getVisibility() == View.VISIBLE) {
ViewGroup.LayoutParams params = image.getLayoutParams();
diff --git a/tests/compliancetests/assets/emergency_alert_channels.json b/tests/compliancetests/assets/emergency_alert_channels.json
index a10366184..0355b094d 100644
--- a/tests/compliancetests/assets/emergency_alert_channels.json
+++ b/tests/compliancetests/assets/emergency_alert_channels.json
@@ -1594,6 +1594,62 @@
"toggle_avail": "true"
}
},
+ "bulgaria": {
+ "4370": {
+ "title": "BG-ALERT: Emergency Alert",
+ "default_value": "true",
+ "toggle_avail": "false"
+ },
+ "4383": {
+ "title": "BG-ALERT: Emergency Alert",
+ "default_value": "true",
+ "toggle_avail": "false"
+ },
+ "4371": {
+ "title": "BG-ALERT: Warning",
+ "default_value": "true",
+ "toggle_avail": "true",
+ "end_channel": "4372"
+ },
+ "4384": {
+ "title": "BG-ALERT: Warning",
+ "default_value": "true",
+ "toggle_avail": "true",
+ "end_channel": "4385"
+ },
+ "4373": {
+ "title": "BG-ALERT: Information",
+ "default_value": "true",
+ "toggle_avail": "true",
+ "end_channel": "4378"
+ },
+ "4386": {
+ "title": "BG-ALERT: Information",
+ "default_value": "true",
+ "toggle_avail": "true",
+ "end_channel": "4391"
+ },
+ "4379": {
+ "title": "BG-ALERT: Missing Person Alert",
+ "default_value": "true",
+ "toggle_avail": "true"
+ },
+ "4392": {
+ "title": "BG-ALERT: Missing Person Alert",
+ "default_value": "true",
+ "toggle_avail": "true"
+ },
+ "4380": {
+ "title": "BG-ALERT: Test alert",
+ "default_value": "false",
+ "toggle_avail": "true"
+ },
+ "4393": {
+ "title": "BG-ALERT: Test alert",
+ "default_value": "false",
+ "toggle_avail": "true"
+ }
+ },
"estonia": {
"4352": {
"title": "",
diff --git a/tests/compliancetests/assets/emergency_alert_settings.json b/tests/compliancetests/assets/emergency_alert_settings.json
index 1944f2010..d77accb47 100644
--- a/tests/compliancetests/assets/emergency_alert_settings.json
+++ b/tests/compliancetests/assets/emergency_alert_settings.json
@@ -487,6 +487,32 @@
"toggle_avail": "true"
}
},
+ "bulgaria": {
+ "Extreme and Severe Threats": {
+ "default_value": "true",
+ "toggle_avail": "true"
+ },
+ "Information": {
+ "default_value": "true",
+ "toggle_avail": "true"
+ },
+ "Missing Person Alerts": {
+ "default_value": "true",
+ "toggle_avail": "true"
+ },
+ "Test Alerts": {
+ "default_value": "false",
+ "toggle_avail": "true"
+ },
+ "Vibration": {
+ "default_value": "true",
+ "toggle_avail": "true"
+ },
+ "Speak alert message": {
+ "default_value": "true",
+ "toggle_avail": "true"
+ }
+ },
"netherlands": {
"NL-Alert": {
"default_value": "true",
diff --git a/tests/compliancetests/assets/region_plmn_list.json b/tests/compliancetests/assets/region_plmn_list.json
index 088373655..16a4c8359 100644
--- a/tests/compliancetests/assets/region_plmn_list.json
+++ b/tests/compliancetests/assets/region_plmn_list.json
@@ -167,6 +167,10 @@
"mccmnc": "24702",
"imsi": "247020123456789"
},
+ "bulgaria": {
+ "mccmnc": "28401",
+ "imsi": "284010123456789"
+ },
"greece": {
"mccmnc": "20201",
"imsi": "202010123456789"
diff --git a/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastActivityTestCase.java b/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastActivityTestCase.java
index db5a270cd..832499be7 100644
--- a/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastActivityTestCase.java
+++ b/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastActivityTestCase.java
@@ -119,6 +119,8 @@ public class CellBroadcastActivityTestCase<T extends Activity> extends ActivityU
private Resources mResources;
+ boolean mIsOverrideConfigurationEnabled;
+
public TestContext(Context base) {
super(base);
mResources = spy(super.getResources());
@@ -157,7 +159,19 @@ public class CellBroadcastActivityTestCase<T extends Activity> extends ActivityU
@Override
public Context createConfigurationContext(Configuration overrideConfiguration) {
- return this;
+ if (!mIsOverrideConfigurationEnabled) {
+ return this;
+ }
+
+ TestContext newTestContext = new TestContext(
+ super.createConfigurationContext(overrideConfiguration));
+ newTestContext.mInjectedSystemServices.putAll(mInjectedSystemServices);
+ return newTestContext;
}
+
+ public void enableOverrideConfiguration(boolean enabled) {
+ mIsOverrideConfigurationEnabled = enabled;
+ }
+
}
}
diff --git a/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java b/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java
index c33911f4b..57df4c83b 100644
--- a/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java
+++ b/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java
@@ -629,4 +629,30 @@ public class CellBroadcastAlertDialogTest extends
assertEquals(getNewMessageList().size(), 1);
}
+
+ private void setWatchUiMode() {
+ Configuration configuration = new Configuration(
+ mContext.getResources().getConfiguration());
+ configuration.uiMode =
+ (configuration.uiMode & ~Configuration.UI_MODE_TYPE_MASK)
+ | Configuration.UI_MODE_TYPE_WATCH;
+ mContext.enableOverrideConfiguration(true);
+ mContext = (TestContext) mContext.createConfigurationContext(configuration);
+ setActivityContext(mContext);
+ }
+
+ public void testOnConfigurationChangedForWatch() throws Throwable {
+ setWatchUiMode();
+ CellBroadcastAlertDialog activity = startActivity();
+
+ Configuration newConfig = new Configuration();
+ newConfig.orientation = Configuration.ORIENTATION_LANDSCAPE;
+ activity.onConfigurationChanged(newConfig);
+
+ newConfig.orientation = Configuration.ORIENTATION_PORTRAIT;
+ activity.onConfigurationChanged(newConfig);
+
+ assertNull(activity.findViewById(R.id.pictogramImage));
+ }
+
}