From dbe58e96dcf63741db220266e0145a939e447be0 Mon Sep 17 00:00:00 2001 From: SongFerngWang Date: Tue, 20 Jun 2023 19:19:16 +0800 Subject: [PATCH] Stop the searching of broadcast - When the user leaves the page, stop the searching - After the buds are added into broadcast, then stop the searching Bug: 287136134 Test: build pass. manually testing Change-Id: I305a9c6ba8cca1bd5c3c0e1d78ad4a84f9a155b7 --- .../bluetooth/BluetoothFindBroadcastsFragment.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/com/android/settings/bluetooth/BluetoothFindBroadcastsFragment.java b/src/com/android/settings/bluetooth/BluetoothFindBroadcastsFragment.java index 05bc179ac26..f9d083dbf1f 100644 --- a/src/com/android/settings/bluetooth/BluetoothFindBroadcastsFragment.java +++ b/src/com/android/settings/bluetooth/BluetoothFindBroadcastsFragment.java @@ -125,6 +125,10 @@ public class BluetoothFindBroadcastsFragment extends RestrictedDashboardFragment Log.w(TAG, "onSourceAdded: mSelectedPreference == null!"); return; } + if (mLeBroadcastAssistant != null + && mLeBroadcastAssistant.isSearchInProgress()) { + mLeBroadcastAssistant.stopSearchingForSources(); + } getActivity().runOnUiThread(() -> updateListCategoryFromBroadcastMetadata( mSelectedPreference.getBluetoothLeBroadcastMetadata(), true)); } @@ -232,6 +236,9 @@ public class BluetoothFindBroadcastsFragment extends RestrictedDashboardFragment public void onStop() { super.onStop(); if (mLeBroadcastAssistant != null) { + if (mLeBroadcastAssistant.isSearchInProgress()) { + mLeBroadcastAssistant.stopSearchingForSources(); + } mLeBroadcastAssistant.unregisterServiceCallBack(mBroadcastAssistantCallback); } }