Always contain window frames in window bounds

Previously, if the window bounds and the safe area of display cutout
don't intersect, we might get invalid window frames.

This CL uses a new method to intersect rectangles which makes sure the
result frame is contained by the window bounds.

Fix: 367461591
Flag: EXEMPT bugfix
Test: atest WindowLayoutTests
Change-Id: I63d28e5dcdcea9f4206f5026c00905a5cb413bd3
2 files changed