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

Commit bb966393 authored by Nagendra Prasad Nagarle Basavaraju's avatar Nagendra Prasad Nagarle Basavaraju
Browse files

[Telephony]Pre-submit test Failures at ServiceStateTrackerTest

- testRegisterForVoiceRegStateOrRatChange()
- testRegAndInvalidRegForNetworkAttached()
- testLocaleTrackerUpdateWithIWLANInService()
- testSetCsNormalNotifications()
- testSetCsEmergencyNotifications()
- testSetCsNotifications()
- testSetPsNotifications()
- testGetCombinedRegState()
- testUpdatePhoneType()
testUpdateSpnDisplay_spnNotEmptyAndCrossSimCallingEnabled_showSpnOnly()
- testUpdateSpnDisplay_spnNotEmptyAndWifiCallingEnabled_showSpnOnly()

Bug: 261268475
Test: atest FrameworksTelephonyTests
Change-Id: Ic876e106fa9340851bb6eafa4d65ddbac03c6206
parent b3397a3a
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -141,6 +141,14 @@ public class RatRatcheter {
        synchronized (mRatFamilyMap) {
            // Either the two technologies are the same or their families must be non-null
            // and the same.
            // To Fix Missing Null check
            if (ss1.getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
                        AccessNetworkConstants.TRANSPORT_TYPE_WWAN) == null
                    || ss2.getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
                        AccessNetworkConstants.TRANSPORT_TYPE_WWAN) == null) {
                return false;
            }

            int dataRat1 = ServiceState.networkTypeToRilRadioTechnology(
                    ss1.getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
                           AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
@@ -150,6 +158,7 @@ public class RatRatcheter {
                           AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                            .getAccessNetworkTechnology());


            // The api getAccessNetworkTechnology@NetworkRegistrationInfo always returns LTE though
            // data rat is LTE CA. Because it uses mIsUsingCarrierAggregation to indicate whether
            // it is LTE CA or not. However, we need its actual data rat to check if they are the
+50 −10
Original line number Diff line number Diff line
@@ -303,6 +303,11 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        waitUntilReady();
        waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());

        // Voice radio tech change will always trigger an update of
        // phone object irrespective of this config
        mContextFixture.putBooleanResource(
                com.android.internal.R.bool.config_switch_phone_on_voice_reg_state_change, false);

        // Override SPN related resource
        mContextFixture.putResource(
                com.android.internal.R.string.lockscreen_carrier_default,
@@ -916,13 +921,15 @@ public class ServiceStateTrackerTest extends TelephonyTest {
    @Test
    @MediumTest
    public void testUpdatePhoneType() {
        String brandOverride = "spn from brand override";
        doReturn(brandOverride).when(mUiccProfile).getOperatorBrandOverride();
        doReturn(false).when(mPhone).isPhoneTypeGsm();
        doReturn(true).when(mPhone).isPhoneTypeCdmaLte();
        doReturn(CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_RUIM).when(mCdmaSSM).
                getCdmaSubscriptionSource();

        logd("Calling updatePhoneType");
        // switch to CDMA
        logd("Calling updatePhoneType");
        sst.updatePhoneType();

        ArgumentCaptor<Integer> integerArgumentCaptor = ArgumentCaptor.forClass(Integer.class);
@@ -967,7 +974,6 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        mSimulatedCommands.setVoiceRegState(NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING);
        mSimulatedCommands.setDataRegState(NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING);
        mSimulatedCommands.notifyNetworkStateChanged();

        waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());

        // verify if registered handler has message posted to it
@@ -1149,7 +1155,6 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        mSimulatedCommands.notifyNetworkStateChanged();

        waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());

        // verify if registered handler has message posted to it
        ArgumentCaptor<Message> messageArgumentCaptor = ArgumentCaptor.forClass(Message.class);
        verify(mTestHandler).sendMessageAtTime(messageArgumentCaptor.capture(), anyLong());
@@ -1273,7 +1278,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {

    @Test
    @MediumTest
    public void testRegisterForVoiceRegStateOrRatChange() {
    public void testRegisterForVoiceRegStateOrRatChange() throws Exception {
        NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .setDomain(NetworkRegistrationInfo.DOMAIN_CS)
@@ -1281,14 +1286,17 @@ public class ServiceStateTrackerTest extends TelephonyTest {
                .build();
        sst.mSS.addNetworkRegistrationInfo(nri);

        sst.mSS.setState(ServiceState.STATE_IN_SERVICE);
        sst.registerForVoiceRegStateOrRatChanged(mTestHandler, EVENT_VOICE_RAT_CHANGED, null);

        waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());

        // Verify if message was posted to handler and value of result
        ArgumentCaptor<Message> messageArgumentCaptor = ArgumentCaptor.forClass(Message.class);
        verify(mTestHandler).sendMessageAtTime(messageArgumentCaptor.capture(), anyLong());
        verify(mTestHandler)
                .sendMessageAtTime(messageArgumentCaptor.capture(), anyLong());
        assertEquals(EVENT_VOICE_RAT_CHANGED, messageArgumentCaptor.getValue().what);

        assertEquals(new Pair<Integer, Integer>(ServiceState.STATE_IN_SERVICE,
                        ServiceState.RIL_RADIO_TECHNOLOGY_LTE),
                ((AsyncResult)messageArgumentCaptor.getValue().obj).result);
@@ -1383,6 +1391,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        mSimulatedCommands.setDataRegState(NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING);
        mSimulatedCommands.notifyNetworkStateChanged();

        waitForDelayedHandlerAction(mSSTTestHandler.getThreadHandler(), 500, 200);
        waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());

        // verify if registered handler has message posted to it
@@ -1534,7 +1543,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {

    @Test
    @SmallTest
    public void testSetPsNotifications() {
    public void testSetPsNotifications() throws Exception {
        int subId = 1;
        sst.mSubId = subId;
        doReturn(subId).when(mSubInfo).getSubscriptionId();
@@ -1552,6 +1561,9 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        when(mockResources.getDrawable(anyInt(), any())).thenReturn(mockDrawable);

        mContextFixture.putResource(com.android.internal.R.string.RestrictedOnDataTitle, "test1");
        // Make sure getState() condition returns in service, without this at logs at times found to
        // be out of service
        sst.mSS.setState(ServiceState.STATE_IN_SERVICE);
        sst.setNotification(ServiceStateTracker.PS_ENABLED);
        ArgumentCaptor<Notification> notificationArgumentCaptor =
                ArgumentCaptor.forClass(Notification.class);
@@ -1567,7 +1579,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {

    @Test
    @SmallTest
    public void testSetCsNotifications() {
    public void testSetCsNotifications() throws Exception {
        int subId = 1;
        sst.mSubId = subId;
        doReturn(subId).when(mSubInfo).getSubscriptionId();
@@ -1585,6 +1597,9 @@ public class ServiceStateTrackerTest extends TelephonyTest {

        mContextFixture.putResource(com.android.internal.R.string.RestrictedOnAllVoiceTitle,
                "test2");
        // Make sure getState() condition returns in service, without this at logs at times found to
        // be out of service
        sst.mSS.setState(ServiceState.STATE_IN_SERVICE);
        sst.setNotification(ServiceStateTracker.CS_ENABLED);
        ArgumentCaptor<Notification> notificationArgumentCaptor =
                ArgumentCaptor.forClass(Notification.class);
@@ -1600,7 +1615,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {

    @Test
    @SmallTest
    public void testSetCsNormalNotifications() {
    public void testSetCsNormalNotifications() throws Exception {
        int subId = 1;
        sst.mSubId = subId;
        doReturn(subId).when(mSubInfo).getSubscriptionId();
@@ -1617,6 +1632,9 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        when(mockResources.getDrawable(anyInt(), any())).thenReturn(mockDrawable);

        mContextFixture.putResource(com.android.internal.R.string.RestrictedOnNormalTitle, "test3");
        // Make sure getState() condition returns in service, without this at logs at times found to
        // be out of service
        sst.mSS.setState(ServiceState.STATE_IN_SERVICE);
        sst.setNotification(ServiceStateTracker.CS_NORMAL_ENABLED);
        ArgumentCaptor<Notification> notificationArgumentCaptor =
                ArgumentCaptor.forClass(Notification.class);
@@ -1632,7 +1650,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {

    @Test
    @SmallTest
    public void testSetCsEmergencyNotifications() {
    public void testSetCsEmergencyNotifications() throws Exception {
        int subId = 1;
        sst.mSubId = subId;
        doReturn(subId).when(mSubInfo).getSubscriptionId();
@@ -1650,6 +1668,9 @@ public class ServiceStateTrackerTest extends TelephonyTest {

        mContextFixture.putResource(com.android.internal.R.string.RestrictedOnEmergencyTitle,
                "test4");
        // Make sure mIsEmergencyOnly should be true, when setNotification notification type is
        // CS_EMERGENCY_ENABLED notification
        sst.mSS.setEmergencyOnly(true);
        sst.setNotification(ServiceStateTracker.CS_EMERGENCY_ENABLED);
        ArgumentCaptor<Notification> notificationArgumentCaptor =
                ArgumentCaptor.forClass(Notification.class);
@@ -2428,6 +2449,9 @@ public class ServiceStateTrackerTest extends TelephonyTest {
    public void testLocaleTrackerUpdateWithIWLANInService() {
        // Start state: Cell data only LTE + IWLAN
        final String[] OpNamesResult = new String[] { "carrier long", "carrier", "310310" };
        // Clear invocations for mLocaleTracker as precondition before test case execution & as part
        // test setup
        Mockito.clearInvocations(mLocaleTracker);
        changeRegStateWithIwlanOperatorNumeric(NetworkRegistrationInfo.REGISTRATION_STATE_HOME,
                TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, OpNamesResult, true);
@@ -2811,13 +2835,20 @@ public class ServiceStateTrackerTest extends TelephonyTest {
    @Test
    public void testUpdateSpnDisplay_spnNotEmptyAndCrossSimCallingEnabled_showSpnOnly() {
        // GSM phone

        doReturn(true).when(mPhone).isPhoneTypeGsm();
        final CellIdentityLte cellIdentityLte =
                new CellIdentityLte(1, 1, 5, 1, new int[] {1, 2}, 5000, "001", "01", "test",
                        "tst", Collections.emptyList(), null);

        // In Service
        ServiceState ss = new ServiceState();
        ss.setVoiceRegState(ServiceState.STATE_IN_SERVICE);
        ss.setDataRegState(ServiceState.STATE_IN_SERVICE);
        //To By Pass RatRacheter
        ss.addNetworkRegistrationInfo(makeNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS,
                AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
                cellIdentityLte, true));
        sst.mSS = ss;

        // cross-sim-calling is enable
@@ -2846,11 +2877,19 @@ public class ServiceStateTrackerTest extends TelephonyTest {
    public void testUpdateSpnDisplay_spnNotEmptyAndWifiCallingEnabled_showSpnOnly() {
        // GSM phone
        doReturn(true).when(mPhone).isPhoneTypeGsm();
        final CellIdentityLte cellIdentityLte =
                new CellIdentityLte(1, 1, 5, 1, new int[] {1, 2}, 5000, "001", "01", "test",
                        "tst", Collections.emptyList(), null);

        // In Service
        ServiceState ss = new ServiceState();
        ss.setVoiceRegState(ServiceState.STATE_IN_SERVICE);
        ss.setDataRegState(ServiceState.STATE_IN_SERVICE);
        //To By Pass RatRacheter
        ss.addNetworkRegistrationInfo(makeNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS,
                AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
                cellIdentityLte, true));
        sst.mSS = ss;

        // wifi-calling is enabled
@@ -3087,6 +3126,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {
    @Test
    public void testGetCombinedRegState() {
        doReturn(mImsPhone).when(mPhone).getImsPhone();
        doReturn(true).when(mPhone).isPhoneTypeGsm();

        // If voice/data out of service, return out of service.
        doReturn(ServiceState.STATE_OUT_OF_SERVICE).when(mServiceState).getState();