TouchEvent (2/n): Receiving touch mode events in InputEventReceiver
This CL enhances InputEventReceiver to receive incoming TouchModeEvent from the transport layer. Bug: 191935212 Test: manual (build) Change-Id: I6dba5ab213f52e26c25d856a3cb8b27bfdb81d40
This commit is contained in:
@@ -170,6 +170,16 @@ public abstract class InputEventReceiver {
|
||||
public void onDragEvent(boolean isExiting, float x, float y) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the display for the window associated with the input channel has entered or
|
||||
* exited touch mode.
|
||||
*
|
||||
* @param isInTouchMode {@code true} if the display showing the window associated with the
|
||||
* input channel entered touch mode.
|
||||
*/
|
||||
public void onTouchModeChanged(boolean isInTouchMode) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a batched input event is pending.
|
||||
*
|
||||
|
||||
@@ -54,6 +54,7 @@ static struct {
|
||||
jmethodID onPointerCaptureEvent;
|
||||
jmethodID onDragEvent;
|
||||
jmethodID onBatchedInputEventPending;
|
||||
jmethodID onTouchModeChanged;
|
||||
} gInputEventReceiverClassInfo;
|
||||
|
||||
// Add prefix to the beginning of each line in 'str'
|
||||
@@ -424,6 +425,18 @@ status_t NativeInputEventReceiver::consumeEvents(JNIEnv* env,
|
||||
finishInputEvent(seq, true /* handled */);
|
||||
continue;
|
||||
}
|
||||
case AINPUT_EVENT_TYPE_TOUCH_MODE: {
|
||||
const TouchModeEvent* touchModeEvent = static_cast<TouchModeEvent*>(inputEvent);
|
||||
if (kDebugDispatchCycle) {
|
||||
ALOGD("channel '%s' ~ Received touch mode event: isInTouchMode=%s",
|
||||
getInputChannelName().c_str(), toString(touchModeEvent->isInTouchMode()));
|
||||
}
|
||||
env->CallVoidMethod(receiverObj.get(),
|
||||
gInputEventReceiverClassInfo.onTouchModeChanged,
|
||||
jboolean(touchModeEvent->isInTouchMode()));
|
||||
finishInputEvent(seq, true /* handled */);
|
||||
continue;
|
||||
}
|
||||
|
||||
default:
|
||||
assert(false); // InputConsumer should prevent this from ever happening
|
||||
|
||||
Reference in New Issue
Block a user