ndk icon indicating copy to clipboard operation
ndk copied to clipboard

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

Open korejan opened this issue 3 years ago • 1 comments

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

korejan avatar Jul 25 '22 22:07 korejan

Filling up this incomplete report:

  1. This change was made in #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 #294 also assumed that any valid return code is 0 or 1 and nothing else.

MarijnS95 avatar Aug 02 '22 08:08 MarijnS95