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

Commit 1b5dd0da authored by Ameer Armaly's avatar Ameer Armaly
Browse files

Allow accessibility services to request input channels for windows of TYPE_ACCESSIBILITY_OVERLAY.

Bug: 238840614
Test: atest AccessibilityOverlayTest
Change-Id: Id555c2da8f9549f45ecb6fb108e2c13c2ee4dd86
parent 5a780824
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -299,7 +299,8 @@ interface IWindowSession {
    */
    void grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window,
            in IBinder hostInputToken, int flags, int privateFlags, int type,
            in IBinder focusGrantToken, String inputHandleName, out InputChannel outInputChannel);
            in IBinder windowToken, in IBinder focusGrantToken, String inputHandleName,
            out InputChannel outInputChannel);

    /**
     * Update the flags on an input channel associated with a particular surface.
+8 −0
Original line number Diff line number Diff line
@@ -376,6 +376,7 @@ public class SurfaceControlViewHost {
    public void setView(@NonNull View view, @NonNull WindowManager.LayoutParams attrs) {
        Objects.requireNonNull(view);
        attrs.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
        addWindowToken(attrs);
        view.setLayoutParams(attrs);
        mViewRoot.setView(view, attrs, null);
    }
@@ -453,4 +454,11 @@ public class SurfaceControlViewHost {
    public IBinder getFocusGrantToken() {
        return mWm.getFocusGrantToken();
    }

    private void addWindowToken(WindowManager.LayoutParams attrs) {
        final WindowManagerImpl wm =
                (WindowManagerImpl) mViewRoot.mContext.getSystemService(Context.WINDOW_SERVICE);
        attrs.token = wm.getDefaultToken();
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -503,4 +503,8 @@ public final class WindowManagerImpl implements WindowManager {
        }
        return null;
    }

    IBinder getDefaultToken() {
        return mDefaultToken;
    }
}
+6 −4
Original line number Diff line number Diff line
@@ -166,11 +166,12 @@ public class WindowlessWindowManager implements IWindowSession {
                if (mRealWm instanceof IWindowSession.Stub) {
                    mRealWm.grantInputChannel(displayId,
                            new SurfaceControl(sc, "WindowlessWindowManager.addToDisplay"),
                            window, mHostInputToken, attrs.flags, attrs.privateFlags, attrs.type,
                            window, mHostInputToken,
                            attrs.flags, attrs.privateFlags, attrs.type, attrs.token,
                            mFocusGrantToken, attrs.getTitle().toString(), outInputChannel);
                } else {
                    mRealWm.grantInputChannel(displayId, sc, window, mHostInputToken, attrs.flags,
                            attrs.privateFlags, attrs.type, mFocusGrantToken,
                            attrs.privateFlags, attrs.type, attrs.token, mFocusGrantToken,
                            attrs.getTitle().toString(), outInputChannel);
                }
            } catch (RemoteException e) {
@@ -508,8 +509,9 @@ public class WindowlessWindowManager implements IWindowSession {

    @Override
    public void grantInputChannel(int displayId, SurfaceControl surface, IWindow window,
            IBinder hostInputToken, int flags, int privateFlags, int type, IBinder focusGrantToken,
            String inputHandleName, InputChannel outInputChannel) {
            IBinder hostInputToken, int flags, int privateFlags, int type,
            IBinder windowToken, IBinder focusGrantToken, String inputHandleName,
            InputChannel outInputChannel) {
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ class DragResizeInputListener implements AutoCloseable {
                    FLAG_NOT_FOCUSABLE,
                    PRIVATE_FLAG_TRUSTED_OVERLAY,
                    TYPE_APPLICATION,
                    null /* windowToken */,
                    mFocusGrantToken,
                    TAG + " of " + decorationSurface.toString(),
                    mInputChannel);
Loading