diff options
author | Brad Ebinger <breadley@google.com> | 2018-03-08 11:37:35 -0800 |
---|---|---|
committer | Brad Ebinger <breadley@google.com> | 2018-03-13 11:16:21 -0700 |
commit | d1b1a3cb525ce13cf10e327c8de5878b73d7a5cd (patch) | |
tree | 71b0a8cfcc05b551cacdc6f075206657847d3182 | |
parent | 27b7c1d502149ab8cee920282721933245c7b525 (diff) | |
download | ims-d1b1a3cb525ce13cf10e327c8de5878b73d7a5cd.tar.gz |
Add ImsManager#removeRegistrationListener
Adds a removeRegistrationListener API to
complement the existing add method.
Bug: 73951668
Test: Manual
Merged-In: Ieee1d53763d3544ad8e014f900559559c043248c
Change-Id: I3c31236ec51480c819936a7ba1fac882d5a42200
-rw-r--r-- | src/java/com/android/ims/ImsManager.java | 22 | ||||
-rw-r--r-- | src/java/com/android/ims/MmTelFeatureConnection.java | 2 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java index 521b46ad..3a971cf4 100644 --- a/src/java/com/android/ims/ImsManager.java +++ b/src/java/com/android/ims/ImsManager.java @@ -1556,7 +1556,6 @@ public class ImsManager { throw new NullPointerException("registration callback can't be null"); } - checkAndThrowExceptionIfServiceUnavailable(); try { mMmTelFeatureConnection.addRegistrationCallback(callback); log("Registration Callback registered."); @@ -1568,6 +1567,27 @@ public class ImsManager { } /** + * Removes a previously added registration callback that was added via + * {@link #addRegistrationCallback(ImsRegistrationImplBase.Callback)} . + * @param callback A {@link ImsRegistrationImplBase.Callback} that was previously added. + * @throws ImsException when the ImsService connection is not available. + */ + public void removeRegistrationListener(ImsRegistrationImplBase.Callback callback) + throws ImsException { + if (callback == null) { + throw new NullPointerException("registration callback can't be null"); + } + + try { + mMmTelFeatureConnection.removeRegistrationCallback(callback); + log("Registration callback removed."); + } catch (RemoteException e) { + throw new ImsException("removeRegistrationCallback(IRIB)", e, + ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); + } + } + + /** * Adds a callback that gets called when MMTel capability status has changed, for example when * Voice over IMS or VT over IMS is not available currently. * @param callback A {@link ImsFeature.CapabilityCallback} that will notify the caller when diff --git a/src/java/com/android/ims/MmTelFeatureConnection.java b/src/java/com/android/ims/MmTelFeatureConnection.java index 2d11ae60..6028f6f3 100644 --- a/src/java/com/android/ims/MmTelFeatureConnection.java +++ b/src/java/com/android/ims/MmTelFeatureConnection.java @@ -196,7 +196,7 @@ public class MmTelFeatureConnection { IImsRegistration imsRegistration = getRegistration(); if (imsRegistration != null) { try { - getRegistration().addRegistrationCallback(mRegistrationCallbackAdapter); + getRegistration().removeRegistrationCallback(mRegistrationCallbackAdapter); } catch (RemoteException e) { Log.w(TAG, "removeConnection: couldn't remove registration callback"); } |