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

Commit 7c227ebd authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

AcessibilityController: Use InputConfig to determine window behavior

The behavior of an input window is controlled by InputConfig flags in
InputWindowHandle. Use these flags to determine the behavior of input
windows when we get window information from a SurfaceFlinger callback.

Bug: 216806304
Test: presubmit
Change-Id: Ifbd47da7470eb6b8fbc257ecb4938712e46740ba
parent f9975966
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -1598,7 +1598,7 @@ final class AccessibilityController {
            // Do not account space of trusted non-touchable windows, except the split-screen
            // Do not account space of trusted non-touchable windows, except the split-screen
            // divider.
            // divider.
            // If it's not trusted, touch events are not sent to the windows behind it.
            // If it's not trusted, touch events are not sent to the windows behind it.
            if (((a11yWindow.getFlags() & WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE) != 0)
            if (!a11yWindow.isTouchable()
                    && (a11yWindow.getType() != TYPE_DOCK_DIVIDER)
                    && (a11yWindow.getType() != TYPE_DOCK_DIVIDER)
                    && a11yWindow.isTrustedOverlay()) {
                    && a11yWindow.isTrustedOverlay()) {
                return false;
                return false;
@@ -1623,8 +1623,7 @@ final class AccessibilityController {
            // Ignore non-touchable windows, except the split-screen divider, which is
            // Ignore non-touchable windows, except the split-screen divider, which is
            // occasionally non-touchable but still useful for identifying split-screen
            // occasionally non-touchable but still useful for identifying split-screen
            // mode and the PIP menu.
            // mode and the PIP menu.
            if (((a11yWindow.getFlags()
            if (!a11yWindow.isTouchable()
                    & WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE) != 0)
                    && (a11yWindow.getType() != TYPE_DOCK_DIVIDER
                    && (a11yWindow.getType() != TYPE_DOCK_DIVIDER
                    && !a11yWindow.isPIPMenu())) {
                    && !a11yWindow.isPIPMenu())) {
                return false;
                return false;
+16 −17
Original line number Original line Diff line number Diff line
@@ -600,14 +600,15 @@ public final class AccessibilityWindowsPopulator extends WindowInfosListener {
        // Data
        // Data
        private IWindow mWindow;
        private IWindow mWindow;
        private int mDisplayId;
        private int mDisplayId;
        private int mFlags;
        @WindowManager.LayoutParams.WindowType
        private int mType;
        private int mType;
        @InputWindowHandle.InputConfigFlags
        private int mInputConfig;
        private int mPrivateFlags;
        private int mPrivateFlags;
        private boolean mIsPIPMenu;
        private boolean mIsPIPMenu;
        private boolean mIsFocused;
        private boolean mIsFocused;
        private boolean mShouldMagnify;
        private boolean mShouldMagnify;
        private boolean mIgnoreDuetoRecentsAnimation;
        private boolean mIgnoreDuetoRecentsAnimation;
        private boolean mIsTrustedOverlay;
        private final Region mTouchableRegionInScreen = new Region();
        private final Region mTouchableRegionInScreen = new Region();
        private final Region mTouchableRegionInWindow = new Region();
        private final Region mTouchableRegionInWindow = new Region();
        private final Region mLetterBoxBounds = new Region();
        private final Region mLetterBoxBounds = new Region();
@@ -630,7 +631,7 @@ public final class AccessibilityWindowsPopulator extends WindowInfosListener {


            instance.mWindow = inputWindowHandle.getWindow();
            instance.mWindow = inputWindowHandle.getWindow();
            instance.mDisplayId = inputWindowHandle.displayId;
            instance.mDisplayId = inputWindowHandle.displayId;
            instance.mFlags = inputWindowHandle.layoutParamsFlags;
            instance.mInputConfig = inputWindowHandle.inputConfig;
            instance.mType = inputWindowHandle.layoutParamsType;
            instance.mType = inputWindowHandle.layoutParamsType;
            instance.mIsPIPMenu = inputWindowHandle.getWindow().asBinder().equals(pipIBinder);
            instance.mIsPIPMenu = inputWindowHandle.getWindow().asBinder().equals(pipIBinder);


@@ -643,8 +644,6 @@ public final class AccessibilityWindowsPopulator extends WindowInfosListener {
            final RecentsAnimationController controller = service.getRecentsAnimationController();
            final RecentsAnimationController controller = service.getRecentsAnimationController();
            instance.mIgnoreDuetoRecentsAnimation = windowState != null && controller != null
            instance.mIgnoreDuetoRecentsAnimation = windowState != null && controller != null
                    && controller.shouldIgnoreForAccessibility(windowState);
                    && controller.shouldIgnoreForAccessibility(windowState);
            instance.mIsTrustedOverlay =
                    (inputWindowHandle.inputConfig & InputConfig.TRUSTED_OVERLAY) != 0;


            // TODO (b/199358388) : gets the letterbox bounds of the window from other way.
            // TODO (b/199358388) : gets the letterbox bounds of the window from other way.
            if (windowState != null && windowState.areAppWindowBoundsLetterboxed()) {
            if (windowState != null && windowState.areAppWindowBoundsLetterboxed()) {
@@ -681,13 +680,6 @@ public final class AccessibilityWindowsPopulator extends WindowInfosListener {
            outRegion.set(mTouchableRegionInWindow);
            outRegion.set(mTouchableRegionInWindow);
        }
        }


        /**
         * @return the layout parameter flag {@link android.view.WindowManager.LayoutParams#flags}.
         */
        public int getFlags() {
            return mFlags;
        }

        /**
        /**
         * @return the layout parameter type {@link android.view.WindowManager.LayoutParams#type}.
         * @return the layout parameter type {@link android.view.WindowManager.LayoutParams#type}.
         */
         */
@@ -750,7 +742,14 @@ public final class AccessibilityWindowsPopulator extends WindowInfosListener {
         * @return true if this window is the trusted overlay.
         * @return true if this window is the trusted overlay.
         */
         */
        public boolean isTrustedOverlay() {
        public boolean isTrustedOverlay() {
            return mIsTrustedOverlay;
            return (mInputConfig & InputConfig.TRUSTED_OVERLAY) != 0;
        }

        /**
         * @return true if this window is touchable.
         */
        public boolean isTouchable() {
            return (mInputConfig & InputConfig.NOT_TOUCHABLE) == 0;
        }
        }


        /**
        /**
@@ -823,8 +822,8 @@ public final class AccessibilityWindowsPopulator extends WindowInfosListener {
            windowInfo.displayId = window.mDisplayId;
            windowInfo.displayId = window.mDisplayId;
            windowInfo.type = window.mType;
            windowInfo.type = window.mType;
            windowInfo.token = window.mWindow.asBinder();
            windowInfo.token = window.mWindow.asBinder();
            windowInfo.hasFlagWatchOutsideTouch = (window.mFlags
            windowInfo.hasFlagWatchOutsideTouch = (window.mInputConfig
                    & WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH) != 0;
                    & InputConfig.WATCH_OUTSIDE_TOUCH) != 0;
            windowInfo.inPictureInPicture = false;
            windowInfo.inPictureInPicture = false;


            // There only are two windowless windows now, one is split window, and the other
            // There only are two windowless windows now, one is split window, and the other
@@ -850,13 +849,13 @@ public final class AccessibilityWindowsPopulator extends WindowInfosListener {
        public String toString() {
        public String toString() {
            String builder = "A11yWindow=[" + mWindow.asBinder()
            String builder = "A11yWindow=[" + mWindow.asBinder()
                    + ", displayId=" + mDisplayId
                    + ", displayId=" + mDisplayId
                    + ", flag=0x" + Integer.toHexString(mFlags)
                    + ", inputConfig=0x" + Integer.toHexString(mInputConfig)
                    + ", type=" + mType
                    + ", type=" + mType
                    + ", privateFlag=0x" + Integer.toHexString(mPrivateFlags)
                    + ", privateFlag=0x" + Integer.toHexString(mPrivateFlags)
                    + ", focused=" + mIsFocused
                    + ", focused=" + mIsFocused
                    + ", shouldMagnify=" + mShouldMagnify
                    + ", shouldMagnify=" + mShouldMagnify
                    + ", ignoreDuetoRecentsAnimation=" + mIgnoreDuetoRecentsAnimation
                    + ", ignoreDuetoRecentsAnimation=" + mIgnoreDuetoRecentsAnimation
                    + ", isTrustedOverlay=" + mIsTrustedOverlay
                    + ", isTrustedOverlay=" + isTrustedOverlay()
                    + ", regionInScreen=" + mTouchableRegionInScreen
                    + ", regionInScreen=" + mTouchableRegionInScreen
                    + ", touchableRegion=" + mTouchableRegionInWindow
                    + ", touchableRegion=" + mTouchableRegionInWindow
                    + ", letterBoxBounds=" + mLetterBoxBounds
                    + ", letterBoxBounds=" + mLetterBoxBounds