Wink Saville
6083d81ce4
Allow reliable detection of a message that is in use.
Because the standard Looper.loop code calls Message#recycle it is imperative that Handler#handleMessage code not attempt to resue a message it receives. If allowed to do so it will cause bugs that could be difficult to diagnois. This change adds Message#flags and uses one bit to reliably detect a message is in use and throws an error in MessageQueue#enqueueMessage. This allows early detection of this bug. Note: This is not new functionality, but the current implementation does not detect messages that are in use because it uses Message#when != 0 as the detection mechanism. The problem is that a Message#when value of 0 is valid value used to place a message at the front of the queue and is thus unreliable. Another option is to change the setting of Message#when in Message#enqueueMessage so that it is never 0, although that does change subtly a publicly accessible field. Yet another option would be to use other fields but all candidates have similar problems as when in that they are publicly accessible or even settable such as Message#target. Change-Id: I2df600537700a3fe206678f38bcae7329751c4e5
…
…
…
Description
No description provided
Languages
Java
77.3%
Kotlin
9.2%
PowerBuilder
6.6%
C++
5.5%
AIDL
1%