summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Harry Cutts <hcutts@google.com> 2025-02-21 03:04:40 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-02-21 03:04:40 -0800
commit9fd5fdd4d9765eef965361d7abca423222d9c93b (patch)
tree9eb15b3074728911d8636bef8fa5ee114cf6db7e
parentd70cc2a19de1afd72bfaeb47dbaaa8fab4204d1b (diff)
parentfa83e33649a0906cd8fd27c12305ada1197cfb81 (diff)
Merge "InputVerifier: add panic message for source conversion" into main
-rw-r--r--libs/input/rust/lib.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/input/rust/lib.rs b/libs/input/rust/lib.rs
index 7638559553..ee999f7666 100644
--- a/libs/input/rust/lib.rs
+++ b/libs/input/rust/lib.rs
@@ -133,6 +133,12 @@ fn process_movement(
flags: u32,
button_state: u32,
) -> String {
+ let Some(converted_source) = Source::from_bits(source) else {
+ panic!(
+ "The conversion of source 0x{source:08x} failed, please check if some sources have not \
+ been added to Source."
+ );
+ };
let Some(motion_flags) = MotionFlags::from_bits(flags) else {
panic!(
"The conversion of flags 0x{:08x} failed, please check if some flags have not been \
@@ -167,7 +173,7 @@ fn process_movement(
}
let result = verifier.process_movement(NotifyMotionArgs {
device_id: DeviceId(device_id),
- source: Source::from_bits(source).unwrap(),
+ source: converted_source,
action: motion_action,
pointer_properties,
flags: motion_flags,