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

Commit 30f34f27 authored by Michael Wright's avatar Michael Wright Committed by android-build-merger
Browse files

Merge "Add class docs for InputMonitor." into qt-dev

am: b0241bd8

Change-Id: I2d1ad860aa6655b626502c91514ebf04571acef8
parents 4d712583 b0241bd8
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);
        }
    }

    /**