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

Commit 8aa61e7b authored by Brad Ebinger's avatar Brad Ebinger Committed by Android (Google) Code Review
Browse files

Merge "Always send CLIR_DEFAULT if no user setting has been set" into sc-dev

parents 2f046ed9 268f1195
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2707,6 +2707,10 @@ public class GsmCdmaPhone extends Phone {
        Rlog.i(LOG_TAG, "syncClirSetting: " + CLIR_KEY + getSubId() + "=" + clirSetting);
        if (clirSetting >= 0) {
            mCi.setCLIR(clirSetting, null);
        } else {
            // if there is no preference set, ensure the CLIR is updated to the default value in
            // order to ensure that CLIR values in the RIL are not carried over during SIM swap.
            mCi.setCLIR(CommandsInterface.CLIR_DEFAULT, null);
        }
    }

+23 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static com.android.internal.telephony.TelephonyTestUtils.waitForMs;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -517,6 +518,28 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        }
    }

    @Test
    @SmallTest
    public void testClirCs() {
        mPhoneUT.mCi = mMockCi;
        // Start out with no preference set and ensure CommandsInterface receives setClir with
        // the default set.
        mPhoneUT.sendEmptyMessage(Phone.EVENT_REGISTERED_TO_NETWORK);
        processAllMessages();
        verify(mMockCi).setCLIR(eq(CommandsInterface.CLIR_DEFAULT), any());
        // Now set the CLIR mode explicitly
        mPhoneUT.setOutgoingCallerIdDisplay(CommandsInterface.CLIR_SUPPRESSION, null);
        ArgumentCaptor<Message> messageCaptor = ArgumentCaptor.forClass(Message.class);
        verify(mMockCi).setCLIR(eq(CommandsInterface.CLIR_SUPPRESSION), messageCaptor.capture());
        Message message = messageCaptor.getValue();
        assertNotNull(message);
        message.obj = AsyncResult.forMessage(message);
        // Now Call registered to network again and the CLIR mode sent should reflect the new value.
        mPhoneUT.sendEmptyMessage(Phone.EVENT_REGISTERED_TO_NETWORK);
        processAllMessages();
        verify(mMockCi).setCLIR(eq(CommandsInterface.CLIR_SUPPRESSION), any());
    }

    @Test
    @SmallTest
    public void testWpsClirActiveDialOverCs() throws Exception {