Merge "Check the isInUse with the lock held in MessageQueue" into rvc-dev

This commit is contained in:
Jing Ji
2020-05-09 04:18:39 +00:00
committed by Android (Google) Code Review

View File

@@ -550,11 +550,12 @@ public final class MessageQueue {
if (msg.target == null) {
throw new IllegalArgumentException("Message must have a target.");
}
if (msg.isInUse()) {
throw new IllegalStateException(msg + " This message is already in use.");
}
synchronized (this) {
if (msg.isInUse()) {
throw new IllegalStateException(msg + " This message is already in use.");
}
if (mQuitting) {
IllegalStateException e = new IllegalStateException(
msg.target + " sending message to a Handler on a dead thread");