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

Commit 6207fc13 authored by Tianhao Yao's avatar Tianhao Yao
Browse files

Add identifier for EmbeddedWindows

Use LayoutParams title as identifier for EmbeddedWindows

Test: `adb shell dumpsys input` shows the names for EmbeddedWindows
Bug: 205621873
Change-Id: I5c10b1e38aafff0734f42429c4f421a95de3d0da
parent 67e82c3d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -298,7 +298,7 @@ interface IWindowSession {
    */
    void grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window,
            in IBinder hostInputToken, int flags, int privateFlags, int type,
            in IBinder focusGrantToken, out InputChannel outInputChannel);
            in IBinder focusGrantToken, String inputHandleName, out InputChannel outInputChannel);

    /**
     * Update the flags on an input channel associated with a particular surface.
+7 −6
Original line number Diff line number Diff line
@@ -164,10 +164,11 @@ public class WindowlessWindowManager implements IWindowSession {
                    mRealWm.grantInputChannel(displayId,
                            new SurfaceControl(sc, "WindowlessWindowManager.addToDisplay"),
                            window, mHostInputToken, attrs.flags, attrs.privateFlags, attrs.type,
                        mFocusGrantToken, outInputChannel);
                            mFocusGrantToken, attrs.getTitle().toString(), outInputChannel);
                } else {
                    mRealWm.grantInputChannel(displayId, sc, window, mHostInputToken, attrs.flags,
                        attrs.privateFlags, attrs.type, mFocusGrantToken, outInputChannel);
                            attrs.privateFlags, attrs.type, mFocusGrantToken,
                            attrs.getTitle().toString(), outInputChannel);
                }
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to grant input to surface: ", e);
@@ -485,7 +486,7 @@ 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,
            InputChannel outInputChannel) {
            String inputHandleName, InputChannel outInputChannel) {
    }

    @Override
+7 −5
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ class EmbeddedWindowController {
        final IWindow mClient;
        @Nullable final WindowState mHostWindowState;
        @Nullable final ActivityRecord mHostActivityRecord;
        final String mName;
        final int mOwnerUid;
        final int mOwnerPid;
        final WindowManagerService mWmService;
@@ -186,7 +187,7 @@ class EmbeddedWindowController {
         */
        EmbeddedWindow(Session session, WindowManagerService service, IWindow clientToken,
                       WindowState hostWindowState, int ownerUid, int ownerPid, int windowType,
                       int displayId, IBinder focusGrantToken) {
                       int displayId, IBinder focusGrantToken, String inputHandleName) {
            mSession = session;
            mWmService = service;
            mClient = clientToken;
@@ -198,14 +199,15 @@ class EmbeddedWindowController {
            mWindowType = windowType;
            mDisplayId = displayId;
            mFocusGrantToken = focusGrantToken;
            final String hostWindowName =
                    (mHostWindowState != null) ? "-" + mHostWindowState.getWindowTag().toString()
                            : "";
            mName = "Embedded{" + inputHandleName + hostWindowName + "}";
        }

        @Override
        public String toString() {
            final String hostWindowName = (mHostWindowState != null)
                    ? mHostWindowState.getWindowTag().toString() : "Internal";
            return "EmbeddedWindow{ u" + UserHandle.getUserId(mOwnerUid) + " " + hostWindowName
                    + "}";
            return mName;
        }

        InputApplicationHandle getApplicationHandle() {
+3 −2
Original line number Diff line number Diff line
@@ -818,7 +818,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
    @Override
    public void grantInputChannel(int displayId, SurfaceControl surface,
            IWindow window, IBinder hostInputToken, int flags, int privateFlags, int type,
            IBinder focusGrantToken, InputChannel outInputChannel) {
            IBinder focusGrantToken, String inputHandleName, 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
@@ -834,7 +834,8 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
        try {
            mService.grantInputChannel(this, mUid, mPid, displayId, surface, window, hostInputToken,
                    flags, mCanAddInternalSystemWindow ? privateFlags : 0,
                    mCanAddInternalSystemWindow ? type : 0, focusGrantToken, outInputChannel);
                    mCanAddInternalSystemWindow ? type : 0, focusGrantToken, inputHandleName,
                    outInputChannel);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
+4 −4
Original line number Diff line number Diff line
@@ -8339,7 +8339,7 @@ public class WindowManagerService extends IWindowManager.Stub
    void grantInputChannel(Session session, int callingUid, int callingPid, int displayId,
            SurfaceControl surface, IWindow window, IBinder hostInputToken,
            int flags, int privateFlags, int type, IBinder focusGrantToken,
                           InputChannel outInputChannel) {
            String inputHandleName, InputChannel outInputChannel) {
        final InputApplicationHandle applicationHandle;
        final String name;
        final InputChannel clientChannel;
@@ -8347,7 +8347,7 @@ public class WindowManagerService extends IWindowManager.Stub
            EmbeddedWindowController.EmbeddedWindow win =
                    new EmbeddedWindowController.EmbeddedWindow(session, this, window,
                            mInputToWindowMap.get(hostInputToken), callingUid, callingPid, type,
                            displayId, focusGrantToken);
                            displayId, focusGrantToken, inputHandleName);
            clientChannel = win.openInputChannel();
            mEmbeddedWindowController.add(clientChannel.getToken(), win);
            applicationHandle = win.getApplicationHandle();