Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42b1b6ce authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Cleanup touchpad_typing_palm_rejection flag" into main

parents cecfd023 7dab98ea
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -60,13 +60,6 @@ flag {
  bug: "299977100"
}

flag {
  name: "enable_touchpad_typing_palm_rejection"
  namespace: "input"
  description: "Enabling additional touchpad palm rejection will disable the tap to click while the user is typing on a physical keyboard"
  bug: "301055381"
}

flag {
  name: "enable_v2_touchpad_typing_palm_rejection"
  namespace: "input"
+2 −6
Original line number Diff line number Diff line
@@ -39,9 +39,6 @@ namespace android {

namespace {

// This will disable the tap to click while the user is typing on a physical keyboard
const bool ENABLE_TOUCHPAD_PALM_REJECTION = input_flags::enable_touchpad_typing_palm_rejection();

// In addition to v1, v2 will also cancel ongoing move gestures while typing and add delay in
// re-enabling the tap to click.
const bool ENABLE_TOUCHPAD_PALM_REJECTION_V2 =
@@ -226,8 +223,7 @@ std::list<NotifyArgs> GestureConverter::handleMove(nsecs_t when, nsecs_t readTim
    if (!mIsHoverCancelled) {
        // handleFling calls hoverMove with zero delta on FLING_TAP_DOWN. Don't enable tap to click
        // for this case as subsequent handleButtonsChange may choose to ignore this tap.
        if ((ENABLE_TOUCHPAD_PALM_REJECTION || ENABLE_TOUCHPAD_PALM_REJECTION_V2) &&
            (std::abs(deltaX) > 0 || std::abs(deltaY) > 0)) {
        if (std::abs(deltaX) > 0 || std::abs(deltaY) > 0) {
            enableTapToClick(when);
        }
    }
@@ -278,7 +274,7 @@ std::list<NotifyArgs> GestureConverter::handleButtonsChange(nsecs_t when, nsecs_
            // return early to prevent this tap
            return out;
        }
    } else if (ENABLE_TOUCHPAD_PALM_REJECTION && mReaderContext.isPreventingTouchpadTaps()) {
    } else if (mReaderContext.isPreventingTouchpadTaps()) {
        enableTapToClick(when);
        if (gesture.details.buttons.is_tap) {
            // return early to prevent this tap
+2 −7
Original line number Diff line number Diff line
@@ -42,8 +42,6 @@ namespace input_flags = com::android::input::flags;

namespace {

const auto TOUCHPAD_PALM_REJECTION =
        ACONFIG_FLAG(input_flags, enable_touchpad_typing_palm_rejection);
const auto TOUCHPAD_PALM_REJECTION_V2 =
        ACONFIG_FLAG(input_flags, enable_v2_touchpad_typing_palm_rejection);

@@ -1461,7 +1459,6 @@ TEST_F(GestureConverterTest, Click) {
}

TEST_F_WITH_FLAGS(GestureConverterTest, TapWithTapToClickDisabled,
                  REQUIRES_FLAGS_ENABLED(TOUCHPAD_PALM_REJECTION),
                  REQUIRES_FLAGS_DISABLED(TOUCHPAD_PALM_REJECTION_V2)) {
    nsecs_t currentTime = ARBITRARY_GESTURE_TIME;

@@ -1574,8 +1571,7 @@ TEST_F_WITH_FLAGS(GestureConverterTest, TapWithTapToClickDisabledWithDelay,
    ASSERT_THAT(args, Each(VariantWith<NotifyMotionArgs>(WithRelativeMotion(0.f, 0.f))));
}

TEST_F_WITH_FLAGS(GestureConverterTest, ClickWithTapToClickDisabled,
                  REQUIRES_FLAGS_ENABLED(TOUCHPAD_PALM_REJECTION)) {
TEST_F(GestureConverterTest, ClickWithTapToClickDisabled) {
    // Click should still produce button press/release events
    mReader->getContext()->setPreventingTouchpadTaps(true);

@@ -1644,8 +1640,7 @@ TEST_F_WITH_FLAGS(GestureConverterTest, ClickWithTapToClickDisabled,
    ASSERT_FALSE(mReader->getContext()->isPreventingTouchpadTaps());
}

TEST_F_WITH_FLAGS(GestureConverterTest, MoveEnablesTapToClick,
                  REQUIRES_FLAGS_ENABLED(TOUCHPAD_PALM_REJECTION)) {
TEST_F(GestureConverterTest, MoveEnablesTapToClick) {
    // initially disable tap-to-click
    mReader->getContext()->setPreventingTouchpadTaps(true);