From b67f2f199cf6af1ffa234cc26bc691ab1ca2d6ba Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Mon, 21 Nov 2022 22:46:05 +0100 Subject: [PATCH] ndk/input: Allow any non-zero return in `pre_dispatch()` again (#325) Despite the [Android source] never returning anything other than `0` or `1` there appear to be platforms out in the wild that take [the documentation] quite literally and return vague non-zero codes apart `1` with a possible secondary meaning. [Android source]: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/android_view_InputQueue.cpp;drc=b6d7f3b484e4c32c144c66bee342c29e7a8d34cc;l=115 [the documentation]: https://developer.android.com/ndk/reference/group/input#ainputqueue_predispatchevent --- ndk/CHANGELOG.md | 1 + ndk/src/input_queue.rs | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ndk/CHANGELOG.md b/ndk/CHANGELOG.md index 7297184f..8f4d8081 100644 --- a/ndk/CHANGELOG.md +++ b/ndk/CHANGELOG.md @@ -1,6 +1,7 @@ # Unreleased - event: Add `tool_type` getter for `Pointer`. (#323) +- input_queue: Allow any non-zero return code from `pre_dispatch()` again, as per documentation. (#325) # 0.7.0 (2022-07-24) diff --git a/ndk/src/input_queue.rs b/ndk/src/input_queue.rs index ecd8c006..1ca5a0eb 100644 --- a/ndk/src/input_queue.rs +++ b/ndk/src/input_queue.rs @@ -78,8 +78,7 @@ impl InputQueue { match unsafe { ffi::AInputQueue_preDispatchEvent(self.ptr.as_ptr(), event.ptr().as_ptr()) } { 0 => Some(event), - 1 => None, - r => unreachable!("AInputQueue_preDispatchEvent returned non-boolean {}", r), + _ => None, } }