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

Commit e5b89a54 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Change Input to use IBinder intead of IWindow for client token." into main

parents 6bccb9d7 0a830818
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -296,9 +296,11 @@ interface IWindowSession {

    /**
    * Request the server to call setInputWindowInfo on a given Surface, and return
    * an input channel where the client can receive input.
    * an input channel where the client can receive input. For windows, the clientToken should be
    * the IWindow binder object. For other requests, the token can be any unique IBinder token to
    * be used as unique identifier.
    */
    void grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window,
    void grantInputChannel(int displayId, in SurfaceControl surface, in IBinder clientToken,
            in IBinder hostInputToken, int flags, int privateFlags, int inputFeatures, int type,
            in IBinder windowToken, in IBinder focusGrantToken, String inputHandleName,
            out InputChannel outInputChannel);
+4 −18
Original line number Diff line number Diff line
@@ -83,15 +83,11 @@ public final class InputWindowHandle {
    public IBinder token;

    /**
     * The {@link IWindow} handle if InputWindowHandle is associated with a window, null otherwise.
     * The {@link IBinder} handle if InputWindowHandle is associated with a client token,
     * normally the IWindow token, null otherwise.
     */
    @Nullable
    private IBinder windowToken;
    /**
     * Used to cache IWindow from the windowToken so we don't need to convert every time getWindow
     * is called.
     */
    private IWindow window;

    // The window name.
    public String name;
@@ -181,7 +177,6 @@ public final class InputWindowHandle {
        inputApplicationHandle = new InputApplicationHandle(other.inputApplicationHandle);
        token = other.token;
        windowToken = other.windowToken;
        window = other.window;
        name = other.name;
        layoutParamsFlags = other.layoutParamsFlags;
        layoutParamsType = other.layoutParamsType;
@@ -249,23 +244,14 @@ public final class InputWindowHandle {
        touchableRegionSurfaceControl = new WeakReference<>(bounds);
    }

    public void setWindowToken(IWindow iwindow) {
        windowToken = iwindow.asBinder();
        window = iwindow;
    public void setWindowToken(IBinder iwindow) {
        windowToken = iwindow;
    }

    public @Nullable IBinder getWindowToken() {
        return windowToken;
    }

    public IWindow getWindow() {
        if (window != null) {
            return window;
        }
        window = IWindow.Stub.asInterface(windowToken);
        return window;
    }

    /**
     * Set the provided inputConfig flag values.
     * @param inputConfig the flag values to change
+5 −5
Original line number Diff line number Diff line
@@ -228,14 +228,14 @@ public class WindowlessWindowManager implements IWindowSession {
                if (mRealWm instanceof IWindowSession.Stub) {
                    mRealWm.grantInputChannel(displayId,
                            new SurfaceControl(sc, "WindowlessWindowManager.addToDisplay"),
                            window, mHostInputToken, attrs.flags, attrs.privateFlags,
                            window.asBinder(), mHostInputToken, attrs.flags, attrs.privateFlags,
                            attrs.inputFeatures, attrs.type,
                            attrs.token, state.mInputTransferToken, attrs.getTitle().toString(),
                            outInputChannel);
                } else {
                    mRealWm.grantInputChannel(displayId, sc, window, mHostInputToken, attrs.flags,
                            attrs.privateFlags, attrs.inputFeatures, attrs.type, attrs.token,
                            state.mInputTransferToken, attrs.getTitle().toString(),
                    mRealWm.grantInputChannel(displayId, sc, window.asBinder(), mHostInputToken,
                            attrs.flags, attrs.privateFlags, attrs.inputFeatures, attrs.type,
                            attrs.token, state.mInputTransferToken, attrs.getTitle().toString(),
                            outInputChannel);
                }
                state.mInputChannelToken =
@@ -592,7 +592,7 @@ public class WindowlessWindowManager implements IWindowSession {
            List<Rect> unrestrictedRects) {}

    @Override
    public void grantInputChannel(int displayId, SurfaceControl surface, IWindow window,
    public void grantInputChannel(int displayId, SurfaceControl surface, IBinder clientToken,
            IBinder hostInputToken, int flags, int privateFlags, int inputFeatures, int type,
            IBinder windowToken, IBinder focusGrantToken, String inputHandleName,
            InputChannel outInputChannel) {
+2 −2
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ class DragResizeInputListener implements AutoCloseable {
            mWindowSession.grantInputChannel(
                    mDisplayId,
                    mDecorationSurface,
                    mFakeWindow,
                    mFakeWindow.asBinder(),
                    null /* hostInputToken */,
                    FLAG_NOT_FOCUSABLE,
                    PRIVATE_FLAG_TRUSTED_OVERLAY,
@@ -155,7 +155,7 @@ class DragResizeInputListener implements AutoCloseable {
            mWindowSession.grantInputChannel(
                    mDisplayId,
                    mInputSinkSurface,
                    mFakeSinkWindow,
                    mFakeSinkWindow.asBinder(),
                    null /* hostInputToken */,
                    FLAG_NOT_FOCUSABLE,
                    0 /* privateFlags */,
+1 −1
Original line number Diff line number Diff line
@@ -558,7 +558,7 @@ final class AccessibilityController {
        }
        if (newTarget != null) {
            int displayId = newTarget.getDisplayId();
            IBinder clientBinder = newTarget.getIWindow().asBinder();
            IBinder clientBinder = newTarget.getWindowToken();
            mFocusedWindow.put(displayId, clientBinder);
        }
    }
Loading