summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/values-mcc310-mnc410/config.xml4
-rw-r--r--res/values/config.xml2
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java9
3 files changed, 12 insertions, 3 deletions
diff --git a/res/values-mcc310-mnc410/config.xml b/res/values-mcc310-mnc410/config.xml
index e988997a8..20d0913b9 100644
--- a/res/values-mcc310-mnc410/config.xml
+++ b/res/values-mcc310-mnc410/config.xml
@@ -21,4 +21,8 @@
<bool name="show_date_time_title">true</bool>
<!-- Whether to show CMAS messages by in a different order than received by prioritizing them -->
<bool name="show_cmas_messages_in_priority_order">true</bool>
+ <!-- Whether allowing testing mode on user build or not -->
+ <bool name="allow_testing_mode_on_user_build">true</bool>
+ <!-- Whether to show test settings -->
+ <bool name="show_test_settings">false</bool>
</resources>
diff --git a/res/values/config.xml b/res/values/config.xml
index 4a0cdf78f..1022e8b93 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -53,6 +53,8 @@
<bool name="mute_by_physical_button">true</bool>
<!-- Whether enable LED flash when playing alert tones -->
<bool name="enable_led_flash">false</bool>
+ <!-- Whether allowing testing mode on user build or not -->
+ <bool name="allow_testing_mode_on_user_build">false</bool>
<!-- Section for switch default value -->
<!-- Master toggle default value -->
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java b/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java
index 3ac297175..e52af12b7 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java
@@ -24,6 +24,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
+import android.content.res.Resources;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.SystemProperties;
@@ -90,6 +91,8 @@ public class CellBroadcastReceiver extends BroadcastReceiver {
mContext = context.getApplicationContext();
String action = intent.getAction();
+ Resources res = CellBroadcastSettings.getResources(mContext,
+ SubscriptionManager.DEFAULT_SUBSCRIPTION_ID);
if (ACTION_MARK_AS_READ.equals(action)) {
final long deliveryTime = intent.getLongExtra(EXTRA_DELIVERY_TIME, -1);
@@ -117,12 +120,12 @@ public class CellBroadcastReceiver extends BroadcastReceiver {
// rename registered notification channels on locale change
CellBroadcastAlertService.createNotificationChannels(mContext);
} else if (TelephonyManager.ACTION_SECRET_CODE.equals(action)) {
- if (SystemProperties.getInt("ro.debuggable", 0) == 1) {
+ if (SystemProperties.getInt("ro.debuggable", 0) == 1
+ || res.getBoolean(R.bool.allow_testing_mode_on_user_build)) {
setTestingMode(!isTestingMode(mContext));
int msgId = (isTestingMode(mContext)) ? R.string.testing_mode_enabled
: R.string.testing_mode_disabled;
- String msg = CellBroadcastSettings.getResources(mContext,
- SubscriptionManager.DEFAULT_SUBSCRIPTION_ID).getString(msgId);
+ String msg = res.getString(msgId);
Toast.makeText(mContext, msg, Toast.LENGTH_SHORT).show();
LocalBroadcastManager.getInstance(mContext)
.sendBroadcast(new Intent(ACTION_TESTING_MODE_CHANGED));