Loading src/java/com/android/internal/telephony/SubscriptionController.java +22 −3 Original line number Diff line number Diff line Loading @@ -588,6 +588,8 @@ public class SubscriptionController extends ISub.Stub { SubscriptionManager.GROUP_UUID)); int profileClass = cursor.getInt(cursor.getColumnIndexOrThrow( SubscriptionManager.PROFILE_CLASS)); int portIndex = cursor.getInt(cursor.getColumnIndexOrThrow( SubscriptionManager.PORT_INDEX)); int subType = cursor.getInt(cursor.getColumnIndexOrThrow( SubscriptionManager.SUBSCRIPTION_TYPE)); String groupOwner = getOptionalStringFromCursor(cursor, SubscriptionManager.GROUP_OWNER, Loading @@ -605,7 +607,8 @@ public class SubscriptionController extends ISub.Stub { + " countIso:" + countryIso + " isEmbedded:" + isEmbedded + " accessRules:" + Arrays.toString(accessRules) + " carrierConfigAccessRules: " + Arrays.toString(carrierConfigAccessRules) + " cardId:" + cardIdToPrint + " publicCardId:" + publicCardId + " cardId:" + cardIdToPrint + " portIndex:" + portIndex + " publicCardId:" + publicCardId + " isOpportunistic:" + isOpportunistic + " groupUUID:" + groupUUID + " profileClass:" + profileClass + " subscriptionType: " + subType + " carrierConfigAccessRules:" + carrierConfigAccessRules Loading @@ -621,7 +624,8 @@ public class SubscriptionController extends ISub.Stub { carrierName, nameSource, iconTint, number, dataRoaming, /* icon= */ null, mcc, mnc, countryIso, isEmbedded, accessRules, cardId, publicCardId, isOpportunistic, groupUUID, /* isGroupDisabled= */ false , carrierId, profileClass, subType, groupOwner, carrierConfigAccessRules, areUiccApplicationsEnabled); subType, groupOwner, carrierConfigAccessRules, areUiccApplicationsEnabled, portIndex); info.setAssociatedPlmns(ehplmns, hplmns); return info; } Loading Loading @@ -1366,7 +1370,8 @@ public class SubscriptionController extends ISub.Stub { Cursor cursor = resolver.query(SubscriptionManager.CONTENT_URI, new String[]{SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID, SubscriptionManager.SIM_SLOT_INDEX, SubscriptionManager.NAME_SOURCE, SubscriptionManager.ICC_ID, SubscriptionManager.CARD_ID}, SubscriptionManager.ICC_ID, SubscriptionManager.CARD_ID, SubscriptionManager.PORT_INDEX}, selection, args, null); boolean setDisplayName = false; Loading @@ -1393,6 +1398,7 @@ public class SubscriptionController extends ISub.Stub { int nameSource = cursor.getInt(2); String oldIccId = cursor.getString(3); String oldCardId = cursor.getString(4); int oldPortIndex = cursor.getInt(5); ContentValues value = new ContentValues(); if (slotIndex != oldSimInfoId) { Loading @@ -1412,6 +1418,15 @@ public class SubscriptionController extends ISub.Stub { } } //update portIndex for pSim UiccSlot slot = mUiccController.getUiccSlotForPhone(slotIndex); if (slot != null && !slot.isEuicc()) { int portIndex = slot.getPortIndexFromIccId(uniqueId); if (portIndex != oldPortIndex) { value.put(SubscriptionManager.PORT_INDEX, portIndex); } } if (value.size() > 0) { resolver.update(SubscriptionManager.getUriForSubscriptionId(subId), value, null, null); Loading Loading @@ -1729,6 +1744,10 @@ public class SubscriptionController extends ISub.Stub { value.put(SubscriptionManager.CARD_ID, cardId); } } UiccSlot slot = mUiccController.getUiccSlotForPhone(slotIndex); if (slot != null) { value.put(SubscriptionManager.PORT_INDEX, slot.getPortIndexFromIccId(uniqueId)); } } value.put(SubscriptionManager.ALLOWED_NETWORK_TYPES, "user=" + RadioAccessFamily.getRafFromNetworkType( Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +18 −1 Original line number Diff line number Diff line Loading @@ -65,8 +65,10 @@ import com.android.telephony.Rlog; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.CopyOnWriteArraySet; import java.util.stream.Collectors; /** *@hide Loading Loading @@ -699,8 +701,12 @@ public class SubscriptionInfoUpdater extends Handler { } String iccId = sInactiveIccIds[phoneId] != null ? sInactiveIccIds[phoneId] : sIccId[phoneId]; ContentValues value = new ContentValues(1); ContentValues value = new ContentValues(); value.put(SubscriptionManager.UICC_APPLICATIONS_ENABLED, true); if (isSimAbsent) { // When sim is absent, set the port index to invalid port index -1; value.put(SubscriptionManager.PORT_INDEX, TelephonyManager.INVALID_PORT_INDEX); } sContext.getContentResolver().update(SubscriptionManager.CONTENT_URI, value, SubscriptionManager.ICC_ID + "=\'" + iccId + "\'", null); sInactiveIccIds[phoneId] = null; Loading Loading @@ -983,6 +989,8 @@ public class SubscriptionInfoUpdater extends Handler { SubscriptionManager.NAME_SOURCE_CARRIER); } values.put(SubscriptionManager.PROFILE_CLASS, embeddedProfile.getProfileClass()); values.put(SubscriptionManager.PORT_INDEX, getEmbeddedProfilePortIndex(embeddedProfile.getIccid())); CarrierIdentifier cid = embeddedProfile.getCarrierIdentifier(); if (cid != null) { // Due to the limited subscription information, carrier id identified here might Loading Loading @@ -1047,6 +1055,15 @@ public class SubscriptionInfoUpdater extends Handler { return hasChanges; } private int getEmbeddedProfilePortIndex(String iccId) { UiccSlot[] slots = UiccController.getInstance().getUiccSlots(); for (UiccSlot slot : slots) { if (slot != null && slot.isEuicc() && slot.isIccIdMappedToPortIndex(iccId)) { return slot.getPortIndexFromIccId(iccId); } } return TelephonyManager.INVALID_PORT_INDEX; } /** * Called by CarrierConfigLoader to update the subscription before sending a broadcast. */ Loading src/java/com/android/internal/telephony/uicc/UiccSlot.java +18 −0 Original line number Diff line number Diff line Loading @@ -241,6 +241,24 @@ public class UiccSlot extends Handler { } } public boolean isIccIdMappedToPortIndex(String iccId) { synchronized (mLock) { return mIccIds.containsValue(iccId); } } public int getPortIndexFromIccId(String iccId) { synchronized (mLock) { for (Map.Entry<Integer, String> entry : mIccIds.entrySet()) { if (entry.getValue().equalsIgnoreCase(iccId)) { return entry.getKey(); } } // If iccId is not found, return invalid port index. return TelephonyManager.INVALID_PORT_INDEX; } } public int getPhoneIdFromPortIndex(int portIndex) { synchronized (mLock) { return mPortIdxToPhoneId.getOrDefault(portIndex, INVALID_PHONE_ID); Loading tests/telephonytests/src/com/android/internal/telephony/FakeTelephonyProvider.java +2 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,8 @@ public class FakeTelephonyProvider extends MockContentProvider { + Telephony.SimInfo.COLUMN_ALLOWED_NETWORK_TYPES_FOR_REASONS + " TEXT," + Telephony.SimInfo.COLUMN_D2D_STATUS_SHARING + " INTEGER DEFAULT 0," + Telephony.SimInfo.COLUMN_D2D_STATUS_SHARING_SELECTED_CONTACTS + "TEXT," + Telephony.SimInfo.COLUMN_NR_ADVANCED_CALLING_ENABLED + " INTEGER DEFAULT -1" + Telephony.SimInfo.COLUMN_NR_ADVANCED_CALLING_ENABLED + " INTEGER DEFAULT -1," + Telephony.SimInfo.COLUMN_PORT_INDEX + " INTEGER DEFAULT -1" + ");"; } Loading Loading
src/java/com/android/internal/telephony/SubscriptionController.java +22 −3 Original line number Diff line number Diff line Loading @@ -588,6 +588,8 @@ public class SubscriptionController extends ISub.Stub { SubscriptionManager.GROUP_UUID)); int profileClass = cursor.getInt(cursor.getColumnIndexOrThrow( SubscriptionManager.PROFILE_CLASS)); int portIndex = cursor.getInt(cursor.getColumnIndexOrThrow( SubscriptionManager.PORT_INDEX)); int subType = cursor.getInt(cursor.getColumnIndexOrThrow( SubscriptionManager.SUBSCRIPTION_TYPE)); String groupOwner = getOptionalStringFromCursor(cursor, SubscriptionManager.GROUP_OWNER, Loading @@ -605,7 +607,8 @@ public class SubscriptionController extends ISub.Stub { + " countIso:" + countryIso + " isEmbedded:" + isEmbedded + " accessRules:" + Arrays.toString(accessRules) + " carrierConfigAccessRules: " + Arrays.toString(carrierConfigAccessRules) + " cardId:" + cardIdToPrint + " publicCardId:" + publicCardId + " cardId:" + cardIdToPrint + " portIndex:" + portIndex + " publicCardId:" + publicCardId + " isOpportunistic:" + isOpportunistic + " groupUUID:" + groupUUID + " profileClass:" + profileClass + " subscriptionType: " + subType + " carrierConfigAccessRules:" + carrierConfigAccessRules Loading @@ -621,7 +624,8 @@ public class SubscriptionController extends ISub.Stub { carrierName, nameSource, iconTint, number, dataRoaming, /* icon= */ null, mcc, mnc, countryIso, isEmbedded, accessRules, cardId, publicCardId, isOpportunistic, groupUUID, /* isGroupDisabled= */ false , carrierId, profileClass, subType, groupOwner, carrierConfigAccessRules, areUiccApplicationsEnabled); subType, groupOwner, carrierConfigAccessRules, areUiccApplicationsEnabled, portIndex); info.setAssociatedPlmns(ehplmns, hplmns); return info; } Loading Loading @@ -1366,7 +1370,8 @@ public class SubscriptionController extends ISub.Stub { Cursor cursor = resolver.query(SubscriptionManager.CONTENT_URI, new String[]{SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID, SubscriptionManager.SIM_SLOT_INDEX, SubscriptionManager.NAME_SOURCE, SubscriptionManager.ICC_ID, SubscriptionManager.CARD_ID}, SubscriptionManager.ICC_ID, SubscriptionManager.CARD_ID, SubscriptionManager.PORT_INDEX}, selection, args, null); boolean setDisplayName = false; Loading @@ -1393,6 +1398,7 @@ public class SubscriptionController extends ISub.Stub { int nameSource = cursor.getInt(2); String oldIccId = cursor.getString(3); String oldCardId = cursor.getString(4); int oldPortIndex = cursor.getInt(5); ContentValues value = new ContentValues(); if (slotIndex != oldSimInfoId) { Loading @@ -1412,6 +1418,15 @@ public class SubscriptionController extends ISub.Stub { } } //update portIndex for pSim UiccSlot slot = mUiccController.getUiccSlotForPhone(slotIndex); if (slot != null && !slot.isEuicc()) { int portIndex = slot.getPortIndexFromIccId(uniqueId); if (portIndex != oldPortIndex) { value.put(SubscriptionManager.PORT_INDEX, portIndex); } } if (value.size() > 0) { resolver.update(SubscriptionManager.getUriForSubscriptionId(subId), value, null, null); Loading Loading @@ -1729,6 +1744,10 @@ public class SubscriptionController extends ISub.Stub { value.put(SubscriptionManager.CARD_ID, cardId); } } UiccSlot slot = mUiccController.getUiccSlotForPhone(slotIndex); if (slot != null) { value.put(SubscriptionManager.PORT_INDEX, slot.getPortIndexFromIccId(uniqueId)); } } value.put(SubscriptionManager.ALLOWED_NETWORK_TYPES, "user=" + RadioAccessFamily.getRafFromNetworkType( Loading
src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +18 −1 Original line number Diff line number Diff line Loading @@ -65,8 +65,10 @@ import com.android.telephony.Rlog; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.CopyOnWriteArraySet; import java.util.stream.Collectors; /** *@hide Loading Loading @@ -699,8 +701,12 @@ public class SubscriptionInfoUpdater extends Handler { } String iccId = sInactiveIccIds[phoneId] != null ? sInactiveIccIds[phoneId] : sIccId[phoneId]; ContentValues value = new ContentValues(1); ContentValues value = new ContentValues(); value.put(SubscriptionManager.UICC_APPLICATIONS_ENABLED, true); if (isSimAbsent) { // When sim is absent, set the port index to invalid port index -1; value.put(SubscriptionManager.PORT_INDEX, TelephonyManager.INVALID_PORT_INDEX); } sContext.getContentResolver().update(SubscriptionManager.CONTENT_URI, value, SubscriptionManager.ICC_ID + "=\'" + iccId + "\'", null); sInactiveIccIds[phoneId] = null; Loading Loading @@ -983,6 +989,8 @@ public class SubscriptionInfoUpdater extends Handler { SubscriptionManager.NAME_SOURCE_CARRIER); } values.put(SubscriptionManager.PROFILE_CLASS, embeddedProfile.getProfileClass()); values.put(SubscriptionManager.PORT_INDEX, getEmbeddedProfilePortIndex(embeddedProfile.getIccid())); CarrierIdentifier cid = embeddedProfile.getCarrierIdentifier(); if (cid != null) { // Due to the limited subscription information, carrier id identified here might Loading Loading @@ -1047,6 +1055,15 @@ public class SubscriptionInfoUpdater extends Handler { return hasChanges; } private int getEmbeddedProfilePortIndex(String iccId) { UiccSlot[] slots = UiccController.getInstance().getUiccSlots(); for (UiccSlot slot : slots) { if (slot != null && slot.isEuicc() && slot.isIccIdMappedToPortIndex(iccId)) { return slot.getPortIndexFromIccId(iccId); } } return TelephonyManager.INVALID_PORT_INDEX; } /** * Called by CarrierConfigLoader to update the subscription before sending a broadcast. */ Loading
src/java/com/android/internal/telephony/uicc/UiccSlot.java +18 −0 Original line number Diff line number Diff line Loading @@ -241,6 +241,24 @@ public class UiccSlot extends Handler { } } public boolean isIccIdMappedToPortIndex(String iccId) { synchronized (mLock) { return mIccIds.containsValue(iccId); } } public int getPortIndexFromIccId(String iccId) { synchronized (mLock) { for (Map.Entry<Integer, String> entry : mIccIds.entrySet()) { if (entry.getValue().equalsIgnoreCase(iccId)) { return entry.getKey(); } } // If iccId is not found, return invalid port index. return TelephonyManager.INVALID_PORT_INDEX; } } public int getPhoneIdFromPortIndex(int portIndex) { synchronized (mLock) { return mPortIdxToPhoneId.getOrDefault(portIndex, INVALID_PHONE_ID); Loading
tests/telephonytests/src/com/android/internal/telephony/FakeTelephonyProvider.java +2 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,8 @@ public class FakeTelephonyProvider extends MockContentProvider { + Telephony.SimInfo.COLUMN_ALLOWED_NETWORK_TYPES_FOR_REASONS + " TEXT," + Telephony.SimInfo.COLUMN_D2D_STATUS_SHARING + " INTEGER DEFAULT 0," + Telephony.SimInfo.COLUMN_D2D_STATUS_SHARING_SELECTED_CONTACTS + "TEXT," + Telephony.SimInfo.COLUMN_NR_ADVANCED_CALLING_ENABLED + " INTEGER DEFAULT -1" + Telephony.SimInfo.COLUMN_NR_ADVANCED_CALLING_ENABLED + " INTEGER DEFAULT -1," + Telephony.SimInfo.COLUMN_PORT_INDEX + " INTEGER DEFAULT -1" + ");"; } Loading