Add getPhoneCapability function
Bug: 175711587
Test: atest TelephonyManager#testGetPhoneCapability
Change-Id: Ic1b57a58409d378381245beb45e1a2a515ffbcea
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e8f6674..3de9e22 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -8921,7 +8921,7 @@
loge("isMultiSimSupportedInternal: no static configuration available");
return TelephonyManager.MULTISIM_NOT_SUPPORTED_BY_HARDWARE;
}
- if (staticCapability.logicalModemList.size() < 2) {
+ if (staticCapability.getLogicalModemList().size() < 2) {
loge("isMultiSimSupportedInternal: maximum number of modem is < 2");
return TelephonyManager.MULTISIM_NOT_SUPPORTED_BY_HARDWARE;
}
@@ -10042,4 +10042,23 @@
}
}
}
+
+ /**
+ * Gets the current phone capability.
+ *
+ * Requires carrier privileges or READ_PRECISE_PHONE_STATE permission.
+ * @return the PhoneCapability which describes the data connection capability of modem.
+ * It's used to evaluate possible phone config change, for example from single
+ * SIM device to multi-SIM device.
+ */
+ @Override
+ public PhoneCapability getPhoneCapability() {
+ enforceReadPrivilegedPermission("getPhoneCapability");
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ return mPhoneConfigurationManager.getCurrentPhoneCapability();
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
}