Remove Session Id from ImsService APIs that do not need it. am: b5f30c7854 am: 8dcc70a6a7
Brad Ebinger [Tue, 21 Feb 2017 20:32:19 +0000 (20:32 +0000)]
am: f72f113ad5

Change-Id: Iae8a76042e2817220d605520de7b0dd4d9fb8a4e

src/java/com/android/ims/ImsManager.java

index 123f298..c57b441 100644 (file)
@@ -1011,37 +1011,6 @@ public class ImsManager {
      * @throws NullPointerException if {@code listener} is null
      * @throws ImsException if calling the IMS service results in an error
      */
-    public void addRegistrationListener(int sessionId, int serviceClass,
-            ImsConnectionStateListener listener)
-            throws ImsException {
-        checkAndThrowExceptionIfServiceUnavailable();
-
-        if (listener == null) {
-            throw new NullPointerException("listener can't be null");
-        }
-
-        try {
-            ImsRegistrationListenerProxy p = createRegistrationListenerProxy(serviceClass,
-                    listener);
-            mRegistrationListeners.add(p);
-            mImsServiceProxy.addRegistrationListener(sessionId, p);
-        } catch (RemoteException e) {
-            throw new ImsException("addRegistrationListener()", e,
-                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
-        }
-    }
-
-    /**
-     * Adds registration listener to the IMS service.
-     *
-     * @param serviceClass a service class specified in {@link ImsServiceClass}
-     *      For VoLTE service, it MUST be a {@link ImsServiceClass#MMTEL}.
-     * @param listener To listen to IMS registration events; It cannot be null
-     * @throws NullPointerException if {@code listener} is null
-     * @throws ImsException if calling the IMS service results in an error
-     * @deprecated Use {@link #addRegistrationListener(int, int, ImsConnectionStateListener)}
-     * instead.
-     */
     public void addRegistrationListener(int serviceClass, ImsConnectionStateListener listener)
             throws ImsException {
         checkAndThrowExceptionIfServiceUnavailable();
@@ -1053,9 +1022,8 @@ public class ImsManager {
         try {
             ImsRegistrationListenerProxy p = createRegistrationListenerProxy(serviceClass,
                     listener);
-            // Only add the listener if it doesn't already exist in the set.
             mRegistrationListeners.add(p);
-            mImsServiceProxy.addRegistrationListener(ImsFeature.MMTEL, p);
+            mImsServiceProxy.addRegistrationListener(p);
         } catch (RemoteException e) {
             throw new ImsException("addRegistrationListener()", e,
                     ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
@@ -1065,13 +1033,12 @@ public class ImsManager {
     /**
      * Removes the registration listener from the IMS service.
      *
-     * @param sessionId The session ID returned by open.
      * @param listener Previously registered listener that will be removed. Can not be null.
      * @throws NullPointerException if {@code listener} is null
      * @throws ImsException if calling the IMS service results in an error
      * instead.
      */
-    public void removeRegistrationListener(int sessionId, ImsConnectionStateListener listener)
+    public void removeRegistrationListener(ImsConnectionStateListener listener)
             throws ImsException {
         checkAndThrowExceptionIfServiceUnavailable();
 
@@ -1085,7 +1052,7 @@ public class ImsManager {
             if(optionalProxy.isPresent()) {
                 ImsRegistrationListenerProxy p = optionalProxy.get();
                 mRegistrationListeners.remove(p);
-                mImsServiceProxy.removeRegistrationListener(sessionId, p);
+                mImsServiceProxy.removeRegistrationListener(p);
             }
         } catch (RemoteException e) {
             throw new ImsException("removeRegistrationListener()", e,
@@ -1119,18 +1086,17 @@ public class ImsManager {
     /**
      * Gets the configuration interface to provision / withdraw the supplementary service settings.
      *
-     * @param sessionId a session id which is obtained from {@link ImsManager#open}
      * @return the Ut interface instance
      * @throws ImsException if getting the Ut interface results in an error
      */
-    public ImsUtInterface getSupplementaryServiceConfiguration(int sessionId)
+    public ImsUtInterface getSupplementaryServiceConfiguration()
             throws ImsException {
         // FIXME: manage the multiple Ut interfaces based on the session id
         if (mUt == null || !mImsServiceProxy.isBinderAlive()) {
             checkAndThrowExceptionIfServiceUnavailable();
 
             try {
-                IImsUt iUt = mImsServiceProxy.getUtInterface(sessionId);
+                IImsUt iUt = mImsServiceProxy.getUtInterface();
 
                 if (iUt == null) {
                     throw new ImsException("getSupplementaryServiceConfiguration()",
@@ -1151,7 +1117,6 @@ public class ImsManager {
      * Checks if the IMS service has successfully registered to the IMS network
      * with the specified service & call type.
      *
-     * @param sessionId a session id which is obtained from {@link ImsManager#open}
      * @param serviceType a service type that is specified in {@link ImsCallProfile}
      *        {@link ImsCallProfile#SERVICE_TYPE_NORMAL}
      *        {@link ImsCallProfile#SERVICE_TYPE_EMERGENCY}
@@ -1164,12 +1129,12 @@ public class ImsManager {
      *        false otherwise
      * @throws ImsException if calling the IMS service results in an error
      */
-    public boolean isConnected(int sessionId, int serviceType, int callType)
+    public boolean isConnected(int serviceType, int callType)
             throws ImsException {
         checkAndThrowExceptionIfServiceUnavailable();
 
         try {
-            return mImsServiceProxy.isConnected(sessionId, serviceType, callType);
+            return mImsServiceProxy.isConnected(serviceType, callType);
         } catch (RemoteException e) {
             throw new ImsException("isServiceConnected()", e,
                     ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
@@ -1179,15 +1144,14 @@ public class ImsManager {
     /**
      * Checks if the specified IMS service is opend.
      *
-     * @param sessionId a session id which is obtained from {@link ImsManager#open}
      * @return true if the specified service id is opened; false otherwise
      * @throws ImsException if calling the IMS service results in an error
      */
-    public boolean isOpened(int sessionId) throws ImsException {
+    public boolean isOpened() throws ImsException {
         checkAndThrowExceptionIfServiceUnavailable();
 
         try {
-            return mImsServiceProxy.isOpened(sessionId);
+            return mImsServiceProxy.isOpened();
         } catch (RemoteException e) {
             throw new ImsException("isOpened()", e,
                     ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
@@ -1214,8 +1178,8 @@ public class ImsManager {
      * @return a {@link ImsCallProfile} object
      * @throws ImsException if calling the IMS service results in an error
      */
-    public ImsCallProfile createCallProfile(int sessionId,
-            int serviceType, int callType) throws ImsException {
+    public ImsCallProfile createCallProfile(int sessionId, int serviceType, int callType)
+            throws ImsException {
         checkAndThrowExceptionIfServiceUnavailable();
 
         try {
@@ -1328,7 +1292,7 @@ public class ImsManager {
             checkAndThrowExceptionIfServiceUnavailable();
 
             try {
-                IImsConfig config = mImsServiceProxy.getConfigInterface(mPhoneId);
+                IImsConfig config = mImsServiceProxy.getConfigInterface();
                 if (config == null) {
                     throw new ImsException("getConfigInterface()",
                             ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
@@ -1343,13 +1307,13 @@ public class ImsManager {
         return mConfig;
     }
 
-    public void setUiTTYMode(Context context, int sessionId, int uiTtyMode, Message onComplete)
+    public void setUiTTYMode(Context context, int uiTtyMode, Message onComplete)
             throws ImsException {
 
         checkAndThrowExceptionIfServiceUnavailable();
 
         try {
-            mImsServiceProxy.setUiTTYMode(sessionId, uiTtyMode, onComplete);
+            mImsServiceProxy.setUiTTYMode(uiTtyMode, onComplete);
         } catch (RemoteException e) {
             throw new ImsException("setTTYMode()", e,
                     ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
@@ -1583,7 +1547,7 @@ public class ImsManager {
         checkAndThrowExceptionIfServiceUnavailable();
 
         try {
-            mImsServiceProxy.turnOnIms(mPhoneId);
+            mImsServiceProxy.turnOnIms();
         } catch (RemoteException e) {
             throw new ImsException("turnOnIms() ", e, ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
         }
@@ -1646,7 +1610,7 @@ public class ImsManager {
         checkAndThrowExceptionIfServiceUnavailable();
 
         try {
-            mImsServiceProxy.turnOffIms(mPhoneId);
+            mImsServiceProxy.turnOffIms();
         } catch (RemoteException e) {
             throw new ImsException("turnOffIms() ", e, ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
         }
@@ -1842,7 +1806,7 @@ public class ImsManager {
             checkAndThrowExceptionIfServiceUnavailable();
 
             try {
-                IImsEcbm iEcbm = mImsServiceProxy.getEcbmInterface(serviceId);
+                IImsEcbm iEcbm = mImsServiceProxy.getEcbmInterface();
 
                 if (iEcbm == null) {
                     throw new ImsException("getEcbmInterface()",
@@ -1869,8 +1833,7 @@ public class ImsManager {
             checkAndThrowExceptionIfServiceUnavailable();
 
             try {
-                IImsMultiEndpoint iImsMultiEndpoint = mImsServiceProxy.getMultiEndpointInterface(
-                        serviceId);
+                IImsMultiEndpoint iImsMultiEndpoint = mImsServiceProxy.getMultiEndpointInterface();
 
                 if (iImsMultiEndpoint == null) {
                     throw new ImsException("getMultiEndpointInterface()",