aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2017-08-10 23:11:47 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-08-10 23:11:47 +0000
commitc41dd5079d4f98dc378daebe64931b4699533a97 (patch)
treeee6e84f8b9cd5722f58fc1b36de4124084d65f7c
parent71463b448be896ed8b50e43e116f5005a3989864 (diff)
parentfa3df0bc9ed9aa30ef67e65e67aec65e2a0f568e (diff)
downloadims-c41dd5079d4f98dc378daebe64931b4699533a97.tar.gz
Check Various IMS interfaces before returning cached value am: 138b4a620d
am: fa3df0bc9e Change-Id: I11551ae94cd69532a81b8c0d43f5cfbc901f28b5
-rw-r--r--src/java/com/android/ims/ImsEcbm.java4
-rw-r--r--src/java/com/android/ims/ImsManager.java106
-rw-r--r--src/java/com/android/ims/ImsMultiEndpoint.java4
-rw-r--r--src/java/com/android/ims/ImsUt.java7
4 files changed, 69 insertions, 52 deletions
diff --git a/src/java/com/android/ims/ImsEcbm.java b/src/java/com/android/ims/ImsEcbm.java
index 9fa9598d..53549bf0 100644
--- a/src/java/com/android/ims/ImsEcbm.java
+++ b/src/java/com/android/ims/ImsEcbm.java
@@ -78,6 +78,10 @@ public class ImsEcbm {
}
}
+ public boolean isBinderAlive() {
+ return miEcbm.asBinder().isBinderAlive();
+ }
+
/**
* Adapter class for {@link IImsEcbmListener}.
*/
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
index 7cb192cb..82f2c68f 100644
--- a/src/java/com/android/ims/ImsManager.java
+++ b/src/java/com/android/ims/ImsManager.java
@@ -1616,24 +1616,24 @@ public class ImsManager {
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();
+ if (mUt != null && mUt.isBinderAlive()) {
+ return mUt;
+ }
- if (iUt == null) {
- throw new ImsException("getSupplementaryServiceConfiguration()",
- ImsReasonInfo.CODE_UT_NOT_SUPPORTED);
- }
+ checkAndThrowExceptionIfServiceUnavailable();
+ try {
+ IImsUt iUt = mImsServiceProxy.getUtInterface();
- mUt = new ImsUt(iUt);
- } catch (RemoteException e) {
- throw new ImsException("getSupplementaryServiceConfiguration()", e,
- ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+ if (iUt == null) {
+ throw new ImsException("getSupplementaryServiceConfiguration()",
+ ImsReasonInfo.CODE_UT_NOT_SUPPORTED);
}
- }
+ mUt = new ImsUt(iUt);
+ } catch (RemoteException e) {
+ throw new ImsException("getSupplementaryServiceConfiguration()", e,
+ ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+ }
return mUt;
}
@@ -1811,23 +1811,22 @@ public class ImsManager {
* @throws ImsException if getting the setting interface results in an error.
*/
public ImsConfig getConfigInterface() throws ImsException {
+ if (mConfig != null && mConfig.isBinderAlive()) {
+ return mConfig;
+ }
- if (mConfig == null || !mImsServiceProxy.isBinderAlive()) {
- checkAndThrowExceptionIfServiceUnavailable();
-
- try {
- IImsConfig config = mImsServiceProxy.getConfigInterface();
- if (config == null) {
- throw new ImsException("getConfigInterface()",
- ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
- }
- mConfig = new ImsConfig(config, mContext);
- } catch (RemoteException e) {
- throw new ImsException("getConfigInterface()", e,
- ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+ checkAndThrowExceptionIfServiceUnavailable();
+ try {
+ IImsConfig config = mImsServiceProxy.getConfigInterface();
+ if (config == null) {
+ throw new ImsException("getConfigInterface()",
+ ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
}
+ mConfig = new ImsConfig(config, mContext);
+ } catch (RemoteException e) {
+ throw new ImsException("getConfigInterface()", e,
+ ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
}
- if (DBG) log("getConfigInterface(), mConfig= " + mConfig);
return mConfig;
}
@@ -2369,21 +2368,22 @@ public class ImsManager {
* @throws ImsException if getting the ECBM interface results in an error
*/
public ImsEcbm getEcbmInterface(int serviceId) throws ImsException {
- if (mEcbm == null || !mImsServiceProxy.isBinderAlive()) {
- checkAndThrowExceptionIfServiceUnavailable();
+ if (mEcbm != null && mEcbm.isBinderAlive()) {
+ return mEcbm;
+ }
- try {
- IImsEcbm iEcbm = mImsServiceProxy.getEcbmInterface();
+ checkAndThrowExceptionIfServiceUnavailable();
+ try {
+ IImsEcbm iEcbm = mImsServiceProxy.getEcbmInterface();
- if (iEcbm == null) {
- throw new ImsException("getEcbmInterface()",
- ImsReasonInfo.CODE_ECBM_NOT_SUPPORTED);
- }
- mEcbm = new ImsEcbm(iEcbm);
- } catch (RemoteException e) {
- throw new ImsException("getEcbmInterface()", e,
- ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+ if (iEcbm == null) {
+ throw new ImsException("getEcbmInterface()",
+ ImsReasonInfo.CODE_ECBM_NOT_SUPPORTED);
}
+ mEcbm = new ImsEcbm(iEcbm);
+ } catch (RemoteException e) {
+ throw new ImsException("getEcbmInterface()", e,
+ ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
}
return mEcbm;
}
@@ -2396,22 +2396,24 @@ public class ImsManager {
* @throws ImsException if getting the multi-endpoint interface results in an error
*/
public ImsMultiEndpoint getMultiEndpointInterface(int serviceId) throws ImsException {
- if (mMultiEndpoint == null || !mImsServiceProxy.isBinderAlive()) {
- checkAndThrowExceptionIfServiceUnavailable();
+ if (mMultiEndpoint != null && mMultiEndpoint.isBinderAlive()) {
+ return mMultiEndpoint;
+ }
- try {
- IImsMultiEndpoint iImsMultiEndpoint = mImsServiceProxy.getMultiEndpointInterface();
+ checkAndThrowExceptionIfServiceUnavailable();
+ try {
+ IImsMultiEndpoint iImsMultiEndpoint = mImsServiceProxy.getMultiEndpointInterface();
- if (iImsMultiEndpoint == null) {
- throw new ImsException("getMultiEndpointInterface()",
- ImsReasonInfo.CODE_MULTIENDPOINT_NOT_SUPPORTED);
- }
- mMultiEndpoint = new ImsMultiEndpoint(iImsMultiEndpoint);
- } catch (RemoteException e) {
- throw new ImsException("getMultiEndpointInterface()", e,
- ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+ if (iImsMultiEndpoint == null) {
+ throw new ImsException("getMultiEndpointInterface()",
+ ImsReasonInfo.CODE_MULTIENDPOINT_NOT_SUPPORTED);
}
+ mMultiEndpoint = new ImsMultiEndpoint(iImsMultiEndpoint);
+ } catch (RemoteException e) {
+ throw new ImsException("getMultiEndpointInterface()", e,
+ ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
}
+
return mMultiEndpoint;
}
diff --git a/src/java/com/android/ims/ImsMultiEndpoint.java b/src/java/com/android/ims/ImsMultiEndpoint.java
index 2cc19b1b..96926960 100644
--- a/src/java/com/android/ims/ImsMultiEndpoint.java
+++ b/src/java/com/android/ims/ImsMultiEndpoint.java
@@ -78,4 +78,8 @@ public class ImsMultiEndpoint {
ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
}
}
+
+ public boolean isBinderAlive() {
+ return mImsMultiendpoint.asBinder().isBinderAlive();
+ }
}
diff --git a/src/java/com/android/ims/ImsUt.java b/src/java/com/android/ims/ImsUt.java
index 4cc7011b..d8d70b05 100644
--- a/src/java/com/android/ims/ImsUt.java
+++ b/src/java/com/android/ims/ImsUt.java
@@ -508,6 +508,13 @@ public class ImsUt implements ImsUtInterface {
}
}
+ /**
+ * @return returns true if the binder is alive, false otherwise.
+ */
+ public boolean isBinderAlive() {
+ return miUt.asBinder().isBinderAlive();
+ }
+
public void transact(Bundle ssInfo, Message result) {
if (DBG) {
log("transact :: Ut=" + miUt + ", ssInfo=" + ssInfo);