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

Commit 268f1195 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Always send CLIR_DEFAULT if no user setting has been set

Previously, we would only send CLIR updates when the network
was attached if  the CLIR mode was not default. This causes issues
on some radios, where the CLIR mode is not reset to the default
when a SIM change occurs.

Bug: 176112154
Test: atest FrameworksTelephonyTests
Change-Id: I2b8e4cb5b61c0e254bec8267b622e5824187de5a
parent 6895ab85
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 {