Add getSlotsMapping to PhoneInterfaceManager
Bug: 123101769
Test: build
Change-Id: Iedd6f5c7f1d932b45dc6f3b6cfa76dad4e0c430a
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 4590807..1631b64 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6551,4 +6551,24 @@
}
}
+ @Override
+ public int[] getSlotsMapping() {
+ enforceReadPrivilegedPermission("getSlotsMapping");
+
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ int phoneCount = TelephonyManager.getDefault().getPhoneCount();
+ // All logical slots should have a mapping to a physical slot.
+ int[] logicalSlotsMapping = new int[phoneCount];
+ UiccSlotInfo[] slotInfos = getUiccSlotsInfo();
+ for (int i = 0; i < slotInfos.length; i++) {
+ if (SubscriptionManager.isValidPhoneId(slotInfos[i].getLogicalSlotIdx())) {
+ logicalSlotsMapping[slotInfos[i].getLogicalSlotIdx()] = i;
+ }
+ }
+ return logicalSlotsMapping;
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
}