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

Commit ad3a6bf8 authored by Michael Wright's avatar Michael Wright
Browse files

Add class docs for InputMonitor.

And clear Binder calling identity when monitoring gesture input. This is
a follow up for the review on Ic1e2cd6afea219d0e20b29e7150c9a42b75c7a67.

Bug: 123748692
Test: Manual
Change-Id: I72687fd8790927f76a2a56d4c5e80a4e9f89299c
parent 0454f3b8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -22,6 +22,13 @@ import android.os.Parcelable;
import android.os.RemoteException;

/**
 * An {@code InputMonitor} allows privileged applications and components to monitor streams of
 * {@link InputEvent}s without having to be the designated recipient for the event.
 *
 * For example, focus dispatched events would normally only go to the focused window on the
 * targeted display, but an {@code InputMonitor} will also receive a copy of that event if they're
 * registered to monitor that type of event on the targeted display.
 *
 * @hide
 */
public final class InputMonitor implements Parcelable {
+11 −5
Original line number Diff line number Diff line
@@ -523,11 +523,17 @@ public class InputManagerService extends IInputManager.Stub
        }


        final long ident = Binder.clearCallingIdentity();
        try {
            InputChannel[] inputChannels = InputChannel.openInputChannelPair(inputChannelName);
            InputMonitorHost host = new InputMonitorHost(inputChannels[0]);
            inputChannels[0].setToken(host.asBinder());
        nativeRegisterInputMonitor(mPtr, inputChannels[0], displayId, true /*isGestureMonitor*/);
            nativeRegisterInputMonitor(mPtr, inputChannels[0], displayId,
                    true /*isGestureMonitor*/);
            return new InputMonitor(inputChannelName, inputChannels[1], host);
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }

    /**