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

Commit 2756839a authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Remove PreferStylusOverTouchBlocker

To prevent crash on emulator, let's disable
PreferStylusOverTouchBlocker. A proper solution might require a re-work
of how it operates.

Test: atest inputflinger_tests
Bug: 222531989
Change-Id: I5481e6baf284be8f254b6caec45be0478f1fe4a7
parent 4771e01d
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -368,14 +368,6 @@ void UnwantedInteractionBlocker::notifyKey(const NotifyKeyArgs* args) {
}

void UnwantedInteractionBlocker::notifyMotion(const NotifyMotionArgs* args) {
    ftl::StaticVector<NotifyMotionArgs, 2> processedArgs =
            mPreferStylusOverTouchBlocker.processMotion(*args);
    for (const NotifyMotionArgs& loopArgs : processedArgs) {
        notifyMotionInner(&loopArgs);
    }
}

void UnwantedInteractionBlocker::notifyMotionInner(const NotifyMotionArgs* args) {
    auto it = mPalmRejectors.find(args->deviceId);
    const bool sendToPalmRejector = it != mPalmRejectors.end() && isFromTouchscreen(args->source);
    if (!sendToPalmRejector) {
@@ -449,8 +441,6 @@ void UnwantedInteractionBlocker::notifyInputDevicesChanged(

void UnwantedInteractionBlocker::dump(std::string& dump) {
    dump += "UnwantedInteractionBlocker:\n";
    dump += "  mPreferStylusOverTouchBlocker:\n";
    dump += addPrefix(mPreferStylusOverTouchBlocker.dump(), "    ");
    dump += StringPrintf("  mEnablePalmRejection: %s\n", toString(mEnablePalmRejection));
    dump += StringPrintf("  isPalmRejectionEnabled (flag value): %s\n",
                         toString(isPalmRejectionEnabled()));
+0 −6
Original line number Diff line number Diff line
@@ -23,8 +23,6 @@
#include "ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_util.h"
#include "ui/events/ozone/evdev/touch_filter/palm_detection_filter.h"

#include "PreferStylusOverTouchBlocker.h"

namespace android {

// --- Functions for manipulation of event streams
@@ -90,13 +88,9 @@ private:
    InputListenerInterface& mListener;
    const bool mEnablePalmRejection;

    // When stylus is down, ignore touch
    PreferStylusOverTouchBlocker mPreferStylusOverTouchBlocker;
    // Detect and reject unwanted palms on screen
    // Use a separate palm rejector for every touch device.
    std::map<int32_t /*deviceId*/, PalmRejector> mPalmRejectors;
    // TODO(b/210159205): delete this when simultaneous stylus and touch is supported
    void notifyMotionInner(const NotifyMotionArgs* args);
};

class SlotState {
+8 −0
Original line number Diff line number Diff line
@@ -490,6 +490,14 @@ TEST_F(UnwantedInteractionBlockerTest, NoCrashWhenResetHappens) {
            &(args = generateMotionArgs(0 /*downTime*/, 4 /*eventTime*/, DOWN, {{7, 8, 9}})));
}

TEST_F(UnwantedInteractionBlockerTest, NoCrashWhenStylusSourceWithFingerToolIsReceived) {
    mBlocker->notifyInputDevicesChanged({generateTestDeviceInfo()});
    NotifyMotionArgs args = generateMotionArgs(0 /*downTime*/, 1 /*eventTime*/, DOWN, {{1, 2, 3}});
    args.pointerProperties[0].toolType = AMOTION_EVENT_TOOL_TYPE_FINGER;
    args.source = AINPUT_SOURCE_STYLUS;
    mBlocker->notifyMotion(&args);
}

/**
 * If input devices have changed, but the important device info that's used by the
 * UnwantedInteractionBlocker has not changed, there should not be a reset.