Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9690b615 authored by Mark Fasheh's avatar Mark Fasheh Committed by Android Build Coastguard Worker
Browse files

Fix for b/411488376

Loop back around for another check of the stack if we detect a quitting
condition during nextMessage(). Otherwise we may miss an item added in
between our stack drain and the setting of quitting to true.

Bug: 411488376
Flag: build.RELEASE_PACKAGE_MESSAGEQUEUE_IMPLEMENTATION
Test: atest MessageQueueTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:111148f6c18a9d8b0c281bba2d5a9cf82bdb6dff)
Merged-In: I12bc300db8c3660214769874bde08b08ea1fbc16
Change-Id: I12bc300db8c3660214769874bde08b08ea1fbc16
parent 5d3da032
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -801,10 +801,8 @@ public final class MessageQueue {
            if (found == null) {
                if (getQuitting()) {
                    mNextPollTimeoutMillis = 0;
                    // State change will be Active->Active, so can immediately return here.
                    return null;
                } else if (next == null) {
                    /* No message to deliver, sleep indefinitely, unless quitting */
                    /* No message to deliver, sleep indefinitely */
                    mNextPollTimeoutMillis = -1;
                    nextOp = sStackStateParked;
                    if (DEBUG) {