| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2019 The Android Open Source Project | 
|  | 3 | * | 
|  | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | * you may not use this file except in compliance with the License. | 
|  | 6 | * You may obtain a copy of the License at | 
|  | 7 | * | 
|  | 8 | *      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | * | 
|  | 10 | * Unless required by applicable law or agreed to in writing, software | 
|  | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | * See the License for the specific language governing permissions and | 
|  | 14 | * limitations under the License. | 
|  | 15 | */ | 
|  | 16 |  | 
| Prabir Pradhan | 9244aea | 2020-02-05 20:31:40 -0800 | [diff] [blame] | 17 | #include "../Macros.h" | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 18 |  | 
|  | 19 | #include "MultiTouchInputMapper.h" | 
|  | 20 |  | 
|  | 21 | namespace android { | 
|  | 22 |  | 
|  | 23 | // --- Constants --- | 
|  | 24 |  | 
|  | 25 | // Maximum number of slots supported when using the slot-based Multitouch Protocol B. | 
|  | 26 | static constexpr size_t MAX_SLOTS = 32; | 
|  | 27 |  | 
|  | 28 | // --- MultiTouchMotionAccumulator --- | 
|  | 29 |  | 
|  | 30 | MultiTouchMotionAccumulator::MultiTouchMotionAccumulator() | 
|  | 31 | : mCurrentSlot(-1), | 
|  | 32 | mSlots(nullptr), | 
|  | 33 | mSlotCount(0), | 
|  | 34 | mUsingSlotsProtocol(false), | 
|  | 35 | mHaveStylus(false) {} | 
|  | 36 |  | 
|  | 37 | MultiTouchMotionAccumulator::~MultiTouchMotionAccumulator() { | 
|  | 38 | delete[] mSlots; | 
|  | 39 | } | 
|  | 40 |  | 
| Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 41 | void MultiTouchMotionAccumulator::configure(InputDeviceContext& deviceContext, size_t slotCount, | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 42 | bool usingSlotsProtocol) { | 
|  | 43 | mSlotCount = slotCount; | 
|  | 44 | mUsingSlotsProtocol = usingSlotsProtocol; | 
| Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 45 | mHaveStylus = deviceContext.hasAbsoluteAxis(ABS_MT_TOOL_TYPE); | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 46 |  | 
|  | 47 | delete[] mSlots; | 
|  | 48 | mSlots = new Slot[slotCount]; | 
|  | 49 | } | 
|  | 50 |  | 
| Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 51 | void MultiTouchMotionAccumulator::reset(InputDeviceContext& deviceContext) { | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 52 | // Unfortunately there is no way to read the initial contents of the slots. | 
|  | 53 | // So when we reset the accumulator, we must assume they are all zeroes. | 
|  | 54 | if (mUsingSlotsProtocol) { | 
|  | 55 | // Query the driver for the current slot index and use it as the initial slot | 
|  | 56 | // before we start reading events from the device.  It is possible that the | 
|  | 57 | // current slot index will not be the same as it was when the first event was | 
|  | 58 | // written into the evdev buffer, which means the input mapper could start | 
|  | 59 | // out of sync with the initial state of the events in the evdev buffer. | 
|  | 60 | // In the extremely unlikely case that this happens, the data from | 
|  | 61 | // two slots will be confused until the next ABS_MT_SLOT event is received. | 
|  | 62 | // This can cause the touch point to "jump", but at least there will be | 
|  | 63 | // no stuck touches. | 
|  | 64 | int32_t initialSlot; | 
| Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 65 | status_t status = deviceContext.getAbsoluteAxisValue(ABS_MT_SLOT, &initialSlot); | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 66 | if (status) { | 
|  | 67 | ALOGD("Could not retrieve current multitouch slot index.  status=%d", status); | 
|  | 68 | initialSlot = -1; | 
|  | 69 | } | 
|  | 70 | clearSlots(initialSlot); | 
|  | 71 | } else { | 
|  | 72 | clearSlots(-1); | 
|  | 73 | } | 
|  | 74 | } | 
|  | 75 |  | 
|  | 76 | void MultiTouchMotionAccumulator::clearSlots(int32_t initialSlot) { | 
|  | 77 | if (mSlots) { | 
|  | 78 | for (size_t i = 0; i < mSlotCount; i++) { | 
|  | 79 | mSlots[i].clear(); | 
|  | 80 | } | 
|  | 81 | } | 
|  | 82 | mCurrentSlot = initialSlot; | 
|  | 83 | } | 
|  | 84 |  | 
|  | 85 | void MultiTouchMotionAccumulator::process(const RawEvent* rawEvent) { | 
|  | 86 | if (rawEvent->type == EV_ABS) { | 
|  | 87 | bool newSlot = false; | 
|  | 88 | if (mUsingSlotsProtocol) { | 
|  | 89 | if (rawEvent->code == ABS_MT_SLOT) { | 
|  | 90 | mCurrentSlot = rawEvent->value; | 
|  | 91 | newSlot = true; | 
|  | 92 | } | 
|  | 93 | } else if (mCurrentSlot < 0) { | 
|  | 94 | mCurrentSlot = 0; | 
|  | 95 | } | 
|  | 96 |  | 
|  | 97 | if (mCurrentSlot < 0 || size_t(mCurrentSlot) >= mSlotCount) { | 
|  | 98 | #if DEBUG_POINTERS | 
|  | 99 | if (newSlot) { | 
|  | 100 | ALOGW("MultiTouch device emitted invalid slot index %d but it " | 
|  | 101 | "should be between 0 and %zd; ignoring this slot.", | 
|  | 102 | mCurrentSlot, mSlotCount - 1); | 
|  | 103 | } | 
|  | 104 | #endif | 
|  | 105 | } else { | 
|  | 106 | Slot* slot = &mSlots[mCurrentSlot]; | 
|  | 107 |  | 
|  | 108 | switch (rawEvent->code) { | 
|  | 109 | case ABS_MT_POSITION_X: | 
|  | 110 | slot->mInUse = true; | 
|  | 111 | slot->mAbsMTPositionX = rawEvent->value; | 
|  | 112 | break; | 
|  | 113 | case ABS_MT_POSITION_Y: | 
|  | 114 | slot->mInUse = true; | 
|  | 115 | slot->mAbsMTPositionY = rawEvent->value; | 
|  | 116 | break; | 
|  | 117 | case ABS_MT_TOUCH_MAJOR: | 
|  | 118 | slot->mInUse = true; | 
|  | 119 | slot->mAbsMTTouchMajor = rawEvent->value; | 
|  | 120 | break; | 
|  | 121 | case ABS_MT_TOUCH_MINOR: | 
|  | 122 | slot->mInUse = true; | 
|  | 123 | slot->mAbsMTTouchMinor = rawEvent->value; | 
|  | 124 | slot->mHaveAbsMTTouchMinor = true; | 
|  | 125 | break; | 
|  | 126 | case ABS_MT_WIDTH_MAJOR: | 
|  | 127 | slot->mInUse = true; | 
|  | 128 | slot->mAbsMTWidthMajor = rawEvent->value; | 
|  | 129 | break; | 
|  | 130 | case ABS_MT_WIDTH_MINOR: | 
|  | 131 | slot->mInUse = true; | 
|  | 132 | slot->mAbsMTWidthMinor = rawEvent->value; | 
|  | 133 | slot->mHaveAbsMTWidthMinor = true; | 
|  | 134 | break; | 
|  | 135 | case ABS_MT_ORIENTATION: | 
|  | 136 | slot->mInUse = true; | 
|  | 137 | slot->mAbsMTOrientation = rawEvent->value; | 
|  | 138 | break; | 
|  | 139 | case ABS_MT_TRACKING_ID: | 
|  | 140 | if (mUsingSlotsProtocol && rawEvent->value < 0) { | 
|  | 141 | // The slot is no longer in use but it retains its previous contents, | 
|  | 142 | // which may be reused for subsequent touches. | 
|  | 143 | slot->mInUse = false; | 
|  | 144 | } else { | 
|  | 145 | slot->mInUse = true; | 
|  | 146 | slot->mAbsMTTrackingId = rawEvent->value; | 
|  | 147 | } | 
|  | 148 | break; | 
|  | 149 | case ABS_MT_PRESSURE: | 
|  | 150 | slot->mInUse = true; | 
|  | 151 | slot->mAbsMTPressure = rawEvent->value; | 
|  | 152 | break; | 
|  | 153 | case ABS_MT_DISTANCE: | 
|  | 154 | slot->mInUse = true; | 
|  | 155 | slot->mAbsMTDistance = rawEvent->value; | 
|  | 156 | break; | 
|  | 157 | case ABS_MT_TOOL_TYPE: | 
|  | 158 | slot->mInUse = true; | 
|  | 159 | slot->mAbsMTToolType = rawEvent->value; | 
|  | 160 | slot->mHaveAbsMTToolType = true; | 
|  | 161 | break; | 
|  | 162 | } | 
|  | 163 | } | 
|  | 164 | } else if (rawEvent->type == EV_SYN && rawEvent->code == SYN_MT_REPORT) { | 
|  | 165 | // MultiTouch Sync: The driver has returned all data for *one* of the pointers. | 
|  | 166 | mCurrentSlot += 1; | 
|  | 167 | } | 
|  | 168 | } | 
|  | 169 |  | 
|  | 170 | void MultiTouchMotionAccumulator::finishSync() { | 
|  | 171 | if (!mUsingSlotsProtocol) { | 
|  | 172 | clearSlots(-1); | 
|  | 173 | } | 
|  | 174 | } | 
|  | 175 |  | 
|  | 176 | bool MultiTouchMotionAccumulator::hasStylus() const { | 
|  | 177 | return mHaveStylus; | 
|  | 178 | } | 
|  | 179 |  | 
|  | 180 | // --- MultiTouchMotionAccumulator::Slot --- | 
|  | 181 |  | 
|  | 182 | MultiTouchMotionAccumulator::Slot::Slot() { | 
|  | 183 | clear(); | 
|  | 184 | } | 
|  | 185 |  | 
|  | 186 | void MultiTouchMotionAccumulator::Slot::clear() { | 
|  | 187 | mInUse = false; | 
|  | 188 | mHaveAbsMTTouchMinor = false; | 
|  | 189 | mHaveAbsMTWidthMinor = false; | 
|  | 190 | mHaveAbsMTToolType = false; | 
|  | 191 | mAbsMTPositionX = 0; | 
|  | 192 | mAbsMTPositionY = 0; | 
|  | 193 | mAbsMTTouchMajor = 0; | 
|  | 194 | mAbsMTTouchMinor = 0; | 
|  | 195 | mAbsMTWidthMajor = 0; | 
|  | 196 | mAbsMTWidthMinor = 0; | 
|  | 197 | mAbsMTOrientation = 0; | 
|  | 198 | mAbsMTTrackingId = -1; | 
|  | 199 | mAbsMTPressure = 0; | 
|  | 200 | mAbsMTDistance = 0; | 
|  | 201 | mAbsMTToolType = 0; | 
|  | 202 | } | 
|  | 203 |  | 
|  | 204 | int32_t MultiTouchMotionAccumulator::Slot::getToolType() const { | 
|  | 205 | if (mHaveAbsMTToolType) { | 
|  | 206 | switch (mAbsMTToolType) { | 
|  | 207 | case MT_TOOL_FINGER: | 
|  | 208 | return AMOTION_EVENT_TOOL_TYPE_FINGER; | 
|  | 209 | case MT_TOOL_PEN: | 
|  | 210 | return AMOTION_EVENT_TOOL_TYPE_STYLUS; | 
| Arthur Hung | 421eb1c | 2020-01-16 00:09:42 +0800 | [diff] [blame] | 211 | case MT_TOOL_PALM: | 
|  | 212 | return AMOTION_EVENT_TOOL_TYPE_PALM; | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 213 | } | 
|  | 214 | } | 
|  | 215 | return AMOTION_EVENT_TOOL_TYPE_UNKNOWN; | 
|  | 216 | } | 
|  | 217 |  | 
|  | 218 | // --- MultiTouchInputMapper --- | 
|  | 219 |  | 
| Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 220 | MultiTouchInputMapper::MultiTouchInputMapper(InputDeviceContext& deviceContext) | 
|  | 221 | : TouchInputMapper(deviceContext) {} | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 222 |  | 
|  | 223 | MultiTouchInputMapper::~MultiTouchInputMapper() {} | 
|  | 224 |  | 
|  | 225 | void MultiTouchInputMapper::reset(nsecs_t when) { | 
| Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 226 | mMultiTouchMotionAccumulator.reset(getDeviceContext()); | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 227 |  | 
|  | 228 | mPointerIdBits.clear(); | 
|  | 229 |  | 
|  | 230 | TouchInputMapper::reset(when); | 
|  | 231 | } | 
|  | 232 |  | 
|  | 233 | void MultiTouchInputMapper::process(const RawEvent* rawEvent) { | 
|  | 234 | TouchInputMapper::process(rawEvent); | 
|  | 235 |  | 
|  | 236 | mMultiTouchMotionAccumulator.process(rawEvent); | 
|  | 237 | } | 
|  | 238 |  | 
| arthurhung | cc7f980 | 2020-04-30 17:55:40 +0800 | [diff] [blame] | 239 | std::optional<int32_t> MultiTouchInputMapper::getActiveBitId( | 
|  | 240 | const MultiTouchMotionAccumulator::Slot& inSlot) { | 
|  | 241 | if (mHavePointerIds) { | 
|  | 242 | int32_t trackingId = inSlot.getTrackingId(); | 
|  | 243 | for (BitSet32 idBits(mPointerIdBits); !idBits.isEmpty();) { | 
|  | 244 | int32_t n = idBits.clearFirstMarkedBit(); | 
|  | 245 | if (mPointerTrackingIdMap[n] == trackingId) { | 
|  | 246 | return std::make_optional(n); | 
|  | 247 | } | 
|  | 248 | } | 
|  | 249 | } | 
|  | 250 | return std::nullopt; | 
|  | 251 | } | 
|  | 252 |  | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 253 | void MultiTouchInputMapper::syncTouch(nsecs_t when, RawState* outState) { | 
|  | 254 | size_t inCount = mMultiTouchMotionAccumulator.getSlotCount(); | 
|  | 255 | size_t outCount = 0; | 
|  | 256 | BitSet32 newPointerIdBits; | 
|  | 257 | mHavePointerIds = true; | 
|  | 258 |  | 
|  | 259 | for (size_t inIndex = 0; inIndex < inCount; inIndex++) { | 
|  | 260 | const MultiTouchMotionAccumulator::Slot* inSlot = | 
|  | 261 | mMultiTouchMotionAccumulator.getSlot(inIndex); | 
|  | 262 | if (!inSlot->isInUse()) { | 
|  | 263 | continue; | 
|  | 264 | } | 
|  | 265 |  | 
| Arthur Hung | 421eb1c | 2020-01-16 00:09:42 +0800 | [diff] [blame] | 266 | if (inSlot->getToolType() == AMOTION_EVENT_TOOL_TYPE_PALM) { | 
| arthurhung | cc7f980 | 2020-04-30 17:55:40 +0800 | [diff] [blame] | 267 | std::optional<int32_t> id = getActiveBitId(*inSlot); | 
|  | 268 | if (id) { | 
|  | 269 | outState->rawPointerData.canceledIdBits.markBit(id.value()); | 
| Arthur Hung | 421eb1c | 2020-01-16 00:09:42 +0800 | [diff] [blame] | 270 | } | 
| arthurhung | bf89a48 | 2020-04-17 17:37:55 +0800 | [diff] [blame] | 271 | continue; | 
| Arthur Hung | 421eb1c | 2020-01-16 00:09:42 +0800 | [diff] [blame] | 272 | } | 
|  | 273 |  | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 274 | if (outCount >= MAX_POINTERS) { | 
|  | 275 | #if DEBUG_POINTERS | 
|  | 276 | ALOGD("MultiTouch device %s emitted more than maximum of %d pointers; " | 
|  | 277 | "ignoring the rest.", | 
|  | 278 | getDeviceName().c_str(), MAX_POINTERS); | 
|  | 279 | #endif | 
|  | 280 | break; // too many fingers! | 
|  | 281 | } | 
|  | 282 |  | 
|  | 283 | RawPointerData::Pointer& outPointer = outState->rawPointerData.pointers[outCount]; | 
|  | 284 | outPointer.x = inSlot->getX(); | 
|  | 285 | outPointer.y = inSlot->getY(); | 
|  | 286 | outPointer.pressure = inSlot->getPressure(); | 
|  | 287 | outPointer.touchMajor = inSlot->getTouchMajor(); | 
|  | 288 | outPointer.touchMinor = inSlot->getTouchMinor(); | 
|  | 289 | outPointer.toolMajor = inSlot->getToolMajor(); | 
|  | 290 | outPointer.toolMinor = inSlot->getToolMinor(); | 
|  | 291 | outPointer.orientation = inSlot->getOrientation(); | 
|  | 292 | outPointer.distance = inSlot->getDistance(); | 
|  | 293 | outPointer.tiltX = 0; | 
|  | 294 | outPointer.tiltY = 0; | 
|  | 295 |  | 
|  | 296 | outPointer.toolType = inSlot->getToolType(); | 
|  | 297 | if (outPointer.toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN) { | 
|  | 298 | outPointer.toolType = mTouchButtonAccumulator.getToolType(); | 
|  | 299 | if (outPointer.toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN) { | 
|  | 300 | outPointer.toolType = AMOTION_EVENT_TOOL_TYPE_FINGER; | 
|  | 301 | } | 
|  | 302 | } | 
|  | 303 |  | 
|  | 304 | bool isHovering = mTouchButtonAccumulator.getToolType() != AMOTION_EVENT_TOOL_TYPE_MOUSE && | 
|  | 305 | (mTouchButtonAccumulator.isHovering() || | 
|  | 306 | (mRawPointerAxes.pressure.valid && inSlot->getPressure() <= 0)); | 
|  | 307 | outPointer.isHovering = isHovering; | 
|  | 308 |  | 
|  | 309 | // Assign pointer id using tracking id if available. | 
|  | 310 | if (mHavePointerIds) { | 
|  | 311 | int32_t trackingId = inSlot->getTrackingId(); | 
|  | 312 | int32_t id = -1; | 
|  | 313 | if (trackingId >= 0) { | 
|  | 314 | for (BitSet32 idBits(mPointerIdBits); !idBits.isEmpty();) { | 
|  | 315 | uint32_t n = idBits.clearFirstMarkedBit(); | 
|  | 316 | if (mPointerTrackingIdMap[n] == trackingId) { | 
|  | 317 | id = n; | 
|  | 318 | } | 
|  | 319 | } | 
|  | 320 |  | 
|  | 321 | if (id < 0 && !mPointerIdBits.isFull()) { | 
|  | 322 | id = mPointerIdBits.markFirstUnmarkedBit(); | 
|  | 323 | mPointerTrackingIdMap[id] = trackingId; | 
|  | 324 | } | 
|  | 325 | } | 
|  | 326 | if (id < 0) { | 
|  | 327 | mHavePointerIds = false; | 
|  | 328 | outState->rawPointerData.clearIdBits(); | 
|  | 329 | newPointerIdBits.clear(); | 
|  | 330 | } else { | 
|  | 331 | outPointer.id = id; | 
|  | 332 | outState->rawPointerData.idToIndex[id] = outCount; | 
|  | 333 | outState->rawPointerData.markIdBit(id, isHovering); | 
|  | 334 | newPointerIdBits.markBit(id); | 
|  | 335 | } | 
|  | 336 | } | 
|  | 337 | outCount += 1; | 
|  | 338 | } | 
|  | 339 |  | 
|  | 340 | outState->rawPointerData.pointerCount = outCount; | 
|  | 341 | mPointerIdBits = newPointerIdBits; | 
|  | 342 |  | 
|  | 343 | mMultiTouchMotionAccumulator.finishSync(); | 
|  | 344 | } | 
|  | 345 |  | 
|  | 346 | void MultiTouchInputMapper::configureRawPointerAxes() { | 
|  | 347 | TouchInputMapper::configureRawPointerAxes(); | 
|  | 348 |  | 
|  | 349 | getAbsoluteAxisInfo(ABS_MT_POSITION_X, &mRawPointerAxes.x); | 
|  | 350 | getAbsoluteAxisInfo(ABS_MT_POSITION_Y, &mRawPointerAxes.y); | 
|  | 351 | getAbsoluteAxisInfo(ABS_MT_TOUCH_MAJOR, &mRawPointerAxes.touchMajor); | 
|  | 352 | getAbsoluteAxisInfo(ABS_MT_TOUCH_MINOR, &mRawPointerAxes.touchMinor); | 
|  | 353 | getAbsoluteAxisInfo(ABS_MT_WIDTH_MAJOR, &mRawPointerAxes.toolMajor); | 
|  | 354 | getAbsoluteAxisInfo(ABS_MT_WIDTH_MINOR, &mRawPointerAxes.toolMinor); | 
|  | 355 | getAbsoluteAxisInfo(ABS_MT_ORIENTATION, &mRawPointerAxes.orientation); | 
|  | 356 | getAbsoluteAxisInfo(ABS_MT_PRESSURE, &mRawPointerAxes.pressure); | 
|  | 357 | getAbsoluteAxisInfo(ABS_MT_DISTANCE, &mRawPointerAxes.distance); | 
|  | 358 | getAbsoluteAxisInfo(ABS_MT_TRACKING_ID, &mRawPointerAxes.trackingId); | 
|  | 359 | getAbsoluteAxisInfo(ABS_MT_SLOT, &mRawPointerAxes.slot); | 
|  | 360 |  | 
|  | 361 | if (mRawPointerAxes.trackingId.valid && mRawPointerAxes.slot.valid && | 
|  | 362 | mRawPointerAxes.slot.minValue == 0 && mRawPointerAxes.slot.maxValue > 0) { | 
|  | 363 | size_t slotCount = mRawPointerAxes.slot.maxValue + 1; | 
|  | 364 | if (slotCount > MAX_SLOTS) { | 
|  | 365 | ALOGW("MultiTouch Device %s reported %zu slots but the framework " | 
|  | 366 | "only supports a maximum of %zu slots at this time.", | 
|  | 367 | getDeviceName().c_str(), slotCount, MAX_SLOTS); | 
|  | 368 | slotCount = MAX_SLOTS; | 
|  | 369 | } | 
| Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 370 | mMultiTouchMotionAccumulator.configure(getDeviceContext(), slotCount, | 
|  | 371 | true /*usingSlotsProtocol*/); | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 372 | } else { | 
| Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 373 | mMultiTouchMotionAccumulator.configure(getDeviceContext(), MAX_POINTERS, | 
| Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 374 | false /*usingSlotsProtocol*/); | 
|  | 375 | } | 
|  | 376 | } | 
|  | 377 |  | 
|  | 378 | bool MultiTouchInputMapper::hasStylus() const { | 
|  | 379 | return mMultiTouchMotionAccumulator.hasStylus() || mTouchButtonAccumulator.hasStylus(); | 
|  | 380 | } | 
|  | 381 |  | 
|  | 382 | } // namespace android |