diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-04-24 21:46:39 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-24 21:46:39 +0000 |
commit | b3a018584db54f26484f0e433f87b7cb1f2aa408 (patch) | |
tree | 6e7da1437a94f161cae9324a9d3114821f556ebf /src/com/android | |
parent | 818b8c633dcb84e611862c6a1ae42552f8dca02e (diff) | |
parent | 234d142c03da3f86ece8126a4dd766065868f88f (diff) | |
download | CellBroadcastReceiver-b3a018584db54f26484f0e433f87b7cb1f2aa408.tar.gz |
Merge "Test mode changes" into rvc-dev
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java | 9 |
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)); |