Update SubscriptionManager API by replacing 'id' & 'idx' with 'index'.
Bug: 35767068
Test: No build failure on update.
Change-Id: I8e0a885c0e6a7a8af66ae90e7986a6edbff02bba
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index f8eaf49..d7e18ba 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1573,8 +1573,8 @@
return getCallStateForSlot(getSlotForDefaultSubscription());
}
- public int getCallStateForSlot(int slotId) {
- Phone phone = PhoneFactory.getPhone(slotId);
+ public int getCallStateForSlot(int slotIndex) {
+ Phone phone = PhoneFactory.getPhone(slotIndex);
return phone == null ? TelephonyManager.CALL_STATE_IDLE :
PhoneConstantConversions.convertCallState(phone.getState());
}
@@ -1744,20 +1744,20 @@
}
@Override
- public String getImeiForSlot(int slotId, String callingPackage) {
+ public String getImeiForSlot(int slotIndex, String callingPackage) {
if (!canReadPhoneState(callingPackage, "getImeiForSlot")) {
return null;
}
- Phone phone = PhoneFactory.getPhone(slotId);
+ Phone phone = PhoneFactory.getPhone(slotIndex);
return phone == null ? null : phone.getImei();
}
@Override
- public String getDeviceSoftwareVersionForSlot(int slotId, String callingPackage) {
+ public String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage) {
if (!canReadPhoneState(callingPackage, "getDeviceSoftwareVersionForSlot")) {
return null;
}
- Phone phone = PhoneFactory.getPhone(slotId);
+ Phone phone = PhoneFactory.getPhone(slotIndex);
return phone == null ? null : phone.getDeviceSvn();
}
@@ -1885,8 +1885,8 @@
}
@Override
- public int getActivePhoneTypeForSlot(int slotId) {
- final Phone phone = PhoneFactory.getPhone(slotId);
+ public int getActivePhoneTypeForSlot(int slotIndex) {
+ final Phone phone = PhoneFactory.getPhone(slotIndex);
if (phone == null) {
return PhoneConstants.PHONE_TYPE_NONE;
} else {
@@ -2282,15 +2282,16 @@
*/
public boolean hasIccCard() {
// FIXME Make changes to pass defaultSimId of type int
- return hasIccCardUsingSlotId(mSubscriptionController.getSlotId(getDefaultSubscription()));
+ return hasIccCardUsingSlotIndex(mSubscriptionController.getSlotIndex(
+ getDefaultSubscription()));
}
/**
- * @return true if a ICC card is present for a slotId
+ * @return true if a ICC card is present for a slotIndex
*/
@Override
- public boolean hasIccCardUsingSlotId(int slotId) {
- final Phone phone = PhoneFactory.getPhone(slotId);
+ public boolean hasIccCardUsingSlotIndex(int slotIndex) {
+ final Phone phone = PhoneFactory.getPhone(slotIndex);
if (phone != null) {
return phone.getIccCard().hasIccCard();
} else {
@@ -2603,10 +2604,10 @@
* available, the {@link IImsServiceFeatureListener} callback is registered as a listener for
* feature updates.
*/
- public IImsServiceController getImsServiceControllerAndListen(int slotId, int feature,
+ public IImsServiceController getImsServiceControllerAndListen(int slotIndex, int feature,
IImsServiceFeatureListener callback) {
enforceModifyPermission();
- return PhoneFactory.getImsResolver().getImsServiceControllerAndListen(slotId, feature,
+ return PhoneFactory.getImsResolver().getImsServiceControllerAndListen(slotIndex, feature,
callback);
}
@@ -3629,34 +3630,36 @@
/**
* {@hide}
- * Set the allowed carrier list for slotId
+ * Set the allowed carrier list for slotIndex
* Require system privileges. In the future we may add this to carrier APIs.
*
* @return The number of carriers set successfully, should match length of carriers
*/
@Override
- public int setAllowedCarriers(int slotId, List<CarrierIdentifier> carriers) {
+ public int setAllowedCarriers(int slotIndex, List<CarrierIdentifier> carriers) {
enforceModifyPermission();
- int subId = SubscriptionManager.getSubId(slotId)[0];
+
if (carriers == null) {
throw new NullPointerException("carriers cannot be null");
}
+
+ int subId = SubscriptionManager.getSubId(slotIndex)[0];
int[] retVal = (int[]) sendRequest(CMD_SET_ALLOWED_CARRIERS, carriers, subId);
return retVal[0];
}
/**
* {@hide}
- * Get the allowed carrier list for slotId.
+ * Get the allowed carrier list for slotIndex.
* Require system privileges. In the future we may add this to carrier APIs.
*
* @return List of {@link android.service.telephony.CarrierIdentifier}; empty list
* means all carriers are allowed.
*/
@Override
- public List<CarrierIdentifier> getAllowedCarriers(int slotId) {
+ public List<CarrierIdentifier> getAllowedCarriers(int slotIndex) {
enforceReadPrivilegedPermission();
- int subId = SubscriptionManager.getSubId(slotId)[0];
+ int subId = SubscriptionManager.getSubId(slotIndex)[0];
return (List<CarrierIdentifier>) sendRequest(CMD_GET_ALLOWED_CARRIERS, null, subId);
}
@@ -3791,14 +3794,15 @@
/**
* Set SIM card power state. Request is equivalent to inserting or removing the card.
*
- * @param slotId SIM slot id.
+ * @param slotIndex SIM slot id.
* @param powerUp True if powering up the SIM, otherwise powering down
*
**/
@Override
- public void setSimPowerStateForSlot(int slotId, boolean powerUp) {
+ public void setSimPowerStateForSlot(int slotIndex, boolean powerUp) {
enforceModifyPermission();
- Phone phone = PhoneFactory.getPhone(slotId);
+ Phone phone = PhoneFactory.getPhone(slotIndex);
+
if (phone != null) {
phone.setSimPowerState(powerUp);
}
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
index 77de3f5..07402db 100644
--- a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
+++ b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
@@ -310,8 +310,8 @@
int subId2 = mTelephonyManager.getSubIdForPhoneAccount(account2);
if (subId1 != SubscriptionManager.INVALID_SUBSCRIPTION_ID &&
subId2 != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
- retval = (mSubscriptionManager.getSlotId(subId1) <
- mSubscriptionManager.getSlotId(subId2)) ? -1 : 1;
+ retval = (mSubscriptionManager.getSlotIndex(subId1) <
+ mSubscriptionManager.getSlotIndex(subId2)) ? -1 : 1;
}
// Then order by package
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index acf668b..d0af44f 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -152,7 +152,7 @@
}
String slotIdString;
- if (SubscriptionManager.isValidSlotId(slotId)) {
+ if (SubscriptionManager.isValidSlotIndex(slotId)) {
slotIdString = Integer.toString(slotId);
} else {
slotIdString = mContext.getResources().getString(R.string.unknown);
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index f66daec..6ddc35e 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -152,7 +152,7 @@
@Override
public int getSimStateForSlotIdx(int slotId) {
- return SubscriptionManager.getSimStateForSlotIdx(slotId);
+ return SubscriptionManager.getSimStateForSlotIndex(slotId);
}
@Override