add RAT related suggested actions to IMS registration with flagging
Bug: 290573256
Test: atest ImsPhoneTest
Change-Id: I903bdab4ef58edfd455de25b1bcdfb140bcb626d
diff --git a/flags/ims.aconfig b/flags/ims.aconfig
index 0fa1f1e..94c933c 100644
--- a/flags/ims.aconfig
+++ b/flags/ims.aconfig
@@ -27,3 +27,10 @@
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"
+}
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
index 4943ba3..b21d45d 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
@@ -23,6 +23,8 @@
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 @@
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,
diff --git a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java
index 4e61c67..fbb30ff 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java
@@ -24,6 +24,8 @@
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 @@
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() {