Add WaitState class for new MessageQueue

This encapsulates our logic for manipulating an atomic bitfield.

WaitState can be a counter or a deadline.

When it's a counter, the bit WAIT_STATE_IS_COUNTER is set and
the lower 63 bits are used as a long.

When WaitState is a deadline, we reserve bit 62 to indicate a
sync barrier. The middle 42 bits are used for the millisecond
resolution timestamp and the remaining 20 bits are used as a
counter.

Test: atest android.os.WaitStateTest
Bug: 421623328
Flag: EXEMPT new data structure isn't used yet; usages will be flagged.
Change-Id: I9f1a49378ce4c2cfda0f50d4febc57b050e55aef
4 files changed