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

Commit 3e9a9dbd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Pass window type to the InputWindowHandle of embedded window" into rvc-dev am: 0e58daf0

Change-Id: I1c0d234d8067b548a99db3feae92734cb235521c
parents f1bcf535 0e58daf0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ interface IWindowSession {
    * an input channel where the client can receive input.
    */
    void grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window,
            in IBinder hostInputToken, int flags, out InputChannel outInputChannel);
            in IBinder hostInputToken, int flags, int type, out InputChannel outInputChannel);

    /**
     * Update the flags on an input channel associated with a particular surface.
+2 −2
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ public class WindowlessWindowManager implements IWindowSession {
                WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL) == 0)) {
            try {
                mRealWm.grantInputChannel(displayId, sc, window, mHostInputToken, attrs.flags,
                        outInputChannel);
                        attrs.type, outInputChannel);
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to grant input to surface: ", e);
            }
@@ -432,7 +432,7 @@ public class WindowlessWindowManager implements IWindowSession {

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

    @Override
+3 −1
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ class EmbeddedWindowController {
        final int mOwnerPid;
        final WindowManagerService mWmService;
        InputChannel mInputChannel;
        final int mWindowType;

        /**
         * @param clientToken client token used to clean up the map if the embedding process dies
@@ -146,7 +147,7 @@ class EmbeddedWindowController {
         * @param ownerPid  calling pid used for anr blaming
         */
        EmbeddedWindow(WindowManagerService service, IWindow clientToken,
                WindowState hostWindowState, int ownerUid, int ownerPid) {
                WindowState hostWindowState, int ownerUid, int ownerPid, int windowType) {
            mWmService = service;
            mClient = clientToken;
            mHostWindowState = hostWindowState;
@@ -154,6 +155,7 @@ class EmbeddedWindowController {
                    : null;
            mOwnerUid = ownerUid;
            mOwnerPid = ownerPid;
            mWindowType = windowType;
        }

        String getName() {
+8 −2
Original line number Diff line number Diff line
@@ -661,17 +661,23 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {

    @Override
    public void grantInputChannel(int displayId, SurfaceControl surface,
            IWindow window, IBinder hostInputToken, int flags, InputChannel outInputChannel) {
            IWindow window, IBinder hostInputToken, int flags, int type,
            InputChannel outInputChannel) {
        if (hostInputToken == null && !mCanAddInternalSystemWindow) {
            // Callers without INTERNAL_SYSTEM_WINDOW permission cannot grant input channel to
            // embedded windows without providing a host window input token
            throw new SecurityException("Requires INTERNAL_SYSTEM_WINDOW permission");
        }

        if (!mCanAddInternalSystemWindow && type != 0) {
            Slog.w(TAG_WM, "Requires INTERNAL_SYSTEM_WINDOW permission if assign type to"
                    + " input");
        }

        final long identity = Binder.clearCallingIdentity();
        try {
            mService.grantInputChannel(mUid, mPid, displayId, surface, window, hostInputToken,
                    flags, outInputChannel);
                    flags, mCanAddInternalSystemWindow ? type : 0, outInputChannel);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
+7 −6
Original line number Diff line number Diff line
@@ -8027,14 +8027,15 @@ public class WindowManagerService extends IWindowManager.Stub
     * views.
     */
    void grantInputChannel(int callingUid, int callingPid, int displayId, SurfaceControl surface,
            IWindow window, IBinder hostInputToken, int flags, InputChannel outInputChannel) {
            IWindow window, IBinder hostInputToken, int flags, int type,
            InputChannel outInputChannel) {
        final InputApplicationHandle applicationHandle;
        final String name;
        final InputChannel clientChannel;
        synchronized (mGlobalLock) {
            EmbeddedWindowController.EmbeddedWindow win =
                    new EmbeddedWindowController.EmbeddedWindow(this, window,
                            mInputToWindowMap.get(hostInputToken), callingUid, callingPid);
                            mInputToWindowMap.get(hostInputToken), callingUid, callingPid, type);
            clientChannel = win.openInputChannel();
            mEmbeddedWindowController.add(clientChannel.getToken(), win);
            applicationHandle = win.getApplicationHandle();
@@ -8042,7 +8043,7 @@ public class WindowManagerService extends IWindowManager.Stub
        }

        updateInputChannel(clientChannel.getToken(), callingUid, callingPid, displayId, surface,
                name, applicationHandle, flags, null /* region */);
                name, applicationHandle, flags, type, null /* region */);

        clientChannel.transferTo(outInputChannel);
        clientChannel.dispose();
@@ -8050,7 +8051,7 @@ public class WindowManagerService extends IWindowManager.Stub

    private void updateInputChannel(IBinder channelToken, int callingUid, int callingPid,
            int displayId, SurfaceControl surface, String name,
            InputApplicationHandle applicationHandle, int flags, Region region) {
            InputApplicationHandle applicationHandle, int flags, int type, Region region) {
        InputWindowHandle h = new InputWindowHandle(applicationHandle, displayId);
        h.token = channelToken;
        h.name = name;
@@ -8058,7 +8059,7 @@ public class WindowManagerService extends IWindowManager.Stub
        final int sanitizedFlags = flags & (LayoutParams.FLAG_NOT_TOUCHABLE
                | LayoutParams.FLAG_SLIPPERY);
        h.layoutParamsFlags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | sanitizedFlags;
        h.layoutParamsType = 0;
        h.layoutParamsType = type;
        h.dispatchingTimeoutNanos = DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
        h.canReceiveKeys = false;
        h.hasFocus = false;
@@ -8106,7 +8107,7 @@ public class WindowManagerService extends IWindowManager.Stub
        }

        updateInputChannel(channelToken, win.mOwnerUid, win.mOwnerPid, displayId, surface, name,
                applicationHandle, flags, region);
                applicationHandle, flags, win.mWindowType, region);
    }

    /** Return whether layer tracing is enabled */