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

Commit 0d446c18 authored by Christopher Tate's avatar Christopher Tate
Browse files

Crashing the system process is inadvisable

When asking for the set of services published by a package, it's
quite possible that there are none, in which case the returned List<>
is null rather than valid-but-empty.  Don't bother looking at it
when it's null.

Bug 23614440

Change-Id: Ibebb26b9c3f75ec810a95f1b9d2663e884cb98bc
parent 3883e72a
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -1955,12 +1955,14 @@ public class BackupManagerService {
                .setPackage(pkgInfo.packageName);
                .setPackage(pkgInfo.packageName);
        List<ResolveInfo> hosts = mPackageManager.queryIntentServicesAsUser(
        List<ResolveInfo> hosts = mPackageManager.queryIntentServicesAsUser(
                intent, 0, UserHandle.USER_OWNER);
                intent, 0, UserHandle.USER_OWNER);
        if (hosts != null) {
            final int N = hosts.size();
            final int N = hosts.size();
            for (int i = 0; i < N; i++) {
            for (int i = 0; i < N; i++) {
                final ServiceInfo info = hosts.get(i).serviceInfo;
                final ServiceInfo info = hosts.get(i).serviceInfo;
                tryBindTransport(info);
                tryBindTransport(info);
            }
            }
        }
        }
    }


    // Verify that the service exists and is hosted by a privileged app, then proceed to bind
    // Verify that the service exists and is hosted by a privileged app, then proceed to bind
    boolean tryBindTransport(ServiceInfo info) {
    boolean tryBindTransport(ServiceInfo info) {