Merge "[Audiosharing] Enable audio sharing UI when preview option on." into main

This commit is contained in:
Yiyi Shen
2024-11-08 06:36:49 +00:00
committed by Android (Google) Code Review
29 changed files with 445 additions and 379 deletions

View File

@@ -77,9 +77,9 @@ public class AvailableMediaBluetoothDeviceUpdater extends BluetoothDeviceUpdater
// It would show in Available Devices group if the audio sharing flag is disabled or
// the device is not in the audio sharing session.
if (cachedDevice.isConnectedLeAudioDevice()) {
if (BluetoothUtils.isAudioSharingEnabled()
if (BluetoothUtils.isAudioSharingUIAvailable(mContext)
&& BluetoothUtils.hasConnectedBroadcastSource(
cachedDevice, mLocalBtManager)) {
cachedDevice, mLocalBtManager)) {
Log.d(
TAG,
"Filter out device : "

View File

@@ -228,19 +228,19 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
final BluetoothDevice device = cachedDevice.getDevice();
if (device != null
&& mSelectedList.contains(device)) {
if (!BluetoothUtils.isAudioSharingEnabled()) {
if (BluetoothUtils.isAudioSharingUIAvailable(getContext())) {
if (bluetoothProfile == BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT
&& state == BluetoothAdapter.STATE_CONNECTED
&& device.equals(mJustBonded)
&& mShouldTriggerAudioSharingShareThenPairFlow) {
Log.d(getLogTag(),
"onProfileConnectionStateChanged, assistant profile connected");
dismissConnectingDialog();
mHandler.removeMessages(AUTO_DISMISS_MESSAGE_ID);
finishFragmentWithResultForAudioSharing(device);
}
} else {
finish();
return;
}
if (bluetoothProfile == BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT
&& state == BluetoothAdapter.STATE_CONNECTED
&& device.equals(mJustBonded)
&& mShouldTriggerAudioSharingShareThenPairFlow) {
Log.d(getLogTag(),
"onProfileConnectionStateChanged, assistant profile connected");
dismissConnectingDialog();
mHandler.removeMessages(AUTO_DISMISS_MESSAGE_ID);
finishFragmentWithResultForAudioSharing(device);
}
} else {
onDeviceDeleted(cachedDevice);
@@ -309,15 +309,17 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
@VisibleForTesting
boolean shouldTriggerAudioSharingShareThenPairFlow() {
if (!BluetoothUtils.isAudioSharingEnabled()) return false;
Activity activity = getActivity();
Intent intent = activity == null ? null : activity.getIntent();
Bundle args =
intent == null ? null :
intent.getBundleExtra(
SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS);
return args != null
&& args.getBoolean(EXTRA_PAIR_AND_JOIN_SHARING, false);
if (BluetoothUtils.isAudioSharingUIAvailable(getContext())) {
Activity activity = getActivity();
Intent intent = activity == null ? null : activity.getIntent();
Bundle args =
intent == null ? null :
intent.getBundleExtra(
SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS);
return args != null
&& args.getBoolean(EXTRA_PAIR_AND_JOIN_SHARING, false);
}
return false;
}
private void addOnMetadataChangedListener(@Nullable BluetoothDevice device) {