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

Commit c8d7a56e authored by Kihong Seong's avatar Kihong Seong Committed by Gerrit Code Review
Browse files

Merge "Fix ScanManager#profileConnectionStateChanged_sendStartConnectionMessage" into main

parents b785a7c5 8647bb0d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ public class ScanManager {
    private static final int SCAN_MODE_MAX_IN_CONCURRENCY = ScanSettings.SCAN_MODE_BALANCED;
    private final SparseBooleanArray mIsUidForegroundMap = new SparseBooleanArray();
    private boolean mScreenOn = false;
    private boolean mIsConnecting;
    @VisibleForTesting boolean mIsConnecting;
    private int mProfilesConnecting, mProfilesConnected, mProfilesDisconnecting;

    @VisibleForTesting
+9 −1
Original line number Diff line number Diff line
@@ -1361,10 +1361,18 @@ public class ScanManagerTest {

    @Test
    public void profileConnectionStateChanged_sendStartConnectionMessage() {
        // Set scan downgrade duration through Mock
        when(mAdapterService.getScanDowngradeDurationMillis())
                .thenReturn((long) DELAY_SCAN_DOWNGRADE_DURATION_MS);
        assertThat(mScanManager.mIsConnecting).isFalse();

        mScanManager.handleBluetoothProfileConnectionStateChanged(
                BluetoothProfile.A2DP,
                BluetoothProfile.STATE_DISCONNECTED,
                BluetoothProfile.STATE_CONNECTING);
        assertThat(mHandler.hasMessages(ScanManager.MSG_START_CONNECTING)).isTrue();

        // Wait for handleConnectingState to happen
        TestUtils.waitForLooperToBeIdle(mHandler.getLooper());
        assertThat(mScanManager.mIsConnecting).isTrue();
    }
}