Loading src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +11 −1 Original line number Diff line number Diff line Loading @@ -2722,7 +2722,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { mHoldSwitchingState = HoldSwapState.INACTIVE; } ImsPhoneConnection conn = findConnection(imsCall); if (conn != null) { if (conn != null && conn.getState() != ImsPhoneCall.State.DISCONNECTED) { conn.onConnectionEvent(android.telecom.Connection.EVENT_CALL_HOLD_FAILED, null); } mPhone.notifySuppServiceFailed(Phone.SuppService.HOLD); Loading Loading @@ -4454,4 +4454,14 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { public boolean isConferenceEventPackageEnabled() { return mIsConferenceEventPackageEnabled; } @VisibleForTesting public ImsCall.Listener getImsCallListener() { return mImsCallListener; } @VisibleForTesting public ArrayList<ImsPhoneConnection> getConnections() { return mConnections; } } tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java +25 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.internal.telephony.imsphone; import static junit.framework.TestCase.fail; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; Loading @@ -33,6 +35,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.Context; import android.content.SharedPreferences; Loading Loading @@ -99,6 +102,8 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest { private ImsPhoneConnection.Listener mImsPhoneConnectionListener; @Mock private ImsConfig mImsConfig; @Mock private ImsPhoneConnection mImsPhoneConnection; private void imsCallMocking(final ImsCall imsCall) throws Exception { Loading Loading @@ -160,6 +165,7 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest { mImsCall = spy(new ImsCall(mContext, mImsCallProfile)); mSecondImsCall = spy(new ImsCall(mContext, mImsCallProfile)); mImsPhoneConnectionListener = mock(ImsPhoneConnection.Listener.class); mImsPhoneConnection = mock(ImsPhoneConnection.class); imsCallMocking(mImsCall); imsCallMocking(mSecondImsCall); doReturn(ImsFeature.STATE_READY).when(mImsManager).getImsServiceState(); Loading Loading @@ -980,6 +986,25 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest { "SERVICE not allowed in this location"))); } @Test @SmallTest public void testNoHoldErrorMessageWhenCallDisconnected() { when(mImsPhoneConnection.getImsCall()).thenReturn(mImsCall); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocationOnMock) { fail("Error message showed when the call has already been disconnected!"); return null; } }).when(mImsPhoneConnection) .onConnectionEvent(eq(android.telecom.Connection.EVENT_CALL_HOLD_FAILED), any()); mCTUT.getConnections().add(mImsPhoneConnection); when(mImsPhoneConnection.getState()).thenReturn(ImsPhoneCall.State.DISCONNECTED); ImsReasonInfo info = new ImsReasonInfo(ImsReasonInfo.CODE_UNSPECIFIED, ImsReasonInfo.CODE_UNSPECIFIED, null); mCTUT.getImsCallListener().onCallHoldFailed(mImsPhoneConnection.getImsCall(), info); } private ImsPhoneConnection placeCallAndMakeActive() { try { doAnswer(new Answer<ImsCall>() { Loading Loading
src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +11 −1 Original line number Diff line number Diff line Loading @@ -2722,7 +2722,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { mHoldSwitchingState = HoldSwapState.INACTIVE; } ImsPhoneConnection conn = findConnection(imsCall); if (conn != null) { if (conn != null && conn.getState() != ImsPhoneCall.State.DISCONNECTED) { conn.onConnectionEvent(android.telecom.Connection.EVENT_CALL_HOLD_FAILED, null); } mPhone.notifySuppServiceFailed(Phone.SuppService.HOLD); Loading Loading @@ -4454,4 +4454,14 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { public boolean isConferenceEventPackageEnabled() { return mIsConferenceEventPackageEnabled; } @VisibleForTesting public ImsCall.Listener getImsCallListener() { return mImsCallListener; } @VisibleForTesting public ArrayList<ImsPhoneConnection> getConnections() { return mConnections; } }
tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java +25 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.internal.telephony.imsphone; import static junit.framework.TestCase.fail; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; Loading @@ -33,6 +35,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.Context; import android.content.SharedPreferences; Loading Loading @@ -99,6 +102,8 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest { private ImsPhoneConnection.Listener mImsPhoneConnectionListener; @Mock private ImsConfig mImsConfig; @Mock private ImsPhoneConnection mImsPhoneConnection; private void imsCallMocking(final ImsCall imsCall) throws Exception { Loading Loading @@ -160,6 +165,7 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest { mImsCall = spy(new ImsCall(mContext, mImsCallProfile)); mSecondImsCall = spy(new ImsCall(mContext, mImsCallProfile)); mImsPhoneConnectionListener = mock(ImsPhoneConnection.Listener.class); mImsPhoneConnection = mock(ImsPhoneConnection.class); imsCallMocking(mImsCall); imsCallMocking(mSecondImsCall); doReturn(ImsFeature.STATE_READY).when(mImsManager).getImsServiceState(); Loading Loading @@ -980,6 +986,25 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest { "SERVICE not allowed in this location"))); } @Test @SmallTest public void testNoHoldErrorMessageWhenCallDisconnected() { when(mImsPhoneConnection.getImsCall()).thenReturn(mImsCall); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocationOnMock) { fail("Error message showed when the call has already been disconnected!"); return null; } }).when(mImsPhoneConnection) .onConnectionEvent(eq(android.telecom.Connection.EVENT_CALL_HOLD_FAILED), any()); mCTUT.getConnections().add(mImsPhoneConnection); when(mImsPhoneConnection.getState()).thenReturn(ImsPhoneCall.State.DISCONNECTED); ImsReasonInfo info = new ImsReasonInfo(ImsReasonInfo.CODE_UNSPECIFIED, ImsReasonInfo.CODE_UNSPECIFIED, null); mCTUT.getImsCallListener().onCallHoldFailed(mImsPhoneConnection.getImsCall(), info); } private ImsPhoneConnection placeCallAndMakeActive() { try { doAnswer(new Answer<ImsCall>() { Loading