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

Commit 4dc246a4 authored by William Escande's avatar William Escande
Browse files

A2dpServiceTest: Sync test teardown on main looper

Bug: 321252288
Bug: 321202011
Test: atest A2dpServiceTest
Flag: Exempt, test only (+ 1 typo :) )
Change-Id: Ia5b28f8a91344a4795725ca83098249bd02d72f5
parent 99d1760e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -728,7 +728,7 @@ final class A2dpStateMachine extends StateMachine {
        mA2dpService.codecConfigUpdated(mDevice, mCodecStatus, sameAudioFeedingParameters);
    }

    // This method does not check for error conditon (newState == prevState)
    // This method does not check for error condition (newState == prevState)
    private void broadcastConnectionState(int newState, int prevState) {
        log("Connection state " + mDevice + ": " + profileStateToString(prevState)
                    + "->" + profileStateToString(newState));
+6 −2
Original line number Diff line number Diff line
@@ -122,8 +122,12 @@ public class A2dpServiceTest {
    }

    @After
    public void tearDown() throws Exception {
        mA2dpService.stop();
    public void tearDown() {
        // A2dpService handler is running on main looper. Calling `stop` remove the messages but
        // assume it is already on the correct thread.
        // Calling it from another thread may lead to having messages still being processed and
        // executed after tearDown is called.
        InstrumentationRegistry.getInstrumentation().runOnMainSync(mA2dpService::stop);
    }

    @SafeVarargs