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

Commit c46674d0 authored by Hai Zhang's avatar Hai Zhang
Browse files

Fix NPE in PackageManagerInternal.getPackagesForAppId().

The original code would cause NPE for ejected non-shared-user
packages, because List.of() requires the argument to be non-null and
throws an NPE otherwise.

In order to be consistent with the shared user case, we should return
empty list when the APK isn't available.

Bug: 263504888
Test: presubmit
Change-Id: Iefd80188a8dc6be5cd49b3b813aa809fd3489fff
parent 02b7943a
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -5624,7 +5624,12 @@ public class ComputerEngine implements Computer {
            return sus.getPackages();
        } else if (settingBase instanceof PackageSetting) {
            final PackageSetting ps = (PackageSetting) settingBase;
            return List.of(ps.getPkg());
            final AndroidPackage pkg = ps.getPkg();
            if (pkg != null) {
                return Collections.singletonList(pkg);
            } else {
                return Collections.emptyList();
            }
        } else {
            return Collections.emptyList();
        }