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

Commit 9aa180de authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "Fix WM input limitations on secondary displays (2/N)""

parents 0034421d 9628308a
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -212,8 +212,7 @@ public class InputManagerService extends IInputManager.Stub
            int injectorPid, int injectorUid, int syncMode, int timeoutMillis,
            int policyFlags);
    private static native void nativeToggleCapsLock(long ptr, int deviceId);
    private static native void nativeSetInputWindows(long ptr, InputWindowHandle[] windowHandles,
            int displayId);
    private static native void nativeSetInputWindows(long ptr, InputWindowHandle[] windowHandles);
    private static native void nativeSetInputDispatchMode(long ptr, boolean enabled, boolean frozen);
    private static native void nativeSetSystemUiVisibility(long ptr, int visibility);
    private static native void nativeSetFocusedApplication(long ptr,
@@ -1468,7 +1467,7 @@ public class InputManagerService extends IInputManager.Stub
    }

    public void setInputWindows(InputWindowHandle[] windowHandles,
            InputWindowHandle focusedWindowHandle, int displayId) {
            InputWindowHandle focusedWindowHandle) {
        final IWindow newFocusedWindow =
            focusedWindowHandle != null ? focusedWindowHandle.clientWindow : null;
        if (mFocusedWindow != newFocusedWindow) {
@@ -1477,7 +1476,7 @@ public class InputManagerService extends IInputManager.Stub
                setPointerCapture(false);
            }
        }
        nativeSetInputWindows(mPtr, windowHandles, displayId);
        nativeSetInputWindows(mPtr, windowHandles);
    }

    public void setFocusedApplication(InputApplicationHandle application) {
+3 −2
Original line number Diff line number Diff line
@@ -814,7 +814,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() {
@@ -2134,7 +2136,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            mRemovingDisplay = false;
        }

        mInputMonitor.onRemoved();
        mService.onDisplayRemoved(mDisplayId);
    }

+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.os.IBinder;
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
import android.view.Display;
import android.view.InputChannel;
import android.view.WindowManager;
import com.android.server.input.InputApplicationHandle;
+5 −12
Original line number Diff line number Diff line
@@ -367,13 +367,6 @@ final class InputMonitor {
        }
    }

    void onRemoved() {
        // If DisplayContent removed, we need find a way to remove window handles of this display
        // from InputDispatcher, so pass an empty InputWindowHandles to remove them.
        mService.mInputManager.setInputWindows(mInputWindowHandles, mFocusedInputWindowHandle,
                mDisplayId);
    }

    private final class UpdateInputForAllWindowsConsumer implements Consumer<WindowState> {
        InputConsumerImpl navInputConsumer;
        InputConsumerImpl pipInputConsumer;
@@ -406,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.
@@ -414,8 +408,8 @@ final class InputMonitor {
            }

            // Send windows to native code.
            mService.mInputManager.setInputWindows(mInputWindowHandles, mFocusedInputWindowHandle,
                    mDisplayId);
            // TODO: Update Input windows and focus by display?
            mService.mInputManager.setInputWindows(mInputWindowHandles, mFocusedInputWindowHandle);

            clearInputWindowHandlesLw();

@@ -435,8 +429,7 @@ final class InputMonitor {
            final int flags = w.mAttrs.flags;
            final int privateFlags = w.mAttrs.privateFlags;
            final int type = w.mAttrs.type;
            // TODO(b/111361570): multi-display focus, one focus for all display in current.
            final boolean hasFocus = w == mService.mCurrentFocus;//mInputFocus;
            final boolean hasFocus = w == mInputFocus;
            final boolean isVisible = w.isVisibleLw();

            if (mAddRecentsAnimationInputConsumerHandle) {
+14 −9
Original line number Diff line number Diff line
@@ -6071,21 +6071,26 @@ public class WindowManagerService extends IWindowManager.Stub
    @Override
    public void createInputConsumer(IBinder token, String name, InputChannel inputChannel) {
        synchronized (mWindowMap) {
            // TODO(b/112049699): multi-display inputConsumer, just support default in current.
            // Need consider about the behavior from controller.
            DisplayContent displayContent = getDefaultDisplayContentLocked();
            displayContent.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) {
            // TODO(b/112049699): multi-display inputConsumer, just support default in current.
            // Need consider about the behavior from controller.
            DisplayContent displayContent = getDefaultDisplayContentLocked();
            return displayContent.getInputMonitor().destroyInputConsumer(name);
            // 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 false;
        }
    }

Loading