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

Commit 4604abc9 authored by Svetoslav's avatar Svetoslav
Browse files

Moving and resizing windows not reported propely for accessibility.

When the position and size of a window changes we have to report that
to the accessibility layer if the window introspection is enabled.

bug:15569915

Change-Id: I3f869e0a582592bfa5f3743d5c2133ee8cb39b34
parent 006812ac
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -1640,6 +1640,17 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                pw.println("}]");
                pw.println();
            }
            final int windowCount = mSecurityPolicy.mWindows.size();
            for (int j = 0; j < windowCount; j++) {
                if (j > 0) {
                    pw.append(',');
                    pw.println();
                }
                pw.append("Window[");
                AccessibilityWindowInfo window = mSecurityPolicy.mWindows.get(j);
                pw.append(window.toString());
                pw.append(']');
            }
        }
    }

@@ -3283,7 +3294,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                }

                if (mTouchInteractionInProgress && activeWindowGone) {
                    mActiveWindowId = INVALID_WINDOW_ID;
                    mActiveWindowId = mFocusedWindowId;
                }

                // Focused window may change the active one, so set the
@@ -3336,12 +3347,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                    // The active window also determined events from which
                    // windows are delivered.
                    synchronized (mLock) {
                        if (mWindowsForAccessibilityCallback == null) {
                            mFocusedWindowId = getFocusedWindowId();
                        if (mWindowsForAccessibilityCallback == null
                                && windowId == mFocusedWindowId) {
                            if (windowId == mFocusedWindowId) {
                                mActiveWindowId = windowId;
                            }
                        }
                    }
                } break;

                case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER: {
+9 −0
Original line number Diff line number Diff line
@@ -166,6 +166,15 @@ final class AccessibilityController {
        }
    }


    public void onSomeWindowResizedOrMoved() {
        // Not relevant for the display magnifier.

        if (mWindowsForAccessibilityObserver != null) {
            mWindowsForAccessibilityObserver.computeChangedWindows();
        }
    }

    /** NOTE: This has to be called within a surface transaction. */
    public void drawMagnifiedRegionBorderIfNeededLocked() {
        if (mDisplayMagnifier != null) {
+7 −1
Original line number Diff line number Diff line
@@ -151,7 +151,6 @@ import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;

@@ -9228,6 +9227,13 @@ public class WindowManagerService extends IWindowManager.Stub
                        winAnimator.setAnimation(a);
                        winAnimator.mAnimDw = w.mLastFrame.left - w.mFrame.left;
                        winAnimator.mAnimDh = w.mLastFrame.top - w.mFrame.top;

                        //TODO (multidisplay): Accessibility supported only for the default display.
                        if (mAccessibilityController != null
                                && displayId == Display.DEFAULT_DISPLAY) {
                            mAccessibilityController.onSomeWindowResizedOrMoved();
                        }

                        try {
                            w.mClient.moved(w.mFrame.left, w.mFrame.top);
                        } catch (RemoteException e) {
+8 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.os.Debug;
import android.os.RemoteCallbackList;
import android.os.SystemClock;
import android.util.TimeUtils;
import android.view.Display;
import android.view.IWindowFocusObserver;
import android.view.IWindowId;
import com.android.server.input.InputWindowHandle;
@@ -1359,6 +1360,13 @@ final class WindowState implements WindowManagerPolicy.WindowState {
                mClient.resized(frame, overscanInsets, contentInsets, visibleInsets, reportDraw,
                        newConfig);
            }

            //TODO (multidisplay): Accessibility supported only for the default display.
            if (mService.mAccessibilityController != null
                    && getDisplayId() == Display.DEFAULT_DISPLAY) {
                mService.mAccessibilityController.onSomeWindowResizedOrMoved();
            }

            mOverscanInsetsChanged = false;
            mContentInsetsChanged = false;
            mVisibleInsetsChanged = false;