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

Commit 227a7f8f authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Add flags to input_verifier

These flags are currently not known by the verifier. As a result, this
causes a panic when such events are trying to get converted to the rust
object.

Add the missing flags in this CL.

Bug: 271455682
Test: manually enable event verification
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: I351b87c339c7efe8e6f3b14ad05e89d8a9e8c9e2
parent 25537f85
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -65,6 +65,10 @@ rust_bindgen {
    bindgen_flags: [
        "--verbose",
        "--allowlist-var=AMOTION_EVENT_FLAG_CANCELED",
        "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED",
        "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED",
        "--allowlist-var=AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT",
        "--allowlist-var=AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE",
        "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL",
        "--allowlist-var=AMOTION_EVENT_ACTION_UP",
        "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ Result<void> InputVerifier::processMovement(DeviceId deviceId, int32_t action,
    rust::Slice<const RustPointerProperties> properties{rpp.data(), rpp.size()};
    rust::String errorMessage =
            android::input::verifier::process_movement(*mVerifier, deviceId, action, properties,
                                                       flags);
                                                       static_cast<uint32_t>(flags));
    if (errorMessage.empty()) {
        return {};
    } else {
+12 −2
Original line number Diff line number Diff line
@@ -119,8 +119,18 @@ impl MotionAction {

bitflags! {
    /// MotionEvent flags.
    pub struct MotionFlags: i32 {
    pub struct MotionFlags: u32 {
        /// FLAG_CANCELED
        const CANCELED = input_bindgen::AMOTION_EVENT_FLAG_CANCELED;
        const CANCELED = input_bindgen::AMOTION_EVENT_FLAG_CANCELED as u32;
        /// FLAG_WINDOW_IS_OBSCURED
        const WINDOW_IS_OBSCURED = input_bindgen::AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED;
        /// FLAG_WINDOW_IS_PARTIALLY_OBSCURED
        const WINDOW_IS_PARTIALLY_OBSCURED =
                input_bindgen::AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED;
        /// FLAG_IS_ACCESSIBILITY_EVENT
        const IS_ACCESSIBILITY_EVENT =
                input_bindgen::AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT;
        /// FLAG_NO_FOCUS_CHANGE
        const NO_FOCUS_CHANGE = input_bindgen::AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE;
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ mod ffi {
            device_id: i32,
            action: u32,
            pointer_properties: &[RustPointerProperties],
            flags: i32,
            flags: u32,
        ) -> String;
        fn reset_device(verifier: &mut InputVerifier, device_id: i32);
    }
@@ -74,7 +74,7 @@ fn process_movement(
    device_id: i32,
    action: u32,
    pointer_properties: &[RustPointerProperties],
    flags: i32,
    flags: u32,
) -> String {
    let result = verifier.process_movement(
        DeviceId(device_id),