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

Commit 7a7f0c97 authored by Nicolas Prevot's avatar Nicolas Prevot
Browse files

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

BUG:19363615
Change-Id: Icf04b39ce8c592544e69c52f229a2c1bdab661e2
parent 8f6afec2
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
@@ -4127,7 +4127,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));