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

Commit 974833da authored by Hall Liu's avatar Hall Liu Committed by Android (Google) Code Review
Browse files

Merge "Fix to set wrong WFC mode when SIM hot swap" into rvc-dev

parents 07088c7e 725643ad
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -2081,8 +2081,15 @@ public class ImsPhone extends ImsPhoneBase {
        if (mCT.getState() == PhoneConstants.State.IDLE) {
            if (DBG) logd("updateRoamingState now: " + newRoamingState);
            mRoaming = newRoamingState;
            CarrierConfigManager configManager = (CarrierConfigManager)
                    getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
            // Don't set wfc mode if carrierconfig has not loaded. It will be set by GsmCdmaPhone
            // when receives ACTION_CARRIER_CONFIG_CHANGED broadcast.
            if (configManager != null && CarrierConfigManager.isConfigForIdentifiedCarrier(
                    configManager.getConfigForSubId(getSubId()))) {
                ImsManager imsManager = ImsManager.getInstance(mContext, mPhoneId);
                imsManager.setWfcMode(imsManager.getWfcMode(newRoamingState), newRoamingState);
            }
        } else {
            if (DBG) logd("updateRoamingState postponed: " + newRoamingState);
            mCT.registerForVoiceCallEnded(this, EVENT_VOICE_CALL_ENDED, null);
+5 −2
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ public class ImsPhoneTest extends TelephonyTest {
    };

    private ImsPhone mImsPhoneUT;
    private PersistableBundle mBundle;
    private boolean mDoesRilSendMultipleCallRing;
    private static final int EVENT_SUPP_SERVICE_NOTIFICATION = 1;
    private static final int EVENT_SUPP_SERVICE_FAILED = 2;
@@ -155,6 +156,9 @@ public class ImsPhoneTest extends TelephonyTest {
            return null;
        }).when(mPhone).setIsInEcm(anyBoolean());
        doAnswer(invocation -> mIsPhoneUtInEcm).when(mPhone).isInEcm();

        mBundle = mContextFixture.getCarrierConfigBundle();
        mBundle.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
        processAllMessages();
    }

@@ -603,8 +607,7 @@ public class ImsPhoneTest extends TelephonyTest {
    @SmallTest
    public void testProcessDisconnectReason() throws Exception {
        // set up CarrierConfig
        PersistableBundle bundle = mContextFixture.getCarrierConfigBundle();
        bundle.putStringArray(CarrierConfigManager.KEY_WFC_OPERATOR_ERROR_CODES_STRING_ARRAY,
        mBundle.putStringArray(CarrierConfigManager.KEY_WFC_OPERATOR_ERROR_CODES_STRING_ARRAY,
                new String[]{"REG09|0"});
        doReturn(true).when(mImsManager).isWfcEnabledByUser();