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

Commit fa0f12c7 authored by Riya Ghai's avatar Riya Ghai Committed by Android (Google) Code Review
Browse files

Merge "Add dumpsys implementation for dumping package configuration"

parents 2a31f0a7 e66b1c78
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3959,6 +3959,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        getActivityStartController().dump(pw, "", dumpPackage);
    }

    /** Dumps installed packages having app-specific config. */
    void dumpInstalledPackagesConfig(PrintWriter pw) {
        mPackageConfigPersister.dump(pw, getCurrentUserId());
    }

    /**
     * There are three things that cmd can be:
     * - a flattened component name that matches an existing activity
+22 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;

/**
@@ -308,6 +309,27 @@ public class PackageConfigPersister {
        }
    }

    /**
     * Dumps app-specific configurations for all packages for which the records
     * exist.
     */
    void dump(PrintWriter pw, int userId) {
        pw.println("INSTALLED PACKAGES HAVING APP-SPECIFIC CONFIGURATIONS");
        pw.println("Current user ID : " + userId);
        synchronized (mLock) {
            HashMap<String, PackageConfigRecord> persistedPackageConfigMap = mModified.get(userId);
            if (persistedPackageConfigMap != null) {
                for (PackageConfigPersister.PackageConfigRecord packageConfig
                        : persistedPackageConfigMap.values()) {
                    pw.println();
                    pw.println("    PackageName : " + packageConfig.mName);
                    pw.println("        NightMode : " + packageConfig.mNightMode);
                    pw.println("        Locales : " + packageConfig.mLocales);
                }
            }
        }
    }

    // store a changed data so we don't need to get the process
    static class PackageConfigRecord {
        final String mName;
+8 −0
Original line number Diff line number Diff line
@@ -6622,6 +6622,7 @@ public class WindowManagerService extends IWindowManager.Stub
                pw.println("    d[isplays]: active display contents");
                pw.println("    t[okens]: token list");
                pw.println("    w[indows]: window list");
                pw.println("    package-config: installed packages having app-specific config");
                pw.println("    trace: print trace status and write Winscope trace to file");
                pw.println("  cmd may also be a NAME to dump windows.  NAME may");
                pw.println("    be a partial substring in a window name, a");
@@ -6708,6 +6709,9 @@ public class WindowManagerService extends IWindowManager.Stub
            } else if ("constants".equals(cmd)) {
                mConstants.dump(pw);
                return;
            } else if ("package-config".equals(cmd)) {
                mAtmService.dumpInstalledPackagesConfig(pw);
                return;
            } else {
                // Dumping a single name?
                if (!dumpWindows(pw, cmd, args, opti, dumpAll)) {
@@ -6774,6 +6778,10 @@ public class WindowManagerService extends IWindowManager.Stub
            if (dumpAll) {
                pw.println(separator);
            }
            mAtmService.dumpInstalledPackagesConfig(pw);
            if (dumpAll) {
                pw.println(separator);
            }
            mConstants.dump(pw);
        }
    }