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

Commit a9cc4c8d authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Do not send update to carrier config if SIM card is still locked

When the SIM card is still pin locked, do not send an update to
the ImsService turning off MMTEL capabilities. Instead, wait until
the SIM card is unlocked to get the correct capabilities.

Bug: 186121974
Test: manual, reboot devices when pin locked
Test: atest FrameworksTelephonyTests
Change-Id: Ide125ab4943d4ba27ff4b8c77908a924ec1012dc
parent 6895ab85
Loading
Loading
Loading
Loading
+30 −14
Original line number Original line Diff line number Diff line
@@ -106,6 +106,7 @@ import com.android.internal.telephony.CallTracker;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.LocaleTracker;
import com.android.internal.telephony.LocaleTracker;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneConstants;
@@ -1035,10 +1036,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        }
        }


        maybeConfigureRtpHeaderExtensions();
        maybeConfigureRtpHeaderExtensions();

        updateImsServiceConfig();
        if (mCarrierConfigLoaded) {
            mImsManager.updateImsServiceConfig();
        }
        // For compatibility with apps that still use deprecated intent
        // For compatibility with apps that still use deprecated intent
        sendImsServiceStateIntent(ImsManager.ACTION_IMS_SERVICE_UP);
        sendImsServiceStateIntent(ImsManager.ACTION_IMS_SERVICE_UP);
    }
    }
@@ -1461,6 +1459,20 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            return;
            return;
        }
        }


        Phone defaultPhone = getPhone().getDefaultPhone();
        if (defaultPhone != null && defaultPhone.getIccCard() != null) {
            IccCardConstants.State state = defaultPhone.getIccCard().getState();
            // Bypass until PIN/PUK lock is removed as to ensure that we do not push a config down
            // when the device is still locked. A CARRIER_CONFIG_CHANGED indication will be sent
            // once the device moves to ready.
            if (state != null && (!state.iccCardExist() || state.isPinLocked())) {
                loge("cacheCarrierConfiguration: card state is not ready, skipping. State= "
                        + state);
                mCarrierConfigLoaded = false;
                return;
            }
        }

        PersistableBundle carrierConfig = carrierConfigManager.getConfigForSubId(subId);
        PersistableBundle carrierConfig = carrierConfigManager.getConfigForSubId(subId);
        if (carrierConfig == null) {
        if (carrierConfig == null) {
            loge("cacheCarrierConfiguration: Empty carrier config.");
            loge("cacheCarrierConfiguration: Empty carrier config.");
@@ -1470,9 +1482,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        mCarrierConfigLoaded = true;
        mCarrierConfigLoaded = true;


        updateCarrierConfigCache(carrierConfig);
        updateCarrierConfigCache(carrierConfig);
        if (mImsManager != null) {
        updateImsServiceConfig();
            mImsManager.updateImsServiceConfig();
        }
        // Check for changes due to carrier config.
        // Check for changes due to carrier config.
        maybeConfigureRtpHeaderExtensions();
        maybeConfigureRtpHeaderExtensions();
    }
    }
@@ -3220,9 +3230,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            if (mShouldUpdateImsConfigOnDisconnect) {
            if (mShouldUpdateImsConfigOnDisconnect) {
                // Ensure we update the IMS config when the call is disconnected; we delayed this
                // Ensure we update the IMS config when the call is disconnected; we delayed this
                // because a video call was paused.
                // because a video call was paused.
                if (mImsManager != null) {
                updateImsServiceConfig();
                    mImsManager.updateImsServiceConfig();
                }
                mShouldUpdateImsConfigOnDisconnect = false;
                mShouldUpdateImsConfigOnDisconnect = false;
            }
            }


@@ -3960,7 +3968,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    || item == ImsConfig.ConfigConstants.LVC_SETTING_ENABLED)) {
                    || item == ImsConfig.ConfigConstants.LVC_SETTING_ENABLED)) {
                // Update Ims Service state to make sure updated provisioning values take effect
                // Update Ims Service state to make sure updated provisioning values take effect
                // immediately.
                // immediately.
                mImsManager.updateImsServiceConfig();
                updateImsServiceConfig();
            }
            }
        }
        }


@@ -4812,10 +4820,18 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                && reason != DataEnabledSettings.REASON_REGISTERED && mCarrierConfigLoaded) {
                && reason != DataEnabledSettings.REASON_REGISTERED && mCarrierConfigLoaded) {
            // This will call into updateVideoCallFeatureValue and eventually all clients will be
            // This will call into updateVideoCallFeatureValue and eventually all clients will be
            // asynchronously notified that the availability of VT over LTE has changed.
            // asynchronously notified that the availability of VT over LTE has changed.
            if (mImsManager != null) {
            updateImsServiceConfig();
                mImsManager.updateImsServiceConfig();
        }
        }
    }
    }

    /**
     * If the ImsService is currently connected and we have loaded the carrier config, proceed to
     * trigger the update of the configuration sent to the ImsService.
     */
    private void updateImsServiceConfig() {
        if (mImsManager != null && mCarrierConfigLoaded) {
            mImsManager.updateImsServiceConfig();
        }
    }
    }


    private void maybeNotifyDataDisabled(boolean enabled, int reasonCode) {
    private void maybeNotifyDataDisabled(boolean enabled, int reasonCode) {