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

Commit ae03befa authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Shall clear calling identity to avoid destroying GraphicBuffer unexpectedly."

parents 75430a2f 31d9e8a3
Loading
Loading
Loading
Loading
+51 −40
Original line number Diff line number Diff line
@@ -6796,12 +6796,13 @@ public class WindowManagerService extends IWindowManager.Stub
                "setShouldShowWithInsecureKeyguard()")) {
            throw new SecurityException("Requires INTERNAL_SYSTEM_WINDOW permission");
        }

        final long origId = Binder.clearCallingIdentity();
        try {
            synchronized (mGlobalLock) {
                final DisplayContent displayContent = getDisplayContentOrCreate(displayId, null);
                if (displayContent == null) {
                ProtoLog.w(WM_ERROR, "Attempted to set flag to a display that does not exist: %d",
                        displayId);
                    ProtoLog.w(WM_ERROR, "Attempted to set flag to a display that does not exist: "
                            + "%d", displayId);
                    return;
                }

@@ -6810,6 +6811,9 @@ public class WindowManagerService extends IWindowManager.Stub

                displayContent.reconfigureDisplayLocked();
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
    }

    @Override
@@ -6837,23 +6841,27 @@ public class WindowManagerService extends IWindowManager.Stub
        if (!checkCallingPermission(INTERNAL_SYSTEM_WINDOW, "setShouldShowSystemDecors()")) {
            throw new SecurityException("Requires INTERNAL_SYSTEM_WINDOW permission");
        }

        final long origId = Binder.clearCallingIdentity();
        try {
            synchronized (mGlobalLock) {
                final DisplayContent displayContent = getDisplayContentOrCreate(displayId, null);
                if (displayContent == null) {
                ProtoLog.w(WM_ERROR, "Attempted to set system decors flag to a display that does "
                        + "not exist: %d", displayId);
                    ProtoLog.w(WM_ERROR, "Attempted to set system decors flag to a display that "
                            + "does not exist: %d", displayId);
                    return;
                }
                if (displayContent.isUntrustedVirtualDisplay()) {
                throw new SecurityException("Attempted to set system decors flag to an untrusted "
                        + "virtual display: " + displayId);
                    throw new SecurityException("Attempted to set system decors flag to an "
                            + "untrusted virtual display: " + displayId);
                }

                mDisplayWindowSettings.setShouldShowSystemDecorsLocked(displayContent, shouldShow);

                displayContent.reconfigureDisplayLocked();
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
    }

    @Override
@@ -6883,13 +6891,13 @@ public class WindowManagerService extends IWindowManager.Stub
        if (!checkCallingPermission(INTERNAL_SYSTEM_WINDOW, "setShouldShowIme()")) {
            throw new SecurityException("Requires INTERNAL_SYSTEM_WINDOW permission");
        }

        final long origId = Binder.clearCallingIdentity();
        try {
            synchronized (mGlobalLock) {
                final DisplayContent displayContent = getDisplayContentOrCreate(displayId, null);
                if (displayContent == null) {
                ProtoLog.w(WM_ERROR,
                        "Attempted to set IME flag to a display that does not exist: %d",
                        displayId);
                    ProtoLog.w(WM_ERROR, "Attempted to set IME flag to a display that does not "
                            + "exist: %d", displayId);
                    return;
                }
                if (displayContent.isUntrustedVirtualDisplay()) {
@@ -6901,6 +6909,9 @@ public class WindowManagerService extends IWindowManager.Stub

                displayContent.reconfigureDisplayLocked();
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
    }

    @Override