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

Commit cca207d5 authored by Sukhwan Mun's avatar Sukhwan Mun Committed by Android (Google) Code Review
Browse files

Merge "add RAT related suggested actions to IMS registration with flagging" into main

parents 2849f615 503964b9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -27,3 +27,10 @@ flag {
    description: "This flag is created to prevent unnecessary updates when multiple provisioning items to update ims service are changed."
    bug:"302281114"
}

flag {
    name: "add_rat_related_suggested_action_to_ims_registration"
    namespace: "telephony"
    description: "This flag is for adding suggested actions related to RAT to ims registration"
    bug:"290573256"
}
+7 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import static android.telephony.ims.RegistrationManager.REGISTRATION_STATE_REGIS
import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_NONE;
import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK;
import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT;
import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER_RAT_BLOCK;
import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER_CLEAR_RAT_BLOCK;
import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_NONE;

import static com.android.internal.telephony.CommandsInterface.CB_FACILITY_BAIC;
@@ -2527,6 +2529,11 @@ public class ImsPhone extends ImsPhoneBase {
                if ((suggestedAction == SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK)
                        || (suggestedAction == SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT)) {
                    suggestedModemAction = suggestedAction;
                } else if (mFeatureFlags.addRatRelatedSuggestedActionToImsRegistration()) {
                    if ((suggestedAction == SUGGESTED_ACTION_TRIGGER_RAT_BLOCK)
                            || (suggestedAction == SUGGESTED_ACTION_TRIGGER_CLEAR_RAT_BLOCK)) {
                        suggestedModemAction = suggestedAction;
                    }
                }
            }
            updateImsRegistrationInfo(REGISTRATION_STATE_NOT_REGISTERED,
+77 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import static android.telephony.CarrierConfigManager.USSD_OVER_IMS_PREFERRED;
import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_NONE;
import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK;
import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT;
import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER_RAT_BLOCK;
import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER_CLEAR_RAT_BLOCK;
import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_3G;
import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN;
import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_LTE;
@@ -1484,6 +1486,81 @@ public class ImsPhoneTest extends TelephonyTest {
        assertTrue(regInfo[0] == 1 && regInfo[1] == 1 && regInfo[2] == 1);
    }

    /**
     * Verifies that valid state and reason is passed to RIL with RAT suggested actions
     * when IMS registration state changes to unregistered.
     */
    @Test
    @SmallTest
    public void testUpdateImsRegistrationInfoWithRatSuggestedAction() {
        doReturn(true).when(mFeatureFlags)
                .addRatRelatedSuggestedActionToImsRegistration();

        mSimulatedCommands.updateImsRegistrationInfo(0, 0, 0, 0, null);

        int[] regInfo = mSimulatedCommands.getImsRegistrationInfo();
        assertNotNull(regInfo);
        assertTrue(regInfo[0] == 0 && regInfo[1] == 0 && regInfo[2] == 0);

        RegistrationManager.RegistrationCallback registrationCallback =
                mImsPhoneUT.getImsMmTelRegistrationCallback();

        ImsReasonInfo reasonInfo = new ImsReasonInfo(ImsReasonInfo.CODE_REGISTRATION_ERROR,
                ImsReasonInfo.CODE_UNSPECIFIED, "");

        // unregistered with rat block
        registrationCallback.onUnregistered(reasonInfo,
                SUGGESTED_ACTION_TRIGGER_RAT_BLOCK,
                REGISTRATION_TECH_LTE);
        regInfo = mSimulatedCommands.getImsRegistrationInfo();

        assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED
                && regInfo[1] == REGISTRATION_TECH_LTE
                && regInfo[2] == SUGGESTED_ACTION_TRIGGER_RAT_BLOCK);

        // reset the registration info saved in the SimulatedCommands
        mSimulatedCommands.updateImsRegistrationInfo(0, 0, 0, 0, null);
        regInfo = mSimulatedCommands.getImsRegistrationInfo();

        assertTrue(regInfo[0] == 0 && regInfo[1] == 0 && regInfo[2] == 0);

        // verfies that duplicated notification with the same suggested action is invoked
        registrationCallback.onUnregistered(reasonInfo,
                SUGGESTED_ACTION_TRIGGER_RAT_BLOCK,
                REGISTRATION_TECH_LTE);
        regInfo = mSimulatedCommands.getImsRegistrationInfo();

        assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED
                && regInfo[1] == REGISTRATION_TECH_LTE
                && regInfo[2] == SUGGESTED_ACTION_TRIGGER_RAT_BLOCK);

        // unregistered with rat block clear
        registrationCallback.onUnregistered(reasonInfo,
                SUGGESTED_ACTION_TRIGGER_CLEAR_RAT_BLOCK,
                REGISTRATION_TECH_LTE);
        regInfo = mSimulatedCommands.getImsRegistrationInfo();

        assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED
                && regInfo[1] == REGISTRATION_TECH_LTE
                && regInfo[2] == SUGGESTED_ACTION_TRIGGER_CLEAR_RAT_BLOCK);

        // reset the registration info saved in the SimulatedCommands
        mSimulatedCommands.updateImsRegistrationInfo(0, 0, 0, 0, null);
        regInfo = mSimulatedCommands.getImsRegistrationInfo();

        assertTrue(regInfo[0] == 0 && regInfo[1] == 0 && regInfo[2] == 0);

        // verfies that duplicated notification with the same suggested action is invoked
        registrationCallback.onUnregistered(reasonInfo,
                SUGGESTED_ACTION_TRIGGER_CLEAR_RAT_BLOCK,
                REGISTRATION_TECH_LTE);
        regInfo = mSimulatedCommands.getImsRegistrationInfo();

        assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED
                && regInfo[1] == REGISTRATION_TECH_LTE
                && regInfo[2] == SUGGESTED_ACTION_TRIGGER_CLEAR_RAT_BLOCK);
    }

    @Test
    @SmallTest
    public void testImsDialArgsBuilderFromForAlternateService() {