-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ndk/input_queue: Replace InputQueueError
with std::io::Error
and add missing docs
#292
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MarijnS95
added
blocking a release
Prevents a new release
difficulty: easy
Likely easier than most tasks here
status: needs review
A maintainer must review this code
labels
Jun 11, 2022
MarijnS95
force-pushed
the
ndk-input-queue-error-and-docs
branch
from
June 11, 2022 11:05
6f9a5f0
to
145c328
Compare
MarijnS95
commented
Jun 11, 2022
20 tasks
MarijnS95
force-pushed
the
ndk-input-queue-error-and-docs
branch
4 times, most recently
from
June 11, 2022 21:53
f2d3d6b
to
36b2ccf
Compare
…add missing docs These `AInputQueue` functions all return [standard `errno.h` error codes] which can and should be communicated back to the user instead of appearing as some opaque magic struct. In addition import the NDK documentation for all these functions and make the scope of `unsafe` blocks smaller. [standard `errno.h` error codes]: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/android_view_InputQueue.cpp;l=112;drc=7b3193e1e86ab5c0fcb784cb8616864045dd2515
MarijnS95
force-pushed
the
ndk-input-queue-error-and-docs
branch
from
June 11, 2022 21:54
36b2ccf
to
e765038
Compare
msiglreith
approved these changes
Jun 11, 2022
MarijnS95
added a commit
that referenced
this pull request
Jun 12, 2022
After having blindly retained error handling in [#292], it turns out the underlying [`InputQueue::hasEvents()` implementation] doesn't ever return an error nor does the documentation state that this is possible. As such, mimic what we're already doing in `fn pre_dispatch()` and panic if the value doesn't represent a `bool`. [`InputQueue::hasEvents()` implementation]: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/android_view_InputQueue.cpp;l=88-91;drc=5497dd365e9135805636a40267cb98e2e2b78ee6
MarijnS95
added a commit
that referenced
this pull request
Jun 12, 2022
After having blindly retained error handling in [#292], it turns out the underlying [`InputQueue::hasEvents()` implementation] doesn't ever return an error nor does the documentation state that this is possible. As such, mimic what we're already doing in `fn pre_dispatch()` and panic if the value doesn't represent a `bool`. [`InputQueue::hasEvents()` implementation]: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/android_view_InputQueue.cpp;l=88-91;drc=5497dd365e9135805636a40267cb98e2e2b78ee6
MarijnS95
added a commit
that referenced
this pull request
Jun 12, 2022
…helper conversion function These `AHardwareBuffer` functions all return [standard `errno.h` error codes] which can be communicated back to the user in ergonomic form instead of appearing as a newtyped struct holding a "meaningless" `i32`. Perform the same conversion to just `NativeWindow::set_buffers_geometry` which also returns `errno.h` codes: this change is small enough to not warrant _yet another_ PR, as we've already changed the exact same for `InputQueueError` in [#292]. (Note that this is intentionally omitted from the changelog since `set_buffers_geometry()` is only making its debut in the upcoming release, this change isn't breaking). This pattern is now prevalent across the codebase (`hardware_buffer`, `surface_texture`, and `native_window` all use it), warranting the new `status_to_io_result()` helper function to be introduced in an also-new `utils.rs` module. [standard `errno.h` error codes]: https://cs.android.com/android/platform/superproject/+/master:frameworks/native/libs/nativewindow/AHardwareBuffer.cpp;drc=4120991d92a0265ce480672f704612556328057e [#292]: #292
MarijnS95
added a commit
that referenced
this pull request
Jul 5, 2022
After having blindly retained error handling in [#292], it turns out the underlying [`InputQueue::hasEvents()` implementation] doesn't ever return an error nor does the documentation state that this is possible. As such, mimic what we're already doing in `fn pre_dispatch()` and panic if the value doesn't represent a `bool`. [`InputQueue::hasEvents()` implementation]: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/android_view_InputQueue.cpp;l=88-91;drc=5497dd365e9135805636a40267cb98e2e2b78ee6 [#292]: #292
MarijnS95
added a commit
that referenced
this pull request
Jul 5, 2022
After having blindly retained error handling in [#292], it turns out the underlying [`InputQueue::hasEvents()` implementation] doesn't ever return an error nor does the documentation state that this is possible. As such, mimic what we're already doing in `fn pre_dispatch()` and panic if the value doesn't represent a `bool`. [`InputQueue::hasEvents()` implementation]: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/android_view_InputQueue.cpp;l=88-91;drc=5497dd365e9135805636a40267cb98e2e2b78ee6 [#292]: #292
MarijnS95
added a commit
that referenced
this pull request
Jul 5, 2022
…helper conversion function These `AHardwareBuffer` functions all return [standard `errno.h` error codes] which can be communicated back to the user in ergonomic form instead of appearing as a newtyped struct holding a "meaningless" `i32`. Perform the same conversion to just `NativeWindow::set_buffers_geometry` which also returns `errno.h` codes: this change is small enough to not warrant _yet another_ PR, as we've already changed the exact same for `InputQueueError` in [#292]. (Note that this is intentionally omitted from the changelog since `set_buffers_geometry()` is only making its debut in the upcoming release, this change isn't breaking). This pattern is now prevalent across the codebase (`hardware_buffer`, `surface_texture`, and `native_window` all use it), warranting the new `status_to_io_result()` helper function to be introduced in an also-new `utils.rs` module. [standard `errno.h` error codes]: https://cs.android.com/android/platform/superproject/+/master:frameworks/native/libs/nativewindow/AHardwareBuffer.cpp;drc=4120991d92a0265ce480672f704612556328057e [#292]: #292
MarijnS95
added a commit
that referenced
this pull request
Jul 5, 2022
…helper conversion function (#295) These `AHardwareBuffer` functions all return [standard `errno.h` error codes] which can be communicated back to the user in ergonomic form instead of appearing as a newtyped struct holding a "meaningless" `i32`. Perform the same conversion to just `NativeWindow::set_buffers_geometry` which also returns `errno.h` codes: this change is small enough to not warrant _yet another_ PR, as we've already changed the exact same for `InputQueueError` in [#292]. (Note that this is intentionally omitted from the changelog since `set_buffers_geometry()` is only making its debut in the upcoming release, this change isn't breaking). This pattern is now prevalent across the codebase (`hardware_buffer`, `surface_texture`, and `native_window` all use it), warranting the new `status_to_io_result()` helper function to be introduced in an also-new `utils.rs` module. [standard `errno.h` error codes]: https://cs.android.com/android/platform/superproject/+/master:frameworks/native/libs/nativewindow/AHardwareBuffer.cpp;drc=4120991d92a0265ce480672f704612556328057e [#292]: #292
rib
pushed a commit
to rust-mobile/ndk-glue
that referenced
this pull request
Dec 6, 2022
After having blindly retained error handling in [#292], it turns out the underlying [`InputQueue::hasEvents()` implementation] doesn't ever return an error nor does the documentation state that this is possible. As such, mimic what we're already doing in `fn pre_dispatch()` and panic if the value doesn't represent a `bool`. [`InputQueue::hasEvents()` implementation]: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/android_view_InputQueue.cpp;l=88-91;drc=5497dd365e9135805636a40267cb98e2e2b78ee6 [#292]: rust-mobile/ndk#292
rib
pushed a commit
to rust-mobile/ndk-context
that referenced
this pull request
Dec 7, 2022
After having blindly retained error handling in [#292], it turns out the underlying [`InputQueue::hasEvents()` implementation] doesn't ever return an error nor does the documentation state that this is possible. As such, mimic what we're already doing in `fn pre_dispatch()` and panic if the value doesn't represent a `bool`. [`InputQueue::hasEvents()` implementation]: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/android_view_InputQueue.cpp;l=88-91;drc=5497dd365e9135805636a40267cb98e2e2b78ee6 [#292]: rust-mobile/ndk#292
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
blocking a release
Prevents a new release
difficulty: easy
Likely easier than most tasks here
status: needs review
A maintainer must review this code
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These
AInputQueue
functions all return standarderrno.h
error codes which can and should be communicated back to the user instead of appearing as some opaque magic struct.In addition import the NDK documentation for all these functions and make the scope of
unsafe
blocks smaller.