Skip to content

Commit 89c429f

Browse files
committed
Remove redundant isSplit assignments
Now that touch is always split (except for mouse events), we can also simplify the assignment of isSplit variable and make it const. Eventually, we can consider changing the touchpad code so that we can completely remove the non-split code handling from dispatcher and simplify this even further, because touchpad scroll should always go to the location of the cursor. Bug: 239934827 Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST Flag: EXEMPT refactor Change-Id: Ib753f798fd77d5d74434b9cbb02f17cd07f5906b
1 parent a1635a6 commit 89c429f

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

services/inputflinger/dispatcher/InputDispatcher.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,7 +2412,7 @@ InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, const Motio
24122412
tempTouchState = *oldState;
24132413
}
24142414

2415-
bool isSplit = shouldSplitTouch(entry.source);
2415+
const bool isSplit = shouldSplitTouch(entry.source);
24162416

24172417
const bool isHoverAction = (maskedAction == AMOTION_EVENT_ACTION_HOVER_MOVE ||
24182418
maskedAction == AMOTION_EVENT_ACTION_HOVER_ENTER ||
@@ -2425,11 +2425,6 @@ InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, const Motio
24252425
const bool newGesture = isDown || maskedAction == AMOTION_EVENT_ACTION_SCROLL ||
24262426
maskedAction == AMOTION_EVENT_ACTION_HOVER_ENTER ||
24272427
maskedAction == AMOTION_EVENT_ACTION_HOVER_MOVE;
2428-
const bool isFromMouse = isFromSource(entry.source, AINPUT_SOURCE_MOUSE);
2429-
2430-
if (newGesture) {
2431-
isSplit = false;
2432-
}
24332428

24342429
if (isDown && tempTouchState.hasHoveringPointers(entry.deviceId)) {
24352430
// Compatibility behaviour: ACTION_DOWN causes HOVER_EXIT to get generated.
@@ -2472,8 +2467,6 @@ InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, const Motio
24722467
return injectionError(InputEventInjectionResult::TARGET_MISMATCH);
24732468
}
24742469

2475-
isSplit = !isFromMouse;
2476-
24772470
std::vector<sp<WindowInfoHandle>> newTouchedWindows =
24782471
mWindowInfos.findTouchedSpyWindowsAt(displayId, x, y, isStylus, entry.deviceId,
24792472
mTouchStatesByDisplay);
@@ -2647,7 +2640,6 @@ InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, const Motio
26472640
targets);
26482641

26492642
// Make a slippery entrance into the new window.
2650-
isSplit = !isFromMouse;
26512643

26522644
ftl::Flags<InputTarget::Flags> targetFlags;
26532645
if (canReceiveForegroundTouches(*newTouchedWindowHandle->getInfo())) {

0 commit comments

Comments
 (0)