[Audiosharing] Update media devices section.
1. Filter out the media devices in audio sharing from the section. 2. During the audio sharing, click the media device will lead to stopping the sharing. Flagged with enable_le_audio_sharing Bug: 305620450 Test: atest AvailableMediaBluetoothDeviceUpdaterTest.java Change-Id: I0676fd5aa98e593c6a5458845fc1b1631a5a6698
This commit is contained in:
@@ -29,6 +29,7 @@ import com.android.settings.flags.Flags;
|
||||
import com.android.settingslib.bluetooth.BluetoothUtils;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothLeBroadcast;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothLeBroadcastAssistant;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
@@ -298,4 +299,20 @@ public class AudioSharingUtils {
|
||||
targetDevice.setActive();
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns if the broadcast is on-going. */
|
||||
public static boolean isBroadcasting(LocalBluetoothManager manager) {
|
||||
if (manager == null) return false;
|
||||
LocalBluetoothLeBroadcast broadcast =
|
||||
manager.getProfileManager().getLeAudioBroadcastProfile();
|
||||
return broadcast != null && broadcast.isEnabled(null);
|
||||
}
|
||||
|
||||
/** Stops the latest broadcast. */
|
||||
public static void stopBroadcasting(LocalBluetoothManager manager) {
|
||||
if (manager == null) return;
|
||||
LocalBluetoothLeBroadcast broadcast =
|
||||
manager.getProfileManager().getLeAudioBroadcastProfile();
|
||||
broadcast.stopBroadcast(broadcast.getLatestBroadcastId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user