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

Commit 1e37d1e8 authored by Priyanka Advani (xWF)'s avatar Priyanka Advani (xWF) Committed by Android (Google) Code Review
Browse files

Revert "InputVerifier: verify button events and states"

This reverts commit fb477b13.

Reason for revert: Droidmonitor created revert due to b/392150793. Will be verifying through ABTD before submission.

Change-Id: Ie2c9d9e4271addf5b198e34875ee02082b0132ba
parent fb477b13
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -849,7 +849,6 @@ enum {
 * Refer to the documentation on the MotionEvent class for descriptions of each button.
 * Refer to the documentation on the MotionEvent class for descriptions of each button.
 */
 */
enum {
enum {
    // LINT.IfChange(AMOTION_EVENT_BUTTON)
    /** primary */
    /** primary */
    AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0,
    AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0,
    /** secondary */
    /** secondary */
@@ -862,7 +861,6 @@ enum {
    AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
    AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
    AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 1 << 5,
    AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 1 << 5,
    AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 1 << 6,
    AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 1 << 6,
    // LINT.ThenChange(/frameworks/native/libs/input/rust/input.rs)
};
};


/**
/**
+2 −3
Original line number Original line Diff line number Diff line
@@ -47,10 +47,9 @@ public:
    InputVerifier(const std::string& name);
    InputVerifier(const std::string& name);


    android::base::Result<void> processMovement(int32_t deviceId, int32_t source, int32_t action,
    android::base::Result<void> processMovement(int32_t deviceId, int32_t source, int32_t action,
                                                int32_t actionButton, uint32_t pointerCount,
                                                uint32_t pointerCount,
                                                const PointerProperties* pointerProperties,
                                                const PointerProperties* pointerProperties,
                                                const PointerCoords* pointerCoords, int32_t flags,
                                                const PointerCoords* pointerCoords, int32_t flags);
                                                int32_t buttonState);


    void resetDevice(int32_t deviceId);
    void resetDevice(int32_t deviceId);


+0 −7
Original line number Original line Diff line number Diff line
@@ -91,13 +91,6 @@ rust_bindgen {
        "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
        "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
        "--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
        "--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
        "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
        "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
        "--allowlist-var=AMOTION_EVENT_BUTTON_PRIMARY",
        "--allowlist-var=AMOTION_EVENT_BUTTON_SECONDARY",
        "--allowlist-var=AMOTION_EVENT_BUTTON_TERTIARY",
        "--allowlist-var=AMOTION_EVENT_BUTTON_BACK",
        "--allowlist-var=AMOTION_EVENT_BUTTON_FORWARD",
        "--allowlist-var=AMOTION_EVENT_BUTTON_STYLUS_PRIMARY",
        "--allowlist-var=AMOTION_EVENT_BUTTON_STYLUS_SECONDARY",
        "--allowlist-var=MAX_POINTER_ID",
        "--allowlist-var=MAX_POINTER_ID",
        "--allowlist-var=AINPUT_SOURCE_CLASS_NONE",
        "--allowlist-var=AINPUT_SOURCE_CLASS_NONE",
        "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON",
        "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON",
+3 −3
Original line number Original line Diff line number Diff line
@@ -651,9 +651,9 @@ status_t InputPublisher::publishMotionEvent(
    const status_t status = mChannel->sendMessage(&msg);
    const status_t status = mChannel->sendMessage(&msg);


    if (status == OK && verifyEvents()) {
    if (status == OK && verifyEvents()) {
        Result<void> result = mInputVerifier.processMovement(deviceId, source, action, actionButton,
        Result<void> result =
                                                             pointerCount, pointerProperties,
                mInputVerifier.processMovement(deviceId, source, action, pointerCount,
                                                             pointerCoords, flags, buttonState);
                                               pointerProperties, pointerCoords, flags);
        if (!result.ok()) {
        if (!result.ok()) {
            LOG(ERROR) << "Bad stream: " << result.error();
            LOG(ERROR) << "Bad stream: " << result.error();
            return BAD_VALUE;
            return BAD_VALUE;
+3 −6
Original line number Original line Diff line number Diff line
@@ -34,10 +34,9 @@ InputVerifier::InputVerifier(const std::string& name)
      : mVerifier(android::input::verifier::create(rust::String::lossy(name))){};
      : mVerifier(android::input::verifier::create(rust::String::lossy(name))){};


Result<void> InputVerifier::processMovement(DeviceId deviceId, int32_t source, int32_t action,
Result<void> InputVerifier::processMovement(DeviceId deviceId, int32_t source, int32_t action,
                                            int32_t actionButton, uint32_t pointerCount,
                                            uint32_t pointerCount,
                                            const PointerProperties* pointerProperties,
                                            const PointerProperties* pointerProperties,
                                            const PointerCoords* pointerCoords, int32_t flags,
                                            const PointerCoords* pointerCoords, int32_t flags) {
                                            int32_t buttonState) {
    std::vector<RustPointerProperties> rpp;
    std::vector<RustPointerProperties> rpp;
    for (size_t i = 0; i < pointerCount; i++) {
    for (size_t i = 0; i < pointerCount; i++) {
        rpp.emplace_back(RustPointerProperties{.id = pointerProperties[i].id});
        rpp.emplace_back(RustPointerProperties{.id = pointerProperties[i].id});
@@ -45,9 +44,7 @@ Result<void> InputVerifier::processMovement(DeviceId deviceId, int32_t source, i
    rust::Slice<const RustPointerProperties> properties{rpp.data(), rpp.size()};
    rust::Slice<const RustPointerProperties> properties{rpp.data(), rpp.size()};
    rust::String errorMessage =
    rust::String errorMessage =
            android::input::verifier::process_movement(*mVerifier, deviceId, source, action,
            android::input::verifier::process_movement(*mVerifier, deviceId, source, action,
                                                       actionButton, properties,
                                                       properties, static_cast<uint32_t>(flags));
                                                       static_cast<uint32_t>(flags),
                                                       static_cast<uint32_t>(buttonState));
    if (errorMessage.empty()) {
    if (errorMessage.empty()) {
        return {};
        return {};
    } else {
    } else {
Loading