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

Commit fa7f994c authored by Saho Kobayashi's avatar Saho Kobayashi Committed by Android (Google) Code Review
Browse files

Merge "Don't account space for non-touchable windows"

parents ee88e094 acc6dd85
Loading
Loading
Loading
Loading
+65 −48
Original line number Diff line number Diff line
@@ -1610,12 +1610,14 @@ final class AccessibilityController {

                    final Region regionInScreen = new Region();
                    computeWindowRegionInScreen(windowState, regionInScreen);

                    if (windowMattersToAccessibility(windowState, regionInScreen, unaccountedSpace,
                    if (windowMattersToAccessibility(windowState,
                            regionInScreen, unaccountedSpace,
                            skipRemainingWindowsForTaskFragments)) {
                        addPopulatedWindowInfo(windowState, regionInScreen, windows, addedWindows);
                        if (windowMattersToUnaccountedSpaceComputation(windowState)) {
                            updateUnaccountedSpace(windowState, regionInScreen, unaccountedSpace,
                                    skipRemainingWindowsForTaskFragments);
                        }
                        focusedWindowAdded |= windowState.isFocused();
                    } else if (isUntouchableNavigationBar(windowState, mTempRegion1)) {
                        // If this widow is navigation bar without touchable region, accounting the
@@ -1664,6 +1666,25 @@ final class AccessibilityController {
            mInitialized = true;
        }

        // Some windows should be excluded from unaccounted space computation, though they still
        // should be reported
        private boolean windowMattersToUnaccountedSpaceComputation(WindowState windowState) {
            // Do not account space of trusted non-touchable windows, except the split-screen
            // divider.
            // If it's not trusted, touch events are not sent to the windows behind it.
            if (((windowState.mAttrs.flags & WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE) != 0)
                    && (windowState.mAttrs.type != TYPE_DOCK_DIVIDER)
                    && windowState.isTrustedOverlay()) {
                return false;
            }

            if (windowState.mAttrs.type
                    == WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY) {
                return false;
            }
            return true;
        }

        private boolean windowMattersToAccessibility(WindowState windowState,
                Region regionInScreen, Region unaccountedSpace,
                ArrayList<TaskFragment> skipRemainingWindowsForTaskFragments) {
@@ -1707,9 +1728,6 @@ final class AccessibilityController {
        private void updateUnaccountedSpace(WindowState windowState, Region regionInScreen,
                Region unaccountedSpace,
                ArrayList<TaskFragment> skipRemainingWindowsForTaskFragments) {
            if (windowState.mAttrs.type
                    != WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY) {

            // Account for the space this window takes if the window
            // is not an accessibility overlay which does not change
            // the reported windows.
@@ -1755,7 +1773,6 @@ final class AccessibilityController {
                        Region.Op.REVERSE_DIFFERENCE);
            }
        }
        }

        private void computeWindowRegionInScreen(WindowState windowState, Region outRegion) {
            // Get the touchable frame.
+4 −0
Original line number Diff line number Diff line
@@ -276,6 +276,10 @@ class InputWindowHandleWrapper {
        mChanged = true;
    }

    boolean isTrustedOverlay() {
        return mHandle.trustedOverlay;
    }

    @Override
    public String toString() {
        return mHandle + ", changed=" + mChanged;
+4 −0
Original line number Diff line number Diff line
@@ -6257,4 +6257,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        scheduleAnimation();
        return true;
    }

    boolean isTrustedOverlay() {
        return mInputWindowHandle.isTrustedOverlay();
    }
}