looper: Provide event
value to file descriptor poll callback
#435
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.
When
looper
calls a callback that triggered for a poll on a file descriptor it provides the reason for the wakeup, because users are allowed to register multiple. Hence it is important for the user to know the trigger reason to enact on the result appropriately. E.g. aHANGUP
typically requires the callback to be deregistered by returningfalse
, as the other end (for apipe()
orsocket()
) has been closed and this file descriptor should no longer trigger any other event.Note that various events are received by this callback regardless of whether the user registered it with that flag in
events
. This is all reflected by updating the documentation comments forFdEvent
based on upstream Android documentation.Keep in mind that
FdEvent
is abitflag
, and Android uses that to batch up multiple events. E.g. writing to apipe()
and closing the writefd
- while the readfd
is registered in a callback - causes the callback (from a subsequentlooper.poll*()
) to be called withINPUT | HANGUP
, indicating that there is data to read but that the file descriptor will be dormant after that.