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

Commit 987144aa authored by ryanlwlin's avatar ryanlwlin
Browse files

Fix magnification bounds cut out with floating a11y button

The window type Floating Accessibility Button is
TYPE_NAVIGATION_BAR_PANEL which is unmagnifed, it leads to
the cut out while drawing the magnification bounds.

To fix it we did a compromise. We omit the window bounds of
TYPE_NAVIGATION_BAR_PANEL windows while computing the
magnification bounds. The cons is that magnification region
is really changed. That means the interaction with such
windows might have latency depending on if they are
inside the magnification bounds. However, it is acceptable because
users don't have complex interaction witch such windows and
see them rarely.

bug: 185401123
Test: manually test
Change-Id: Ia0088a0140fb8d5516e703ebfa5e203f857636d9
parent 6a213319
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CO
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;

import static com.android.server.accessibility.AccessibilityTraceFileProto.ENTRY;
import static com.android.server.accessibility.AccessibilityTraceFileProto.MAGIC_NUMBER;
@@ -938,8 +939,7 @@ final class AccessibilityController {
                for (int i = visibleWindowCount - 1; i >= 0; i--) {
                    WindowState windowState = visibleWindows.valueAt(i);
                    final int windowType = windowState.mAttrs.type;
                    if ((windowType == TYPE_MAGNIFICATION_OVERLAY
                            || windowType == TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY)
                    if (isExcludedWindowType(windowType)
                            || ((windowState.mAttrs.privateFlags
                            & PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY) != 0)) {
                        continue;
@@ -1040,6 +1040,17 @@ final class AccessibilityController {
                }
            }

            private boolean isExcludedWindowType(int windowType) {
                return windowType == TYPE_MAGNIFICATION_OVERLAY
                        // Omit the touch region to avoid the cut out of the magnification
                        // bounds because nav bar panel is unmagnifiable.
                        || windowType == TYPE_NAVIGATION_BAR_PANEL
                        // Omit the touch region of window magnification to avoid the cut out of the
                        // magnification and the magnified center of window magnification could be
                        // in the bounds
                        || windowType == TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY;
            }

            void onRotationChanged(SurfaceControl.Transaction t) {
                // If we are showing the magnification border, hide it immediately so
                // the user does not see strange artifacts during rotation. The screenshot