Loading android/app/src/com/android/bluetooth/bass_client/BassClientService.java +12 −2 Original line number Diff line number Diff line Loading @@ -2053,9 +2053,19 @@ public class BassClientService extends ProfileService { for (int syncedBroadcast : syncedBroadcasts) { addSelectSourceRequest(syncedBroadcast, true); } } // when starting scan, clear the previously cached broadcast scan results mCachedBroadcasts .keySet() .removeIf( key -> !mPausedBroadcastIds.containsKey(key) || !mPausedBroadcastIds .get(key) .equals(PauseType.SINK_UNINTENTIONAL)); } else { // when starting scan, clear the previously cached broadcast scan results mCachedBroadcasts.clear(); } // clear previous sources notify flag before scanning new result // this is to make sure the active sources are notified even if already synced if (mPeriodicAdvertisementResultMap != null) { Loading android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java +38 −0 Original line number Diff line number Diff line Loading @@ -6759,6 +6759,44 @@ public class BassClientServiceTest { checkNoTimeout(TEST_BROADCAST_ID, BassClientService.MESSAGE_BROADCAST_MONITOR_TIMEOUT); } @Test @EnableFlags({ Flags.FLAG_LEAUDIO_BROADCAST_RESYNC_HELPER, Flags.FLAG_LEAUDIO_BROADCAST_EXTRACT_PERIODIC_SCANNER_FROM_STATE_MACHINE }) public void outOfRange_syncEstablishedFailed_restartSearching() { prepareSynchronizedPairAndStopSearching(); // Bis and PA unsynced, SINK_UNINTENTIONAL BluetoothLeBroadcastMetadata meta = createBroadcastMetadata(TEST_BROADCAST_ID); injectRemoteSourceStateChanged(meta, false, false); mInOrderMethodProxy .verify(mMethodProxy) .periodicAdvertisingManagerRegisterSync( any(), any(), anyInt(), anyInt(), any(), any()); checkTimeout(TEST_BROADCAST_ID, BassClientService.MESSAGE_BIG_MONITOR_TIMEOUT); checkNoTimeout(TEST_BROADCAST_ID, BassClientService.MESSAGE_BROADCAST_MONITOR_TIMEOUT); onSyncEstablishedFailed(mSourceDevice, TEST_SYNC_HANDLE); checkTimeout(TEST_BROADCAST_ID, BassClientService.MESSAGE_BROADCAST_MONITOR_TIMEOUT); mInOrderMethodProxy .verify(mMethodProxy) .periodicAdvertisingManagerRegisterSync( any(), any(), anyInt(), anyInt(), any(), any()); // Start searching again should not removed cache for SINK_UNINTENTIONAL // which allow to register sync again after onSyncEstablishedFailed startSearchingForSources(); checkTimeout(TEST_BROADCAST_ID, BassClientService.MESSAGE_BIG_MONITOR_TIMEOUT); onSyncEstablishedFailed(mSourceDevice, TEST_SYNC_HANDLE); mInOrderMethodProxy .verify(mMethodProxy) .periodicAdvertisingManagerRegisterSync( any(), any(), anyInt(), anyInt(), any(), any()); } @Test @EnableFlags({ Flags.FLAG_LEAUDIO_BROADCAST_RESYNC_HELPER, Loading Loading
android/app/src/com/android/bluetooth/bass_client/BassClientService.java +12 −2 Original line number Diff line number Diff line Loading @@ -2053,9 +2053,19 @@ public class BassClientService extends ProfileService { for (int syncedBroadcast : syncedBroadcasts) { addSelectSourceRequest(syncedBroadcast, true); } } // when starting scan, clear the previously cached broadcast scan results mCachedBroadcasts .keySet() .removeIf( key -> !mPausedBroadcastIds.containsKey(key) || !mPausedBroadcastIds .get(key) .equals(PauseType.SINK_UNINTENTIONAL)); } else { // when starting scan, clear the previously cached broadcast scan results mCachedBroadcasts.clear(); } // clear previous sources notify flag before scanning new result // this is to make sure the active sources are notified even if already synced if (mPeriodicAdvertisementResultMap != null) { Loading
android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java +38 −0 Original line number Diff line number Diff line Loading @@ -6759,6 +6759,44 @@ public class BassClientServiceTest { checkNoTimeout(TEST_BROADCAST_ID, BassClientService.MESSAGE_BROADCAST_MONITOR_TIMEOUT); } @Test @EnableFlags({ Flags.FLAG_LEAUDIO_BROADCAST_RESYNC_HELPER, Flags.FLAG_LEAUDIO_BROADCAST_EXTRACT_PERIODIC_SCANNER_FROM_STATE_MACHINE }) public void outOfRange_syncEstablishedFailed_restartSearching() { prepareSynchronizedPairAndStopSearching(); // Bis and PA unsynced, SINK_UNINTENTIONAL BluetoothLeBroadcastMetadata meta = createBroadcastMetadata(TEST_BROADCAST_ID); injectRemoteSourceStateChanged(meta, false, false); mInOrderMethodProxy .verify(mMethodProxy) .periodicAdvertisingManagerRegisterSync( any(), any(), anyInt(), anyInt(), any(), any()); checkTimeout(TEST_BROADCAST_ID, BassClientService.MESSAGE_BIG_MONITOR_TIMEOUT); checkNoTimeout(TEST_BROADCAST_ID, BassClientService.MESSAGE_BROADCAST_MONITOR_TIMEOUT); onSyncEstablishedFailed(mSourceDevice, TEST_SYNC_HANDLE); checkTimeout(TEST_BROADCAST_ID, BassClientService.MESSAGE_BROADCAST_MONITOR_TIMEOUT); mInOrderMethodProxy .verify(mMethodProxy) .periodicAdvertisingManagerRegisterSync( any(), any(), anyInt(), anyInt(), any(), any()); // Start searching again should not removed cache for SINK_UNINTENTIONAL // which allow to register sync again after onSyncEstablishedFailed startSearchingForSources(); checkTimeout(TEST_BROADCAST_ID, BassClientService.MESSAGE_BIG_MONITOR_TIMEOUT); onSyncEstablishedFailed(mSourceDevice, TEST_SYNC_HANDLE); mInOrderMethodProxy .verify(mMethodProxy) .periodicAdvertisingManagerRegisterSync( any(), any(), anyInt(), anyInt(), any(), any()); } @Test @EnableFlags({ Flags.FLAG_LEAUDIO_BROADCAST_RESYNC_HELPER, Loading