Loading src/java/com/android/internal/telephony/imsphone/ImsPhone.java +14 −4 Original line number Diff line number Diff line Loading @@ -304,6 +304,8 @@ public class ImsPhone extends ImsPhoneBase { private @ImsRegistrationImplBase.ImsRegistrationTech int mImsRegistrationTech = REGISTRATION_TECH_NONE; private @RegistrationManager.SuggestedAction int mImsRegistrationSuggestedAction; private @ImsRegistrationImplBase.ImsRegistrationTech int mImsDeregistrationTech = REGISTRATION_TECH_NONE; private int mImsRegistrationCapabilities; private boolean mNotifiedRegisteredState; Loading Loading @@ -2478,10 +2480,12 @@ public class ImsPhone extends ImsPhoneBase { @Override public void handleImsUnregistered(ImsReasonInfo imsReasonInfo, @RegistrationManager.SuggestedAction int suggestedAction) { @RegistrationManager.SuggestedAction int suggestedAction, @ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech) { if (DBG) { logd("handleImsUnregistered: onImsMmTelDisconnected imsReasonInfo=" + imsReasonInfo + ", suggestedAction=" + suggestedAction); + imsReasonInfo + ", suggestedAction=" + suggestedAction + ", disconnectedRadioTech=" + imsRadioTech); } mRegLocalLog.log("handleImsUnregistered: onImsMmTelDisconnected imsRadioTech=" + imsReasonInfo); Loading @@ -2500,7 +2504,7 @@ public class ImsPhone extends ImsPhoneBase { } } updateImsRegistrationInfo(REGISTRATION_STATE_NOT_REGISTERED, REGISTRATION_TECH_NONE, suggestedModemAction); imsRadioTech, suggestedModemAction); } @Override Loading Loading @@ -2673,7 +2677,8 @@ public class ImsPhone extends ImsPhoneBase { if (regState == mImsRegistrationState) { if ((regState == REGISTRATION_STATE_REGISTERED && imsRadioTech == mImsRegistrationTech) || (regState == REGISTRATION_STATE_NOT_REGISTERED && suggestedAction == mImsRegistrationSuggestedAction)) { && suggestedAction == mImsRegistrationSuggestedAction && imsRadioTech == mImsDeregistrationTech)) { // Filter duplicate notification. return; } Loading @@ -2697,6 +2702,11 @@ public class ImsPhone extends ImsPhoneBase { mImsRegistrationState = regState; mImsRegistrationTech = imsRadioTech; mImsRegistrationSuggestedAction = suggestedAction; if (regState == REGISTRATION_STATE_NOT_REGISTERED) { mImsDeregistrationTech = imsRadioTech; } else { mImsDeregistrationTech = REGISTRATION_TECH_NONE; } mImsRegistrationCapabilities = 0; // REGISTRATION_STATE_REGISTERED will be notified when the capability is updated. mNotifiedRegisteredState = false; Loading src/java/com/android/internal/telephony/imsphone/ImsRegistrationCallbackHelper.java +9 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.ImsRegistrationAttributes; import android.telephony.ims.RegistrationManager; import android.telephony.ims.aidl.IImsRegistrationCallback; import android.telephony.ims.stub.ImsRegistrationImplBase; import android.util.Log; import java.util.concurrent.Executor; Loading Loading @@ -52,7 +53,8 @@ public class ImsRegistrationCallbackHelper { * Handle the callback when IMS is unregistered. */ void handleImsUnregistered(ImsReasonInfo imsReasonInfo, @RegistrationManager.SuggestedAction int suggestedAction); @RegistrationManager.SuggestedAction int suggestedAction, @ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech); /** * Handle the callback when the list of subscriber {@link Uri}s associated with this IMS Loading Loading @@ -81,14 +83,17 @@ public class ImsRegistrationCallbackHelper { @Override public void onUnregistered(ImsReasonInfo imsReasonInfo) { onUnregistered(imsReasonInfo, RegistrationManager.SUGGESTED_ACTION_NONE); onUnregistered(imsReasonInfo, RegistrationManager.SUGGESTED_ACTION_NONE, ImsRegistrationImplBase.REGISTRATION_TECH_NONE); } @Override public void onUnregistered(ImsReasonInfo imsReasonInfo, @RegistrationManager.SuggestedAction int suggestedAction) { @RegistrationManager.SuggestedAction int suggestedAction, @ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech) { updateRegistrationState(RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED); mImsRegistrationUpdate.handleImsUnregistered(imsReasonInfo, suggestedAction); mImsRegistrationUpdate.handleImsUnregistered(imsReasonInfo, suggestedAction, imsRadioTech); } @Override Loading tests/telephonytests/src/android/telephony/ims/ImsRegistrationTests.java +19 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package android.telephony.ims; import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK; import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_LTE; import static junit.framework.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; Loading Loading @@ -148,7 +151,18 @@ public class ImsRegistrationTests { ImsReasonInfo info = new ImsReasonInfo(); mRegistration.onDeregistered(info); verify(mCallback).onDeregistered(eq(info), anyInt()); verify(mCallback).onDeregistered(eq(info), anyInt(), anyInt()); } @SmallTest @Test public void testRegistrationCallbackOnDeregisteredWithSuggestedAction() throws RemoteException { ImsReasonInfo info = new ImsReasonInfo(); mRegistration.onDeregistered(info, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_LTE); verify(mCallback).onDeregistered(eq(info), eq(SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK), eq(REGISTRATION_TECH_LTE)); } @SmallTest Loading Loading @@ -219,10 +233,10 @@ public class ImsRegistrationTests { // The original callback that has been registered should get LTE tech in disconnected // message verify(mCallback).onDeregistered(eq(info), anyInt()); verify(mCallback).onDeregistered(eq(info), anyInt(), anyInt()); // A callback that has just been registered should get NONE for tech in disconnected // message verify(mCallback2).onDeregistered(eq(info), anyInt()); verify(mCallback2).onDeregistered(eq(info), anyInt(), anyInt()); } @SmallTest Loading @@ -232,7 +246,7 @@ public class ImsRegistrationTests { mRegistration.onDeregistered(info); verify(mCallback).onDeregistered(eq(info), anyInt()); verify(mCallback).onDeregistered(eq(info), anyInt(), anyInt()); assertEquals(ImsRegistrationImplBase.REGISTRATION_TECH_NONE, mRegBinder.getRegistrationTechnology()); } Loading @@ -243,7 +257,7 @@ public class ImsRegistrationTests { mRegBinder.addRegistrationCallback(mCallback2); // Verify that if we have never set the registration state, we do not callback immediately // with onUnregistered. verify(mCallback2, never()).onDeregistered(any(ImsReasonInfo.class), anyInt()); verify(mCallback2, never()).onDeregistered(any(ImsReasonInfo.class), anyInt(), anyInt()); } @SmallTest Loading tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java +33 −12 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER 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; import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_NONE; import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_NR; import static com.android.internal.telephony.CommandsInterface.CF_ACTION_ENABLE; Loading Loading @@ -1227,11 +1226,27 @@ public class ImsPhoneTest extends TelephonyTest { ImsReasonInfo.CODE_UNSPECIFIED, ""); // unregistered with fatal error registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_NR); regInfo = mSimulatedCommands.getImsRegistrationInfo(); assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED && regInfo[1] == REGISTRATION_TECH_NR && regInfo[2] == SUGGESTED_ACTION_TRIGGER_PLMN_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); // unregistered with fatal error but rat changed registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_LTE); regInfo = mSimulatedCommands.getImsRegistrationInfo(); assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED && regInfo[1] == REGISTRATION_TECH_NONE && regInfo[1] == REGISTRATION_TECH_LTE && regInfo[2] == SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK); // reset the registration info saved in the SimulatedCommands Loading @@ -1241,7 +1256,8 @@ public class ImsPhoneTest extends TelephonyTest { assertTrue(regInfo[0] == 0 && regInfo[1] == 0 && regInfo[2] == 0); // duplicated notification with the same suggested action registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_LTE); regInfo = mSimulatedCommands.getImsRegistrationInfo(); // verify that there is no update in the SimulatedCommands Loading @@ -1249,11 +1265,12 @@ public class ImsPhoneTest extends TelephonyTest { // unregistered with repeated error registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT); SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT, REGISTRATION_TECH_LTE); regInfo = mSimulatedCommands.getImsRegistrationInfo(); assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED && regInfo[1] == REGISTRATION_TECH_NONE && regInfo[1] == REGISTRATION_TECH_LTE && regInfo[2] == SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT); // reset the registration info saved in the SimulatedCommands Loading @@ -1264,28 +1281,31 @@ public class ImsPhoneTest extends TelephonyTest { // duplicated notification with the same suggested action registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT); SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT, REGISTRATION_TECH_LTE); regInfo = mSimulatedCommands.getImsRegistrationInfo(); // verify that there is no update in the SimulatedCommands assertTrue(regInfo[0] == 0 && regInfo[1] == 0 && regInfo[2] == 0); // unregistered with temporary error registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_NONE); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_NONE, REGISTRATION_TECH_LTE); regInfo = mSimulatedCommands.getImsRegistrationInfo(); assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED && regInfo[1] == REGISTRATION_TECH_NONE && regInfo[1] == REGISTRATION_TECH_LTE && regInfo[2] == SUGGESTED_ACTION_NONE); // verifies that reason codes except ImsReasonInfo.CODE_REGISTRATION_ERROR are discarded. reasonInfo = new ImsReasonInfo(ImsReasonInfo.CODE_LOCAL_NETWORK_NO_SERVICE, ImsReasonInfo.CODE_UNSPECIFIED, ""); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_NR); regInfo = mSimulatedCommands.getImsRegistrationInfo(); assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED && regInfo[1] == REGISTRATION_TECH_NONE && regInfo[1] == REGISTRATION_TECH_NR && regInfo[2] == SUGGESTED_ACTION_NONE); // change the registration info saved in the SimulatedCommands Loading @@ -1295,7 +1315,8 @@ public class ImsPhoneTest extends TelephonyTest { assertTrue(regInfo[0] == 1 && regInfo[1] == 1 && regInfo[2] == 1); // duplicated notification with the same suggested action registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_NONE); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_NONE, REGISTRATION_TECH_NR); regInfo = mSimulatedCommands.getImsRegistrationInfo(); // verify that there is no update in the SimulatedCommands Loading tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsRegistrationCallbackHelperTest.java +21 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,9 @@ package com.android.internal.telephony.imsphone; 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.stub.ImsRegistrationImplBase.REGISTRATION_TECH_LTE; import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_NONE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; Loading Loading @@ -166,7 +169,24 @@ public class ImsRegistrationCallbackHelperTest extends TelephonyTest { assertEquals(RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED, mRegistrationCallbackHelper.getImsRegistrationState()); verify(mMockRegistrationUpdate).handleImsUnregistered(eq(reasonInfo), eq(SUGGESTED_ACTION_NONE)); eq(SUGGESTED_ACTION_NONE), eq(REGISTRATION_TECH_NONE)); } @Test @SmallTest public void testImsUnRegisteredWithSuggestedAction() { // Verify the RegistrationCallback should not be null RegistrationCallback callback = mRegistrationCallbackHelper.getCallback(); assertNotNull(callback); ImsReasonInfo reasonInfo = new ImsReasonInfo(ImsReasonInfo.CODE_REGISTRATION_ERROR, 0); callback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_LTE); assertEquals(RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED, mRegistrationCallbackHelper.getImsRegistrationState()); verify(mMockRegistrationUpdate).handleImsUnregistered(eq(reasonInfo), eq(SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK), eq(REGISTRATION_TECH_LTE)); } @Test Loading Loading
src/java/com/android/internal/telephony/imsphone/ImsPhone.java +14 −4 Original line number Diff line number Diff line Loading @@ -304,6 +304,8 @@ public class ImsPhone extends ImsPhoneBase { private @ImsRegistrationImplBase.ImsRegistrationTech int mImsRegistrationTech = REGISTRATION_TECH_NONE; private @RegistrationManager.SuggestedAction int mImsRegistrationSuggestedAction; private @ImsRegistrationImplBase.ImsRegistrationTech int mImsDeregistrationTech = REGISTRATION_TECH_NONE; private int mImsRegistrationCapabilities; private boolean mNotifiedRegisteredState; Loading Loading @@ -2478,10 +2480,12 @@ public class ImsPhone extends ImsPhoneBase { @Override public void handleImsUnregistered(ImsReasonInfo imsReasonInfo, @RegistrationManager.SuggestedAction int suggestedAction) { @RegistrationManager.SuggestedAction int suggestedAction, @ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech) { if (DBG) { logd("handleImsUnregistered: onImsMmTelDisconnected imsReasonInfo=" + imsReasonInfo + ", suggestedAction=" + suggestedAction); + imsReasonInfo + ", suggestedAction=" + suggestedAction + ", disconnectedRadioTech=" + imsRadioTech); } mRegLocalLog.log("handleImsUnregistered: onImsMmTelDisconnected imsRadioTech=" + imsReasonInfo); Loading @@ -2500,7 +2504,7 @@ public class ImsPhone extends ImsPhoneBase { } } updateImsRegistrationInfo(REGISTRATION_STATE_NOT_REGISTERED, REGISTRATION_TECH_NONE, suggestedModemAction); imsRadioTech, suggestedModemAction); } @Override Loading Loading @@ -2673,7 +2677,8 @@ public class ImsPhone extends ImsPhoneBase { if (regState == mImsRegistrationState) { if ((regState == REGISTRATION_STATE_REGISTERED && imsRadioTech == mImsRegistrationTech) || (regState == REGISTRATION_STATE_NOT_REGISTERED && suggestedAction == mImsRegistrationSuggestedAction)) { && suggestedAction == mImsRegistrationSuggestedAction && imsRadioTech == mImsDeregistrationTech)) { // Filter duplicate notification. return; } Loading @@ -2697,6 +2702,11 @@ public class ImsPhone extends ImsPhoneBase { mImsRegistrationState = regState; mImsRegistrationTech = imsRadioTech; mImsRegistrationSuggestedAction = suggestedAction; if (regState == REGISTRATION_STATE_NOT_REGISTERED) { mImsDeregistrationTech = imsRadioTech; } else { mImsDeregistrationTech = REGISTRATION_TECH_NONE; } mImsRegistrationCapabilities = 0; // REGISTRATION_STATE_REGISTERED will be notified when the capability is updated. mNotifiedRegisteredState = false; Loading
src/java/com/android/internal/telephony/imsphone/ImsRegistrationCallbackHelper.java +9 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.ImsRegistrationAttributes; import android.telephony.ims.RegistrationManager; import android.telephony.ims.aidl.IImsRegistrationCallback; import android.telephony.ims.stub.ImsRegistrationImplBase; import android.util.Log; import java.util.concurrent.Executor; Loading Loading @@ -52,7 +53,8 @@ public class ImsRegistrationCallbackHelper { * Handle the callback when IMS is unregistered. */ void handleImsUnregistered(ImsReasonInfo imsReasonInfo, @RegistrationManager.SuggestedAction int suggestedAction); @RegistrationManager.SuggestedAction int suggestedAction, @ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech); /** * Handle the callback when the list of subscriber {@link Uri}s associated with this IMS Loading Loading @@ -81,14 +83,17 @@ public class ImsRegistrationCallbackHelper { @Override public void onUnregistered(ImsReasonInfo imsReasonInfo) { onUnregistered(imsReasonInfo, RegistrationManager.SUGGESTED_ACTION_NONE); onUnregistered(imsReasonInfo, RegistrationManager.SUGGESTED_ACTION_NONE, ImsRegistrationImplBase.REGISTRATION_TECH_NONE); } @Override public void onUnregistered(ImsReasonInfo imsReasonInfo, @RegistrationManager.SuggestedAction int suggestedAction) { @RegistrationManager.SuggestedAction int suggestedAction, @ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech) { updateRegistrationState(RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED); mImsRegistrationUpdate.handleImsUnregistered(imsReasonInfo, suggestedAction); mImsRegistrationUpdate.handleImsUnregistered(imsReasonInfo, suggestedAction, imsRadioTech); } @Override Loading
tests/telephonytests/src/android/telephony/ims/ImsRegistrationTests.java +19 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package android.telephony.ims; import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK; import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_LTE; import static junit.framework.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; Loading Loading @@ -148,7 +151,18 @@ public class ImsRegistrationTests { ImsReasonInfo info = new ImsReasonInfo(); mRegistration.onDeregistered(info); verify(mCallback).onDeregistered(eq(info), anyInt()); verify(mCallback).onDeregistered(eq(info), anyInt(), anyInt()); } @SmallTest @Test public void testRegistrationCallbackOnDeregisteredWithSuggestedAction() throws RemoteException { ImsReasonInfo info = new ImsReasonInfo(); mRegistration.onDeregistered(info, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_LTE); verify(mCallback).onDeregistered(eq(info), eq(SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK), eq(REGISTRATION_TECH_LTE)); } @SmallTest Loading Loading @@ -219,10 +233,10 @@ public class ImsRegistrationTests { // The original callback that has been registered should get LTE tech in disconnected // message verify(mCallback).onDeregistered(eq(info), anyInt()); verify(mCallback).onDeregistered(eq(info), anyInt(), anyInt()); // A callback that has just been registered should get NONE for tech in disconnected // message verify(mCallback2).onDeregistered(eq(info), anyInt()); verify(mCallback2).onDeregistered(eq(info), anyInt(), anyInt()); } @SmallTest Loading @@ -232,7 +246,7 @@ public class ImsRegistrationTests { mRegistration.onDeregistered(info); verify(mCallback).onDeregistered(eq(info), anyInt()); verify(mCallback).onDeregistered(eq(info), anyInt(), anyInt()); assertEquals(ImsRegistrationImplBase.REGISTRATION_TECH_NONE, mRegBinder.getRegistrationTechnology()); } Loading @@ -243,7 +257,7 @@ public class ImsRegistrationTests { mRegBinder.addRegistrationCallback(mCallback2); // Verify that if we have never set the registration state, we do not callback immediately // with onUnregistered. verify(mCallback2, never()).onDeregistered(any(ImsReasonInfo.class), anyInt()); verify(mCallback2, never()).onDeregistered(any(ImsReasonInfo.class), anyInt(), anyInt()); } @SmallTest Loading
tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java +33 −12 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import static android.telephony.ims.RegistrationManager.SUGGESTED_ACTION_TRIGGER 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; import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_NONE; import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_NR; import static com.android.internal.telephony.CommandsInterface.CF_ACTION_ENABLE; Loading Loading @@ -1227,11 +1226,27 @@ public class ImsPhoneTest extends TelephonyTest { ImsReasonInfo.CODE_UNSPECIFIED, ""); // unregistered with fatal error registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_NR); regInfo = mSimulatedCommands.getImsRegistrationInfo(); assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED && regInfo[1] == REGISTRATION_TECH_NR && regInfo[2] == SUGGESTED_ACTION_TRIGGER_PLMN_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); // unregistered with fatal error but rat changed registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_LTE); regInfo = mSimulatedCommands.getImsRegistrationInfo(); assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED && regInfo[1] == REGISTRATION_TECH_NONE && regInfo[1] == REGISTRATION_TECH_LTE && regInfo[2] == SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK); // reset the registration info saved in the SimulatedCommands Loading @@ -1241,7 +1256,8 @@ public class ImsPhoneTest extends TelephonyTest { assertTrue(regInfo[0] == 0 && regInfo[1] == 0 && regInfo[2] == 0); // duplicated notification with the same suggested action registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_LTE); regInfo = mSimulatedCommands.getImsRegistrationInfo(); // verify that there is no update in the SimulatedCommands Loading @@ -1249,11 +1265,12 @@ public class ImsPhoneTest extends TelephonyTest { // unregistered with repeated error registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT); SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT, REGISTRATION_TECH_LTE); regInfo = mSimulatedCommands.getImsRegistrationInfo(); assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED && regInfo[1] == REGISTRATION_TECH_NONE && regInfo[1] == REGISTRATION_TECH_LTE && regInfo[2] == SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT); // reset the registration info saved in the SimulatedCommands Loading @@ -1264,28 +1281,31 @@ public class ImsPhoneTest extends TelephonyTest { // duplicated notification with the same suggested action registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT); SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT, REGISTRATION_TECH_LTE); regInfo = mSimulatedCommands.getImsRegistrationInfo(); // verify that there is no update in the SimulatedCommands assertTrue(regInfo[0] == 0 && regInfo[1] == 0 && regInfo[2] == 0); // unregistered with temporary error registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_NONE); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_NONE, REGISTRATION_TECH_LTE); regInfo = mSimulatedCommands.getImsRegistrationInfo(); assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED && regInfo[1] == REGISTRATION_TECH_NONE && regInfo[1] == REGISTRATION_TECH_LTE && regInfo[2] == SUGGESTED_ACTION_NONE); // verifies that reason codes except ImsReasonInfo.CODE_REGISTRATION_ERROR are discarded. reasonInfo = new ImsReasonInfo(ImsReasonInfo.CODE_LOCAL_NETWORK_NO_SERVICE, ImsReasonInfo.CODE_UNSPECIFIED, ""); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_NR); regInfo = mSimulatedCommands.getImsRegistrationInfo(); assertTrue(regInfo[0] == RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED && regInfo[1] == REGISTRATION_TECH_NONE && regInfo[1] == REGISTRATION_TECH_NR && regInfo[2] == SUGGESTED_ACTION_NONE); // change the registration info saved in the SimulatedCommands Loading @@ -1295,7 +1315,8 @@ public class ImsPhoneTest extends TelephonyTest { assertTrue(regInfo[0] == 1 && regInfo[1] == 1 && regInfo[2] == 1); // duplicated notification with the same suggested action registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_NONE); registrationCallback.onUnregistered(reasonInfo, SUGGESTED_ACTION_NONE, REGISTRATION_TECH_NR); regInfo = mSimulatedCommands.getImsRegistrationInfo(); // verify that there is no update in the SimulatedCommands Loading
tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsRegistrationCallbackHelperTest.java +21 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,9 @@ package com.android.internal.telephony.imsphone; 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.stub.ImsRegistrationImplBase.REGISTRATION_TECH_LTE; import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_NONE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; Loading Loading @@ -166,7 +169,24 @@ public class ImsRegistrationCallbackHelperTest extends TelephonyTest { assertEquals(RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED, mRegistrationCallbackHelper.getImsRegistrationState()); verify(mMockRegistrationUpdate).handleImsUnregistered(eq(reasonInfo), eq(SUGGESTED_ACTION_NONE)); eq(SUGGESTED_ACTION_NONE), eq(REGISTRATION_TECH_NONE)); } @Test @SmallTest public void testImsUnRegisteredWithSuggestedAction() { // Verify the RegistrationCallback should not be null RegistrationCallback callback = mRegistrationCallbackHelper.getCallback(); assertNotNull(callback); ImsReasonInfo reasonInfo = new ImsReasonInfo(ImsReasonInfo.CODE_REGISTRATION_ERROR, 0); callback.onUnregistered(reasonInfo, SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK, REGISTRATION_TECH_LTE); assertEquals(RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED, mRegistrationCallbackHelper.getImsRegistrationState()); verify(mMockRegistrationUpdate).handleImsUnregistered(eq(reasonInfo), eq(SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK), eq(REGISTRATION_TECH_LTE)); } @Test Loading