Check handler before trying to wait for looper
Problem: Tests that tried to put the state machine in a disconnected state would run into a race condition where the the test logic was racing to grab the looper object to wait on it before the class under test cleaned up the handler via the normal state machine quit logic. If the class under test cleaned up quickly, the test would fail with an NPE when it made a getHandler() call. Solution: Null check the handler. If its null, then we've got no waiting to do. We can assert the state after to make sure we're in the state we're supposed to be in. Bug: 386715308 Flag: EXEMPT, test only change Test: atest com.android.bluetooth.mapclient.MapClientStateMachineTest Test: atest com.android.bluetooth.pbapclient.PbapClientServiceTest Change-Id: Iaef6ec1c7eb6f0658c5470e105b9fd18bd4c2009
Loading
Please register or sign in to comment