summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brad Ebinger <breadley@google.com> 2020-05-21 16:35:23 -0700
committer Brad Ebinger <breadley@google.com> 2020-06-19 17:20:22 +0000
commite170706352f1ccc87c8050b92ea19cdd099f6306 (patch)
treec4b9fbcd245925c0f5f21e0700b23409b44905c6
parent7efd5a48e0ff5564e4848a7acad9421bb4690026 (diff)
Remove IllegalArgumentException for registration of capabilities
We threw an IllegalArgumentException for an invalid subscription, however this is counter to what this exception should be used for. Instead, use ImsException#CODE_ERROR_INVALID_SUBSCRIPTION. Also fixed incorrect ImsException sent when telephony crashed. Bug: 156402275 Fixes: 159135792 Test: atest FrameworksTelephonyTests; CtsTelephonyTestCases; manual Change-Id: I3250419a2438afb58922ae653e3f2e4f9628e593 Merged-In: I3250419a2438afb58922ae653e3f2e4f9628e593
-rw-r--r--telephony/java/android/telephony/ims/ImsMmTelManager.java12
1 files changed, 2 insertions, 10 deletions
diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java
index 872f49d65d25..c274ec49cb2e 100644
--- a/telephony/java/android/telephony/ims/ImsMmTelManager.java
+++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java
@@ -519,9 +519,6 @@ public class ImsMmTelManager implements RegistrationManager {
* @param executor The executor the callback events should be run on.
* @param c The MmTel {@link CapabilityCallback} to be registered.
* @see #unregisterMmTelCapabilityCallback(CapabilityCallback)
- * @throws IllegalArgumentException if the subscription associated with this callback is not
- * active (SIM is not inserted, ESIM inactive) or invalid, or a null {@link Executor} or
- * {@link CapabilityCallback} callback.
* @throws ImsException if the subscription associated with this callback is valid, but
* the {@link ImsService} associated with the subscription is not available. This can happen if
* the service crashed, for example. See {@link ImsException#getCode()} for a more detailed
@@ -544,18 +541,13 @@ public class ImsMmTelManager implements RegistrationManager {
ITelephony iTelephony = getITelephony();
if (iTelephony == null) {
throw new ImsException("Could not find Telephony Service.",
- ImsException.CODE_ERROR_INVALID_SUBSCRIPTION);
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
try {
iTelephony.registerMmTelCapabilityCallback(mSubId, c.getBinder());
} catch (ServiceSpecificException e) {
- if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) {
- // Rethrow as runtime error to keep API compatible.
- throw new IllegalArgumentException(e.getMessage());
- } else {
- throw new ImsException(e.getMessage(), e.errorCode);
- }
+ throw new ImsException(e.getMessage(), e.errorCode);
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
} catch (IllegalStateException e) {