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

Commit 821c4616 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE caused by orphaned child sessions"

parents 48b3ab71 b5345b5c
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -1461,8 +1461,9 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
        private TreeMap<PackageInstallerSession, TreeSet<PackageInstallerSession>> mSessionMap;

        private final Comparator<PackageInstallerSession> mSessionCreationComparator =
                Comparator.comparingLong((PackageInstallerSession sess) -> sess.createdMillis)
                          .thenComparingInt(sess -> sess.sessionId);
                Comparator.comparingLong(
                        (PackageInstallerSession sess) -> sess != null ? sess.createdMillis : -1)
                        .thenComparingInt(sess -> sess != null ? sess.sessionId : -1);

        ParentChildSessionMap() {
            mSessionMap = new TreeMap<>(mSessionCreationComparator);
@@ -1500,10 +1501,12 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
            for (Map.Entry<PackageInstallerSession, TreeSet<PackageInstallerSession>> entry
                    : mSessionMap.entrySet()) {
                PackageInstallerSession parentSession = entry.getKey();
                if (parentSession != null) {
                    pw.print(tag + " ");
                    parentSession.dump(pw);
                    pw.println();
                    pw.increaseIndent();
                }

                for (PackageInstallerSession childSession : entry.getValue()) {
                    pw.print(tag + " Child ");