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

Commit 89070b00 authored by Sanket Padawe's avatar Sanket Padawe Committed by android-build-merger
Browse files

Merge "Change 'idx' to 'index' for SubscriptionManager api." am: 5b18fad2

am: a9c03ba2

Change-Id: Ifb4c4ff2928e1f5da291d7e8cf5e269caae09416
parents 9b414526 a9c03ba2
Loading
Loading
Loading
Loading
+95 −94
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ import java.util.concurrent.ConcurrentHashMap;
 * SubscriptionController to provide an inter-process communication to
 * access Sms in Icc.
 *
 * Any setters which take subId, slotId or phoneId as a parameter will throw an exception if the
 * Any setters which take subId, slotIndex or phoneId as a parameter will throw an exception if the
 * parameter equals the corresponding INVALID_XXX_ID or DEFAULT_XXX_ID.
 *
 * All getters will lookup the corresponding default if the parameter is DEFAULT_XXX_ID. Ie calling
@@ -66,9 +66,9 @@ import java.util.concurrent.ConcurrentHashMap;
 *
 * Finally, any getters which perform the mapping between subscriptions, slots and phones will
 * return the corresponding INVALID_XXX_ID if the parameter is INVALID_XXX_ID. All other getters
 * will fail and return the appropriate error value. Ie calling getSlotId(INVALID_SUBSCRIPTION_ID)
 * will return INVALID_SLOT_ID and calling getSubInfoForSubscriber(INVALID_SUBSCRIPTION_ID)
 * will return null.
 * will fail and return the appropriate error value. Ie calling
 * getSlotIndex(INVALID_SUBSCRIPTION_ID) will return INVALID_SIM_SLOT_INDEX and calling
 * getSubInfoForSubscriber(INVALID_SUBSCRIPTION_ID) will return null.
 *
 */
public class SubscriptionController extends ISub.Stub {
@@ -128,7 +128,7 @@ public class SubscriptionController extends ISub.Stub {
    private AppOpsManager mAppOps;

    // FIXME: Does not allow for multiple subs in a slot and change to SparseArray
    private static Map<Integer, Integer> sSlotIdxToSubId =
    private static Map<Integer, Integer> sSlotIndexToSubId =
            new ConcurrentHashMap<Integer, Integer>();
    private static int mDefaultFallbackSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
    private static int mDefaultPhoneId = SubscriptionManager.DEFAULT_PHONE_INDEX;
@@ -185,7 +185,7 @@ public class SubscriptionController extends ISub.Stub {
    }

    private boolean isSubInfoReady() {
        return sSlotIdxToSubId.size() > 0;
        return sSlotIndexToSubId.size() > 0;
    }

    private SubscriptionController(Phone phone) {
@@ -466,13 +466,13 @@ public class SubscriptionController extends ISub.Stub {
    }

    /**
     * Get the active SubscriptionInfo associated with the slotIdx
     * @param slotIdx the slot which the subscription is inserted
     * Get the active SubscriptionInfo associated with the slotIndex
     * @param slotIndex the slot which the subscription is inserted
     * @param callingPackage The package making the IPC.
     * @return SubscriptionInfo, maybe null if its not active
     */
    @Override
    public SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIdx,
    public SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIndex,
            String callingPackage) {
        if (!canReadPhoneState(callingPackage, "getActiveSubscriptionInfoForSimSlotIndex")) {
            return null;
@@ -485,16 +485,16 @@ public class SubscriptionController extends ISub.Stub {
                    mContext.getOpPackageName());
            if (subList != null) {
                for (SubscriptionInfo si : subList) {
                    if (si.getSimSlotIndex() == slotIdx) {
                    if (si.getSimSlotIndex() == slotIndex) {
                        if (DBG) {
                            logd("[getActiveSubscriptionInfoForSimSlotIndex]+ slotIdx=" + slotIdx
                                    + " subId=" + si);
                            logd("[getActiveSubscriptionInfoForSimSlotIndex]+ slotIndex="
                                    + slotIndex + " subId=" + si);
                        }
                        return si;
                    }
                }
                if (DBG) {
                    logd("[getActiveSubscriptionInfoForSimSlotIndex]+ slotIdx=" + slotIdx
                    logd("[getActiveSubscriptionInfoForSimSlotIndex]+ slotIndex=" + slotIndex
                            + " subId=null");
                }
            } else {
@@ -666,13 +666,13 @@ public class SubscriptionController extends ISub.Stub {
    /**
     * Add a new SubInfoRecord to subinfo database if needed
     * @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 0 if success, < 0 on error.
     */
    @Override
    public int addSubInfoRecord(String iccId, int slotId) {
    public int addSubInfoRecord(String iccId, int slotIndex) {
        if (DBG) logdl("[addSubInfoRecord]+ iccId:" + SubscriptionInfo.givePrintableIccid(iccId) +
                " slotId:" + slotId);
                " slotIndex:" + slotIndex);

        enforceModifyPhoneState("addSubInfoRecord");

@@ -699,7 +699,7 @@ public class SubscriptionController extends ISub.Stub {
                    value.put(SubscriptionManager.ICC_ID, iccId);
                    // default SIM color differs between slots
                    value.put(SubscriptionManager.COLOR, color);
                    value.put(SubscriptionManager.SIM_SLOT_INDEX, slotId);
                    value.put(SubscriptionManager.SIM_SLOT_INDEX, slotIndex);
                    value.put(SubscriptionManager.CARRIER_NAME, "");
                    Uri uri = resolver.insert(SubscriptionManager.CONTENT_URI, value);
                    if (DBG) logdl("[addSubInfoRecord] New record created: " + uri);
@@ -709,8 +709,8 @@ public class SubscriptionController extends ISub.Stub {
                    int nameSource = cursor.getInt(2);
                    ContentValues value = new ContentValues();

                    if (slotId != oldSimInfoId) {
                        value.put(SubscriptionManager.SIM_SLOT_INDEX, slotId);
                    if (slotIndex != oldSimInfoId) {
                        value.put(SubscriptionManager.SIM_SLOT_INDEX, slotIndex);
                    }

                    if (nameSource != SubscriptionManager.NAME_SOURCE_USER_INPUT) {
@@ -733,30 +733,30 @@ public class SubscriptionController extends ISub.Stub {

            cursor = resolver.query(SubscriptionManager.CONTENT_URI, null,
                    SubscriptionManager.SIM_SLOT_INDEX + "=?",
                    new String[] {String.valueOf(slotId)}, null);
                    new String[] {String.valueOf(slotIndex)}, null);
            try {
                if (cursor != null && cursor.moveToFirst()) {
                    do {
                        int subId = cursor.getInt(cursor.getColumnIndexOrThrow(
                                SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID));
                        // If sSlotIdxToSubId already has a valid subId for a slotId/phoneId,
                        // do not add another subId for same slotId/phoneId.
                        Integer currentSubId = sSlotIdxToSubId.get(slotId);
                        // If sSlotIndexToSubId already has a valid subId for a slotIndex/phoneId,
                        // do not add another subId for same slotIndex/phoneId.
                        Integer currentSubId = sSlotIndexToSubId.get(slotIndex);
                        if (currentSubId == null
                                || !SubscriptionManager.isValidSubscriptionId(currentSubId)) {
                            // TODO While two subs active, if user deactivats first
                            // one, need to update the default subId with second one.

                            // FIXME: Currently we assume phoneId == slotId which in the future
                            // FIXME: Currently we assume phoneId == slotIndex which in the future
                            // may not be true, for instance with multiple subs per slot.
                            // But is true at the moment.
                            sSlotIdxToSubId.put(slotId, subId);
                            sSlotIndexToSubId.put(slotIndex, subId);
                            int subIdCountMax = getActiveSubInfoCountMax();
                            int defaultSubId = getDefaultSubId();
                            if (DBG) {
                                logdl("[addSubInfoRecord]"
                                        + " sSlotIdxToSubId.size=" + sSlotIdxToSubId.size()
                                        + " slotId=" + slotId + " subId=" + subId
                                        + " sSlotIndexToSubId.size=" + sSlotIndexToSubId.size()
                                        + " slotIndex=" + slotIndex + " subId=" + subId
                                        + " defaultSubId=" + defaultSubId + " simCount=" + subIdCountMax);
                            }

@@ -780,7 +780,7 @@ public class SubscriptionController extends ISub.Stub {
                                        + " && currentSubId is valid, IGNORE");
                            }
                        }
                        if (DBG) logdl("[addSubInfoRecord] hashmap(" + slotId + "," + subId + ")");
                        if (DBG) logdl("[addSubInfoRecord] hashmap(" + slotIndex + "," + subId + ")");
                    } while (cursor.moveToNext());
                }
            } finally {
@@ -790,7 +790,7 @@ public class SubscriptionController extends ISub.Stub {
            }

            // Set Display name after sub id is set above so as to get valid simCarrierName
            int[] subIds = getSubId(slotId);
            int[] subIds = getSubId(slotIndex);
            if (subIds == null || subIds.length == 0) {
                if (DBG) {
                    logdl("[addSubInfoRecord]- getSubId failed subIds == null || length == 0 subIds="
@@ -805,7 +805,7 @@ public class SubscriptionController extends ISub.Stub {
                if (!TextUtils.isEmpty(simCarrierName)) {
                    nameToSet = simCarrierName;
                } else {
                    nameToSet = "CARD " + Integer.toString(slotId + 1);
                    nameToSet = "CARD " + Integer.toString(slotIndex + 1);
                }

                ContentValues value = new ContentValues();
@@ -818,9 +818,9 @@ public class SubscriptionController extends ISub.Stub {
            }

            // Once the records are loaded, notify DcTracker
            sPhones[slotId].updateDataConnectionTracker();
            sPhones[slotIndex].updateDataConnectionTracker();

            if (DBG) logdl("[addSubInfoRecord]- info size=" + sSlotIdxToSubId.size());
            if (DBG) logdl("[addSubInfoRecord]- info size=" + sSlotIndexToSubId.size());

        } finally {
            Binder.restoreCallingIdentity(identity);
@@ -836,10 +836,10 @@ public class SubscriptionController extends ISub.Stub {
     * @param spn spn to be included in carrier text
     * @return true if carrier text is set, false otherwise
     */
    public boolean setPlmnSpn(int slotId, boolean showPlmn, String plmn, boolean showSpn,
    public boolean setPlmnSpn(int slotIndex, boolean showPlmn, String plmn, boolean showSpn,
                              String spn) {
        synchronized (mLock) {
            int[] subIds = getSubId(slotId);
            int[] subIds = getSubId(slotIndex);
            if (mContext.getPackageManager().resolveContentProvider(
                    SubscriptionManager.CONTENT_URI.getAuthority(), 0) == null ||
                    subIds == null ||
@@ -1096,37 +1096,37 @@ public class SubscriptionController extends ISub.Stub {
    }

    @Override
    public int getSlotId(int subId) {
        if (VDBG) printStackTrace("[getSlotId] subId=" + subId);
    public int getSlotIndex(int subId) {
        if (VDBG) printStackTrace("[getSlotIndex] subId=" + subId);

        if (subId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
            subId = getDefaultSubId();
        }
        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
            if (DBG) logd("[getSlotId]- subId invalid");
            if (DBG) logd("[getSlotIndex]- subId invalid");
            return SubscriptionManager.INVALID_SIM_SLOT_INDEX;
        }

        int size = sSlotIdxToSubId.size();
        int size = sSlotIndexToSubId.size();

        if (size == 0)
        {
            if (DBG) logd("[getSlotId]- size == 0, return SIM_NOT_INSERTED instead");
            if (DBG) logd("[getSlotIndex]- size == 0, return SIM_NOT_INSERTED instead");
            return SubscriptionManager.SIM_NOT_INSERTED;
        }

        for (Entry<Integer, Integer> entry: sSlotIdxToSubId.entrySet()) {
        for (Entry<Integer, Integer> entry: sSlotIndexToSubId.entrySet()) {
            int sim = entry.getKey();
            int sub = entry.getValue();

            if (subId == sub)
            {
                if (VDBG) logv("[getSlotId]- return = " + sim);
                if (VDBG) logv("[getSlotIndex]- return = " + sim);
                return sim;
            }
        }

        if (DBG) logd("[getSlotId]- return fail");
        if (DBG) logd("[getSlotIndex]- return fail");
        return SubscriptionManager.INVALID_SIM_SLOT_INDEX;
    }

@@ -1136,41 +1136,41 @@ public class SubscriptionController extends ISub.Stub {
     */
    @Override
    @Deprecated
    public int[] getSubId(int slotIdx) {
        if (VDBG) printStackTrace("[getSubId]+ slotIdx=" + slotIdx);
    public int[] getSubId(int slotIndex) {
        if (VDBG) printStackTrace("[getSubId]+ slotIndex=" + slotIndex);

        // Map default slotIdx to the current default subId.
        // Map default slotIndex to the current default subId.
        // TODO: Not used anywhere sp consider deleting as it's somewhat nebulous
        // as a slot maybe used for multiple different type of "connections"
        // such as: voice, data and sms. But we're doing the best we can and using
        // getDefaultSubId which makes a best guess.
        if (slotIdx == SubscriptionManager.DEFAULT_SIM_SLOT_INDEX) {
            slotIdx = getSlotId(getDefaultSubId());
            if (VDBG) logd("[getSubId] map default slotIdx=" + slotIdx);
        if (slotIndex == SubscriptionManager.DEFAULT_SIM_SLOT_INDEX) {
            slotIndex = getSlotIndex(getDefaultSubId());
            if (VDBG) logd("[getSubId] map default slotIndex=" + slotIndex);
        }

        // Check that we have a valid SlotIdx
        if (!SubscriptionManager.isValidSlotId(slotIdx)) {
            if (DBG) logd("[getSubId]- invalid slotIdx=" + slotIdx);
        // Check that we have a valid slotIndex
        if (!SubscriptionManager.isValidSlotIndex(slotIndex)) {
            if (DBG) logd("[getSubId]- invalid slotIndex=" + slotIndex);
            return null;
        }

        // Check if we've got any SubscriptionInfo records using slotIdToSubId as a surrogate.
        int size = sSlotIdxToSubId.size();
        // Check if we've got any SubscriptionInfo records using slotIndexToSubId as a surrogate.
        int size = sSlotIndexToSubId.size();
        if (size == 0) {
            if (VDBG) {
                logd("[getSubId]- sSlotIdxToSubId.size == 0, return DummySubIds slotIdx="
                        + slotIdx);
                logd("[getSubId]- sSlotIndexToSubId.size == 0, return DummySubIds slotIndex="
                        + slotIndex);
            }
            return getDummySubIds(slotIdx);
            return getDummySubIds(slotIndex);
        }

        // Create an array of subIds that are in this slot?
        ArrayList<Integer> subIds = new ArrayList<Integer>();
        for (Entry<Integer, Integer> entry: sSlotIdxToSubId.entrySet()) {
        for (Entry<Integer, Integer> entry: sSlotIndexToSubId.entrySet()) {
            int slot = entry.getKey();
            int sub = entry.getValue();
            if (slotIdx == slot) {
            if (slotIndex == slot) {
                subIds.add(sub);
            }
        }
@@ -1185,8 +1185,8 @@ public class SubscriptionController extends ISub.Stub {
            if (VDBG) logd("[getSubId]- subIdArr=" + subIdArr);
            return subIdArr;
        } else {
            if (DBG) logd("[getSubId]- numSubIds == 0, return DummySubIds slotIdx=" + slotIdx);
            return getDummySubIds(slotIdx);
            if (DBG) logd("[getSubId]- numSubIds == 0, return DummySubIds slotIndex=" + slotIndex);
            return getDummySubIds(slotIndex);
        }
    }

@@ -1208,15 +1208,15 @@ public class SubscriptionController extends ISub.Stub {
            return SubscriptionManager.INVALID_PHONE_INDEX;
        }

        int size = sSlotIdxToSubId.size();
        int size = sSlotIndexToSubId.size();
        if (size == 0) {
            phoneId = mDefaultPhoneId;
            if (DBG) logdl("[getPhoneId]- no sims, returning default phoneId=" + phoneId);
            return phoneId;
        }

        // FIXME: Assumes phoneId == slotId
        for (Entry<Integer, Integer> entry: sSlotIdxToSubId.entrySet()) {
        // FIXME: Assumes phoneId == slotIndex
        for (Entry<Integer, Integer> entry: sSlotIndexToSubId.entrySet()) {
            int sim = entry.getKey();
            int sub = entry.getValue();

@@ -1234,7 +1234,7 @@ public class SubscriptionController extends ISub.Stub {

    }

    private int[] getDummySubIds(int slotIdx) {
    private int[] getDummySubIds(int slotIndex) {
        // FIXME: Remove notion of Dummy SUBSCRIPTION_ID.
        // I tested this returning null as no one appears to care,
        // but no connection came up on sprout with two sims.
@@ -1243,10 +1243,10 @@ public class SubscriptionController extends ISub.Stub {
        if (numSubs > 0) {
            int[] dummyValues = new int[numSubs];
            for (int i = 0; i < numSubs; i++) {
                dummyValues[i] = SubscriptionManager.DUMMY_SUBSCRIPTION_ID_BASE - slotIdx;
                dummyValues[i] = SubscriptionManager.DUMMY_SUBSCRIPTION_ID_BASE - slotIndex;
            }
            if (VDBG) {
                logd("getDummySubIds: slotIdx=" + slotIdx
                logd("getDummySubIds: slotIndex=" + slotIndex
                    + " return " + numSubs + " DummySubIds with each subId=" + dummyValues[0]);
            }
            return dummyValues;
@@ -1265,14 +1265,14 @@ public class SubscriptionController extends ISub.Stub {
        // Now that all security checks passes, perform the operation as ourselves.
        final long identity = Binder.clearCallingIdentity();
        try {
            int size = sSlotIdxToSubId.size();
            int size = sSlotIndexToSubId.size();

            if (size == 0) {
                if (DBG) logdl("[clearSubInfo]- no simInfo size=" + size);
                return 0;
            }

            sSlotIdxToSubId.clear();
            sSlotIndexToSubId.clear();
            if (DBG) logdl("[clearSubInfo]- clear size=" + size);
            return size;
        } finally {
@@ -1554,7 +1554,7 @@ public class SubscriptionController extends ISub.Stub {
        return true;
    }

    // FIXME: We need we should not be assuming phoneId == slotId as it will not be true
    // FIXME: We need we should not be assuming phoneId == slotIndex as it will not be true
    // when there are multiple subscriptions per sim and probably for other reasons.
    public int getSubIdUsingPhoneId(int phoneId) {
        int[] subIds = getSubId(phoneId);
@@ -1564,37 +1564,38 @@ public class SubscriptionController extends ISub.Stub {
        return subIds[0];
    }

    public int[] getSubIdUsingSlotId(int slotId) {
        return getSubId(slotId);
    public int[] getSubIdUsingSlotIndex(int slotIndex) {
        return getSubId(slotIndex);
    }

    public List<SubscriptionInfo> getSubInfoUsingSlotIdWithCheck(int slotId, boolean needCheck,
    public List<SubscriptionInfo> getSubInfoUsingSlotIndexWithCheck(int slotIndex,
                                                                    boolean needCheck,
                                                                    String callingPackage) {
        if (DBG) logd("[getSubInfoUsingSlotIdWithCheck]+ slotId:" + slotId);
        if (DBG) logd("[getSubInfoUsingSlotIndexWithCheck]+ slotIndex:" + slotIndex);

        if (!canReadPhoneState(callingPackage, "getSubInfoUsingSlotIdWithCheck")) {
        if (!canReadPhoneState(callingPackage, "getSubInfoUsingSlotIndexWithCheck")) {
            return null;
        }

        // Now that all security checks passes, perform the operation as ourselves.
        final long identity = Binder.clearCallingIdentity();
        try {
            if (slotId == SubscriptionManager.DEFAULT_SIM_SLOT_INDEX) {
                slotId = getSlotId(getDefaultSubId());
            if (slotIndex == SubscriptionManager.DEFAULT_SIM_SLOT_INDEX) {
                slotIndex = getSlotIndex(getDefaultSubId());
            }
            if (!SubscriptionManager.isValidSlotId(slotId)) {
                if (DBG) logd("[getSubInfoUsingSlotIdWithCheck]- invalid slotId");
            if (!SubscriptionManager.isValidSlotIndex(slotIndex)) {
                if (DBG) logd("[getSubInfoUsingSlotIndexWithCheck]- invalid slotIndex");
                return null;
            }

            if (needCheck && !isSubInfoReady()) {
                if (DBG) logd("[getSubInfoUsingSlotIdWithCheck]- not ready");
                if (DBG) logd("[getSubInfoUsingSlotIndexWithCheck]- not ready");
                return null;
            }

            Cursor cursor = mContext.getContentResolver().query(SubscriptionManager.CONTENT_URI,
                    null, SubscriptionManager.SIM_SLOT_INDEX + "=?",
                    new String[]{String.valueOf(slotId)}, null);
                    new String[]{String.valueOf(slotIndex)}, null);
            ArrayList<SubscriptionInfo> subList = null;
            try {
                if (cursor != null) {
@@ -1613,7 +1614,7 @@ public class SubscriptionController extends ISub.Stub {
                    cursor.close();
                }
            }
            if (DBG) logd("[getSubInfoUsingSlotId]- null info return");
            if (DBG) logd("[getSubInfoUsingSlotIndex]- null info return");

            return subList;
        } finally {
@@ -1639,7 +1640,7 @@ public class SubscriptionController extends ISub.Stub {
     */
    @Override
    public int[] getActiveSubIdList() {
        Set<Entry<Integer, Integer>> simInfoSet = sSlotIdxToSubId.entrySet();
        Set<Entry<Integer, Integer>> simInfoSet = sSlotIndexToSubId.entrySet();

        int[] subIdArr = new int[simInfoSet.size()];
        int i = 0;
@@ -1659,25 +1660,25 @@ public class SubscriptionController extends ISub.Stub {
    @Override
    public boolean isActiveSubId(int subId) {
        boolean retVal = SubscriptionManager.isValidSubscriptionId(subId)
                && sSlotIdxToSubId.containsValue(subId);
                && sSlotIndexToSubId.containsValue(subId);

        if (VDBG) logdl("[isActiveSubId]- " + retVal);
        return retVal;
    }

    /**
     * Get the SIM state for the slot idx
     * Get the SIM state for the slot index
     * @return SIM state as the ordinal of {@See IccCardConstants.State}
     */
    @Override
    public int getSimStateForSlotIdx(int slotIdx) {
    public int getSimStateForSlotIndex(int slotIndex) {
        State simState;
        String err;
        if (slotIdx < 0) {
        if (slotIndex < 0) {
            simState = IccCardConstants.State.UNKNOWN;
            err = "invalid slotIdx";
            err = "invalid slotIndex";
        } else {
            Phone phone = PhoneFactory.getPhone(slotIdx);
            Phone phone = PhoneFactory.getPhone(slotIndex);
            if (phone == null) {
                simState = IccCardConstants.State.UNKNOWN;
                err = "phone == null";
@@ -1693,8 +1694,8 @@ public class SubscriptionController extends ISub.Stub {
            }
        }
        if (VDBG) {
            logd("getSimStateForSlotIdx: " + err + " simState=" + simState
                    + " ordinal=" + simState.ordinal() + " slotIdx=" + slotIdx);
            logd("getSimStateForSlotIndex: " + err + " simState=" + simState
                    + " ordinal=" + simState.ordinal() + " slotIndex=" + slotIndex);
        }
        return simState.ordinal();
    }
@@ -1747,7 +1748,7 @@ public class SubscriptionController extends ISub.Stub {
     */
    @Override
    public String getSubscriptionProperty(int subId, String propKey, String callingPackage) {
        if (!canReadPhoneState(callingPackage, "getSubInfoUsingSlotIdWithCheck")) {
        if (!canReadPhoneState(callingPackage, "getSubInfoUsingSlotIndexWithCheck")) {
            return null;
        }
        String resultValue = null;
@@ -1827,8 +1828,8 @@ public class SubscriptionController extends ISub.Stub {
                    .from(mContext).getDefaultSmsPhoneId());
            pw.flush();

            for (Entry<Integer, Integer> entry : sSlotIdxToSubId.entrySet()) {
                pw.println(" sSlotIdxToSubId[" + entry.getKey() + "]: subId=" + entry.getValue());
            for (Entry<Integer, Integer> entry : sSlotIndexToSubId.entrySet()) {
                pw.println(" sSlotIndexToSubId[" + entry.getKey() + "]: subId=" + entry.getValue());
            }
            pw.flush();
            pw.println("++++++++++++++++++++++++++++++++");
+1 −1
Original line number Diff line number Diff line
@@ -557,7 +557,7 @@ public class SubscriptionInfoUpdater extends Handler {
        for (int i = 0; i < PROJECT_SIM_NUM; i++) {
            oldIccId[i] = null;
            List<SubscriptionInfo> oldSubInfo =
                    SubscriptionController.getInstance().getSubInfoUsingSlotIdWithCheck(i, false,
                    SubscriptionController.getInstance().getSubInfoUsingSlotIndexWithCheck(i, false,
                    mContext.getOpPackageName());
            if (oldSubInfo != null) {
                oldIccId[i] = oldSubInfo.get(0).getIccId();
+2 −2
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ public class CatService extends Handler implements AppInterface {
            mHandlerThread = null;
            removeCallbacksAndMessages(null);
            if (sInstance != null) {
                if (SubscriptionManager.isValidSlotId(mSlotId)) {
                if (SubscriptionManager.isValidSlotIndex(mSlotId)) {
                    sInstance[mSlotId] = null;
                } else {
                    CatLog.d(this, "error: invaild slot id: " + mSlotId);
@@ -777,7 +777,7 @@ public class CatService extends Handler implements AppInterface {
        int slotId = PhoneConstants.DEFAULT_CARD_INDEX;
        SubscriptionController sControl = SubscriptionController.getInstance();
        if (sControl != null) {
            slotId = sControl.getSlotId(sControl.getDefaultSubId());
            slotId = sControl.getSlotIndex(sControl.getDefaultSubId());
        }
        return getInstance(null, null, null, slotId);
    }
+5 −5

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ public class IccCardProxy extends Handler implements IccCard {

    private void broadcastIccStateChangedIntent(String value, String reason) {
        synchronized (mLock) {
            if (mPhoneId == null || !SubscriptionManager.isValidSlotId(mPhoneId)) {
            if (mPhoneId == null || !SubscriptionManager.isValidSlotIndex(mPhoneId)) {
                loge("broadcastIccStateChangedIntent: mPhoneId=" + mPhoneId
                        + " is invalid; Return!!");
                return;
@@ -513,7 +513,7 @@ public class IccCardProxy extends Handler implements IccCard {

    private void setExternalState(State newState, boolean override) {
        synchronized (mLock) {
            if (mPhoneId == null || !SubscriptionManager.isValidSlotId(mPhoneId)) {
            if (mPhoneId == null || !SubscriptionManager.isValidSlotIndex(mPhoneId)) {
                loge("setExternalState: mPhoneId=" + mPhoneId + " is invalid; Return!!");
                return;
            }
Loading