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

Commit cb247866 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Svetoslav
Browse files

PackageManager#queryIntentServices breaks its contract.

PackageManager#queryIntentServices javadoc contract states that this
method (and the like) never returns null, rather an empty list if
no result is found. However, there is a path in the PackageManagerService
that returns null, thus breaking the contract. Handling the null list
explicitly.

bug:10930560

Change-Id: I708c51b8b7075e529145c8b0bf159efd6b697532
parent b198115e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -413,6 +413,10 @@ public final class PrintManagerService extends IPrintManager.Stub {
                        .queryIntentServicesAsUser(intent, PackageManager.GET_SERVICES,
                                getChangingUserId());

                if (installedServices == null) {
                    return;
                }

                final int installedServiceCount = installedServices.size();
                for (int i = 0; i < installedServiceCount; i++) {
                    ServiceInfo serviceInfo = installedServices.get(i).serviceInfo;