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

Commit 406da279 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Update ImsService config only when carrier config changes for valid subId

No longer call disableIms when there is an invalid subId, only reevaluate
when there is a valid subscription loaded.

Bug: 137689868
Test: manual; atest FrameworksTelephonyTests
Change-Id: I9129f489727c04c432072a51d893b483a03835db
parent f798f8e7
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -2852,14 +2852,6 @@ public class GsmCdmaPhone extends Phone {
                                .config_switch_phone_on_voice_reg_state_change)) {
                    mCi.getVoiceRadioTechnology(obtainMessage(EVENT_REQUEST_VOICE_RADIO_TECH_DONE));
                }
                // Force update IMS service if it is available, if it isn't the config will be
                // updated when ImsPhoneCallTracker opens a connection.
                ImsManager imsManager = ImsManager.getInstance(mContext, mPhoneId);
                if (imsManager.isServiceAvailable()) {
                    imsManager.updateImsServiceConfig();
                } else {
                    logd("ImsManager is not available to update CarrierConfig.");
                }

                // Update broadcastEmergencyCallStateChanges
                CarrierConfigManager configMgr = (CarrierConfigManager)
+10 −5
Original line number Diff line number Diff line
@@ -334,7 +334,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
                        SubscriptionManager.INVALID_SUBSCRIPTION_ID);
                if (subId == mPhone.getSubId()) {
                    cacheCarrierConfiguration(subId);
                    updateCarrierConfiguration(subId);
                    log("onReceive : Updating mAllowEmergencyVideoCalls = " +
                            mAllowEmergencyVideoCalls);
                }
@@ -903,7 +903,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        intentfilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        intentfilter.addAction(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER);
        mPhone.getContext().registerReceiver(mReceiver, intentfilter);
        cacheCarrierConfiguration(mPhone.getSubId());
        updateCarrierConfiguration(mPhone.getSubId());

        mPhone.getDefaultPhone().getDataEnabledSettings().registerForDataEnabledChanged(
                this, EVENT_DATA_ENABLED_CHANGED, null);
@@ -1368,11 +1368,13 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    }

    /**
     * Caches frequently used carrier configuration items locally.
     * Caches frequently used carrier configuration items locally and notifies ImsService of new
     * configuration if the subId is valid (there is an active sub ID loaded).
     *
     * @param subId The sub id.
     * @param subId The sub id to use to update configuration, may be invalid if a SIM has been
     *              removed.
     */
    private void cacheCarrierConfiguration(int subId) {
    private void updateCarrierConfiguration(int subId) {
        CarrierConfigManager carrierConfigManager = (CarrierConfigManager)
                mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
        if (carrierConfigManager == null
@@ -1392,6 +1394,9 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        mCarrierConfigLoaded = true;

        updateCarrierConfigCache(carrierConfig);
        if (mImsManager != null) {
            mImsManager.updateImsServiceConfig();
        }
    }

    /**