Merge "Check the isInUse with the lock held in MessageQueue" into rvc-dev am: 04dc962d1d

Change-Id: I132892b0e8cedc7d42f485d3c9a4c6bca0dd2449
This commit is contained in:
Jing Ji
2020-05-12 19:26:18 +00:00
committed by Automerger Merge Worker

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");