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

Commit b5e960f5 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Fix empty touchable region of pip window

AccessibilityController uses the region to compute the window list
for AccessibilityManagerService to evaluate window changed events.
If the region is empty, the window will be ignored.

Bug: 120429758
Test: atest AccessibilityWindowQueryTest

Change-Id: Ic2d7f3a8249478358308b093ca8db9d3b8948046
parent b78f9295
Loading
Loading
Loading
Loading
+5 −20
Original line number Diff line number Diff line
@@ -2168,11 +2168,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
                mTmpRect.inset(-delta, -delta);
            }
            region.set(mTmpRect);
            region.translate(-mWindowFrames.mFrame.left, -mWindowFrames.mFrame.top);
            cropRegionToStackBoundsIfNeeded(region);
        } else {
            // Not modal or full screen modal
            getTouchableRegion(region, true /* forSurface */);
            getTouchableRegion(region);
        }
        // Translate to surface based coordinates.
        region.translate(-mWindowFrames.mFrame.left, -mWindowFrames.mFrame.top);

        return flags;
    }
@@ -2809,16 +2811,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP

    /** Get the touchable region in global coordinates. */
    void getTouchableRegion(Region outRegion) {
        getTouchableRegion(outRegion, false /* forSurface */);
    }

    /** If {@param forSuface} is {@code true}, the region will be translated to surface based. */
    private void getTouchableRegion(Region outRegion, boolean forSurface) {
        if (inPinnedWindowingMode() && !isFocused()) {
            outRegion.setEmpty();
            return;
        }

        final Rect frame = mWindowFrames.mFrame;
        switch (mTouchableInsets) {
            default:
@@ -2833,18 +2825,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
                break;
            case TOUCHABLE_INSETS_REGION: {
                outRegion.set(mGivenTouchableRegion);
                outRegion.translate(frame.left, frame.top);
                break;
            }
        }
        cropRegionToStackBoundsIfNeeded(outRegion);

        if (forSurface) {
            if (mTouchableInsets != TOUCHABLE_INSETS_REGION) {
                outRegion.translate(-frame.left, -frame.top);
            }
            outRegion.getBounds(mTmpRect);
            applyInsets(outRegion, mTmpRect, mAttrs.surfaceInsets);
        }
    }

    private void cropRegionToStackBoundsIfNeeded(Region region) {