Add interface to determine whether the IMS service is available
Etan Cohen [Fri, 27 Feb 2015 01:47:13 +0000 (17:47 -0800)]
Bug: 19447972
Change-Id: Ida074dd6840c1c7682bdca32d858aa28db2dc71d

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

index 0cdf66d..9a0f04a 100644 (file)
@@ -280,6 +280,22 @@ public class ImsManager {
         createImsService(true);
     }
 
+    /*
+     * Returns a flag indicating whether the IMS service is available.
+     */
+    public boolean isServiceAvailable() {
+        if (mImsService != null) {
+            return true;
+        }
+
+        IBinder binder = ServiceManager.checkService(getImsServiceName(mPhoneId));
+        if (binder != null) {
+            return true;
+        }
+
+        return false;
+    }
+
     /**
      * Opens the IMS service for making calls and/or receiving generic IMS calls.
      * The caller may make subsquent calls through {@link #makeCall}.