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

Commit 64ea5eaa authored by Chavi Weingarten's avatar Chavi Weingarten
Browse files

Change session.remove to take an IBinder instead of an IWindow

Removing the window will tear down the input connection for an embedded
window. To make it more generic and allow non windows to have
InputChannel, it's simpler to pass in an IBinder instead of creating a
fake IWindow.

Test: WindowStateTests
Bug: 278757236
Change-Id: Ie632429e3c890077d6c4788941c686977d1ba5c9
parent e5b89a54
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase
                state.addExtraResult("add", elapsedTimeNsOfAdd);

                startTime = SystemClock.elapsedRealtimeNanos();
                session.remove(this);
                session.remove(asBinder());
                final long elapsedTimeNsOfRemove = SystemClock.elapsedRealtimeNanos() - startTime;
                state.addExtraResult("remove", elapsedTimeNsOfRemove);

+1 −1
Original line number Diff line number Diff line
@@ -2289,7 +2289,7 @@ public abstract class WallpaperService extends Service {
                        mInputEventReceiver = null;
                    }

                    mSession.remove(mWindow);
                    mSession.remove(mWindow.asBinder());
                } catch (RemoteException e) {
                }
                mSurfaceHolder.mSurface.release();
+9 −2
Original line number Diff line number Diff line
@@ -59,8 +59,15 @@ interface IWindowSession {
    int addToDisplayWithoutInputChannel(IWindow window, in WindowManager.LayoutParams attrs,
            in int viewVisibility, in int layerStackId, out InsetsState insetsState,
            out Rect attachedFrame, out float[] sizeCompatScale);
    @UnsupportedAppUsage
    void remove(IWindow window);

    /**
     * Removes a clientToken from WMS, which includes unlinking the input channel.
     *
     * @param clientToken The token that should be removed. This will normally be the IWindow token
     * for a standard window. It can also be the generic clientToken that was used when calling
     * grantInputChannel
     */
    void remove(IBinder clientToken);

    /**
     * Change the parameters of a window.  You supply the
+1 −1
Original line number Diff line number Diff line
@@ -5879,7 +5879,7 @@ public final class ViewRootImpl implements ViewParent,
            mInputQueue = null;
        }
        try {
            mWindowSession.remove(mWindow);
            mWindowSession.remove(mWindow.asBinder());
        } catch (RemoteException e) {
        }
        // Dispose receiver would dispose client InputChannel, too. That could send out a socket
+3 −3
Original line number Diff line number Diff line
@@ -276,11 +276,11 @@ public class WindowlessWindowManager implements IWindowSession {
    }

    @Override
    public void remove(android.view.IWindow window) throws RemoteException {
        mRealWm.remove(window);
    public void remove(IBinder clientToken) throws RemoteException {
        mRealWm.remove(clientToken);
        State state;
        synchronized (this) {
            state = mStateForWindow.remove(window.asBinder());
            state = mStateForWindow.remove(clientToken);
        }
        if (state == null) {
            throw new IllegalArgumentException(
Loading