summaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorJack Yu <jackyu@google.com>2020-04-24 12:59:41 -0700
committerJack Yu <jackyu@google.com>2020-04-24 13:02:13 -0700
commit234d142c03da3f86ece8126a4dd766065868f88f (patch)
tree1a193d0c2dda26550828a5fa1af8110ea4367a7e /src/com/android
parent6cb0f1fb2c6c087193d3ebc3b60e9285cfc3948e (diff)
downloadCellBroadcastReceiver-234d142c03da3f86ece8126a4dd766065868f88f.tar.gz
Test mode changes
1. Allow testing mode on commercial build for AT&T 2. Hide test alert toggle by default. Can be enabled by *#*#CMAS#*#*. Fix: 154845375 Test: Manual Change-Id: I27a092628a7c010e7af9f90341854671af72cb27
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java9
1 files changed, 6 insertions, 3 deletions
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));