Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abe06d37 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

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
parent 3ff5eddd
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -912,8 +912,12 @@ public final class InCallController extends CallsManagerListenerBase {
        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) {