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

Commit 25b60fd5 authored by Kihong Seong's avatar Kihong Seong Committed by Automerger Merge Worker
Browse files

Merge "Fix...

Merge "Fix ScanManager#profileConnectionStateChanged_sendStartConnectionMessage" into main am: c8d7a56e am: 073e7895 am: 39bba68e am: fa880122

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2752022



Change-Id: I6a22bd520eefe4fdbcda26ece3f712529d2fdded
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f705665b fa880122
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line 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 static final int SCAN_MODE_MAX_IN_CONCURRENCY = ScanSettings.SCAN_MODE_BALANCED;
    private final SparseBooleanArray mIsUidForegroundMap = new SparseBooleanArray();
    private final SparseBooleanArray mIsUidForegroundMap = new SparseBooleanArray();
    private boolean mScreenOn = false;
    private boolean mScreenOn = false;
    private boolean mIsConnecting;
    @VisibleForTesting boolean mIsConnecting;
    private int mProfilesConnecting, mProfilesConnected, mProfilesDisconnecting;
    private int mProfilesConnecting, mProfilesConnected, mProfilesDisconnecting;


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


    @Test
    @Test
    public void profileConnectionStateChanged_sendStartConnectionMessage() {
    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(
        mScanManager.handleBluetoothProfileConnectionStateChanged(
                BluetoothProfile.A2DP,
                BluetoothProfile.A2DP,
                BluetoothProfile.STATE_DISCONNECTED,
                BluetoothProfile.STATE_DISCONNECTED,
                BluetoothProfile.STATE_CONNECTING);
                BluetoothProfile.STATE_CONNECTING);
        assertThat(mHandler.hasMessages(ScanManager.MSG_START_CONNECTING)).isTrue();

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