diff options
author | Tyler Gunn <tgunn@google.com> | 2022-06-17 19:23:04 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-06-17 19:23:04 +0000 |
commit | 2fc67cdf5d8a8c739ffbb49c9b383b95990a17b1 (patch) | |
tree | ade4bb537b6de0c47fb5a7ee09dca4016122ae2b | |
parent | 659685245cc5e4ad0b98884ec1a05f70f873f3e3 (diff) | |
parent | e4e6b563451037a6e26b96ce239361674ca036bd (diff) | |
download | telephony-2fc67cdf5d8a8c739ffbb49c9b383b95990a17b1.tar.gz |
Merge "Fix issue where remotely disconnected calls show up as missed." into tm-dev am: e4e6b56345
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/18920326
Change-Id: I5a83c8adfd93f185e6efc339215783f75fd9a4df
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java | 14 | ||||
-rw-r--r-- | tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java | 18 |
2 files changed, 29 insertions, 3 deletions
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java index cc8af38cdd..488d98f64f 100644 --- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java @@ -3292,12 +3292,20 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { } else if (conn.isIncoming() && conn.getConnectTime() == 0 && cause != DisconnectCause.ANSWERED_ELSEWHERE) { - - if (conn.getDisconnectCause() == DisconnectCause.LOCAL) { + // Two cases where the call is declared as rejected. + // 1. The disconnect was initiated by the user. I.e. the connection's + // disconnect cause is LOCAL at this point. + // 2. The network provided disconnect cause is INCOMING_REJECTED. This will be + // the case for ImsReasonInfo.CODE_USER_TERMINATED_BY_REMOTE and + // ImsReasonInfo.CODE_REJECTED_ELSEWHERE. + if (conn.getDisconnectCause() == DisconnectCause.LOCAL + || cause == DisconnectCause.INCOMING_REJECTED) { // If the user initiated a disconnect of this connection, then we will treat // this is a rejected call. - // Note; the record the fact that this is a local disconnect in + // Note; we record the fact that this is a local disconnect in // ImsPhoneConnection#onHangupLocal + // Alternatively, the network can specify INCOMING_REJECTED as a result of + // remote reject on another device; we'll still treat as rejected. cause = DisconnectCause.INCOMING_REJECTED; } else { // Otherwise in all other cases consider it missed. diff --git a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java index 95eedc2aed..af3b7466aa 100644 --- a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java +++ b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java @@ -508,6 +508,24 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest { assertEquals(DisconnectCause.INCOMING_REJECTED, connection.getDisconnectCause()); } + @Test + @SmallTest + public void testRejectedElsewhereIsRejected() { + ImsPhoneConnection connection = setupRingingConnection(); + mImsCallListener.onCallTerminated(connection.getImsCall(), + new ImsReasonInfo(ImsReasonInfo.CODE_REJECTED_ELSEWHERE, 0)); + assertEquals(DisconnectCause.INCOMING_REJECTED, connection.getDisconnectCause()); + } + + @Test + @SmallTest + public void testRemoteCallDeclineIsRejected() { + ImsPhoneConnection connection = setupRingingConnection(); + mImsCallListener.onCallTerminated(connection.getImsCall(), + new ImsReasonInfo(ImsReasonInfo.CODE_REMOTE_CALL_DECLINE, 0)); + assertEquals(DisconnectCause.INCOMING_REJECTED, connection.getDisconnectCause()); + } + private ImsPhoneConnection setupRingingConnection() { mImsCallProfile.setCallerNumberVerificationStatus( ImsCallProfile.VERIFICATION_STATUS_PASSED); |