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

Commit 679ccb01 authored by Robert Carr's avatar Robert Carr
Browse files

Pass InputWindowInfo to SurfaceFlinger.

As a first pass we can simply start from where
we used to pass the handles to the InputDispatcher and instead
go through every window, assosciating the appropriate InputWindowInfo
with it if it has a surface.

Bug: 80101428
Bug: 113136004
Bug: 111440400
Test: Manual
Change-Id: Ic7f64e0d0fb12f4140ad37c8ed4a0c30255df38e
parent 328d4426
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -1800,10 +1800,9 @@ public class InputManagerService extends IInputManager.Stub
    }

    // Native callback.
    private long notifyANR(InputApplicationHandle inputApplicationHandle,
            IBinder token, String reason) {
    private long notifyANR(IBinder token, String reason) {
        return mWindowManagerCallbacks.notifyANR(
                inputApplicationHandle, token, reason);
                token, reason);
    }

    // Native callback.
@@ -1834,14 +1833,12 @@ public class InputManagerService extends IInputManager.Stub
    }

    // Native callback.
    private long interceptKeyBeforeDispatching(IBinder focus,
            KeyEvent event, int policyFlags) {
    private long interceptKeyBeforeDispatching(IBinder focus, KeyEvent event, int policyFlags) {
        return mWindowManagerCallbacks.interceptKeyBeforeDispatching(focus, event, policyFlags);
    }

    // Native callback.
    private KeyEvent dispatchUnhandledKey(IBinder focus,
            KeyEvent event, int policyFlags) {
    private KeyEvent dispatchUnhandledKey(IBinder focus, KeyEvent event, int policyFlags) {
        return mWindowManagerCallbacks.dispatchUnhandledKey(focus, event, policyFlags);
    }

@@ -1993,8 +1990,7 @@ public class InputManagerService extends IInputManager.Stub

        public void notifyInputChannelBroken(IBinder token);

        public long notifyANR(InputApplicationHandle inputApplicationHandle,
                IBinder token, String reason);
        public long notifyANR(IBinder token, String reason);

        public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags);

+1 −1
Original line number Diff line number Diff line
@@ -2400,8 +2400,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            mDisplayReady = false;
            mRemovingDisplay = false;
        }

        mDisplayPolicy.onDisplayRemoved();
        mInputMonitor.onRemoved();
        mService.mWindowPlacerLocked.requestTraversal();
    }

+1 −5
Original line number Diff line number Diff line
@@ -72,8 +72,7 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal
     * Called by the InputManager.
     */
    @Override
    public long notifyANR(InputApplicationHandle inputApplicationHandle,
            IBinder token, String reason) {
    public long notifyANR(IBinder token, String reason) {
        AppWindowToken appWindowToken = null;
        WindowState windowState = null;
        boolean aboveSystem = false;
@@ -84,9 +83,6 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal
                    appWindowToken = windowState.mAppToken;
                }
            }
            if (appWindowToken == null && inputApplicationHandle != null) {
                appWindowToken = (AppWindowToken)inputApplicationHandle.appWindowToken;
            }

            if (windowState != null) {
                Slog.i(TAG_WM, "Input event dispatching timed out "
+9 −8
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.view.InputApplicationHandle;
import android.view.InputChannel;
import android.view.InputEventReceiver;
import android.view.InputWindowHandle;
import android.view.SurfaceControl;

import com.android.server.policy.WindowManagerPolicy;

@@ -72,6 +73,8 @@ final class InputMonitor {

    private int mDisplayId;

    SurfaceControl.Transaction mInputTransaction = new SurfaceControl.Transaction();

    /**
     * The set of input consumer added to the window manager by name, which consumes input events
     * for the windows below it.
@@ -362,12 +365,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, mDisplayId);
    }

    private final class UpdateInputForAllWindowsConsumer implements Consumer<WindowState> {
        InputConsumerImpl navInputConsumer;
        InputConsumerImpl pipInputConsumer;
@@ -407,8 +404,7 @@ final class InputMonitor {
                addInputWindowHandle(wallpaperInputConsumer.mWindowHandle);
            }

            // Send windows to native code.
            mService.mInputManager.setInputWindows(mInputWindowHandles, mDisplayId);
            mInputTransaction.apply();

            clearInputWindowHandlesLw();

@@ -492,6 +488,11 @@ final class InputMonitor {

            addInputWindowHandle(
                    inputWindowHandle, w, flags, type, isVisible, hasFocus, hasWallpaper);

            if (w.mWinAnimator.hasSurface()) {
                mInputTransaction.setInputWindowInfo(
                        w.mWinAnimator.mSurfaceController.mSurfaceControl, inputWindowHandle);
            }
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -2167,7 +2167,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
                mTmpRect.inset(-delta, -delta);
            }
            region.set(mTmpRect);
            cropRegionToStackBoundsIfNeeded(region);
            region.translate(-mWindowFrames.mFrame.left, -mWindowFrames.mFrame.top);
        } else {
            // Not modal or full screen modal
            getTouchableRegion(region);
Loading