Modified MultiSim APIs
Capitalize S in Multisim.
isMultiSimSupported should return three states, to describe the three possible cases
(hardware not supported, hardware supported but carrier restricted, available)
Bug: 128524079
Test: compilation
Change-Id: I7d6801c98ef6f641e7dfee7303aae6cfbdf90839
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 6f02ae2..76da51a 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6726,13 +6726,13 @@
}
@Override
- public void setMultisimCarrierRestriction(boolean isMultisimCarrierRestricted) {
+ public void setMultiSimCarrierRestriction(boolean isMultiSimCarrierRestricted) {
enforceModifyPermission();
final long identity = Binder.clearCallingIdentity();
try {
mTelephonySharedPreferences.edit()
- .putBoolean(PREF_MULTI_SIM_RESTRICTED, isMultisimCarrierRestricted)
+ .putBoolean(PREF_MULTI_SIM_RESTRICTED, isMultiSimCarrierRestricted)
.commit();
} finally {
Binder.restoreCallingIdentity(identity);
@@ -6740,45 +6740,47 @@
}
@Override
- public boolean isMultisimSupported(String callingPackage) {
+ @TelephonyManager.IsMultiSimSupportedResult
+ public int isMultiSimSupported(String callingPackage) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp,
- getDefaultPhone().getSubId(), callingPackage, "isMultisimSupported")) {
- return false;
+ getDefaultPhone().getSubId(), callingPackage, "isMultiSimSupported")) {
+ return TelephonyManager.MULTISIM_NOT_SUPPORTED_BY_HARDWARE;
}
final long identity = Binder.clearCallingIdentity();
try {
- return isMultisimSupportedInternal();
+ return isMultiSimSupportedInternal();
} finally {
Binder.restoreCallingIdentity(identity);
}
}
- private boolean isMultisimSupportedInternal() {
+ @TelephonyManager.IsMultiSimSupportedResult
+ private int isMultiSimSupportedInternal() {
// If the device has less than 2 SIM cards, indicate that multisim is restricted.
int numPhysicalSlots = UiccController.getInstance().getUiccSlots().length;
if (numPhysicalSlots < 2) {
- loge("isMultisimSupportedInternal: requires at least 2 cards");
- return false;
+ loge("isMultiSimSupportedInternal: requires at least 2 cards");
+ return TelephonyManager.MULTISIM_NOT_SUPPORTED_BY_HARDWARE;
}
// Check if the hardware supports multisim functionality. If usage of multisim is not
// supported by the modem, indicate that it is restricted.
PhoneCapability staticCapability =
mPhoneConfigurationManager.getStaticPhoneCapability();
if (staticCapability == null) {
- loge("isMultisimSupportedInternal: no static configuration available");
- return false;
+ loge("isMultiSimSupportedInternal: no static configuration available");
+ return TelephonyManager.MULTISIM_NOT_SUPPORTED_BY_HARDWARE;
}
if (staticCapability.logicalModemList.size() < 2) {
- loge("isMultisimSupportedInternal: maximum number of modem is < 2");
- return false;
+ loge("isMultiSimSupportedInternal: maximum number of modem is < 2");
+ return TelephonyManager.MULTISIM_NOT_SUPPORTED_BY_HARDWARE;
}
// Check if support of multiple SIMs is restricted by carrier
if (mTelephonySharedPreferences.getBoolean(PREF_MULTI_SIM_RESTRICTED, false)) {
- return false;
+ return TelephonyManager.MULTISIM_NOT_SUPPORTED_BY_CARRIER;
}
- return true;
+ return TelephonyManager.MULTISIM_ALLOWED;
}
/**
@@ -6800,7 +6802,7 @@
try {
//only proceed if multi-sim is not restricted
- if (!isMultisimSupportedInternal()) {
+ if (isMultiSimSupportedInternal() != TelephonyManager.MULTISIM_ALLOWED) {
loge("switchMultiSimConfig not possible. It is restricted or not supported.");
return;
}