summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryoungtaecha <youngtaecha@google.com>2021-12-01 13:38:30 +0000
committeryoungtaecha <youngtaecha@google.com>2021-12-08 00:23:24 +0000
commit95fd52b0941c77b13c53ea57503ca854e3d04d5a (patch)
tree3eaafcf90843065b8a2a449fae716531ffa6e138
parent23046f1e1fe3559cc767aaab66686222d902eafc (diff)
downloadCellBroadcastReceiver-95fd52b0941c77b13c53ea57503ca854e3d04d5a.tar.gz
Disable testing_mode on below conditions.
- userbuildmode is true and - allow_testing_mode_on_user_build is false and - testing_mode is true Bug: 205920270 Test: Manual Test: atest CellBroadcastReceiverOemUnitTests Change-Id: Ib4354a69cbdb6912bc5eee866efafba8d9861690
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java b/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java
index e4a114b1f..14ebe3b0c 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java
@@ -275,7 +275,7 @@ public class CellBroadcastReceiver extends BroadcastReceiver {
* @param context the context
* @param subId subId of the carrier config event
*/
- private void resetSettingsIfCarrierChanged(Context context, int subId) {
+ private void resetSettingsAsNeeded(Context context, int subId) {
// subId may be -1 if carrier config broadcast is being sent on SIM removal
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
if (getPreviousCarrierIdForDefaultSub() == NO_PREVIOUS_CARRIER_ID) {
@@ -318,6 +318,17 @@ public class CellBroadcastReceiver extends BroadcastReceiver {
return;
}
+ /** When user_build_mode is true and alow_testing_mode_on_user_build is false
+ * then testing_mode is not able to be true at all.
+ */
+ Resources res = getResourcesMethod();
+ if (!res.getBoolean(R.bool.allow_testing_mode_on_user_build)
+ && SystemProperties.getInt("ro.debuggable", 0) == 0
+ && CellBroadcastReceiver.isTestingMode(context)) {
+ Log.d(TAG, "it can't be testing_mode at all");
+ setTestingMode(false);
+ }
+
if (carrierId != previousCarrierId) {
saveCarrierIdForDefaultSub(carrierId);
startConfigService(context,
@@ -445,7 +456,7 @@ public class CellBroadcastReceiver extends BroadcastReceiver {
if (isSystemUser()) {
Log.d(TAG, "initializeSharedPreference");
- resetSettingsIfCarrierChanged(context, subId);
+ resetSettingsAsNeeded(context, subId);
SharedPreferences sp = getDefaultSharedPreferences();