Add new end-block-suppression command
New end-block-suppression command can be used to disable suppressing
blocking when emergency services have been contacted.
Bug: 158811183
Test: Manual and atest CtsTelephonyTestCases
Signed-off-by: Taesu Lee <[email protected]>
Change-Id: I37f1f0c326b5ebce715903f7e70c669f5c247d4e
Merged-In: I37f1f0c326b5ebce715903f7e70c669f5c247d4e
(cherry picked from commit c81a39bc04802e89a52f7d7a36683101735e32fc)
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 0348389..512ca03 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -22,6 +22,7 @@
import android.os.PersistableBundle;
import android.os.Process;
import android.os.RemoteException;
+import android.provider.BlockedNumberContract;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -56,6 +57,7 @@
private static final String IMS_SUBCOMMAND = "ims";
private static final String NUMBER_VERIFICATION_SUBCOMMAND = "numverify";
private static final String EMERGENCY_NUMBER_TEST_MODE = "emergency-number-test-mode";
+ private static final String END_BLOCK_SUPPRESSION = "end-block-suppression";
private static final String CARRIER_CONFIG_SUBCOMMAND = "cc";
private static final String DATA_TEST_MODE = "data";
private static final String DATA_ENABLE = "enable";
@@ -82,6 +84,7 @@
private SubscriptionManager mSubscriptionManager;
private CarrierConfigManager mCarrierConfigManager;
+ private Context mContext;
private enum CcType {
BOOLEAN, DOUBLE, DOUBLE_ARRAY, INT, INT_ARRAY, LONG, LONG_ARRAY, STRING,
@@ -132,6 +135,7 @@
(CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
mSubscriptionManager = (SubscriptionManager)
context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
+ mContext = context;
}
@Override
@@ -153,6 +157,8 @@
}
case DATA_TEST_MODE:
return handleDataTestModeCommand();
+ case END_BLOCK_SUPPRESSION:
+ return handleEndBlockSuppressionCommand();
default: {
return handleDefaultCommands(cmd);
}
@@ -169,12 +175,15 @@
pw.println(" IMS Commands.");
pw.println(" emergency-number-test-mode");
pw.println(" Emergency Number Test Mode Commands.");
+ pw.println(" end-block-suppression");
+ pw.println(" End Block Suppression command.");
pw.println(" data");
pw.println(" Data Test Mode Commands.");
pw.println(" cc");
pw.println(" Carrier Config Commands.");
onHelpIms();
onHelpEmergencyNumber();
+ onHelpEndBlockSupperssion();
onHelpDataTestMode();
onHelpCc();
}
@@ -242,6 +251,13 @@
pw.println(" -p: get the full emergency number list in the test mode.");
}
+ private void onHelpEndBlockSupperssion() {
+ PrintWriter pw = getOutPrintWriter();
+ pw.println("End Block Suppression command:");
+ pw.println(" end-block-suppression: disable suppressing blocking by contact");
+ pw.println(" with emergency services.");
+ }
+
private void onHelpCc() {
PrintWriter pw = getOutPrintWriter();
pw.println("Carrier Config Commands:");
@@ -1169,4 +1185,15 @@
}
return bundle;
}
+
+ private int handleEndBlockSuppressionCommand() {
+ if (!checkShellUid()) {
+ return -1;
+ }
+
+ if (BlockedNumberContract.SystemContract.getBlockSuppressionStatus(mContext).isSuppressed) {
+ BlockedNumberContract.SystemContract.endBlockSuppression(mContext);
+ }
+ return 0;
+ }
}