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

Commit f35375b5 authored by Felipe Leme's avatar Felipe Leme
Browse files

Dump services permissions on 'package' service.

Test: adb shell dumpsys package
Test: adb shell dumpsys package services-permissions
Test: adb shell dumpsys package android

Fixes: 70681510

Change-Id: I63be1df5276613193f5b079441d402a5382fdfde
parent 2c37c058
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ public final class DumpState {
    public static final int DUMP_COMPILER_STATS = 1 << 21;
    public static final int DUMP_CHANGES = 1 << 22;
    public static final int DUMP_VOLUMES = 1 << 23;
    public static final int DUMP_SERVICE_PERMISSIONS = 1 << 24;

    public static final int OPTION_SHOW_FILTERS = 1 << 0;

+29 −1
Original line number Diff line number Diff line
@@ -173,6 +173,7 @@ import android.content.pm.PackageParser.Package;
import android.content.pm.PackageParser.PackageLite;
import android.content.pm.PackageParser.PackageParserException;
import android.content.pm.PackageParser.ParseFlags;
import android.content.pm.PackageParser.ServiceIntentInfo;
import android.content.pm.PackageStats;
import android.content.pm.PackageUserState;
import android.content.pm.ParceledListSlice;
@@ -12558,7 +12559,12 @@ public class PackageManagerService extends IPackageManager.Stub
                    out.print(' ');
                    filter.service.printComponentShortName(out);
                    out.print(" filter ");
                    out.println(Integer.toHexString(System.identityHashCode(filter)));
                    out.print(Integer.toHexString(System.identityHashCode(filter)));
                    if (filter.service.info.permission != null) {
                        out.print(" permission "); out.println(filter.service.info.permission);
                    } else {
                        out.println();
                    }
        }
        @Override
@@ -20551,6 +20557,7 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                pw.println("    dexopt: dump dexopt state");
                pw.println("    compiler-stats: dump compiler statistics");
                pw.println("    enabled-overlays: dump list of enabled overlay packages");
                pw.println("    service-permissions: dump permissions required by services");
                pw.println("    <package.name>: info about given package");
                return;
            } else if ("--checkin".equals(opt)) {
@@ -20686,6 +20693,8 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                dumpState.setDump(DumpState.DUMP_COMPILER_STATS);
            } else if ("changes".equals(cmd)) {
                dumpState.setDump(DumpState.DUMP_CHANGES);
            } else if ("service-permissions".equals(cmd)) {
                dumpState.setDump(DumpState.DUMP_SERVICE_PERMISSIONS);
            } else if ("write".equals(cmd)) {
                synchronized (mPackages) {
                    mSettings.writeLPr();
@@ -21066,6 +21075,25 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                ipw.decreaseIndent();
            }
            if (!checkin && dumpState.isDumping(DumpState.DUMP_SERVICE_PERMISSIONS)
                    && packageName == null) {
                if (dumpState.onTitlePrinted()) pw.println();
                pw.println("Service permissions:");
                final Iterator<ServiceIntentInfo> filterIterator = mServices.filterIterator();
                while (filterIterator.hasNext()) {
                    final ServiceIntentInfo info = filterIterator.next();
                    final ServiceInfo serviceInfo = info.service.info;
                    final String permission = serviceInfo.permission;
                    if (permission != null) {
                        pw.print("    ");
                        pw.print(serviceInfo.getComponentName().flattenToShortString());
                        pw.print(": ");
                        pw.println(permission);
                    }
                }
            }
            if (!checkin && dumpState.isDumping(DumpState.DUMP_DEXOPT)) {
                if (dumpState.onTitlePrinted()) pw.println();
                dumpDexoptStateLPr(pw, packageName);