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

Commit f580c916 authored by Nicolas Prevot's avatar Nicolas Prevot Committed by Android (Google) Code Review
Browse files

Merge "Dump the profile/device owner when dumping device policy state."

parents 7415d666 7a7f0c97
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -39,7 +39,9 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
@@ -320,5 +322,23 @@ class DeviceOwner {
            this.admin = admin;
            this.packageName = admin.getPackageName();
        }
        public void dump(String prefix, PrintWriter pw) {
            pw.println(prefix + "admin=" + admin);
            pw.println(prefix + "name=" + name);
            pw.println();
        }
    }

    public void dump(String prefix, PrintWriter pw) {
        if (mDeviceOwner != null) {
            pw.println(prefix + "Device Owner: ");
            mDeviceOwner.dump(prefix + "  ", pw);
        }
        if (mProfileOwners != null) {
            for (Map.Entry<Integer, OwnerInfo> entry : mProfileOwners.entrySet()) {
                pw.println(prefix + "Profile Owner (User " + entry.getKey() + "): ");
                entry.getValue().dump(prefix + "  ", pw);
            }
        }
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -4139,7 +4139,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {

        synchronized (this) {
            p.println("Current Device Policy Manager state:");

            if (mDeviceOwner != null) {
                mDeviceOwner.dump("  ", pw);
            }
            int userCount = mUserData.size();
            for (int u = 0; u < userCount; u++) {
                DevicePolicyData policy = getUserData(mUserData.keyAt(u));