diff options
| author | Tyler Gunn <tgunn@google.com> | 2021-03-09 15:31:47 -0800 |
|---|---|---|
| committer | Tyler Gunn <tgunn@google.com> | 2021-03-11 15:37:14 -0800 |
| commit | 5af368bf0bca5cc7bbf7e384b9b3ef0ea3913701 (patch) | |
| tree | 35b52dbb1e9e8d40f5376e76bab09f88abd014f9 /tests/src | |
| parent | 0bcd8701fadabd3801012b3c610f7336da466ff1 (diff) | |
| download | platform_packages_services_Telecomm-5af368bf0bca5cc7bbf7e384b9b3ef0ea3913701.tar.gz platform_packages_services_Telecomm-5af368bf0bca5cc7bbf7e384b9b3ef0ea3913701.tar.bz2 platform_packages_services_Telecomm-5af368bf0bca5cc7bbf7e384b9b3ef0ea3913701.zip | |
Handle providing disconnect message through CallRedirectionService.
If a CDS is bound, then we will pass the disconnect cause on to the CDS
and wait up to 2 sec for it to potentially return an override disconnect
message. If it does we override the telephony-provided disconnect cause
so that the message provided showed up in the Dialer app.
Test: Added CTS tests for these cases.
Test: Manual test with telecom test app.
Bug: 163085177
Change-Id: I8705c3b912e5277727a8dfca9e321b3856176ee9
Diffstat (limited to 'tests/src')
| -rw-r--r-- | tests/src/com/android/server/telecom/tests/CallsManagerTest.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java index 08f353668..71e6b3510 100644 --- a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java +++ b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java @@ -41,6 +41,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.ComponentName; +import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.net.Uri; @@ -52,6 +53,7 @@ import android.os.SystemClock; import android.os.UserHandle; import android.telecom.CallerInfo; import android.telecom.Connection; +import android.telecom.DisconnectCause; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; @@ -228,6 +230,8 @@ public class CallsManagerTest extends TelecomTestCase { doNothing().when(mRoleManagerAdapter).setCurrentUserHandle(any()); when(mDisconnectedCallNotifierFactory.create(any(Context.class),any(CallsManager.class))) .thenReturn(mDisconnectedCallNotifier); + when(mTimeoutsAdapter.getCallDiagnosticServiceTimeoutMillis(any(ContentResolver.class))) + .thenReturn(2000L); mCallsManager = new CallsManager( mComponentContextFixture.getTestDouble().getApplicationContext(), mLock, @@ -1508,6 +1512,39 @@ public class CallsManagerTest extends TelecomTestCase { eq(CallState.ACTIVE)); } + /** + * Verifies where a call diagnostic service is NOT in use that we don't try to relay to the + * CallDiagnosticService and that we get a synchronous disconnect. + * @throws Exception + */ + @MediumTest + @Test + public void testDisconnectCallSynchronous() throws Exception { + Call callSpy = addSpyCall(); + callSpy.setIsSimCall(true); + when(mCallDiagnosticServiceController.isConnected()).thenReturn(false); + mCallsManager.markCallAsDisconnected(callSpy, new DisconnectCause(DisconnectCause.ERROR)); + + verify(mCallDiagnosticServiceController, never()).onCallDisconnected(any(Call.class), + any(DisconnectCause.class)); + verify(callSpy).setDisconnectCause(any(DisconnectCause.class)); + } + + @MediumTest + @Test + public void testDisconnectCallAsynchronous() throws Exception { + Call callSpy = addSpyCall(); + callSpy.setIsSimCall(true); + when(mCallDiagnosticServiceController.isConnected()).thenReturn(true); + when(mCallDiagnosticServiceController.onCallDisconnected(any(Call.class), + any(DisconnectCause.class))).thenReturn(true); + mCallsManager.markCallAsDisconnected(callSpy, new DisconnectCause(DisconnectCause.ERROR)); + + verify(mCallDiagnosticServiceController).onCallDisconnected(any(Call.class), + any(DisconnectCause.class)); + verify(callSpy, never()).setDisconnectCause(any(DisconnectCause.class)); + } + private Call addSpyCall() { return addSpyCall(SIM_2_HANDLE, CallState.ACTIVE); } |
