What you’ll study
- What the hardware actually senses: capacitive grids, passive and active pens, EMR, infrared frames.
- How the kernel reports several fingers at once: the multi-touch protocol, slots and tracking IDs.
- The system side:
EventHub,InputReader, the stages after it (palm rejection among them) andInputDispatcher. - How the dispatcher picks your window, and why an unanswered touch becomes an ANR after 5 seconds.
- The
InputChannel: the socket between the system and your app. - The app side: why touch is handled once per frame, and how the samples are resampled to the frame.
How it connects
Guide 1 found that a stroke is drawn from samples, and
that they arrive bundled. Guide 3 showed the main thread
waking on an input socket and handling touch in the frame’s first step. This guide fills in the part
between: where the samples come from, who bundles them, and what the system changes on the way. The
next guide reads the MotionEvent that arrives at the end: pointers, history and axes.
Read it at your level
| Level | Read | You should be able to |
|---|---|---|
| Student | The basics, the hardware | Say how a screen knows where a finger is, and why a pen can report pressure |
| Fresher | + The lab, the high level | Name the parts between the glass and onTouchEvent() and what each one does |
| Junior | + The low level up to the dispatcher | Read getevent output and explain how a touch picks its window |
| Mid | + The channel, batching and resampling | Explain why touch arrives once per frame and why the newest point may be made up |
| Senior | + Edge cases, cross questions | Reason about input latency, input ANRs and resampling on real devices |
The basics
A touchscreen doesn’t send “a tap”. It sends samples: many times a second, a small controller chip behind the glass reports where each finger or pen is. Everything after that is software deciding what the samples mean and who should get them.
finger or pen on the glass
│ the sensor: an electrode grid, a digitizer coil, or infrared beams
touch controller (firmware) finds each contact, gives it an ID, reports at its own rate
│
Linux kernel driver /dev/input/eventN, in the multi-touch protocol
│
system_server: inputflinger
EventHub reads every /dev/input device
InputReader raw events → pointer motions in screen coordinates
more stages palm rejection (when switched on), filters, pointer icons
InputDispatcher picks the window, sends the event, waits for "finished"
│ InputChannel: a Unix socket pair, one end in your app
your app's main thread Looper wakes, samples are batched until the next frame
│
View.onTouchEvent(MotionEvent), or Compose's pointerInput
Two numbers decide a lot of what follows. The touch controller reports at its report rate; the display draws at its refresh rate. They are rarely the same, and they are not in step, so some frames get more samples than others. Android’s answer is to batch the samples per frame and resample them to the frame’s time, which you can watch in the lab below.
The hardware
Different glass, different sensor, different data. What the sensor can measure is the limit of what
your MotionEvent can ever report.
| Technology | How it senses | What it can report | Where you meet it |
|---|---|---|---|
| Projected capacitive, finger | A grid of transparent electrodes; a finger changes the capacitance near it | Position and contact size, many fingers | Every phone and tablet |
| Passive stylus | A conductive tip the grid sees as a thin finger | Position only | Cheap styluses |
| EMR pen | The screen’s digitizer powers a coil and capacitor in the pen, which answers back | Position, pressure, hover, buttons, no battery | Samsung S Pen, Wacom |
| Active electrostatic pen (USI, MPP, AES) | A powered pen transmits a signal the touch grid picks up | Position, pressure, tilt, buttons | Chromebooks, Surface, some Android tablets |
| Infrared frame | LEDs and sensors around the bezel; a touch blocks beams | Position and size, no pressure | Large interactive panels, classroom boards |
| Resistive | Two flexible layers pressed into contact | One position, from any object | Older devices, industrial screens |
Capacitive. The glass carries rows and columns of transparent electrodes. Mutual sensing measures every row and column crossing, so two fingers show up as two separate bumps. Self sensing measures whole rows and whole columns, so two fingers light up two rows and two columns, which cross at four points: two real touches and two “ghosts” (one patent’s worked example). Controllers that need real multi-touch use mutual sensing, or combine both.
EMR (electromagnetic resonance). A layer behind the display sends out a field; a coil and capacitor in the pen resonate with it, which both powers the pen and lets it answer, so the pen needs no battery (Wacom, Wacom support). Pressure on the tip changes the pen’s circuit, and the change travels back in its signal. Because the field reaches a little above the glass, the screen knows where the pen is before it touches: hover.
Active electrostatic pens carry a battery and transmit to the same capacitive grid the fingers use. USI is a specification for powered pens, aimed at Chromebooks, laptops and tablets; version 2.0 added support for in-cell display panels and NFC wireless charging (XDA). MPP is Microsoft’s, from N-trig, which Microsoft bought in 2015 (Microsoft Pen Protocol).
Infrared frames. Rows of LEDs face rows of light sensors around the bezel; the controller pulses them in turn, and a touch shows up as the beams it blocks, in X and in Y (Elo, Sharp). That works on a 65-inch board without a capacitive layer, and it works with a finger, a glove or a marker cap. But two touches block two columns and two rows, which cross at four points, so IR frames face the same ghost problem as self-capacitance. Better frames send each LED’s light to several sensors at an angle to tell real points from ghosts. And a blocked beam has no pressure, which is why big classroom boards report touch size but not force.
Resistive screens, in one paragraph: two layers with a small gap; pressing pushes them together and the voltage at the contact gives the position. Anything can press them, but the layers wear, the image sits behind extra plastic, and the classic design sees one touch. Capacitive glass won because it is durable, clear and multi-touch.
Try it: the resampling lab
100 ms of a finger moving at a steady speed. Top: the touch samples. Middle: the frames (vsyncs), each with a dot at the moment the app draws the finger at, coloured by how that point was made. Bottom: how far the finger moves on screen from one frame to the next.
Things to try: with 120 Hz touch on a 90 Hz display and resampling off, frames take one or two samples and the bars jump, though the finger moves evenly. Switch Resampling on: the steps become equal and the lag settles at 5 ms. Try 240 Hz touch: more samples, so the consumer always has one on each side of its target and interpolates. Try 120 Hz on 120 Hz: no later sample has arrived yet at some frames, so it extrapolates, but never more than half the last gap.
The lab follows the code below with a straight-line finger, so resampling looks perfect. A real finger curves and changes speed, so extrapolated points are sometimes wrong, which is exactly why the system predicts so little.
The high level
| Piece | What it does | Runs in |
|---|---|---|
| Touch controller | Scans the sensor, finds contacts, tracks them, reports samples | Firmware on its own chip |
| Kernel driver | Turns the controller’s reports into the Linux multi-touch protocol on /dev/input/eventN |
Kernel |
EventHub |
Watches /dev/input for devices coming and going, and reads their events |
system_server, the InputReader thread |
InputReader |
Turns raw events into pointer motions: slots into pointers, raw units into screen coordinates, rotated to the display | Same thread |
| Stages after the reader | Palm rejection (UnwantedInteractionBlocker), InputFilter, PointerChoreographer, InputProcessor, a metrics collector |
Called in order as each event passes |
InputDispatcher |
Picks the target window for each touch, sends it, tracks what the app has not finished | system_server, the InputDispatcher thread |
InputChannel |
One Unix socket pair per window: the system holds one end, the app the other | Both sides |
InputConsumer and ViewRootImpl |
Read the socket, batch moves until the next frame, resample, hand the MotionEvent to views |
Your main thread |
The low level
Excerpts are from AOSP main unless noted, trimmed with …. Links are in The map below.
1. The kernel: protocol B, slots and tracking IDs
The kernel’s multi-touch protocol comes in two types. Type A sends every contact anonymously in every report and is obsolete: “all kernel drivers have been converted to use type B”. Type B gives each contact a slot and a tracking ID, and only sends what changed. Two fingers going down, as the kernel documentation shows it:
ABS_MT_SLOT 0
ABS_MT_TRACKING_ID 45
ABS_MT_POSITION_X x[0]
ABS_MT_POSITION_Y y[0]
ABS_MT_SLOT 1
ABS_MT_TRACKING_ID 46
ABS_MT_POSITION_X x[1]
ABS_MT_POSITION_Y y[1]
SYN_REPORT
SYN_REPORT closes one sample. After that, moving the first finger is just its slot and its new X;
lifting it is ABS_MT_TRACKING_ID -1 (“the value -1 denotes an unused slot”). Size, pressure, tool type
and the rest are more ABS_MT_* axes in the same slot. The tracking ID is where Android’s pointer ID
starts: the reason a finger keeps its ID while others come and go.
You can watch this on any device:
adb shell getevent -lt
-l prints names instead of numbers and -t adds timestamps. Touch the screen and you will see the
slots, the tracking IDs and one SYN_REPORT per sample, at the controller’s report rate.
2. Reading devices: EventHub
EventHub uses the same tools as the main thread’s Looper: one epoll set for every input device,
and inotify on /dev/input to notice devices being plugged in or removed.
static const char* DEVICE_INPUT_PATH = "/dev/input";
…
mEpollFd = epoll_create1(EPOLL_CLOEXEC);
…
mINotifyFd = inotify_init1(IN_CLOEXEC);
…
mDeviceInputWd = inotify_add_watch(mINotifyFd, DEVICE_INPUT_PATH, IN_DELETE | IN_CREATE);
getEvents() sleeps in epoll_wait() and, when a device is readable, read()s a batch of raw
input_event structs from it, up to 256 at a time (EVENT_BUFFER_SIZE).
3. Making sense of them: InputReader and the stages after it
The reader thread runs loopOnce() forever:
void InputReader::loopOnce() {
…
std::vector<RawEvent> events = mEventHub->getEvents(timeoutMillis);
…
if (!events.empty()) {
mPendingArgs += processEventsLocked(events.data(), events.size());
}
…
}
Each device gets mappers. For a touchscreen, MultiTouchMotionAccumulator follows the slots:
if (mUsingSlotsProtocol) {
if (rawEvent.code == ABS_MT_SLOT) {
mCurrentSlot = rawEvent.value;
newSlot = true;
}
}
…
Slot& slot = mSlots[mCurrentSlot];
…
slot.populateAxisValue(rawEvent.code, rawEvent.value);
At each SYN_REPORT, TouchInputMapper turns the slots into pointers: raw sensor units into display
coordinates, rotated with the screen, with size and pressure calibrated by the device’s configuration
(see Input device configuration in Read next). The result is passed on, stage by stage. The order
is written in InputManager.cpp:
/**
* The event flow is via the "InputListener" interface, as follows:
* InputReader
* -> UnwantedInteractionBlocker
* -> InputFilter
* -> PointerChoreographer
* -> InputProcessor
* -> InputDeviceMetricsCollector
* -> InputDispatcher
*/
UnwantedInteractionBlocker is the system’s palm rejection. It runs a neural palm model from
ChromeOS (NeuralStylusPalmDetectionFilter), but only when the palm_rejection_enabled flag is set,
and that flag defaults to "0". When it decides a pointer is a palm, it cancels it: the app gets
ACTION_POINTER_UP with FLAG_CANCELED, or ACTION_CANCEL, which is why guide 1’s multi-pointer code
checks that flag. Because it is off on most devices, drawing apps usually do their own palm rejection,
from tool type and contact size.
4. Choosing a window: InputDispatcher
The dispatcher has its own thread. For a new touch, it walks the display’s windows from front to back and takes the first one that accepts a touch at that point:
sp<WindowInfoHandle> InputDispatcher::findTouchedWindowAtLocked(…, float x, float y, bool isStylus, …) const {
// Traverse windows from front to back to find touched window.
const auto& windowHandles = getWindowHandlesLocked(displayId);
for (const sp<WindowInfoHandle>& windowHandle : windowHandles) {
…
const WindowInfo& info = *windowHandle->getInfo();
if (!info.isSpy() &&
windowAcceptsTouchAt(info, displayId, x, y, isStylus, getTransformLocked(displayId))) {
return windowHandle;
}
}
return nullptr;
}
The window list comes from SurfaceFlinger (onWindowInfosChanged()), so the dispatcher sees windows
as they are composed on screen. The window that gets the DOWN normally keeps the rest of that
gesture, even if the finger moves outside it.
Every event sent to a window goes on that connection’s wait queue until the app reports it
finished. If the oldest one waits too long, the dispatcher raises an ANR. The default limit is a
constant in IInputConstants.aidl:
const int UNMULTIPLIED_DEFAULT_DISPATCHING_TIMEOUT_MILLIS = 5000; // 5 seconds
“Unmultiplied” because slow hardware, such as emulators, can scale it. This is the “Input dispatching
timed out” ANR: not a slow onTouchEvent() in itself, but a main thread too busy to finish the event.
5. The socket: InputChannel
Each window that takes input gets an InputChannel pair when it is added:
status_t InputChannel::openInputChannelPair(const std::string& name, …) {
int sockets[2];
if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sockets)) {
…
}
int bufferSize = SOCKET_BUFFER_SIZE;
…
}
SOCK_SEQPACKET keeps message boundaries: one sample is one message. The buffer is 32 KB
(SOCKET_BUFFER_SIZE), and a motion event carries at most 16 pointers (MAX_POINTERS). The system keeps
one end; your app’s end is the descriptor the main thread’s Looper watches, from guide 3. The app
writes back a “finished” message on the same socket, which is what empties the wait queue.
6. One delivery per frame: batching
When the socket becomes readable, NativeInputEventReceiver reads it. DOWN, UP and other actions
are delivered at once. MOVE and HOVER_MOVE samples are not: InputConsumer collects them in a
batch, and ViewRootImpl asks Choreographer to consume the batch in the next frame’s input step:
void scheduleConsumeBatchedInput() {
// If anything is currently scheduled to consume batched input then there's no point in
// scheduling it again.
if (!mConsumeBatchedInputScheduled && !mConsumeBatchedInputImmediatelyScheduled) {
mConsumeBatchedInputScheduled = true;
mChoreographer.postCallback(Choreographer.CALLBACK_INPUT,
mConsumedBatchedInputRunnable, null);
…
}
}
So your onTouchEvent() sees one ACTION_MOVE per frame, with the samples that arrived since the last
frame packed in as historical samples. That is the bundle guide 1 unpacked with
getHistoricalX(). Unbuffered dispatch (requestUnbufferedDispatch()) is the way out: each sample is
delivered as it arrives, at the cost of more work per second.
7. Lining samples up with the frame: resampling
The touch report rate and the display’s refresh rate don’t line up, so without help a frame gets one
sample, the next gets two, and steady motion looks uneven: the lab’s first state. InputConsumer
fixes this by not using the newest sample as it is. It aims at a time just before the frame and works
out where the finger was at exactly that time:
// Latency added during resampling. A few milliseconds doesn't hurt much but
// reduces the impact of mispredicted touch positions.
const std::chrono::duration RESAMPLE_LATENCY = 5ms;
…
nsecs_t sampleTime = frameTime;
if (mResampleTouch) {
sampleTime -= std::chrono::nanoseconds(RESAMPLE_LATENCY).count();
}
ssize_t split = findSampleNoLaterThan(batch, sampleTime);
…
result = consumeSamples(factory, batch, split + 1, outSeq, outEvent);
…
resampleTouchState(sampleTime, static_cast<MotionEvent*>(*outEvent), next);
Samples newer than sampleTime stay in the batch for the next frame. Then resampleTouchState()
adds one extra point at sampleTime:
- Interpolate when a later sample has already arrived: the point lies between the last consumed
sample and that one. Not done if the two are under 2 ms apart (
RESAMPLE_MIN_DELTA). - Extrapolate when no later sample has arrived: continue the line from the last two samples, but
only if they are 2 to 20 ms apart (
RESAMPLE_MAX_DELTA), and never further than 8 ms (RESAMPLE_MAX_PREDICTION) or half the gap between them.
Only MOVE events are resampled, only for fingers, mice, styluses and unknown tools, and only when the
ro.input.resampling property is not 0 (“Resampling is enabled by default”; devices whose touch is
already driven by vsync should switch it off). The added point becomes the event’s current position,
and the real samples sit in its history. From API 35, PointerCoords.isResampled() tells you which is
which.
An extrapolated point can run ahead of the finger. So the pointer never jumps backwards, the consumer
rewrites real samples that are older than the last resampled point: they get the resampled
coordinates, and they are marked as resampled too (rewriteMessage()). A marked point is therefore
“not measured as shown”, either computed or overwritten.
In Android 14 this code lived in InputTransport.cpp; on main it moved to InputConsumer.cpp, with
the same constants. A newer InputConsumerNoResampling takes the resampler as a separate, pluggable
part.
Checkpoint
You should be able to say:
- The controller reports samples at its own rate; the kernel passes them on as protocol B slots with tracking IDs.
EventHubreads every/dev/inputdevice withepoll;InputReaderturns slots into pointers in screen coordinates.- Palm rejection in
system_serverexists but is off unless a flag enables it. InputDispatchersends a touch to the front-most window that accepts it, and waits for “finished”; 5 s unanswered is an ANR.- Each window has a socket pair;
MOVEsamples are batched and handled once per frame. - With resampling, the newest point is computed for 5 ms before the frame, between or just past the real samples.
Why it helps
| Symptom | What is happening | What to do |
|---|---|---|
| Strokes look smooth on one tablet and stepped on another | Report rate and refresh rate differ, and resampling is off or not used | Draw from every historical sample, not just event.x |
| A pen app shows pressure 1.0 for every point | The device reports no pressure axis, or reports signal strength for fingers | Check InputDevice.getMotionRange(AXIS_PRESSURE) and the tool type |
| “Input dispatching timed out” in an ANR | The main thread didn’t finish an event for 5 s | Find the long message, as in guide 3 |
| A saved stroke’s end runs slightly past where the pen stopped | The last points were extrapolated, or overwritten by an extrapolated point | Store only measured samples; draw resampled ones as a temporary tip |
| Two fingers on a classroom board register as four, or jump | IR ghost points | Expect it on IR frames; reject impossible pairs over time |
What is touching, and what can it report:
override fun onTouchEvent(event: MotionEvent): Boolean {
val tool = event.getToolType(0) // TOOL_TYPE_FINGER, _STYLUS, _ERASER, _MOUSE or _UNKNOWN
val pressure = event.device?.getMotionRange(MotionEvent.AXIS_PRESSURE, event.source)
// null: this device has no pressure axis at all (an IR frame has nothing to measure it with).
// For fingers, a range is often signal strength or contact size, not force.
return true
}
Keep only the samples the device measured (API 35 and up; older releases don’t mark them):
private val coords = MotionEvent.PointerCoords()
private fun addMeasuredSamples(event: MotionEvent, i: Int, stroke: Path) {
for (h in 0..event.historySize) { // the history first, then the current position
if (h < event.historySize) event.getHistoricalPointerCoords(i, h, coords) else event.getPointerCoords(i, coords)
if (Build.VERSION.SDK_INT >= 35 && coords.isResampled) continue // computed by the consumer, not measured
stroke.lineTo(coords.x, coords.y)
}
}
How long the newest sample waited before your code saw it:
val waitedMs = SystemClock.uptimeMillis() - event.eventTime // eventTime uses the uptimeMillis() clock
With resampling on, eventTime is the resampled time, about 5 ms before the frame, so this includes
the resampling delay. Use getHistoricalEventTime() for the real samples.
What the system knows about each device:
adb shell dumpsys input
It lists every input device with its axes and calibration, the reader’s and dispatcher’s state, and the windows that can receive touch.
The map
| Step | Code | Where |
|---|---|---|
| Kernel protocol | Slots, tracking IDs, ABS_MT_* |
Multi-touch protocol |
| Read devices | EventHub::getEvents() |
EventHub.cpp |
| Raw to pointers | InputReader::loopOnce(), MultiTouchMotionAccumulator::process(), TouchInputMapper |
InputReader.cpp, MultiTouchMotionAccumulator.cpp, TouchInputMapper.cpp |
| The stages | Order of listeners | InputManager.cpp |
| Palm rejection | UnwantedInteractionBlocker |
UnwantedInteractionBlocker.cpp |
| Pick a window, ANR | findTouchedWindowAtLocked(), wait queue |
InputDispatcher.cpp, IInputConstants.aidl |
| The socket | InputChannel::openInputChannelPair() |
InputTransport.cpp |
| App reads it | NativeInputEventReceiver::handleEvent() |
android_view_InputEventReceiver.cpp |
| Batch per frame | scheduleConsumeBatchedInput(), doConsumeBatchedInput() |
ViewRootImpl.java |
| Resample | consumeBatch(), resampleTouchState() |
InputConsumer.cpp, Android 14 InputTransport.cpp |
Edge cases
- Resampling is per device. A device whose controller is already synced to vsync should set
ro.input.resamplingto0; on such a device you will never seeisResampled(). - Tools that are never resampled. Only fingers, mice, styluses and unknown tools are; an eraser end, for example, is not.
- A pointer can be cancelled after the fact. Palm rejection, or the system taking over a gesture,
cancels pointers your code already drew. Keep strokes “wet” until
UP, and drop them on cancel. - The gesture belongs to the window that got
DOWN. A finger that slides onto another window keeps going to the first one. - Multi-display and split screen. The window search runs per display, so the same panel coordinates can mean different windows on different displays.
- Old kernels, type A devices.
InputReaderstill accepts the anonymous type A protocol. With no tracking IDs,TouchInputMapper.assignPointerIds()matches each contact to the nearest one from the last sample, so two fingers that cross can swap IDs.
Cross questions
Your drawing app gets one ACTION_MOVE per frame, but the panel reports at 240 Hz. Where did the other samples go?
Into the same event, as historical samples. InputConsumer batches MOVE samples and ViewRootImpl consumes the batch once per frame, in Choreographer's input step. Read them with getHistoricalX(), getHistoricalY() and getHistoricalEventTime().
The newest point of a stroke is sometimes slightly ahead of where the pen actually was. Why?
Resampling extrapolated it. When no later sample has arrived by the frame, the consumer continues the line from the last two samples, by at most 8 ms and at most half their gap. From API 35, PointerCoords.isResampled() marks that point.
Does resampling make touch faster?
No. It aims 5 ms before the frame (RESAMPLE_LATENCY), so it trades a steady few milliseconds of lag for even motion and less error from prediction. The comment on the constant says so: "A few milliseconds doesn't hurt much but reduces the impact of mispredicted touch positions."
How does a capacitive phone tell a pen from a finger if the pen is passive?
It mostly can't: a passive stylus is a thin conductive tip, so it reports as a finger, with no pressure. EMR and active pens are different devices with their own signals, so they report TOOL_TYPE_STYLUS, pressure and buttons.
Your onTouchEvent() takes 3 ms. Can it cause an input ANR?
Not by itself. The ANR comes when an event sent to the window isn't finished within 5 s. That happens when the main thread is busy with something else, for example a long message in front of the input, so the event can't even be delivered.
Why does a classroom IR board sometimes show a touch where nobody touched?
Two touches block two vertical and two horizontal beams, which cross at four points. Two are real and two are ghosts. Frames use angled beams and tracking over time to tell them apart, and sometimes guess wrong.
Where does a MotionEvent's pointer ID come from?
From the kernel's tracking ID: in protocol B each contact keeps a tracking ID in its slot from touch-down until ABS_MT_TRACKING_ID -1. MultiTouchInputMapper maps each tracking ID to a small pointer ID (0 to 31) that stays fixed for the contact's life.
Revision: key points
- Hardware limits the data: capacitive gives position and size, EMR and active pens add pressure, tilt and hover, IR frames give no pressure.
- Self-capacitance and IR frames both have ghost points with two touches; mutual capacitance doesn’t.
- The kernel speaks multi-touch protocol B: slots, tracking IDs,
ABS_MT_*, oneSYN_REPORTper sample. EventHubreads devices withepoll;InputReadermakes pointers; stages follow;InputDispatcherdelivers.- System palm rejection is a ChromeOS neural model, off by default.
- The dispatcher picks the front-most window that accepts the touch; 5 s without “finished” is an input ANR.
- One Unix socket pair per window; up to 16 pointers per event.
MOVEsamples are batched and consumed in the frame’s input step.- Resampling aims 5 ms before the frame, interpolates or extrapolates (at most 8 ms), and marks the made-up point from API 35.
Cheat sheet
Each concept in a few words.
| Concept | In a few words |
|---|---|
| Capacitive grid | Senses a finger by its charge: position and size. |
| EMR pen | Powered by the screen’s field; adds pressure, tilt and hover. |
| IR frame | Beams blocked by touch; position and size, no pressure. |
| Ghost points | Extra crossings with two touches; the frame must throw them out. |
| Slot and tracking ID | One contact’s lane, and its name, in the kernel’s protocol B. |
EventHub |
Reads input devices with epoll. |
InputReader |
Turns raw events into pointers and screen coordinates. |
InputDispatcher |
Picks the front-most window that accepts a touch. |
| Palm rejection | The system model is off by default; apps usually add their own. |
| Batching | MOVE samples wait and arrive in the frame’s input step. |
| Resampling | Moves a sample to 5 ms before the frame, at most 8 ms ahead. |
| Pointer limit | At most 16 pointers in one event. |
Read next
- References:
MotionEvent,MotionEvent.PointerCoords,InputDevice,View.requestUnbufferedDispatch() - The platform side: Input and Touch devices, including how input device configuration files calibrate size and pressure
- Linux: Multi-touch (MT) protocol
- The source, in The map above
Search terms that find more: InputDispatcher findTouchedWindow, touch resampling Android, ABS_MT_TRACKING_ID, getevent multitouch, palm rejection Android inputflinger.
The fine print
Excerpts are from AOSP main in November 2026; the resampling code is also quoted from
android14-release, where it lived in InputTransport.cpp. The pipeline stages and file names change
between releases; the shape (kernel slots, a reader and a dispatcher in system_server, a socket per
window, batching per frame) has been stable for many years. The hardware section describes how each
technology works in general; individual devices differ. The resampling lab is a model with a
straight-line finger, not a recording.
Part of the ink series: 1. Why naive drawing feels bad, 2. Canvas, Paint and Path, 3. Looper, epoll and vsync.