Fix ComponentName NPE when binding to InCallService

Currently, if the PackageManager can not find the component that is
set to be bound, it returns null. This creates a null InCallServiceInfo,
which creates a NPE when getComponentName is called during bind. We now
never return null and instead try to bind to the ComponentName anyway if
the PackageManager returns null.

Bug: 30150689
Change-Id: I463332b1707a76d8b018aaaacbca542c91948dbf
diff --git a/src/com/android/server/telecom/ b/src/com/android/server/telecom/
index 1432373..5e1b887 100644
--- a/src/com/android/server/telecom/
+++ b/src/com/android/server/telecom/
@@ -912,8 +912,12 @@
         List<InCallServiceInfo> list = getInCallServiceComponents(componentName, type);
         if (list != null && !list.isEmpty()) {
             return list.get(0);
+        } else {
+            // Last Resort: Try to bind to the ComponentName given directly.
+            Log.e(this, new Exception(), "Package Manager could not find ComponentName: "
+                    + componentName +". Trying to bind anyway.");
+            return new InCallServiceInfo(componentName, false);
-        return null;
     private InCallServiceInfo getInCallServiceComponent(String packageName, int type) {