Loading src/java/com/android/internal/telephony/PhoneFactory.java +1 −1 Original line number Diff line number Diff line Loading @@ -221,7 +221,7 @@ public class PhoneFactory { sSubInfoRecordUpdater = TelephonyComponentFactory.getInstance().inject( SubscriptionInfoUpdater.class.getName()). makeSubscriptionInfoUpdater(pfhandlerThread. getLooper(), context, sCommandsInterfaces); getLooper(), context, SubscriptionController.getInstance()); // Only bring up IMS if the device supports having an IMS stack. if (context.getPackageManager().hasSystemFeature( Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +42 −62 Original line number Diff line number Diff line Loading @@ -108,6 +108,7 @@ public class SubscriptionInfoUpdater extends Handler { @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) protected static String[] sIccId = new String[SUPPORTED_MODEM_COUNT]; protected SubscriptionController mSubscriptionController = null; private static String[] sInactiveIccIds = new String[SUPPORTED_MODEM_COUNT]; private static int[] sSimCardState = new int[SUPPORTED_MODEM_COUNT]; private static int[] sSimApplicationState = new int[SUPPORTED_MODEM_COUNT]; Loading @@ -134,14 +135,13 @@ public class SubscriptionInfoUpdater extends Handler { void run(boolean hasChanges); } // TODO: The SubscriptionController instance should be passed in here from PhoneFactory // rather than invoking the static getter all over the place. @VisibleForTesting public SubscriptionInfoUpdater(Looper looper, Context context, CommandsInterface[] ci) { @VisibleForTesting public SubscriptionInfoUpdater(Looper looper, Context context, SubscriptionController sc) { logd("Constructor invoked"); mBackgroundHandler = new Handler(looper); sContext = context; mSubscriptionController = sc; mSubscriptionManager = SubscriptionManager.from(sContext); mEuiccManager = (EuiccManager) sContext.getSystemService(Context.EUICC_SERVICE); Loading Loading @@ -308,7 +308,7 @@ public class SubscriptionInfoUpdater extends Handler { cardIds.add(getCardIdFromPhoneId(msg.arg1)); updateEmbeddedSubscriptions(cardIds, (hasChanges) -> { if (hasChanges) { SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); } }); handleSimNotReady(msg.arg1); Loading @@ -319,7 +319,7 @@ public class SubscriptionInfoUpdater extends Handler { Runnable r = (Runnable) msg.obj; updateEmbeddedSubscriptions(cardIds, (hasChanges) -> { if (hasChanges) { SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); } if (r != null) { r.run(); Loading Loading @@ -414,7 +414,7 @@ public class SubscriptionInfoUpdater extends Handler { cardIds.add(getCardIdFromPhoneId(phoneId)); updateEmbeddedSubscriptions(cardIds, (hasChanges) -> { if (hasChanges) { SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); } }); broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_READY, null); Loading Loading @@ -459,8 +459,9 @@ public class SubscriptionInfoUpdater extends Handler { // handleSimNotReady so this will be evaluated again. UiccSlot slot = UiccController.getInstance().getUiccSlotForPhone(phoneId); if (slot == null || slot.getIccId() == null) return false; SubscriptionInfo info = SubscriptionController.getInstance() .getSubInfoForIccId(IccUtils.stripTrailingFs(slot.getIccId())); SubscriptionInfo info = mSubscriptionController.getSubInfoForIccId( IccUtils.stripTrailingFs(slot.getIccId())); return info != null && !info.areUiccApplicationsEnabled(); } Loading @@ -487,8 +488,8 @@ public class SubscriptionInfoUpdater extends Handler { sIccId[phoneId] = IccUtils.stripTrailingFs(records.getFullIccId()); updateSubscriptionInfoByIccId(phoneId, true /* updateEmbeddedSubs */); List<SubscriptionInfo> subscriptionInfos = SubscriptionController.getInstance() .getSubInfoUsingSlotIndexPrivileged(phoneId); List<SubscriptionInfo> subscriptionInfos = mSubscriptionController.getSubInfoUsingSlotIndexPrivileged(phoneId); if (subscriptionInfos == null || subscriptionInfos.isEmpty()) { loge("empty subinfo for phoneId: " + phoneId + "could not update ContentResolver"); } else { Loading @@ -499,10 +500,10 @@ public class SubscriptionInfoUpdater extends Handler { String operator = tm.getSimOperatorNumeric(subId); if (!TextUtils.isEmpty(operator)) { if (subId == SubscriptionController.getInstance().getDefaultSubId()) { if (subId == mSubscriptionController.getDefaultSubId()) { MccTable.updateMccMncConfiguration(sContext, operator); } SubscriptionController.getInstance().setMccMnc(operator, subId); mSubscriptionController.setMccMnc(operator, subId); } else { logd("EVENT_RECORDS_LOADED Operator name is null"); } Loading @@ -510,25 +511,25 @@ public class SubscriptionInfoUpdater extends Handler { String iso = tm.getSimCountryIsoForPhone(phoneId); if (!TextUtils.isEmpty(iso)) { SubscriptionController.getInstance().setCountryIso(iso, subId); mSubscriptionController.setCountryIso(iso, subId); } else { logd("EVENT_RECORDS_LOADED sim country iso is null"); } String msisdn = tm.getLine1Number(subId); if (msisdn != null) { SubscriptionController.getInstance().setDisplayNumber(msisdn, subId); mSubscriptionController.setDisplayNumber(msisdn, subId); } String imsi = tm.createForSubscriptionId(subId).getSubscriberId(); if (imsi != null) { SubscriptionController.getInstance().setImsi(imsi, subId); mSubscriptionController.setImsi(imsi, subId); } String[] ehplmns = records.getEhplmns(); String[] hplmns = records.getPlmnsFromHplmnActRecord(); if (ehplmns != null || hplmns != null) { SubscriptionController.getInstance().setAssociatedPlmns(ehplmns, hplmns, subId); mSubscriptionController.setAssociatedPlmns(ehplmns, hplmns, subId); } /* Update preferred network type and network selection mode on SIM change. Loading Loading @@ -620,8 +621,8 @@ public class SubscriptionInfoUpdater extends Handler { if (!TextUtils.isEmpty(iccId)) { // If iccId is new, add a subscription record in the db. String strippedIccId = IccUtils.stripTrailingFs(iccId); if (SubscriptionController.getInstance().getSubInfoForIccId(strippedIccId) == null) { SubscriptionController.getInstance().insertEmptySubInfoRecord( if (mSubscriptionController.getSubInfoForIccId(strippedIccId) == null) { mSubscriptionController.insertEmptySubInfoRecord( strippedIccId, "CARD", SubscriptionManager.INVALID_PHONE_INDEX, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); } Loading Loading @@ -707,7 +708,7 @@ public class SubscriptionInfoUpdater extends Handler { // Clear phoneId only when sim absent is not enough. It's possible to switch SIM profile // within the same slot. Need to clear the slot index of the previous sub. Thus always clear // for the changing slot first. SubscriptionController.getInstance().clearSubInfoRecord(phoneId); mSubscriptionController.clearSubInfoRecord(phoneId); // If SIM is not absent, insert new record or update existing record. if (!ICCID_STRING_FOR_NO_SIM.equals(sIccId[phoneId])) { Loading @@ -716,8 +717,8 @@ public class SubscriptionInfoUpdater extends Handler { mSubscriptionManager.addSubscriptionInfoRecord(sIccId[phoneId], phoneId); } List<SubscriptionInfo> subInfos = SubscriptionController.getInstance() .getSubInfoUsingSlotIndexPrivileged(phoneId); List<SubscriptionInfo> subInfos = mSubscriptionController.getSubInfoUsingSlotIndexPrivileged(phoneId); if (subInfos != null) { boolean changed = false; for (int i = 0; i < subInfos.size(); i++) { Loading @@ -736,7 +737,7 @@ public class SubscriptionInfoUpdater extends Handler { } if (changed) { // refresh Cached Active Subscription Info List SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList(); mSubscriptionController.refreshCachedActiveSubscriptionInfoList(); } } Loading Loading @@ -766,22 +767,22 @@ public class SubscriptionInfoUpdater extends Handler { } updateEmbeddedSubscriptions(cardIds, (hasChanges) -> { if (hasChanges) { SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); } if (DBG) logd("updateSubscriptionInfoByIccId: SubscriptionInfo update complete"); }); } SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); if (DBG) logd("updateSubscriptionInfoByIccId: SubscriptionInfo update complete"); } private static void setSubInfoInitialized() { private void setSubInfoInitialized() { // Should only be triggered once. if (!sIsSubInfoInitialized) { if (DBG) logd("SubInfo Initialized"); sIsSubInfoInitialized = true; SubscriptionController.getInstance().notifySubInfoReady(); mSubscriptionController.notifySubInfoReady(); MultiSimSettingController.getInstance().notifyAllSubscriptionLoaded(); } } Loading Loading @@ -891,8 +892,9 @@ public class SubscriptionInfoUpdater extends Handler { // Update or insert records for all embedded subscriptions (except non-removable ones if the // current eUICC is non-removable, since we assume these are still accessible though not // returned by the eUICC controller). List<SubscriptionInfo> existingSubscriptions = SubscriptionController.getInstance() .getSubscriptionInfoListForEmbeddedSubscriptionUpdate(embeddedIccids, isRemovable); List<SubscriptionInfo> existingSubscriptions = mSubscriptionController.getSubscriptionInfoListForEmbeddedSubscriptionUpdate( embeddedIccids, isRemovable); ContentResolver contentResolver = sContext.getContentResolver(); for (EuiccProfileInfo embeddedProfile : embeddedProfiles) { int index = Loading @@ -901,7 +903,7 @@ public class SubscriptionInfoUpdater extends Handler { int nameSource = SubscriptionManager.NAME_SOURCE_CARRIER_ID; if (index < 0) { // No existing entry for this ICCID; create an empty one. SubscriptionController.getInstance().insertEmptySubInfoRecord( mSubscriptionController.insertEmptySubInfoRecord( embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED); } else { nameSource = existingSubscriptions.get(index).getNameSource(); Loading Loading @@ -963,7 +965,7 @@ public class SubscriptionInfoUpdater extends Handler { SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.getIccid() + "\"", null); // refresh Cached Active Subscription Info List SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList(); mSubscriptionController.refreshCachedActiveSubscriptionInfoList(); } // Remove all remaining subscriptions which have embedded = true. We set embedded to false Loading Loading @@ -991,7 +993,7 @@ public class SubscriptionInfoUpdater extends Handler { contentResolver.update(SubscriptionManager.CONTENT_URI, values, whereClause, null); // refresh Cached Active Subscription Info List SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList(); mSubscriptionController.refreshCachedActiveSubscriptionInfoList(); } if (DBG) logd("updateEmbeddedSubscriptions done hasChanges=" + hasChanges); Loading Loading @@ -1041,20 +1043,14 @@ public class SubscriptionInfoUpdater extends Handler { return; } SubscriptionController sc = SubscriptionController.getInstance(); if (sc == null) { loge("SubscriptionController was null"); return; } int currentSubId = sc.getSubIdUsingPhoneId(phoneId); int currentSubId = mSubscriptionController.getSubIdUsingPhoneId(phoneId); if (!SubscriptionManager.isValidSubscriptionId(currentSubId) || currentSubId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) { if (DBG) logd("No subscription is active for phone being updated"); return; } SubscriptionInfo currentSubInfo = sc.getSubscriptionInfo(currentSubId); SubscriptionInfo currentSubInfo = mSubscriptionController.getSubscriptionInfo(currentSubId); if (currentSubInfo == null) { loge("Couldn't retrieve subscription info for current subscription"); return; Loading Loading @@ -1098,8 +1094,8 @@ public class SubscriptionInfoUpdater extends Handler { && currentSubInfo.getGroupUuid() != null) { cv.put(SubscriptionManager.GROUP_UUID, (String) null); if (DBG) logd("Group Removed for" + currentSubId); } else if (SubscriptionController.getInstance().canPackageManageGroup(groupUuid, configPackageName)) { } else if (mSubscriptionController.canPackageManageGroup( groupUuid, configPackageName)) { cv.put(SubscriptionManager.GROUP_UUID, groupUuid.toString()); cv.put(SubscriptionManager.GROUP_OWNER, configPackageName); if (DBG) logd("Group Added for" + currentSubId); Loading @@ -1114,8 +1110,8 @@ public class SubscriptionInfoUpdater extends Handler { } if (cv.size() > 0 && sContext.getContentResolver().update(SubscriptionManager .getUriForSubscriptionId(currentSubId), cv, null, null) > 0) { sc.refreshCachedActiveSubscriptionInfoList(); sc.notifySubscriptionInfoChanged(); mSubscriptionController.refreshCachedActiveSubscriptionInfoList(); mSubscriptionController.notifySubscriptionInfoChanged(); MultiSimSettingController.getInstance().notifySubscriptionGroupChanged(groupUuid); } } Loading @@ -1129,22 +1125,6 @@ public class SubscriptionInfoUpdater extends Handler { return -1; } private boolean isNewSim(String iccId, String decIccId, String[] oldIccId) { boolean newSim = true; for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) { if(iccId.equals(oldIccId[i])) { newSim = false; break; } else if (decIccId != null && decIccId.equals(oldIccId[i])) { newSim = false; break; } } logd("newSim = " + newSim); return newSim; } @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) protected void broadcastSimStateChanged(int phoneId, String state, String reason) { Intent i = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED); Loading src/java/com/android/internal/telephony/TelephonyComponentFactory.java +2 −2 Original line number Diff line number Diff line Loading @@ -443,7 +443,7 @@ public class TelephonyComponentFactory { } public SubscriptionInfoUpdater makeSubscriptionInfoUpdater(Looper looper, Context context, CommandsInterface[] ci) { return new SubscriptionInfoUpdater(looper, context, ci); SubscriptionController sc) { return new SubscriptionInfoUpdater(looper, context, sc); } } src/java/com/android/internal/telephony/vendor/VendorSubscriptionInfoUpdater.java +5 −6 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.util.Log; import java.util.ArrayList; import java.util.List; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.SubscriptionController; import com.android.internal.telephony.SubscriptionInfoUpdater; Loading @@ -49,10 +48,10 @@ public class VendorSubscriptionInfoUpdater extends SubscriptionInfoUpdater { .getSupportedModemCount(); static VendorSubscriptionInfoUpdater init(Looper looper, Context context, CommandsInterface[] ci) { SubscriptionController sc) { synchronized (VendorSubscriptionInfoUpdater.class) { if (sInstance == null) { sInstance = new VendorSubscriptionInfoUpdater(looper, context, ci); sInstance = new VendorSubscriptionInfoUpdater(looper, context, sc); } else { Log.wtf(LOG_TAG, "init() called multiple times! sInstance = " + sInstance); } Loading @@ -68,8 +67,8 @@ public class VendorSubscriptionInfoUpdater extends SubscriptionInfoUpdater { } protected VendorSubscriptionInfoUpdater(Looper looper, Context context, CommandsInterface[] ci) { super(looper, context, ci); SubscriptionController sc) { super(looper, context, sc); sContext = context; mIsRecordUpdateRequired = new boolean[SUPPORTED_MODEM_COUNT]; Loading Loading @@ -105,7 +104,7 @@ public class VendorSubscriptionInfoUpdater extends SubscriptionInfoUpdater { cardIds.add(getCardIdFromPhoneId(phoneId)); updateEmbeddedSubscriptions(cardIds, (hasChanges) -> { if (hasChanges) { SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); } }); broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_READY, null); Loading tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -162,8 +162,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { .getActiveSubIdList(/*visibleOnly*/false); mIccRecord = mUiccProfile.getIccRecords(); mUpdater = new SubscriptionInfoUpdater(Looper.myLooper(), mContext, new CommandsInterface[]{mSimulatedCommands}); mUpdater = new SubscriptionInfoUpdater(Looper.myLooper(), mContext, mSubscriptionController); processAllMessages(); assertFalse(mUpdater.isSubInfoInitialized()); Loading Loading
src/java/com/android/internal/telephony/PhoneFactory.java +1 −1 Original line number Diff line number Diff line Loading @@ -221,7 +221,7 @@ public class PhoneFactory { sSubInfoRecordUpdater = TelephonyComponentFactory.getInstance().inject( SubscriptionInfoUpdater.class.getName()). makeSubscriptionInfoUpdater(pfhandlerThread. getLooper(), context, sCommandsInterfaces); getLooper(), context, SubscriptionController.getInstance()); // Only bring up IMS if the device supports having an IMS stack. if (context.getPackageManager().hasSystemFeature( Loading
src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +42 −62 Original line number Diff line number Diff line Loading @@ -108,6 +108,7 @@ public class SubscriptionInfoUpdater extends Handler { @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) protected static String[] sIccId = new String[SUPPORTED_MODEM_COUNT]; protected SubscriptionController mSubscriptionController = null; private static String[] sInactiveIccIds = new String[SUPPORTED_MODEM_COUNT]; private static int[] sSimCardState = new int[SUPPORTED_MODEM_COUNT]; private static int[] sSimApplicationState = new int[SUPPORTED_MODEM_COUNT]; Loading @@ -134,14 +135,13 @@ public class SubscriptionInfoUpdater extends Handler { void run(boolean hasChanges); } // TODO: The SubscriptionController instance should be passed in here from PhoneFactory // rather than invoking the static getter all over the place. @VisibleForTesting public SubscriptionInfoUpdater(Looper looper, Context context, CommandsInterface[] ci) { @VisibleForTesting public SubscriptionInfoUpdater(Looper looper, Context context, SubscriptionController sc) { logd("Constructor invoked"); mBackgroundHandler = new Handler(looper); sContext = context; mSubscriptionController = sc; mSubscriptionManager = SubscriptionManager.from(sContext); mEuiccManager = (EuiccManager) sContext.getSystemService(Context.EUICC_SERVICE); Loading Loading @@ -308,7 +308,7 @@ public class SubscriptionInfoUpdater extends Handler { cardIds.add(getCardIdFromPhoneId(msg.arg1)); updateEmbeddedSubscriptions(cardIds, (hasChanges) -> { if (hasChanges) { SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); } }); handleSimNotReady(msg.arg1); Loading @@ -319,7 +319,7 @@ public class SubscriptionInfoUpdater extends Handler { Runnable r = (Runnable) msg.obj; updateEmbeddedSubscriptions(cardIds, (hasChanges) -> { if (hasChanges) { SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); } if (r != null) { r.run(); Loading Loading @@ -414,7 +414,7 @@ public class SubscriptionInfoUpdater extends Handler { cardIds.add(getCardIdFromPhoneId(phoneId)); updateEmbeddedSubscriptions(cardIds, (hasChanges) -> { if (hasChanges) { SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); } }); broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_READY, null); Loading Loading @@ -459,8 +459,9 @@ public class SubscriptionInfoUpdater extends Handler { // handleSimNotReady so this will be evaluated again. UiccSlot slot = UiccController.getInstance().getUiccSlotForPhone(phoneId); if (slot == null || slot.getIccId() == null) return false; SubscriptionInfo info = SubscriptionController.getInstance() .getSubInfoForIccId(IccUtils.stripTrailingFs(slot.getIccId())); SubscriptionInfo info = mSubscriptionController.getSubInfoForIccId( IccUtils.stripTrailingFs(slot.getIccId())); return info != null && !info.areUiccApplicationsEnabled(); } Loading @@ -487,8 +488,8 @@ public class SubscriptionInfoUpdater extends Handler { sIccId[phoneId] = IccUtils.stripTrailingFs(records.getFullIccId()); updateSubscriptionInfoByIccId(phoneId, true /* updateEmbeddedSubs */); List<SubscriptionInfo> subscriptionInfos = SubscriptionController.getInstance() .getSubInfoUsingSlotIndexPrivileged(phoneId); List<SubscriptionInfo> subscriptionInfos = mSubscriptionController.getSubInfoUsingSlotIndexPrivileged(phoneId); if (subscriptionInfos == null || subscriptionInfos.isEmpty()) { loge("empty subinfo for phoneId: " + phoneId + "could not update ContentResolver"); } else { Loading @@ -499,10 +500,10 @@ public class SubscriptionInfoUpdater extends Handler { String operator = tm.getSimOperatorNumeric(subId); if (!TextUtils.isEmpty(operator)) { if (subId == SubscriptionController.getInstance().getDefaultSubId()) { if (subId == mSubscriptionController.getDefaultSubId()) { MccTable.updateMccMncConfiguration(sContext, operator); } SubscriptionController.getInstance().setMccMnc(operator, subId); mSubscriptionController.setMccMnc(operator, subId); } else { logd("EVENT_RECORDS_LOADED Operator name is null"); } Loading @@ -510,25 +511,25 @@ public class SubscriptionInfoUpdater extends Handler { String iso = tm.getSimCountryIsoForPhone(phoneId); if (!TextUtils.isEmpty(iso)) { SubscriptionController.getInstance().setCountryIso(iso, subId); mSubscriptionController.setCountryIso(iso, subId); } else { logd("EVENT_RECORDS_LOADED sim country iso is null"); } String msisdn = tm.getLine1Number(subId); if (msisdn != null) { SubscriptionController.getInstance().setDisplayNumber(msisdn, subId); mSubscriptionController.setDisplayNumber(msisdn, subId); } String imsi = tm.createForSubscriptionId(subId).getSubscriberId(); if (imsi != null) { SubscriptionController.getInstance().setImsi(imsi, subId); mSubscriptionController.setImsi(imsi, subId); } String[] ehplmns = records.getEhplmns(); String[] hplmns = records.getPlmnsFromHplmnActRecord(); if (ehplmns != null || hplmns != null) { SubscriptionController.getInstance().setAssociatedPlmns(ehplmns, hplmns, subId); mSubscriptionController.setAssociatedPlmns(ehplmns, hplmns, subId); } /* Update preferred network type and network selection mode on SIM change. Loading Loading @@ -620,8 +621,8 @@ public class SubscriptionInfoUpdater extends Handler { if (!TextUtils.isEmpty(iccId)) { // If iccId is new, add a subscription record in the db. String strippedIccId = IccUtils.stripTrailingFs(iccId); if (SubscriptionController.getInstance().getSubInfoForIccId(strippedIccId) == null) { SubscriptionController.getInstance().insertEmptySubInfoRecord( if (mSubscriptionController.getSubInfoForIccId(strippedIccId) == null) { mSubscriptionController.insertEmptySubInfoRecord( strippedIccId, "CARD", SubscriptionManager.INVALID_PHONE_INDEX, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); } Loading Loading @@ -707,7 +708,7 @@ public class SubscriptionInfoUpdater extends Handler { // Clear phoneId only when sim absent is not enough. It's possible to switch SIM profile // within the same slot. Need to clear the slot index of the previous sub. Thus always clear // for the changing slot first. SubscriptionController.getInstance().clearSubInfoRecord(phoneId); mSubscriptionController.clearSubInfoRecord(phoneId); // If SIM is not absent, insert new record or update existing record. if (!ICCID_STRING_FOR_NO_SIM.equals(sIccId[phoneId])) { Loading @@ -716,8 +717,8 @@ public class SubscriptionInfoUpdater extends Handler { mSubscriptionManager.addSubscriptionInfoRecord(sIccId[phoneId], phoneId); } List<SubscriptionInfo> subInfos = SubscriptionController.getInstance() .getSubInfoUsingSlotIndexPrivileged(phoneId); List<SubscriptionInfo> subInfos = mSubscriptionController.getSubInfoUsingSlotIndexPrivileged(phoneId); if (subInfos != null) { boolean changed = false; for (int i = 0; i < subInfos.size(); i++) { Loading @@ -736,7 +737,7 @@ public class SubscriptionInfoUpdater extends Handler { } if (changed) { // refresh Cached Active Subscription Info List SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList(); mSubscriptionController.refreshCachedActiveSubscriptionInfoList(); } } Loading Loading @@ -766,22 +767,22 @@ public class SubscriptionInfoUpdater extends Handler { } updateEmbeddedSubscriptions(cardIds, (hasChanges) -> { if (hasChanges) { SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); } if (DBG) logd("updateSubscriptionInfoByIccId: SubscriptionInfo update complete"); }); } SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); if (DBG) logd("updateSubscriptionInfoByIccId: SubscriptionInfo update complete"); } private static void setSubInfoInitialized() { private void setSubInfoInitialized() { // Should only be triggered once. if (!sIsSubInfoInitialized) { if (DBG) logd("SubInfo Initialized"); sIsSubInfoInitialized = true; SubscriptionController.getInstance().notifySubInfoReady(); mSubscriptionController.notifySubInfoReady(); MultiSimSettingController.getInstance().notifyAllSubscriptionLoaded(); } } Loading Loading @@ -891,8 +892,9 @@ public class SubscriptionInfoUpdater extends Handler { // Update or insert records for all embedded subscriptions (except non-removable ones if the // current eUICC is non-removable, since we assume these are still accessible though not // returned by the eUICC controller). List<SubscriptionInfo> existingSubscriptions = SubscriptionController.getInstance() .getSubscriptionInfoListForEmbeddedSubscriptionUpdate(embeddedIccids, isRemovable); List<SubscriptionInfo> existingSubscriptions = mSubscriptionController.getSubscriptionInfoListForEmbeddedSubscriptionUpdate( embeddedIccids, isRemovable); ContentResolver contentResolver = sContext.getContentResolver(); for (EuiccProfileInfo embeddedProfile : embeddedProfiles) { int index = Loading @@ -901,7 +903,7 @@ public class SubscriptionInfoUpdater extends Handler { int nameSource = SubscriptionManager.NAME_SOURCE_CARRIER_ID; if (index < 0) { // No existing entry for this ICCID; create an empty one. SubscriptionController.getInstance().insertEmptySubInfoRecord( mSubscriptionController.insertEmptySubInfoRecord( embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED); } else { nameSource = existingSubscriptions.get(index).getNameSource(); Loading Loading @@ -963,7 +965,7 @@ public class SubscriptionInfoUpdater extends Handler { SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.getIccid() + "\"", null); // refresh Cached Active Subscription Info List SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList(); mSubscriptionController.refreshCachedActiveSubscriptionInfoList(); } // Remove all remaining subscriptions which have embedded = true. We set embedded to false Loading Loading @@ -991,7 +993,7 @@ public class SubscriptionInfoUpdater extends Handler { contentResolver.update(SubscriptionManager.CONTENT_URI, values, whereClause, null); // refresh Cached Active Subscription Info List SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList(); mSubscriptionController.refreshCachedActiveSubscriptionInfoList(); } if (DBG) logd("updateEmbeddedSubscriptions done hasChanges=" + hasChanges); Loading Loading @@ -1041,20 +1043,14 @@ public class SubscriptionInfoUpdater extends Handler { return; } SubscriptionController sc = SubscriptionController.getInstance(); if (sc == null) { loge("SubscriptionController was null"); return; } int currentSubId = sc.getSubIdUsingPhoneId(phoneId); int currentSubId = mSubscriptionController.getSubIdUsingPhoneId(phoneId); if (!SubscriptionManager.isValidSubscriptionId(currentSubId) || currentSubId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) { if (DBG) logd("No subscription is active for phone being updated"); return; } SubscriptionInfo currentSubInfo = sc.getSubscriptionInfo(currentSubId); SubscriptionInfo currentSubInfo = mSubscriptionController.getSubscriptionInfo(currentSubId); if (currentSubInfo == null) { loge("Couldn't retrieve subscription info for current subscription"); return; Loading Loading @@ -1098,8 +1094,8 @@ public class SubscriptionInfoUpdater extends Handler { && currentSubInfo.getGroupUuid() != null) { cv.put(SubscriptionManager.GROUP_UUID, (String) null); if (DBG) logd("Group Removed for" + currentSubId); } else if (SubscriptionController.getInstance().canPackageManageGroup(groupUuid, configPackageName)) { } else if (mSubscriptionController.canPackageManageGroup( groupUuid, configPackageName)) { cv.put(SubscriptionManager.GROUP_UUID, groupUuid.toString()); cv.put(SubscriptionManager.GROUP_OWNER, configPackageName); if (DBG) logd("Group Added for" + currentSubId); Loading @@ -1114,8 +1110,8 @@ public class SubscriptionInfoUpdater extends Handler { } if (cv.size() > 0 && sContext.getContentResolver().update(SubscriptionManager .getUriForSubscriptionId(currentSubId), cv, null, null) > 0) { sc.refreshCachedActiveSubscriptionInfoList(); sc.notifySubscriptionInfoChanged(); mSubscriptionController.refreshCachedActiveSubscriptionInfoList(); mSubscriptionController.notifySubscriptionInfoChanged(); MultiSimSettingController.getInstance().notifySubscriptionGroupChanged(groupUuid); } } Loading @@ -1129,22 +1125,6 @@ public class SubscriptionInfoUpdater extends Handler { return -1; } private boolean isNewSim(String iccId, String decIccId, String[] oldIccId) { boolean newSim = true; for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) { if(iccId.equals(oldIccId[i])) { newSim = false; break; } else if (decIccId != null && decIccId.equals(oldIccId[i])) { newSim = false; break; } } logd("newSim = " + newSim); return newSim; } @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) protected void broadcastSimStateChanged(int phoneId, String state, String reason) { Intent i = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED); Loading
src/java/com/android/internal/telephony/TelephonyComponentFactory.java +2 −2 Original line number Diff line number Diff line Loading @@ -443,7 +443,7 @@ public class TelephonyComponentFactory { } public SubscriptionInfoUpdater makeSubscriptionInfoUpdater(Looper looper, Context context, CommandsInterface[] ci) { return new SubscriptionInfoUpdater(looper, context, ci); SubscriptionController sc) { return new SubscriptionInfoUpdater(looper, context, sc); } }
src/java/com/android/internal/telephony/vendor/VendorSubscriptionInfoUpdater.java +5 −6 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.util.Log; import java.util.ArrayList; import java.util.List; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.SubscriptionController; import com.android.internal.telephony.SubscriptionInfoUpdater; Loading @@ -49,10 +48,10 @@ public class VendorSubscriptionInfoUpdater extends SubscriptionInfoUpdater { .getSupportedModemCount(); static VendorSubscriptionInfoUpdater init(Looper looper, Context context, CommandsInterface[] ci) { SubscriptionController sc) { synchronized (VendorSubscriptionInfoUpdater.class) { if (sInstance == null) { sInstance = new VendorSubscriptionInfoUpdater(looper, context, ci); sInstance = new VendorSubscriptionInfoUpdater(looper, context, sc); } else { Log.wtf(LOG_TAG, "init() called multiple times! sInstance = " + sInstance); } Loading @@ -68,8 +67,8 @@ public class VendorSubscriptionInfoUpdater extends SubscriptionInfoUpdater { } protected VendorSubscriptionInfoUpdater(Looper looper, Context context, CommandsInterface[] ci) { super(looper, context, ci); SubscriptionController sc) { super(looper, context, sc); sContext = context; mIsRecordUpdateRequired = new boolean[SUPPORTED_MODEM_COUNT]; Loading Loading @@ -105,7 +104,7 @@ public class VendorSubscriptionInfoUpdater extends SubscriptionInfoUpdater { cardIds.add(getCardIdFromPhoneId(phoneId)); updateEmbeddedSubscriptions(cardIds, (hasChanges) -> { if (hasChanges) { SubscriptionController.getInstance().notifySubscriptionInfoChanged(); mSubscriptionController.notifySubscriptionInfoChanged(); } }); broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_READY, null); Loading
tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -162,8 +162,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { .getActiveSubIdList(/*visibleOnly*/false); mIccRecord = mUiccProfile.getIccRecords(); mUpdater = new SubscriptionInfoUpdater(Looper.myLooper(), mContext, new CommandsInterface[]{mSimulatedCommands}); mUpdater = new SubscriptionInfoUpdater(Looper.myLooper(), mContext, mSubscriptionController); processAllMessages(); assertFalse(mUpdater.isSubInfoInitialized()); Loading