Merge "Update SubscriptionManager API by replacing 'id' & 'idx' with 'index'."
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index da58d2b..fc7faab 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1537,8 +1537,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 :
             DefaultPhoneNotifier.convertCallState(phone.getState());
     }
@@ -1707,20 +1707,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();
     }
 
@@ -1848,8 +1848,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 {
@@ -2180,15 +2180,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) {
-        int subId[] = mSubscriptionController.getSubIdUsingSlotId(slotId);
+    public boolean hasIccCardUsingSlotIndex(int slotIndex) {
+        int subId[] = mSubscriptionController.getSubIdUsingSlotIndex(slotIndex);
         final Phone phone = getPhone(subId[0]);
         if (subId != null && phone != null) {
             return phone.getIccCard().hasIccCard();
@@ -2502,10 +2503,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);
     }
 
@@ -3424,31 +3425,31 @@
 
     /**
      * {@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];
+        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);
     }
 
@@ -3583,14 +3584,14 @@
     /**
      * 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();
-        int subId[] = mSubscriptionController.getSubIdUsingSlotId(slotId);
+        int subId[] = mSubscriptionController.getSubIdUsingSlotIndex(slotIndex);
         if (subId == null || subId.length == 0) {
             return;
         }
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 b2e9984..fbb6433 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);