diff options
author | Brad Ebinger <breadley@google.com> | 2018-03-05 16:39:02 -0800 |
---|---|---|
committer | Brad Ebinger <breadley@google.com> | 2018-03-13 11:08:00 -0700 |
commit | 0aed76da29d1ffbf4b515b2835567cff8dac465a (patch) | |
tree | f105302bffa768c8a841c933f4c7563550e09f76 | |
parent | 27b7c1d502149ab8cee920282721933245c7b525 (diff) | |
download | ims-0aed76da29d1ffbf4b515b2835567cff8dac465a.tar.gz |
Dynamic Query for ImsService
1) Fixes ImsManager.Connector bug where we would reset
retry count, even if there was an ImsException.
2) ImsManager#isServiceAvailable now uses ImsResolver state
to figure out if an ImsService is possibly going to bind/
unbind.
Test: Telephony test ImsService, telephony unit tests
Bug: 72642524
Merged-In: I6d68b98126b2b682b4f2c54947acdd90e7bc51b0
Change-Id: Iac4de9091c3374970be450930424a22d9158de13
-rw-r--r-- | src/java/com/android/ims/ImsManager.java | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java index 521b46ad..29176a27 100644 --- a/src/java/com/android/ims/ImsManager.java +++ b/src/java/com/android/ims/ImsManager.java @@ -339,10 +339,19 @@ public class ImsManager { private void notifyReady() throws ImsException { ImsManager manager; synchronized (mLock) { - mRetryCount = 0; manager = mImsManager; } - mListener.connectionReady(manager); + try { + mListener.connectionReady(manager); + } + catch (ImsException e) { + Log.w(TAG, "Connector: notifyReady exception: " + e.getMessage()); + throw e; + } + // Only reset retry count if connectionReady does not generate an ImsException/ + synchronized (mLock) { + mRetryCount = 0; + } } private void notifyNotReady() { @@ -1421,10 +1430,18 @@ public class ImsManager { } /* - * Returns a flag indicating whether the IMS service is available. If it is not available, - * it will try to connect before reporting failure. + * Returns a flag indicating whether the IMS service is available. If it is not available or + * busy, it will try to connect before reporting failure. */ public boolean isServiceAvailable() { + // If we are busy resolving dynamic IMS bindings, we are not available yet. + TelephonyManager tm = (TelephonyManager) + mContext.getSystemService(Context.TELEPHONY_SERVICE); + if (tm.isResolvingImsBinding()) { + Log.d(TAG, "isServiceAvailable: resolving IMS binding, returning false"); + return false; + } + connectIfServiceIsAvailable(); // mImsServiceProxy will always create an ImsServiceProxy. return mMmTelFeatureConnection.isBinderAlive(); |