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

Commit 3d3bd67f authored by Andrii Kulian's avatar Andrii Kulian Committed by Android (Google) Code Review
Browse files

Merge changes I87c5ad3f,I09b32c8f

* changes:
  Fix 2 input issues.
  Clear calling id in dontOverrideDisplayInfo.
parents 8f299037 3b388800
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -801,7 +801,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        // {@link DisplayContent} ready for use.
        mDisplayReady = true;

        mInputMonitor = new InputMonitor(service, mDisplayId);
        // TODO(b/112081256): Use independent InputMonitor.
        mInputMonitor = isDefaultDisplay ? new InputMonitor(service, mDisplayId)
                : mService.getDefaultDisplayContentLocked().mInputMonitor;
    }

    boolean isReady() {
+2 −1
Original line number Diff line number Diff line
@@ -399,7 +399,8 @@ final class InputMonitor {
            this.inDrag = inDrag;
            wallpaperController = mService.mRoot.mWallpaperController;

            mService.mRoot.getDisplayContent(mDisplayId).forAllWindows(this,
            // TODO(b/112081256): Use independent InputMonitor for each display.
            mService.mRoot/*.getDisplayContent(mDisplayId)*/.forAllWindows(this,
                    true /* traverseTopToBottom */);
            if (mAddWallpaperInputConsumerHandle) {
                // No visible wallpaper found, add the wallpaper input consumer at the end.
+31 −23
Original line number Diff line number Diff line
@@ -6082,23 +6082,26 @@ public class WindowManagerService extends IWindowManager.Stub
    @Override
    public void createInputConsumer(IBinder token, String name, InputChannel inputChannel) {
        synchronized (mWindowMap) {
            mRoot.forAllDisplays(dc -> {
                dc.getInputMonitor().createInputConsumer(token, name, inputChannel,
            // TODO(b/112049699): Fix this for multiple displays. There is only one inputChannel
            // here to accept the return value.
            DisplayContent display = mRoot.getDisplayContent(Display.DEFAULT_DISPLAY);
            if (display != null) {
                display.getInputMonitor().createInputConsumer(token, name, inputChannel,
                        Binder.getCallingPid(), Binder.getCallingUserHandle());
            });
            }
        }
    }

    @Override
    public boolean destroyInputConsumer(String name) {
        synchronized (mWindowMap) {
            AtomicBoolean retValue = new AtomicBoolean(true);
            mRoot.forAllDisplays(dc -> {
                if (!dc.getInputMonitor().destroyInputConsumer(name)) {
                    retValue.set(false);
            // TODO(b/112049699): Fix this for multiple displays. For consistency with
            // createInputConsumer above.
            DisplayContent display = mRoot.getDisplayContent(Display.DEFAULT_DISPLAY);
            if (display != null) {
                return display.getInputMonitor().destroyInputConsumer(name);
            }
            });
            return retValue.get();
            return false;
        }
    }

@@ -7090,6 +7093,8 @@ public class WindowManagerService extends IWindowManager.Stub

    @Override
    public void dontOverrideDisplayInfo(int displayId) {
        final long token = Binder.clearCallingIdentity();
        try {
            synchronized (mWindowMap) {
                final DisplayContent dc = getDisplayContentOrCreate(displayId);
                if (dc == null) {
@@ -7104,6 +7109,9 @@ public class WindowManagerService extends IWindowManager.Stub
                mDisplayManagerInternal.setDisplayInfoOverrideFromWindowManager(displayId,
                        null /* info */);
            }
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    @Override