frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccController.java
public void updateSimState(int phoneId, @NonNull IccCardConstants.State state,
@Nullable String reason) {
post(() -> {
log("updateSimState: phoneId=" + phoneId + ", state=" + state + ", reason="
+ reason);
String legacySimState = getIccStateIntentString(state);
int simState = state.ordinal();
SubscriptionManagerService.getInstance().updateSimState(phoneId, simState,
this::post,
() -> {
// The following are executed after subscription update completed in
// subscription manager service.
broadcastSimStateEvents(phoneId, state, reason);
// At this point, the SIM state must be a final state (meaning we won't
// get more SIM state updates). So resolve the carrier id and update the
// carrier services.
log("updateSimState: resolve carrier id and update carrier "
+ "services.");
PhoneFactory.getPhone(phoneId).resolveSubscriptionCarrierId(
legacySimState);
updateCarrierServices(phoneId, legacySimState); ***update Carrieronfig***
}
);
});
}
private void updateCarrierServices(int phoneId, @NonNull String simState) {
CarrierConfigManager configManager = mContext.getSystemService(CarrierConfigManager.class);
if (configManager != null) {
configManager.updateConfigForPhoneId(phoneId, simState);
}
mCarrierServiceBindHelper.updateForPhoneId(phoneId, simState);
}
CarrierConfigManager.java
public void updateConfigForPhoneId(int phoneId, String simState) {
try {
ICarrierConfigLoader loader = getICarrierConfigLoader();
if (loader == null) {
Rlog.w(TAG, "Error updating config for phoneId=" + phoneId
+ " ICarrierConfigLoader is null");
return;
}
loader.updateConfigForPhoneId(phoneId, simState);
} catch (RemoteException | IllegalArgumentException ex) {
Rlog.e(TAG, "Error updating config for phoneId=" + phoneId + ": " + ex);
}
}
CarrierConfigLoader.java
@Override
public void updateConfigForPhoneId(int phoneId, @NonNull String simState) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.MODIFY_PHONE_STATE, null);
logdWithLocalLog("Update config for phoneId: " + phoneId + " simState: " + simState);
if (!SubscriptionManager.isValidPhoneId(phoneId)) {
throw new IllegalArgumentException("Invalid phoneId: " + phoneId);
}
// requires Java 7 for switch on string.
switch (simState) {
case IccCardConstants.INTENT_VALUE_ICC_ABSENT:
case IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR:
case IccCardConstants.INTENT_VALUE_ICC_CARD_RESTRICTED:
case IccCardConstants.INTENT_VALUE_ICC_UNKNOWN:
case IccCardConstants.INTENT_VALUE_ICC_NOT_READY:
mIsEssentialSimRecordsLoaded[phoneId] = false;
mHandler.sendMessage(mHandler.obtainMessage(EVENT_CLEAR_CONFIG, phoneId, -1));