diff options
author | Brad Ebinger <breadley@google.com> | 2022-06-17 12:07:19 -0700 |
---|---|---|
committer | Brad Ebinger <breadley@google.com> | 2022-06-17 12:32:28 -0700 |
commit | fff67ce3fc506e6adb865c69d881b13f3cfed632 (patch) | |
tree | 0f088b2fb9d19169cff18d4530149b4dd8316ad7 | |
parent | 2838d3908eecbc55c57076c142ac1c204f2761f9 (diff) | |
download | ims-fff67ce3fc506e6adb865c69d881b13f3cfed632.tar.gz |
Fix RTT NPE due to ImsCall#close being calledandroid13-dev
When the IMS call is closed, in some cases, a pending RTT
initialization request could still be in the queue to be
processed. Since this depends on resources that have since been
release, it can cause an NPE.
Guard against this condition and return early if this condition
is hit.
Bug: 236279778
Test: atest FrameworksTelephonyTests:ImsCallTest
Change-Id: I1c734eebd8135655752e646c5967e65cfe140c89
-rwxr-xr-x | src/java/com/android/ims/ImsCall.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/java/com/android/ims/ImsCall.java b/src/java/com/android/ims/ImsCall.java index a5813d88..06230a16 100755 --- a/src/java/com/android/ims/ImsCall.java +++ b/src/java/com/android/ims/ImsCall.java @@ -1762,7 +1762,12 @@ public class ImsCall implements ICall { public void sendRttMessage(String rttMessage) { synchronized(mLockObj) { if (mSession == null) { - loge("sendRttMessage::no session"); + loge("sendRttMessage::no session, ignoring"); + return; + } + if (mCallProfile == null || mCallProfile.mMediaProfile == null) { + loge("sendRttMessage:: no valid call profile, ignoring"); + return; } if (!mCallProfile.mMediaProfile.isRttCall()) { logi("sendRttMessage::Not an rtt call, ignoring"); @@ -1781,7 +1786,12 @@ public class ImsCall implements ICall { synchronized(mLockObj) { if (mSession == null) { - loge("sendRttModifyRequest::no session"); + loge("sendRttModifyRequest::no session, ignoring"); + return; + } + if (mCallProfile == null || mCallProfile.mMediaProfile == null) { + loge("sendRttModifyRequest:: no valid call profile, ignoring"); + return; } if (rttOn && mCallProfile.mMediaProfile.isRttCall()) { logi("sendRttModifyRequest::Already RTT call, ignoring request to turn on."); @@ -1815,6 +1825,11 @@ public class ImsCall implements ICall { synchronized(mLockObj) { if (mSession == null) { loge("sendRttModifyResponse::no session"); + return; + } + if (mCallProfile == null || mCallProfile.mMediaProfile == null) { + loge("sendRttModifyResponse:: no valid call profile, ignoring"); + return; } if (mCallProfile.mMediaProfile.isRttCall()) { logi("sendRttModifyResponse::Already RTT call, ignoring."); |