Fix noisy test.

testReadProjectionState_listener fails occasionally because callbacks from UiModeManagerService, while dispatched inline, may not arrive before asserts are made. We fix this by waiting for the callback to be called in cases where we expect it, and waiting 2 seconds in cases where we expect it not to be called.

Also modify setup method to release automotive projection so that if a test fails before releasing it, other tests will not fail and confuse the situation.

Bug: 174515840
Test: this is a test :)
Change-Id: Ia898b947ee3d15aeb88b95ae5e54754c604b80fc
1 file changed