[Audiosharing] Add flag to start broadcast with no lea headset connected

Allow audio sharing with no connected le audio headset when settings_need_connected_ble_device_for_broadcast is false

Bug: 343277847
Test: atest
Change-Id: I560338d53ddf290550faf8198cd7173bb734d150
This commit is contained in:
Yiyi Shen
2024-05-29 15:24:54 +08:00
parent 1dc5bf026b
commit bfdcc82dc7
2 changed files with 29 additions and 5 deletions

View File

@@ -27,6 +27,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.FeatureFlagUtils;
import android.util.Log;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
@@ -320,10 +321,15 @@ public class AudioSharingSwitchBarController extends BasePreferenceController
}
return;
}
if (mAssistant
.getDevicesMatchingConnectionStates(
new int[] {BluetoothProfile.STATE_CONNECTED})
.isEmpty()) {
// FeatureFlagUtils.SETTINGS_NEED_CONNECTED_BLE_DEVICE_FOR_BROADCAST is always true in
// prod. We can turn off the flag for debug purpose.
if (FeatureFlagUtils.isEnabled(
mContext,
FeatureFlagUtils.SETTINGS_NEED_CONNECTED_BLE_DEVICE_FOR_BROADCAST)
&& mAssistant
.getDevicesMatchingConnectionStates(
new int[] {BluetoothProfile.STATE_CONNECTED})
.isEmpty()) {
// Pop up dialog to ask users to connect at least one lea buds before audio sharing.
AudioSharingUtils.postOnMainThread(
mContext,