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

Commit b1b70b75 authored by Alex Buynytskyy's avatar Alex Buynytskyy
Browse files

Semi-silently ignore security exception.

Output an error into "error" stream, but keep the primary output stream clean, containing only list of packages.

Bug: 309623512
Test: N/A
Change-Id: Ib2bf90fa4c2a2f5a43b1c22158426899585cb472
parent 38fc4f35
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1085,8 +1085,14 @@ class PackageManagerShellCommand extends ShellCommand {
        // the sdk or package name along with optional additional information based on opt.
        final Map<String, List<String>> out = new HashMap<>();
        for (int userId : userIds) {
            final int translatedUserId =
            final int translatedUserId;
            try {
                translatedUserId =
                    translateUserId(userId, UserHandle.USER_SYSTEM, "runListPackages");
            } catch (RuntimeException ex) {
                getErrPrintWriter().println("Error: " + ex.toString());
                continue;
            }
            @SuppressWarnings("unchecked") final ParceledListSlice<PackageInfo> slice =
                    mInterface.getInstalledPackages(getFlags, translatedUserId);
            final List<PackageInfo> packages = slice.getList();