Loading src/java/com/android/internal/telephony/uicc/UiccController.java +6 −16 Original line number Diff line number Diff line Loading @@ -268,25 +268,15 @@ public class UiccController extends Handler { } /** * Given the slot index, return the phone ID, or -1 if no phone is associated with the given * slot. * Given the slot index and port index, return the phone ID, or -1 if no phone is associated * with the given slot and port. * @param slotId the slot index to check * @param portIndex unique index referring to a port belonging to the SIM slot * @return the associated phone ID or -1 */ // TODO In case of MEP, pass port index as well, so that proper phoneId can be retrieved. public int getPhoneIdFromSlotId(int slotId/*, int portIdx*/) { for (int i = 0; i < mPhoneIdToSlotId.length; i++) { if (mPhoneIdToSlotId[i] == slotId) { /*// In case of MEP, slotId can be same for different phoneIds. // So add condition check for portIdx as well. UiccPort uiccPort = getUiccPortForPhone(mPhoneIdToSlotId[i]); if (uiccPort != null && uiccPort.getPortIdx() == portIdx) { return i; }*/ return i; } } return -1; public int getPhoneIdFromSlotPortIndex(int slotId, int portIndex) { UiccSlot slot = getUiccSlot(slotId); return slot == null ? UiccSlot.INVALID_PHONE_ID : slot.getPhoneIdFromPortIndex(portIndex); } /** Loading src/java/com/android/internal/telephony/uicc/UiccSlot.java +12 −3 Original line number Diff line number Diff line Loading @@ -197,7 +197,9 @@ public class UiccSlot extends Handler { } mPortIdxToPhoneId.clear(); for (int i = 0; i < simPortInfos.length; i++) { mPortIdxToPhoneId.put(i, simPortInfos[i].mLogicalSlotIndex); // If port is not active, update with invalid phone id(i.e. -1) mPortIdxToPhoneId.put(i, simPortInfos[i].mPortActive ? simPortInfos[i].mLogicalSlotIndex : INVALID_PHONE_ID); } } } Loading Loading @@ -228,7 +230,7 @@ public class UiccSlot extends Handler { } } public int getPortIdx(int phoneId) { public int getPortIndexFromPhoneId(int phoneId) { synchronized (mLock) { for (Map.Entry<Integer, Integer> entry : mPortIdxToPhoneId.entrySet()) { if (entry.getValue() == phoneId) { Loading @@ -239,6 +241,12 @@ public class UiccSlot extends Handler { } } public int getPhoneIdFromPortIndex(int portIndex) { synchronized (mLock) { return mPortIdxToPhoneId.getOrDefault(portIndex, INVALID_PHONE_ID); } } public boolean isPortActive(int portIdx) { UiccPort uiccPort = null; synchronized (mLock) { Loading Loading @@ -489,7 +497,8 @@ public class UiccSlot extends Handler { if (phoneId != INVALID_PHONE_ID) { UiccController.updateInternalIccState( mContext, IccCardConstants.State.UNKNOWN, null, phoneId); mLastRadioState.put(getPortIdx(phoneId), TelephonyManager.RADIO_POWER_UNAVAILABLE); mLastRadioState.put(getPortIndexFromPhoneId(phoneId), TelephonyManager.RADIO_POWER_UNAVAILABLE); } mCardState = null; Loading Loading
src/java/com/android/internal/telephony/uicc/UiccController.java +6 −16 Original line number Diff line number Diff line Loading @@ -268,25 +268,15 @@ public class UiccController extends Handler { } /** * Given the slot index, return the phone ID, or -1 if no phone is associated with the given * slot. * Given the slot index and port index, return the phone ID, or -1 if no phone is associated * with the given slot and port. * @param slotId the slot index to check * @param portIndex unique index referring to a port belonging to the SIM slot * @return the associated phone ID or -1 */ // TODO In case of MEP, pass port index as well, so that proper phoneId can be retrieved. public int getPhoneIdFromSlotId(int slotId/*, int portIdx*/) { for (int i = 0; i < mPhoneIdToSlotId.length; i++) { if (mPhoneIdToSlotId[i] == slotId) { /*// In case of MEP, slotId can be same for different phoneIds. // So add condition check for portIdx as well. UiccPort uiccPort = getUiccPortForPhone(mPhoneIdToSlotId[i]); if (uiccPort != null && uiccPort.getPortIdx() == portIdx) { return i; }*/ return i; } } return -1; public int getPhoneIdFromSlotPortIndex(int slotId, int portIndex) { UiccSlot slot = getUiccSlot(slotId); return slot == null ? UiccSlot.INVALID_PHONE_ID : slot.getPhoneIdFromPortIndex(portIndex); } /** Loading
src/java/com/android/internal/telephony/uicc/UiccSlot.java +12 −3 Original line number Diff line number Diff line Loading @@ -197,7 +197,9 @@ public class UiccSlot extends Handler { } mPortIdxToPhoneId.clear(); for (int i = 0; i < simPortInfos.length; i++) { mPortIdxToPhoneId.put(i, simPortInfos[i].mLogicalSlotIndex); // If port is not active, update with invalid phone id(i.e. -1) mPortIdxToPhoneId.put(i, simPortInfos[i].mPortActive ? simPortInfos[i].mLogicalSlotIndex : INVALID_PHONE_ID); } } } Loading Loading @@ -228,7 +230,7 @@ public class UiccSlot extends Handler { } } public int getPortIdx(int phoneId) { public int getPortIndexFromPhoneId(int phoneId) { synchronized (mLock) { for (Map.Entry<Integer, Integer> entry : mPortIdxToPhoneId.entrySet()) { if (entry.getValue() == phoneId) { Loading @@ -239,6 +241,12 @@ public class UiccSlot extends Handler { } } public int getPhoneIdFromPortIndex(int portIndex) { synchronized (mLock) { return mPortIdxToPhoneId.getOrDefault(portIndex, INVALID_PHONE_ID); } } public boolean isPortActive(int portIdx) { UiccPort uiccPort = null; synchronized (mLock) { Loading Loading @@ -489,7 +497,8 @@ public class UiccSlot extends Handler { if (phoneId != INVALID_PHONE_ID) { UiccController.updateInternalIccState( mContext, IccCardConstants.State.UNKNOWN, null, phoneId); mLastRadioState.put(getPortIdx(phoneId), TelephonyManager.RADIO_POWER_UNAVAILABLE); mLastRadioState.put(getPortIndexFromPhoneId(phoneId), TelephonyManager.RADIO_POWER_UNAVAILABLE); } mCardState = null; Loading