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

Commit 13ccabe1 authored by Linnan Li's avatar Linnan Li Committed by Siarhei Vishniakou
Browse files

Adding details after a flag is not found in MotionFlags



Because from_bits will return a None if we encounter a flag that we
can't find, and if we call unwrap directly we will have a crash, but the
crash message here will confuse us, so here we add some detailed
information to help us locate the problem later.

Bug: none
Test: Build

Signed-off-by: default avatarLinnan Li <lilinnan@xiaomi.corp-partner.google.com>
(cherry picked from https://partner-android-review.googlesource.com/q/commit:2d17392f625885a7a4e49bad59f5793223c73dda)
Merged-In: If3970964ef696e22dc651579a4c297f431b3e0ca
Change-Id: If3970964ef696e22dc651579a4c297f431b3e0ca
parent f55e4459
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -79,12 +79,20 @@ fn process_movement(
    pointer_properties: &[RustPointerProperties],
    pointer_properties: &[RustPointerProperties],
    flags: u32,
    flags: u32,
) -> String {
) -> String {
    let motion_flags = MotionFlags::from_bits(flags);
    if motion_flags.is_none() {
        panic!(
            "The conversion of flags 0x{:08x} failed, please check if some flags have not been \
            added to MotionFlags.",
            flags
        );
    }
    let result = verifier.process_movement(
    let result = verifier.process_movement(
        DeviceId(device_id),
        DeviceId(device_id),
        Source::from_bits(source).unwrap(),
        Source::from_bits(source).unwrap(),
        action,
        action,
        pointer_properties,
        pointer_properties,
        MotionFlags::from_bits(flags).unwrap(),
        motion_flags.unwrap(),
    );
    );
    match result {
    match result {
        Ok(()) => "".to_string(),
        Ok(()) => "".to_string(),