Loading src/java/com/android/internal/telephony/GsmCdmaPhone.java +4 −0 Original line number Diff line number Diff line Loading @@ -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); } } Loading tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +23 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 { Loading Loading
src/java/com/android/internal/telephony/GsmCdmaPhone.java +4 −0 Original line number Diff line number Diff line Loading @@ -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); } } Loading
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +23 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 { Loading