Skip to content
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 0.7.0] Allow any non-zero return code from AInputQueue_preDispatchEvent() #322

Closed
korejan opened this issue Jul 25, 2022 · 1 comment · Fixed by #325
Closed

[ndk 0.7.0] Allow any non-zero return code from AInputQueue_preDispatchEvent() #322

korejan opened this issue Jul 25, 2022 · 1 comment · Fixed by #325
Labels
difficulty: easy Likely easier than most tasks here type: bug Dang, that shouldn't have happened

Comments

@korejan
Copy link
Contributor

korejan commented Jul 25, 2022

Hello, I believe the behaviour of InputQueue::pre_dispatch in v0.7 is wrong compared to v0.6, the ndk docs for AInputQueue_preDispatchEvent say this about the return value:

...Returns 0 if it was not pre-dispatched, meaning you can process it right now. If non-zero is returned, you must abandon the current event processing and allow the event to appear again in the event queue (if it does not get consumed during pre-dispatching).

Compared to the docs for the return value of AInputQueue_hasEvents (which the current version of InputQueue::has_events handles correctly):

Returns 1 if the queue has events; 0 if it does not have events; and a negative value if there is an error.

On the Quest 2, when the system menu is shown, the return value of AInputQueue_preDispatchEvent is -1 thus invoking the unreachable case. This does not happen with v0.6

@MarijnS95
Copy link
Member

Filling up this incomplete report:

  1. This change was made in ndk/input_queue: Replace InputQueueError with std::io::Error and add missing docs #292;
  2. This behaviour was implied because of the implementation in https://cs.android.com/android/platform/superproject/+/master:frameworks/base/native/android/input.cpp;l=324;drc=3da1d20bcfb103f146ff67910d14b7b40f6f686f?q=AInputQueue_preDispatchEvent (why did "Quest 2" change system code?);
  3. Subsequently ndk/input_queue: Remove Result wrapping from has_events() #294 also assumed that any valid return code is 0 or 1 and nothing else.

@MarijnS95 MarijnS95 changed the title InputQueue::pre_dispatch v0.7 bug [ndk 0.7.0] Allow any non-zero return code from AInputQueue_preDispatchEvent() Aug 2, 2022
@MarijnS95 MarijnS95 added type: bug Dang, that shouldn't have happened difficulty: easy Likely easier than most tasks here labels Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy Likely easier than most tasks here type: bug Dang, that shouldn't have happened
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants