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

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

Merge "Avoid checking for window singleton policy when reparenting a window context" into main

parents 6675244b 70a4349e
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -3242,19 +3242,9 @@ public class WindowManagerService extends IWindowManager.Stub
            final int displayId = display.getDisplayId();
            ProtoLog.d(WM_DEBUG_ADD_REMOVE, "Reparenting to displayId=%d", displayId);

            final String systemUiPermission = isCallerVirtualDeviceOwner(displayId, callingUid)
                    && display.isTrusted()
                    // Virtual device owners can add system windows on their trusted displays.
                    ? android.Manifest.permission.CREATE_VIRTUAL_DEVICE
                    : android.Manifest.permission.STATUS_BAR_SERVICE;

            if (display.getDisplayPolicy().assertDisplaySingletonPolicy(
                    token.getWindowType(), systemUiPermission, callingPid, callingUid)) {
                ProtoLog.e(WM_DEBUG_ADD_REMOVE, "Fail to reparent windowToken since"
                        + " there's a window with windowType=%d on displayId=%d",
                        token.getWindowType(), display.getDisplayId());
                return false;
            }
            // TODO b/404532651 - check the destination display content doesn't have a window
            //  with that type already.

            // Reparent the window created for this window context.
            display.reParentWindowToken(token);
            hideUntilNextDraw(token);