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

Commit c2d1211c authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Use rotated bounds as source touchable region for rotated app"

parents 7ff19c53 fa209a71
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -2624,6 +2624,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        // events can slip to activity from letterbox.
        mActivityRecord.getLetterboxInnerBounds(mTmpRect);
        if (mTmpRect.isEmpty()) {
            final Rect transformedBounds = mActivityRecord.getFixedRotationTransformDisplayBounds();
            if (transformedBounds != null) {
                // Task is in the same orientation as display, so the rotated bounds should be
                // chosen as the touchable region. Then when the surface layer transforms the
                // region to display space, the orientation will be consistent.
                mTmpRect.set(transformedBounds);
            } else {
                // If this is a modal window we need to dismiss it if it's not full screen
                // and the touch happens outside of the frame that displays the content. This
                // means we need to intercept touches outside of that window. The dim layer
@@ -2636,6 +2643,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
                    getRootTask().getDimBounds(mTmpRect);
                }
            }
        }
        adjustRegionInFreefromWindowMode(mTmpRect);
        outRegion.set(mTmpRect);
        cropRegionToStackBoundsIfNeeded(outRegion);
+6 −0
Original line number Diff line number Diff line
@@ -739,6 +739,12 @@ public class WindowStateTests extends WindowTestsBase {
        InputMonitor.setInputWindowInfoIfNeeded(transaction, sc, handleWrapper);
        verify(transaction, never()).setInputWindowInfo(any(), any());

        // The rotated bounds have higher priority as the touchable region.
        final Rect rotatedBounds = new Rect(0, 0, 123, 456);
        doReturn(rotatedBounds).when(win.mToken).getFixedRotationTransformDisplayBounds();
        mDisplayContent.getInputMonitor().populateInputWindowHandle(handleWrapper, win);
        assertEquals(rotatedBounds, handle.touchableRegion.getBounds());

        // Populate as an overlay to disable the input of window.
        InputMonitor.populateOverlayInputInfo(handleWrapper, false /* isVisible */);
        // The overlay attributes should be set.