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

Commit 70a4349e authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato
Browse files

Avoid checking for window singleton policy when reparenting a window context

This is just a partial revert of Ia97726407b8274c02c32dc68bba9ba85cda84608

the singleton per display check was making each reparenting operation to the default display fail, as the mNotificationShade field from the default display DisplayPolicy didn't wasn't cleaned up after the reparenting happened.

While the proper solution here is cleaning up mNotificationShade from the previous DisplayContent, and setting it in the new one, this is for a follow up cl (to reduce risks of unexpected consequences). This cl only fixes this by partially reverting the recently added check for singleton during reparenting.

Bug: 362719719
Bug: 414579333
Test: atest WindowManagerServiceTest WindowContextistenerControllerTest + Move the shade to an external display, and move it back to the default one.
Flag: com.android.systemui.shade_window_goes_around
Change-Id: I325e5c16d1ad5f2c1aa3ad7d56abda7a9f746efb
parent 198c0c89
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -3229,19 +3229,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);