Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 980231f3 authored by Sanket Padawe's avatar Sanket Padawe Committed by Android (Google) Code Review
Browse files

Merge "Change 'idx' to 'index' in SubscriptionManager & TelephonyManager apis."

parents e2436917 7e460251
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1582,7 +1582,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
     */
     */
    public void reportSimUnlocked(int subId) {
    public void reportSimUnlocked(int subId) {
        if (DEBUG_SIM_STATES) Log.v(TAG, "reportSimUnlocked(subId=" + subId + ")");
        if (DEBUG_SIM_STATES) Log.v(TAG, "reportSimUnlocked(subId=" + subId + ")");
        int slotId = SubscriptionManager.getSlotId(subId);
        int slotId = SubscriptionManager.getSlotIndex(subId);
        handleSimStateChange(subId, slotId, State.READY);
        handleSimStateChange(subId, slotId, State.READY);
    }
    }


@@ -1751,7 +1751,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        for (int i = 0; i < list.size(); i++) {
        for (int i = 0; i < list.size(); i++) {
            final SubscriptionInfo info = list.get(i);
            final SubscriptionInfo info = list.get(i);
            final int id = info.getSubscriptionId();
            final int id = info.getSubscriptionId();
            int slotId = SubscriptionManager.getSlotId(id);
            int slotId = SubscriptionManager.getSlotIndex(id);
            if (state == getSimState(id) && bestSlotId > slotId ) {
            if (state == getSimState(id) && bestSlotId > slotId ) {
                resultId = id;
                resultId = id;
                bestSlotId = slotId;
                bestSlotId = slotId;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1897,7 +1897,7 @@ public class PhoneNumberUtils
        number = extractNetworkPortionAlt(number);
        number = extractNetworkPortionAlt(number);


        String emergencyNumbers = "";
        String emergencyNumbers = "";
        int slotId = SubscriptionManager.getSlotId(subId);
        int slotId = SubscriptionManager.getSlotIndex(subId);


        // retrieve the list of emergency numbers
        // retrieve the list of emergency numbers
        // check read-write ecclist property first
        // check read-write ecclist property first
+28 −28
Original line number Original line Diff line number Diff line
@@ -521,14 +521,14 @@ public class SubscriptionManager {
    }
    }


    /**
    /**
     * Get the active SubscriptionInfo associated with the slotIdx
     * Get the active SubscriptionInfo associated with the slotIndex
     * @param slotIdx the slot which the subscription is inserted
     * @param slotIndex the slot which the subscription is inserted
     * @return SubscriptionInfo, maybe null if its not active
     * @return SubscriptionInfo, maybe null if its not active
     */
     */
    public SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIdx) {
    public SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIndex) {
        if (VDBG) logd("[getActiveSubscriptionInfoForSimSlotIndex]+ slotIdx=" + slotIdx);
        if (VDBG) logd("[getActiveSubscriptionInfoForSimSlotIndex]+ slotIndex=" + slotIndex);
        if (!isValidSlotId(slotIdx)) {
        if (!isValidSlotIndex(slotIndex)) {
            logd("[getActiveSubscriptionInfoForSimSlotIndex]- invalid slotIdx");
            logd("[getActiveSubscriptionInfoForSimSlotIndex]- invalid slotIndex");
            return null;
            return null;
        }
        }


@@ -537,7 +537,7 @@ public class SubscriptionManager {
        try {
        try {
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            if (iSub != null) {
            if (iSub != null) {
                result = iSub.getActiveSubscriptionInfoForSimSlotIndex(slotIdx,
                result = iSub.getActiveSubscriptionInfoForSimSlotIndex(slotIndex,
                        mContext.getOpPackageName());
                        mContext.getOpPackageName());
            }
            }
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
@@ -671,24 +671,24 @@ public class SubscriptionManager {
    /**
    /**
     * Add a new SubscriptionInfo to SubscriptionInfo database if needed
     * Add a new SubscriptionInfo to SubscriptionInfo database if needed
     * @param iccId the IccId of the SIM card
     * @param iccId the IccId of the SIM card
     * @param slotId the slot which the SIM is inserted
     * @param slotIndex the slot which the SIM is inserted
     * @return the URL of the newly created row or the updated row
     * @return the URL of the newly created row or the updated row
     * @hide
     * @hide
     */
     */
    public Uri addSubscriptionInfoRecord(String iccId, int slotId) {
    public Uri addSubscriptionInfoRecord(String iccId, int slotIndex) {
        if (VDBG) logd("[addSubscriptionInfoRecord]+ iccId:" + iccId + " slotId:" + slotId);
        if (VDBG) logd("[addSubscriptionInfoRecord]+ iccId:" + iccId + " slotIndex:" + slotIndex);
        if (iccId == null) {
        if (iccId == null) {
            logd("[addSubscriptionInfoRecord]- null iccId");
            logd("[addSubscriptionInfoRecord]- null iccId");
        }
        }
        if (!isValidSlotId(slotId)) {
        if (!isValidSlotIndex(slotIndex)) {
            logd("[addSubscriptionInfoRecord]- invalid slotId");
            logd("[addSubscriptionInfoRecord]- invalid slotIndex");
        }
        }


        try {
        try {
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            if (iSub != null) {
            if (iSub != null) {
                // FIXME: This returns 1 on success, 0 on error should should we return it?
                // FIXME: This returns 1 on success, 0 on error should should we return it?
                iSub.addSubInfoRecord(iccId, slotId);
                iSub.addSubInfoRecord(iccId, slotIndex);
            }
            }
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            // ignore it
            // ignore it
@@ -830,15 +830,15 @@ public class SubscriptionManager {
    }
    }


    /**
    /**
     * Get slotId associated with the subscription.
     * Get slotIndex associated with the subscription.
     * @return slotId as a positive integer or a negative value if an error either
     * @return slotIndex as a positive integer or a negative value if an error either
     * SIM_NOT_INSERTED or < 0 if an invalid slot index
     * SIM_NOT_INSERTED or < 0 if an invalid slot index
     * @hide
     * @hide
     */
     */
    public static int getSlotId(int subId) {
    public static int getSlotIndex(int subId) {
        if (!isValidSubscriptionId(subId)) {
        if (!isValidSubscriptionId(subId)) {
            if (DBG) {
            if (DBG) {
                logd("[getSlotId]- fail");
                logd("[getSlotIndex]- fail");
            }
            }
        }
        }


@@ -847,7 +847,7 @@ public class SubscriptionManager {
        try {
        try {
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            if (iSub != null) {
            if (iSub != null) {
                result = iSub.getSlotId(subId);
                result = iSub.getSlotIndex(subId);
            }
            }
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            // ignore it
            // ignore it
@@ -858,8 +858,8 @@ public class SubscriptionManager {
    }
    }


    /** @hide */
    /** @hide */
    public static int[] getSubId(int slotId) {
    public static int[] getSubId(int slotIndex) {
        if (!isValidSlotId(slotId)) {
        if (!isValidSlotIndex(slotIndex)) {
            logd("[getSubId]- fail");
            logd("[getSubId]- fail");
            return null;
            return null;
        }
        }
@@ -869,7 +869,7 @@ public class SubscriptionManager {
        try {
        try {
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            if (iSub != null) {
            if (iSub != null) {
                subId = iSub.getSubId(slotId);
                subId = iSub.getSubId(slotIndex);
            }
            }
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            // ignore it
            // ignore it
@@ -1155,8 +1155,8 @@ public class SubscriptionManager {
    }
    }


    /** @hide */
    /** @hide */
    public static boolean isValidSlotId(int slotId) {
    public static boolean isValidSlotIndex(int slotIndex) {
        return slotId >= 0 && slotId < TelephonyManager.getDefault().getSimCount();
        return slotIndex >= 0 && slotIndex < TelephonyManager.getDefault().getSimCount();
    }
    }


    /** @hide */
    /** @hide */
@@ -1179,7 +1179,7 @@ public class SubscriptionManager {
        if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
        if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
        intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
        intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
        intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
        intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
        //FIXME this is using phoneId and slotId interchangeably
        //FIXME this is using phoneId and slotIndex interchangeably
        //Eventually, this should be removed as it is not the slot id
        //Eventually, this should be removed as it is not the slot id
        intent.putExtra(PhoneConstants.SLOT_KEY, phoneId);
        intent.putExtra(PhoneConstants.SLOT_KEY, phoneId);
    }
    }
@@ -1228,9 +1228,9 @@ public class SubscriptionManager {
    }
    }


    /**
    /**
     * Returns a constant indicating the state of sim for the slot idx.
     * Returns a constant indicating the state of sim for the slot index.
     *
     *
     * @param slotIdx
     * @param slotIndex
     *
     *
     * {@See TelephonyManager#SIM_STATE_UNKNOWN}
     * {@See TelephonyManager#SIM_STATE_UNKNOWN}
     * {@See TelephonyManager#SIM_STATE_ABSENT}
     * {@See TelephonyManager#SIM_STATE_ABSENT}
@@ -1244,13 +1244,13 @@ public class SubscriptionManager {
     *
     *
     * {@hide}
     * {@hide}
     */
     */
    public static int getSimStateForSlotIdx(int slotIdx) {
    public static int getSimStateForSlotIndex(int slotIndex) {
        int simState = TelephonyManager.SIM_STATE_UNKNOWN;
        int simState = TelephonyManager.SIM_STATE_UNKNOWN;


        try {
        try {
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            if (iSub != null) {
            if (iSub != null) {
                simState = iSub.getSimStateForSlotIdx(slotIdx);
                simState = iSub.getSimStateForSlotIndex(slotIndex);
            }
            }
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
        }
        }
+47 −47
Original line number Original line Diff line number Diff line
@@ -918,15 +918,15 @@ public class TelephonyManager {
     * <p>Requires Permission:
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *
     *
     * @param slotId of which deviceID is returned
     * @param slotIndex of which deviceID is returned
     */
     */
    /** {@hide} */
    /** {@hide} */
    public String getDeviceSoftwareVersion(int slotId) {
    public String getDeviceSoftwareVersion(int slotIndex) {
        ITelephony telephony = getITelephony();
        ITelephony telephony = getITelephony();
        if (telephony == null) return null;
        if (telephony == null) return null;


        try {
        try {
            return telephony.getDeviceSoftwareVersionForSlot(slotId, getOpPackageName());
            return telephony.getDeviceSoftwareVersionForSlot(slotIndex, getOpPackageName());
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            return null;
            return null;
        } catch (NullPointerException ex) {
        } catch (NullPointerException ex) {
@@ -961,15 +961,15 @@ public class TelephonyManager {
     * <p>Requires Permission:
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *
     *
     * @param slotId of which deviceID is returned
     * @param slotIndex of which deviceID is returned
     */
     */
    public String getDeviceId(int slotId) {
    public String getDeviceId(int slotIndex) {
        // FIXME this assumes phoneId == slotId
        // FIXME this assumes phoneId == slotIndex
        try {
        try {
            IPhoneSubInfo info = getSubscriberInfo();
            IPhoneSubInfo info = getSubscriberInfo();
            if (info == null)
            if (info == null)
                return null;
                return null;
            return info.getDeviceIdForPhone(slotId, mContext.getOpPackageName());
            return info.getDeviceIdForPhone(slotIndex, mContext.getOpPackageName());
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            return null;
            return null;
        } catch (NullPointerException ex) {
        } catch (NullPointerException ex) {
@@ -996,17 +996,17 @@ public class TelephonyManager {
     * <p>Requires Permission:
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *
     *
     * @param slotId of which deviceID is returned
     * @param slotIndex of which deviceID is returned
     *
     *
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public String getImei(int slotId) {
    public String getImei(int slotIndex) {
        ITelephony telephony = getITelephony();
        ITelephony telephony = getITelephony();
        if (telephony == null) return null;
        if (telephony == null) return null;


        try {
        try {
            return telephony.getImeiForSlot(slotId, getOpPackageName());
            return telephony.getImeiForSlot(slotIndex, getOpPackageName());
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            return null;
            return null;
        } catch (NullPointerException ex) {
        } catch (NullPointerException ex) {
@@ -1026,11 +1026,11 @@ public class TelephonyManager {
    /**
    /**
     * Returns the NAI. Return null if NAI is not available.
     * Returns the NAI. Return null if NAI is not available.
     *
     *
     *  @param slotId of which Nai is returned
     *  @param slotIndex of which Nai is returned
     */
     */
    /** {@hide}*/
    /** {@hide}*/
    public String getNai(int slotId) {
    public String getNai(int slotIndex) {
        int[] subId = SubscriptionManager.getSubId(slotId);
        int[] subId = SubscriptionManager.getSubId(slotIndex);
        try {
        try {
            IPhoneSubInfo info = getSubscriberInfo();
            IPhoneSubInfo info = getSubscriberInfo();
            if (info == null)
            if (info == null)
@@ -1226,23 +1226,23 @@ public class TelephonyManager {
     *
     *
     * @hide
     * @hide
     */
     */
    public int getCurrentPhoneTypeForSlot(int slotId) {
    public int getCurrentPhoneTypeForSlot(int slotIndex) {
        try{
        try{
            ITelephony telephony = getITelephony();
            ITelephony telephony = getITelephony();
            if (telephony != null) {
            if (telephony != null) {
                return telephony.getActivePhoneTypeForSlot(slotId);
                return telephony.getActivePhoneTypeForSlot(slotIndex);
            } else {
            } else {
                // This can happen when the ITelephony interface is not up yet.
                // This can happen when the ITelephony interface is not up yet.
                return getPhoneTypeFromProperty(slotId);
                return getPhoneTypeFromProperty(slotIndex);
            }
            }
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            // This shouldn't happen in the normal case, as a backup we
            // This shouldn't happen in the normal case, as a backup we
            // read from the system property.
            // read from the system property.
            return getPhoneTypeFromProperty(slotId);
            return getPhoneTypeFromProperty(slotIndex);
        } catch (NullPointerException ex) {
        } catch (NullPointerException ex) {
            // This shouldn't happen in the normal case, as a backup we
            // This shouldn't happen in the normal case, as a backup we
            // read from the system property.
            // read from the system property.
            return getPhoneTypeFromProperty(slotId);
            return getPhoneTypeFromProperty(slotIndex);
        }
        }
    }
    }


@@ -1962,17 +1962,17 @@ public class TelephonyManager {
    /**
    /**
     * @return true if a ICC card is present for a subscription
     * @return true if a ICC card is present for a subscription
     *
     *
     * @param slotId for which icc card presence is checked
     * @param slotIndex for which icc card presence is checked
     */
     */
    /** {@hide} */
    /** {@hide} */
    // FIXME Input argument slotId should be of type int
    // FIXME Input argument slotIndex should be of type int
    public boolean hasIccCard(int slotId) {
    public boolean hasIccCard(int slotIndex) {


        try {
        try {
            ITelephony telephony = getITelephony();
            ITelephony telephony = getITelephony();
            if (telephony == null)
            if (telephony == null)
                return false;
                return false;
            return telephony.hasIccCardUsingSlotId(slotId);
            return telephony.hasIccCardUsingSlotIndex(slotIndex);
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            // Assume no ICC card if remote exception which shouldn't happen
            // Assume no ICC card if remote exception which shouldn't happen
            return false;
            return false;
@@ -1997,31 +1997,31 @@ public class TelephonyManager {
     * @see #SIM_STATE_CARD_RESTRICTED
     * @see #SIM_STATE_CARD_RESTRICTED
     */
     */
    public int getSimState() {
    public int getSimState() {
        int slotIdx = getDefaultSim();
        int slotIndex = getDefaultSim();
        // slotIdx may be invalid due to sim being absent. In that case query all slots to get
        // slotIndex may be invalid due to sim being absent. In that case query all slots to get
        // sim state
        // sim state
        if (slotIdx < 0) {
        if (slotIndex < 0) {
            // query for all slots and return absent if all sim states are absent, otherwise
            // query for all slots and return absent if all sim states are absent, otherwise
            // return unknown
            // return unknown
            for (int i = 0; i < getPhoneCount(); i++) {
            for (int i = 0; i < getPhoneCount(); i++) {
                int simState = getSimState(i);
                int simState = getSimState(i);
                if (simState != SIM_STATE_ABSENT) {
                if (simState != SIM_STATE_ABSENT) {
                    Rlog.d(TAG, "getSimState: default sim:" + slotIdx + ", sim state for " +
                    Rlog.d(TAG, "getSimState: default sim:" + slotIndex + ", sim state for " +
                            "slotIdx=" + i + " is " + simState + ", return state as unknown");
                            "slotIndex=" + i + " is " + simState + ", return state as unknown");
                    return SIM_STATE_UNKNOWN;
                    return SIM_STATE_UNKNOWN;
                }
                }
            }
            }
            Rlog.d(TAG, "getSimState: default sim:" + slotIdx + ", all SIMs absent, return " +
            Rlog.d(TAG, "getSimState: default sim:" + slotIndex + ", all SIMs absent, return " +
                    "state as absent");
                    "state as absent");
            return SIM_STATE_ABSENT;
            return SIM_STATE_ABSENT;
        }
        }
        return getSimState(slotIdx);
        return getSimState(slotIndex);
    }
    }


    /**
    /**
     * Returns a constant indicating the state of the device SIM card in a slot.
     * Returns a constant indicating the state of the device SIM card in a slot.
     *
     *
     * @param slotIdx
     * @param slotIndex
     *
     *
     * @see #SIM_STATE_UNKNOWN
     * @see #SIM_STATE_UNKNOWN
     * @see #SIM_STATE_ABSENT
     * @see #SIM_STATE_ABSENT
@@ -2034,8 +2034,8 @@ public class TelephonyManager {
     * @see #SIM_STATE_CARD_IO_ERROR
     * @see #SIM_STATE_CARD_IO_ERROR
     * @see #SIM_STATE_CARD_RESTRICTED
     * @see #SIM_STATE_CARD_RESTRICTED
     */
     */
    public int getSimState(int slotIdx) {
    public int getSimState(int slotIndex) {
        int simState = SubscriptionManager.getSimStateForSlotIdx(slotIdx);
        int simState = SubscriptionManager.getSimStateForSlotIndex(slotIndex);
        return simState;
        return simState;
    }
    }


@@ -3210,12 +3210,12 @@ public class TelephonyManager {
     *
     *
     * @hide
     * @hide
     */
     */
    public int getCallStateForSlot(int slotId) {
    public int getCallStateForSlot(int slotIndex) {
        try {
        try {
            ITelephony telephony = getITelephony();
            ITelephony telephony = getITelephony();
            if (telephony == null)
            if (telephony == null)
                return CALL_STATE_IDLE;
                return CALL_STATE_IDLE;
            return telephony.getCallStateForSlot(slotId);
            return telephony.getCallStateForSlot(slotIndex);
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            // the phone process is restarting.
            // the phone process is restarting.
            return CALL_STATE_IDLE;
            return CALL_STATE_IDLE;
@@ -4033,7 +4033,7 @@ public class TelephonyManager {


    /** {@hide} */
    /** {@hide} */
    public int getDefaultSim() {
    public int getDefaultSim() {
        return SubscriptionManager.getSlotId(SubscriptionManager.getDefaultSubscriptionId());
        return SubscriptionManager.getSlotIndex(SubscriptionManager.getDefaultSubscriptionId());
    }
    }


    /**
    /**
@@ -4398,7 +4398,7 @@ public class TelephonyManager {
     * feature or {@link null} if the service is not available. If an ImsServiceController is
     * feature or {@link null} if the service is not available. If an ImsServiceController is
     * available, the {@link IImsServiceFeatureListener} callback is registered as a listener for
     * available, the {@link IImsServiceFeatureListener} callback is registered as a listener for
     * feature updates.
     * feature updates.
     * @param slotId The SIM slot that we are requesting the {@link IImsServiceController} for.
     * @param slotIndex The SIM slot that we are requesting the {@link IImsServiceController} for.
     * @param feature The IMS Feature we are requesting, corresponding to {@link ImsFeature}.
     * @param feature The IMS Feature we are requesting, corresponding to {@link ImsFeature}.
     * @param callback Listener that will send updates to ImsManager when there are updates to
     * @param callback Listener that will send updates to ImsManager when there are updates to
     * ImsServiceController.
     * ImsServiceController.
@@ -4406,12 +4406,12 @@ public class TelephonyManager {
     * it is unavailable.
     * it is unavailable.
     * @hide
     * @hide
     */
     */
    public IImsServiceController getImsServiceControllerAndListen(int slotId, @Feature int feature,
    public IImsServiceController getImsServiceControllerAndListen(int slotIndex, @Feature int feature,
            IImsServiceFeatureListener callback) {
            IImsServiceFeatureListener callback) {
        try {
        try {
            ITelephony telephony = getITelephony();
            ITelephony telephony = getITelephony();
            if (telephony != null) {
            if (telephony != null) {
                return telephony.getImsServiceControllerAndListen(slotId, feature, callback);
                return telephony.getImsServiceControllerAndListen(slotIndex, feature, callback);
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Rlog.e(TAG, "getImsServiceControllerAndListen, RemoteException: " + e.getMessage());
            Rlog.e(TAG, "getImsServiceControllerAndListen, RemoteException: " + e.getMessage());
@@ -5641,7 +5641,7 @@ public class TelephonyManager {
    /**
    /**
     * Set SIM card power state. Request is equivalent to inserting or removing the card.
     * 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
     * @param powerUp True if powering up the SIM, otherwise powering down
     *
     *
     * <p>Requires Permission:
     * <p>Requires Permission:
@@ -5649,11 +5649,11 @@ public class TelephonyManager {
     *
     *
     * @hide
     * @hide
     **/
     **/
    public void setSimPowerStateForSlot(int slotId, boolean powerUp) {
    public void setSimPowerStateForSlot(int slotIndex, boolean powerUp) {
        try {
        try {
            ITelephony telephony = getITelephony();
            ITelephony telephony = getITelephony();
            if (telephony != null) {
            if (telephony != null) {
                telephony.setSimPowerStateForSlot(slotId, powerUp);
                telephony.setSimPowerStateForSlot(slotIndex, powerUp);
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#setSimPowerStateForSlot", e);
            Log.e(TAG, "Error calling ITelephony#setSimPowerStateForSlot", e);
@@ -6237,7 +6237,7 @@ public class TelephonyManager {
    }
    }


    /**
    /**
     * 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.
     * Require system privileges. In the future we may add this to carrier APIs.
     *
     *
     * <p>Requires Permission:
     * <p>Requires Permission:
@@ -6251,11 +6251,11 @@ public class TelephonyManager {
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public int setAllowedCarriers(int slotId, List<CarrierIdentifier> carriers) {
    public int setAllowedCarriers(int slotIndex, List<CarrierIdentifier> carriers) {
        try {
        try {
            ITelephony service = getITelephony();
            ITelephony service = getITelephony();
            if (service != null) {
            if (service != null) {
                return service.setAllowedCarriers(slotId, carriers);
                return service.setAllowedCarriers(slotIndex, carriers);
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#setAllowedCarriers", e);
            Log.e(TAG, "Error calling ITelephony#setAllowedCarriers", e);
@@ -6266,7 +6266,7 @@ public class TelephonyManager {
    }
    }


    /**
    /**
     * 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.
     * Require system privileges. In the future we may add this to carrier APIs.
     *
     *
     * <p>Requires Permission:
     * <p>Requires Permission:
@@ -6280,11 +6280,11 @@ public class TelephonyManager {
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public List<CarrierIdentifier> getAllowedCarriers(int slotId) {
    public List<CarrierIdentifier> getAllowedCarriers(int slotIndex) {
        try {
        try {
            ITelephony service = getITelephony();
            ITelephony service = getITelephony();
            if (service != null) {
            if (service != null) {
                return service.getAllowedCarriers(slotId);
                return service.getAllowedCarriers(slotIndex);
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
            Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
+9 −9
Original line number Original line Diff line number Diff line
@@ -52,12 +52,12 @@ interface ISub {
    SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId, String callingPackage);
    SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId, String callingPackage);


    /**
    /**
     * Get the active SubscriptionInfo associated with the slotIdx
     * Get the active SubscriptionInfo associated with the slotIndex
     * @param slotIdx the slot which the subscription is inserted
     * @param slotIndex the slot which the subscription is inserted
     * @param callingPackage The package maing the call.
     * @param callingPackage The package maing the call.
     * @return SubscriptionInfo, maybe null if its not active
     * @return SubscriptionInfo, maybe null if its not active
     */
     */
    SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIdx, String callingPackage);
    SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIndex, String callingPackage);


    /**
    /**
     * Get the SubscriptionInfo(s) of the active subscriptions. The records will be sorted
     * Get the SubscriptionInfo(s) of the active subscriptions. The records will be sorted
@@ -96,10 +96,10 @@ interface ISub {
    /**
    /**
     * Add a new SubscriptionInfo to subinfo database if needed
     * Add a new SubscriptionInfo to subinfo database if needed
     * @param iccId the IccId of the SIM card
     * @param iccId the IccId of the SIM card
     * @param slotId the slot which the SIM is inserted
     * @param slotIndex the slot which the SIM is inserted
     * @return the URL of the newly created row or the updated row
     * @return the URL of the newly created row or the updated row
     */
     */
    int addSubInfoRecord(String iccId, int slotId);
    int addSubInfoRecord(String iccId, int slotIndex);


    /**
    /**
     * Set SIM icon tint color by simInfo index
     * Set SIM icon tint color by simInfo index
@@ -142,9 +142,9 @@ interface ISub {
     */
     */
    int setDataRoaming(int roaming, int subId);
    int setDataRoaming(int roaming, int subId);


    int getSlotId(int subId);
    int getSlotIndex(int subId);


    int[] getSubId(int slotId);
    int[] getSubId(int slotIndex);


    int getDefaultSubId();
    int getDefaultSubId();


@@ -177,10 +177,10 @@ interface ISub {
    String getSubscriptionProperty(int subId, String propKey, String callingPackage);
    String getSubscriptionProperty(int subId, String propKey, String callingPackage);


    /**
    /**
     * Get the SIM state for the slot idx
     * Get the SIM state for the slot index
     * @return SIM state as the ordinal of IccCardConstants.State
     * @return SIM state as the ordinal of IccCardConstants.State
     */
     */
    int getSimStateForSlotIdx(int slotIdx);
    int getSimStateForSlotIndex(int slotIndex);


    boolean isActiveSubId(int subId);
    boolean isActiveSubId(int subId);
}
}
Loading