aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-20 16:06:51 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-20 16:06:51 +0000
commit4e07177066602d01ea997cdb33bb6190ce815ce2 (patch)
tree0f088b2fb9d19169cff18d4530149b4dd8316ad7
parente4eb33d8d4f6c36d11b1f959b645d129863eaaf8 (diff)
parentbd325fc0efd8f104f93e04969abd53e198df2d5f (diff)
downloadims-android13-mainline-os-statsd-release.tar.gz
Change-Id: I0b6e4b48405d514a02d9e2c7c7ae173a84eaf15e
-rwxr-xr-xsrc/java/com/android/ims/ImsCall.java19
-rw-r--r--src/java/com/android/ims/ImsManager.java17
-rw-r--r--tests/src/com/android/ims/ImsManagerTest.java16
3 files changed, 43 insertions, 9 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.");
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
index 257aef91..c41426d0 100644
--- a/src/java/com/android/ims/ImsManager.java
+++ b/src/java/com/android/ims/ImsManager.java
@@ -1634,7 +1634,7 @@ public class ImsManager implements FeatureUpdates {
try {
return iTelephony.getImsProvisioningStatusForCapability(subId, capability, tech);
- } catch (RemoteException e) {
+ } catch (RemoteException | IllegalArgumentException e) {
logw("getImsProvisionedBoolNoException: operation failed for capability=" + capability
+ ". Exception:" + e.getMessage() + ". Returning false.");
return false;
@@ -1660,7 +1660,7 @@ public class ImsManager implements FeatureUpdates {
try {
return iTelephony.getRcsProvisioningStatusForCapability(subId, capability, tech);
- } catch (RemoteException e) {
+ } catch (RemoteException | IllegalArgumentException e) {
logw("getRcsProvisionedBoolNoException: operation failed for capability=" + capability
+ ". Exception:" + e.getMessage() + ". Returning false.");
return false;
@@ -3035,7 +3035,8 @@ public class ImsManager implements FeatureUpdates {
public @MmTelFeature.ProcessCallResult int shouldProcessCall(boolean isEmergency,
String[] numbers) throws ImsException {
try {
- return mMmTelConnectionRef.get().shouldProcessCall(isEmergency, numbers);
+ MmTelFeatureConnection c = getOrThrowExceptionIfServiceUnavailable();
+ return c.shouldProcessCall(isEmergency, numbers);
} catch (RemoteException e) {
throw new ImsException("shouldProcessCall()", e,
ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
@@ -3157,8 +3158,9 @@ public class ImsManager implements FeatureUpdates {
try {
required = iTelephony.isProvisioningRequiredForCapability(subId, capability,
tech);
- } catch (RemoteException e) {
- logw("isMmTelProvisioningRequired couldn't reach telephony!");
+ } catch (RemoteException | IllegalArgumentException e) {
+ logw("isMmTelProvisioningRequired : operation failed" + " capability=" + capability
+ + " tech=" + tech + ". Exception:" + e.getMessage());
}
log("MmTel Provisioning required " + required + " for capability " + capability);
@@ -3182,8 +3184,9 @@ public class ImsManager implements FeatureUpdates {
try {
required = iTelephony.isRcsProvisioningRequiredForCapability(subId, capability,
tech);
- } catch (RemoteException e) {
- logw("isRcsProvisioningRequired couldn't reach telephony!");
+ } catch (RemoteException | IllegalArgumentException e) {
+ logw("isRcsProvisioningRequired : operation failed" + " capability=" + capability
+ + " tech=" + tech + ". Exception:" + e.getMessage());
}
log("Rcs Provisioning required " + required + " for capability " + capability);
diff --git a/tests/src/com/android/ims/ImsManagerTest.java b/tests/src/com/android/ims/ImsManagerTest.java
index 42f110dc..0653908d 100644
--- a/tests/src/com/android/ims/ImsManagerTest.java
+++ b/tests/src/com/android/ims/ImsManagerTest.java
@@ -22,6 +22,7 @@ import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TE
import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_LTE;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.anyInt;
@@ -968,6 +969,21 @@ public class ImsManagerTest extends ImsTestBase {
anyInt());
}
+ @Test @SmallTest
+ public void testShouldProcessCall_ThrowsExceptionIfServiceIsStillInitializing() {
+ ImsManager imsManager = getImsManagerAndInitProvisionedValues();
+ doReturn(-1).when(mMmTelFeatureConnection).getSubId();
+ assertThrows(ImsException.class, () -> imsManager.shouldProcessCall(true, new String[1]));
+ }
+
+ @Test @SmallTest
+ public void testShouldProcessCall_DoesNotThrowExceptionWhenServiceInitialized()
+ throws Exception {
+ ImsManager imsManager = getImsManagerAndInitProvisionedValues();
+ int ret = imsManager.shouldProcessCall(true, new String[1]);
+ assertEquals(MmTelFeature.PROCESS_CALL_IMS, ret);
+ }
+
/**
* Tests the operation of setWfcRoamingSetting and ensures that the user setting for WFC roaming
* and the ImsConfig setting are both called properly.