Merge "Add class docs for InputMonitor." into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b0241bd88a
@@ -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 {
|
||||
|
||||
@@ -523,11 +523,17 @@ public class InputManagerService extends IInputManager.Stub
|
||||
}
|
||||
|
||||
|
||||
InputChannel[] inputChannels = InputChannel.openInputChannelPair(inputChannelName);
|
||||
InputMonitorHost host = new InputMonitorHost(inputChannels[0]);
|
||||
inputChannels[0].setToken(host.asBinder());
|
||||
nativeRegisterInputMonitor(mPtr, inputChannels[0], displayId, true /*isGestureMonitor*/);
|
||||
return new InputMonitor(inputChannelName, inputChannels[1], host);
|
||||
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*/);
|
||||
return new InputMonitor(inputChannelName, inputChannels[1], host);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user