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

Commit 878e87d2 authored by Omar Eissa's avatar Omar Eissa
Browse files

Support showing initial non stopped system packages

Bug: 269129704
Test: inspect output of pm list initial-non-stopped-system-packages
Change-Id: I6741c9d5fe1328d246c10fd6b3d28aa81cc2f52f
parent 78ad5e0d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -502,6 +502,8 @@ interface IPackageManager {

    boolean hasSystemFeature(String name, int version);

    List<String> getInitialNonStoppedSystemPackages();

    void enterSafeMode();
    @UnsupportedAppUsage
    boolean isSafeMode();
+6 −0
Original line number Diff line number Diff line
@@ -5257,6 +5257,12 @@ public class PackageManagerService implements PackageSender, TestUtilityService
            return new ParceledListSlice<>(res);
        }

        @Override
        public @NonNull List<String> getInitialNonStoppedSystemPackages() {
            return mInitialNonStoppedSystemPackages != null
                    ? new ArrayList<>(mInitialNonStoppedSystemPackages) : new ArrayList<>();
        }

        @Override
        public String[] getUnsuspendablePackagesForUser(String[] packageNames, int userId) {
            Objects.requireNonNull(packageNames, "packageNames cannot be null");
+17 −0
Original line number Diff line number Diff line
@@ -782,6 +782,8 @@ class PackageManagerShellCommand extends ShellCommand {
                        getInFileDescriptor(), getOutFileDescriptor(), getErrFileDescriptor(),
                        new String[] { "list" }, getShellCallback(), adoptResultReceiver());
                return 0;
            case "initial-non-stopped-system-packages":
                return runListInitialNonStoppedSystemPackages();
        }
        pw.println("Error: unknown list type '" + type + "'");
        return -1;
@@ -794,6 +796,21 @@ class PackageManagerShellCommand extends ShellCommand {
        return 0;
    }

    private int runListInitialNonStoppedSystemPackages() throws RemoteException {
        final PrintWriter pw = getOutPrintWriter();
        final List<String> list = mInterface.getInitialNonStoppedSystemPackages();

        Collections.sort(list);

        for (String pkgName : list) {
            pw.print("package:");
            pw.print(pkgName);
            pw.println();
        }

        return 0;
    }

    private int runListFeatures() throws RemoteException {
        final PrintWriter pw = getOutPrintWriter();
        final List<FeatureInfo> list = mInterface.getSystemAvailableFeatures().getList();