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

Commit 4185eae6 authored by Hall Liu's avatar Hall Liu
Browse files

Deflake BluetoothRouteManager tests

Properly do the transition into the first state -- inside the handler

Test: run 200 times
Bug: 69482930
Change-Id: I503b79f78c5a033ae593f0bb940df85dd4be0d53
parent 0b672769
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -782,6 +782,7 @@ public class BluetoothRouteManager extends StateMachine {

    @VisibleForTesting
    public void setInitialStateForTesting(String stateName, BluetoothDevice device) {
        sendMessage(RUN_RUNNABLE, (Runnable) () -> {
            switch (stateName) {
                case AUDIO_OFF_STATE_NAME:
                    transitionTo(mAudioOffState);
@@ -795,5 +796,7 @@ public class BluetoothRouteManager extends StateMachine {
                            "setInitialStateForTesting"));
                    break;
            }
            Log.i(LOG_TAG, "transition for testing done: %s", stateName);
        });
    }
}