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

Commit c9c9a48e authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Removing a workaround for incorrect window position on window move.

1. The window manager was not notifying a window when the latter
   has been moved. This was causing incorrect coordinates of the
   nodes reported to accessibility services. To workaround that
   we have carried the correct window location when making a
   call from the accessibility layer into a window. Now the
   window manager notifies the window when it is moved and the
   workaround is no longer needed. This change takes it out.

2. The left and right in the attach info were not updated properly
   after a report that the window has moved.

3. The accessibility manager service was calling directly methods
   on the window manager service without going through the interface
   of the latter. This leads to unnecessary coupling and in the
   long rung increases system complexity and reduces maintability.

bug:6623031

Change-Id: Iacb734b1bf337a47fad02c827ece45bb2f53a79d
parent dd0d0ba6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@ LOCAL_SRC_FILES += \
	core/java/android/view/accessibility/IAccessibilityManager.aidl \
	core/java/android/view/accessibility/IAccessibilityManagerClient.aidl \
	core/java/android/view/IApplicationToken.aidl \
	core/java/android/view/IInputFilter.aidl \
	core/java/android/view/IInputFilterHost.aidl \
	core/java/android/view/IOnKeyguardExitResult.aidl \
	core/java/android/view/IRotationWatcher.aidl \
	core/java/android/view/IWindow.aidl \
+14 −68
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ final class AccessibilityInteractionController {
    }

    public void findAccessibilityNodeInfoByAccessibilityIdClientThread(
            long accessibilityNodeId, int windowLeft, int windowTop, int interactionId,
            long accessibilityNodeId, int interactionId,
            IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid,
            long interrogatingTid) {
        Message message = mHandler.obtainMessage();
@@ -153,12 +153,6 @@ final class AccessibilityInteractionController {
        args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
        args.argi3 = interactionId;
        args.arg1 = callback;

        SomeArgs moreArgs = mPool.acquire();
        moreArgs.argi1 = windowLeft;
        moreArgs.argi2 = windowTop;
        args.arg2 = moreArgs;

        message.obj = args;

        // If the interrogation is performed by the same thread as the main UI
@@ -183,11 +177,6 @@ final class AccessibilityInteractionController {
        final IAccessibilityInteractionConnectionCallback callback =
            (IAccessibilityInteractionConnectionCallback) args.arg1;

        SomeArgs moreArgs = (SomeArgs) args.arg2;
        mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1;
        mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2;

        mPool.release(moreArgs);
        mPool.release(args);

        List<AccessibilityNodeInfo> infos = mTempAccessibilityNodeInfoList;
@@ -220,9 +209,8 @@ final class AccessibilityInteractionController {
    }

    public void findAccessibilityNodeInfoByViewIdClientThread(long accessibilityNodeId,
            int viewId, int windowLeft, int windowTop, int interactionId,
            IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid,
            long interrogatingTid) {
            int viewId, int interactionId, IAccessibilityInteractionConnectionCallback callback,
            int flags, int interrogatingPid, long interrogatingTid) {
        Message message = mHandler.obtainMessage();
        message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_VIEW_ID;
        message.arg1 = flags;
@@ -233,11 +221,6 @@ final class AccessibilityInteractionController {
        args.argi2 = interactionId;
        args.arg1 = callback;

        SomeArgs moreArgs = mPool.acquire();
        moreArgs.argi1 = windowLeft;
        moreArgs.argi2 = windowTop;
        args.arg2 = moreArgs;

        message.obj = args;

        // If the interrogation is performed by the same thread as the main UI
@@ -262,11 +245,6 @@ final class AccessibilityInteractionController {
        final IAccessibilityInteractionConnectionCallback callback =
            (IAccessibilityInteractionConnectionCallback) args.arg1;

        SomeArgs moreArgs = (SomeArgs) args.arg2;
        mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1;
        mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2;

        mPool.release(moreArgs);
        mPool.release(args);

        AccessibilityNodeInfo info = null;
@@ -300,25 +278,19 @@ final class AccessibilityInteractionController {
    }

    public void findAccessibilityNodeInfosByTextClientThread(long accessibilityNodeId,
            String text, int windowLeft, int windowTop, int interactionId,
            IAccessibilityInteractionConnectionCallback callback, int flags,
            int interrogatingPid, long interrogatingTid) {
            String text, int interactionId, IAccessibilityInteractionConnectionCallback callback,
            int flags, int interrogatingPid, long interrogatingTid) {
        Message message = mHandler.obtainMessage();
        message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT;
        message.arg1 = flags;

        SomeArgs args = mPool.acquire();
        args.arg1 = text;
        args.arg2 = callback;
        args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
        args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
        args.argi3 = interactionId;

        SomeArgs moreArgs = mPool.acquire();
        moreArgs.arg1 = callback;
        moreArgs.argi1 = windowLeft;
        moreArgs.argi2 = windowTop;
        args.arg2 = moreArgs;

        message.obj = args;

        // If the interrogation is performed by the same thread as the main UI
@@ -338,17 +310,11 @@ final class AccessibilityInteractionController {

        SomeArgs args = (SomeArgs) message.obj;
        final String text = (String) args.arg1;
        final IAccessibilityInteractionConnectionCallback callback =
            (IAccessibilityInteractionConnectionCallback) args.arg2;
        final int accessibilityViewId = args.argi1;
        final int virtualDescendantId = args.argi2;
        final int interactionId = args.argi3;

        SomeArgs moreArgs = (SomeArgs) args.arg2;
        final IAccessibilityInteractionConnectionCallback callback =
            (IAccessibilityInteractionConnectionCallback) moreArgs.arg1;
        mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1;
        mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2;

        mPool.release(moreArgs);
        mPool.release(args);

        List<AccessibilityNodeInfo> infos = null;
@@ -409,9 +375,9 @@ final class AccessibilityInteractionController {
        }
    }

    public void findFocusClientThread(long accessibilityNodeId, int focusType, int windowLeft,
            int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback,
            int flags, int interogatingPid, long interrogatingTid) {
    public void findFocusClientThread(long accessibilityNodeId, int focusType, int interactionId,
            IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid,
            long interrogatingTid) {
        Message message = mHandler.obtainMessage();
        message.what = PrivateHandler.MSG_FIND_FOCUS;
        message.arg1 = flags;
@@ -423,11 +389,6 @@ final class AccessibilityInteractionController {
        args.argi3 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
        args.arg1 = callback;

        SomeArgs moreArgs = mPool.acquire();
        moreArgs.argi1 = windowLeft;
        moreArgs.argi2 = windowTop;
        args.arg2 = moreArgs;

        message.obj = args;

        // If the interrogation is performed by the same thread as the main UI
@@ -453,11 +414,6 @@ final class AccessibilityInteractionController {
        final IAccessibilityInteractionConnectionCallback callback =
            (IAccessibilityInteractionConnectionCallback) args.arg1;

        SomeArgs moreArgs = (SomeArgs) args.arg2;
        mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1;
        mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2;

        mPool.release(moreArgs);
        mPool.release(args);

        AccessibilityNodeInfo focused = null;
@@ -516,9 +472,9 @@ final class AccessibilityInteractionController {
        }
    }

    public void focusSearchClientThread(long accessibilityNodeId, int direction, int windowLeft,
            int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback,
            int flags, int interogatingPid, long interrogatingTid) {
    public void focusSearchClientThread(long accessibilityNodeId, int direction, int interactionId,
            IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid,
            long interrogatingTid) {
        Message message = mHandler.obtainMessage();
        message.what = PrivateHandler.MSG_FOCUS_SEARCH;
        message.arg1 = flags;
@@ -530,11 +486,6 @@ final class AccessibilityInteractionController {
        args.argi3 = interactionId;
        args.arg1 = callback;

        SomeArgs moreArgs = mPool.acquire();
        moreArgs.argi1 = windowLeft;
        moreArgs.argi2 = windowTop;
        args.arg2 = moreArgs;

        message.obj = args;

        // If the interrogation is performed by the same thread as the main UI
@@ -560,11 +511,6 @@ final class AccessibilityInteractionController {
        final IAccessibilityInteractionConnectionCallback callback =
            (IAccessibilityInteractionConnectionCallback) args.arg1;

        SomeArgs moreArgs = (SomeArgs) args.arg2;
        mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1;
        mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2;

        mPool.release(moreArgs);
        mPool.release(args);

        AccessibilityNodeInfo next = null;
+32 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2012, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.view;

import android.view.IInputFilterHost;
import android.view.InputEvent;

/**
 * Interface for implementing an filter which observes and
 * potentially transforms the input event stream in the system.
 *
 * @hide
 */
oneway interface IInputFilter {
    void install(IInputFilterHost host);
    void uninstall();
    void filterInputEvent(in InputEvent event, int policyFlags);
}
+28 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2012, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.view;

import android.view.InputEvent;

/**
 * Interface for calls from an input filter to its host.
 *
 * @hide
 */
oneway interface IInputFilterHost {
    void sendInputEvent(in InputEvent event, int policyFlags);
}
+22 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.IRemoteCallback;
import android.view.IApplicationToken;
import android.view.IOnKeyguardExitResult;
@@ -33,6 +34,7 @@ import android.view.InputEvent;
import android.view.MotionEvent;
import android.view.InputChannel;
import android.view.InputDevice;
import  android.view.IInputFilter;

/**
 * System private interface to the window manager.
@@ -208,4 +210,24 @@ interface IWindowManager
     * Lock the device immediately.
     */
    void lockNow();

    /**
     * Gets the token for the focused window.
     */
    IBinder getFocusedWindowToken();

    /**
     * Gets the frame on the screen of the window given its token.
     */
    boolean getWindowFrame(IBinder token, out Rect outBounds);

    /**
     * Gets the compatibility scale of e window given its token.
     */
    float getWindowCompatibilityScale(IBinder windowToken);

    /**
     * Sets an input filter for manipulating the input event stream.
     */
    void setInputFilter(in IInputFilter filter);
}
Loading