MessageQueue tail tracking - fix wakeup logic

MessageQueue.enqueueMessage() may choose to wake the thread waiting in
MessageQueue.next() if it is waiting on a barrier but an async message
is inserted.  Specifically, we only wake if there are no async messages
in the queue before async message we are inserting.

The tail tracking optimization inadvertantly changed this logic to
'only wake if there are no async messages in the queue at all', which
could theoretically cause a missed wakeup if there is an async message
that comes after the one which we are inserting.

Fix this by reverting the logic in the non-tail insertion case to it's
prior state.

Bug: 326484732
Test: Boot and use phone with messagequeue tail tracking enabled and disabled
Test: atest MessageQueueTest
Change-Id: Id24bc5ddd7941f94dc06c39013d4bc21712d97a9
1 file changed