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

Commit 06882f8e authored by Romain Guy's avatar Romain Guy
Browse files

Enable HierarchyViewer on debuggable builds, even if they're secure.

That will let us (finally) use the tool on userdebug builds.
parent b81645c8
Loading
Loading
Loading
Loading
+522 −516
Original line number Diff line number Diff line
@@ -199,6 +199,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
    long mLastBatteryStatsCallTime = 0;

    private static final String SYSTEM_SECURE = "ro.secure";
    private static final String SYSTEM_DEBUGGABLE = "ro.debuggable";

    /**
     * Condition waited on by {@link #reenableKeyguard} to know the call to
@@ -3418,7 +3419,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
     * @see com.android.server.ViewServer#VIEW_SERVER_DEFAULT_PORT
     */
    public boolean startViewServer(int port) {
        if ("1".equals(SystemProperties.get(SYSTEM_SECURE, "0"))) {
        if (isSystemSecure()) {
            return false;
        }

@@ -3450,6 +3451,11 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
        return false;
    }

    private boolean isSystemSecure() {
        return "1".equals(SystemProperties.get(SYSTEM_SECURE, "1")) &&
                "0".equals(SystemProperties.get(SYSTEM_DEBUGGABLE, "0"));
    }

    /**
     * Stops the view server if it exists.
     *
@@ -3459,7 +3465,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
     * @see com.android.server.ViewServer
     */
    public boolean stopViewServer() {
        if ("1".equals(SystemProperties.get(SYSTEM_SECURE, "0"))) {
        if (isSystemSecure()) {
            return false;
        }

@@ -3481,7 +3487,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
     * @see com.android.server.ViewServer
     */
    public boolean isViewServerRunning() {
        if ("1".equals(SystemProperties.get(SYSTEM_SECURE, "0"))) {
        if (isSystemSecure()) {
            return false;
        }

@@ -3502,7 +3508,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
     * @return False if an error occured, true otherwise.
     */
    boolean viewServerListWindows(Socket client) {
        if ("1".equals(SystemProperties.get(SYSTEM_SECURE, "0"))) {
        if (isSystemSecure()) {
            return false;
        }

@@ -3569,7 +3575,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
     *         not indicate whether the command itself was successful.
     */
    boolean viewServerWindowCommand(Socket client, String command, String parameters) {
        if ("1".equals(SystemProperties.get(SYSTEM_SECURE, "0"))) {
        if (isSystemSecure()) {
            return false;
        }