aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2017-04-27 17:01:54 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-04-27 17:01:54 +0000
commitac8c8c56b67440fb2e08004cbd1a94791cd154de (patch)
tree84ad83e913646c06ae6be2b6b1724c5d1a33dd7e /src
parentef012cc3f7702c66162fbb33c1ae7f944a43f77f (diff)
parent3dd83d98a32c69770fd9595d4833002bf313450d (diff)
downloadims-ac8c8c56b67440fb2e08004cbd1a94791cd154de.tar.gz
Better handle MSIM DDS changed event am: b10b61e109 am: 0872c3abe8
am: 3dd83d98a3 Change-Id: I1130e81c2e5078513adf7e36dcff947e8d77e4bf
Diffstat (limited to 'src')
-rw-r--r--src/java/com/android/ims/ImsManager.java27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
index 6f38a62e..080c372c 100644
--- a/src/java/com/android/ims/ImsManager.java
+++ b/src/java/com/android/ims/ImsManager.java
@@ -1442,7 +1442,17 @@ public class ImsManager {
mImsConfigListener = listener;
}
- public void addNotifyStatusChangedCallback(ImsServiceProxy.INotifyStatusChanged c) {
+
+ /**
+ * Adds a callback for status changed events if the binder is already available. If it is not,
+ * this method will throw an ImsException.
+ */
+ public void addNotifyStatusChangedCallbackIfAvailable(ImsServiceProxy.INotifyStatusChanged c)
+ throws ImsException {
+ if (!mImsServiceProxy.isBinderAlive()) {
+ throw new ImsException("Binder is not active!",
+ ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+ }
if (c != null) {
mStatusCallbacks.add(c);
}
@@ -1853,8 +1863,6 @@ public class ImsManager {
}
public int getImsServiceStatus() throws ImsException {
- checkAndThrowExceptionIfServiceUnavailable();
-
return mImsServiceProxy.getFeatureStatus();
}
@@ -1986,7 +1994,8 @@ public class ImsManager {
}
/**
- * Binds the IMS service only if the service is not created.
+ * Checks to see if the ImsService Binder is connected. If it is not, we try to create the
+ * connection again.
*/
private void checkAndThrowExceptionIfServiceUnavailable()
throws ImsException {
@@ -2036,13 +2045,13 @@ public class ImsManager {
TelephonyManager tm = (TelephonyManager)
mContext.getSystemService(Context.TELEPHONY_SERVICE);
ImsServiceProxy serviceProxy = new ImsServiceProxy(mPhoneId, ImsFeature.MMTEL);
+ serviceProxy.setStatusCallback(() -> mStatusCallbacks.forEach(
+ ImsServiceProxy.INotifyStatusChanged::notifyStatusChanged));
// Returns null if the service is not available.
IImsServiceController b = tm.getImsServiceControllerAndListen(mPhoneId,
ImsFeature.MMTEL, serviceProxy.getListener());
if (b != null) {
serviceProxy.setBinder(b.asBinder());
- serviceProxy.setStatusCallback(() -> mStatusCallbacks.forEach(
- ImsServiceProxy.INotifyStatusChanged::notifyStatusChanged));
// Trigger the cache to be updated for feature status.
serviceProxy.getFeatureStatus();
} else {
@@ -2062,9 +2071,13 @@ public class ImsManager {
private ImsCallSession createCallSession(int serviceId,
ImsCallProfile profile) throws ImsException {
try {
+ // Throws an exception if the ImsService Feature is not ready to accept commands.
return new ImsCallSession(mImsServiceProxy.createCallSession(serviceId, profile, null));
} catch (RemoteException e) {
- return null;
+ Rlog.w(TAG, "CreateCallSession: Error, remote exception: " + e.getMessage());
+ throw new ImsException("createCallSession()", e,
+ ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+
}
}