Adding new adb command for getSimSlotsMapping.
Test: tested locally working fine. screenshot: https://screenshot.googleplex.com/3g3AjumccmqKt3k
Command : adb shell cmd phone get-sim-slots-mapping
Bug: 212333911
Change-Id: Ida040fe921dad298801023a82be2870cf8d219a6
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index b158588..2726855 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -173,6 +173,7 @@
// Check if telephony new data stack is enabled.
private static final String GET_DATA_MODE = "get-data-mode";
private static final String GET_IMEI = "get-imei";
+ private static final String GET_SIM_SLOTS_MAPPING = "get-sim-slots-mapping";
// Take advantage of existing methods that already contain permissions checks when possible.
private final ITelephony mInterface;
@@ -331,6 +332,8 @@
return handleGetDataMode();
case GET_IMEI:
return handleGetImei();
+ case GET_SIM_SLOTS_MAPPING:
+ return handleGetSimSlotsMapping();
case RADIO_SUBCOMMAND:
return handleRadioCommand();
default: {
@@ -1977,6 +1980,20 @@
return result != TelephonyManager.PREPARE_UNATTENDED_REBOOT_ERROR ? 0 : -1;
}
+ private int handleGetSimSlotsMapping() {
+ // Verify that the user is allowed to run the command. Only allowed in rooted device in a
+ // non user build.
+ if (Binder.getCallingUid() != Process.ROOT_UID || TelephonyUtils.IS_USER) {
+ getErrPrintWriter().println("GetSimSlotsMapping: Permission denied.");
+ return -1;
+ }
+ TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
+ String result = telephonyManager.getSimSlotMapping().toString();
+ getOutPrintWriter().println("simSlotsMapping: " + result);
+
+ return 0;
+ }
+
private int handleGbaCommand() {
String arg = getNextArg();
if (arg == null) {